:root {
  /* Oscuro por defecto: la musica se escucha mucho de noche */
  --brand: #4da3ff;
  --brand-contrast: #ffffff;
  --text: #f1f1f4;
  --muted: #9a9aa6;
  --bg: #0c0c0f;
  --header-bg: rgba(18, 18, 22, .92);
  --card: #17171c;
  --card-2: #222229;
  --input-bg: #222229;
  --border: #2c2c35;
  --mini-bg: #26262e;
  --ok: #2ecc82;
  --ok-bg: #163828;
  --warn: #e0a832;
  --warn-bg: #3a2f14;
  --danger: #f0564a;
  --danger-bg: #3a1f1c;
  --shadow: 0 8px 24px rgba(0, 0, 0, .45);
  --tabbar-h: 58px;
  --mini-h: 60px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --brand: #0a6fdc;
  --text: #17171c;
  --muted: #6b6b78;
  --bg: #f5f5f7;
  --header-bg: rgba(255, 255, 255, .92);
  --card: #ffffff;
  --card-2: #ececf0;
  --input-bg: #ffffff;
  --border: #e1e1e8;
  --mini-bg: #ffffff;
  --ok: #138a52;
  --ok-bg: #e3f6ec;
  --warn: #a86b00;
  --warn-bg: #fdf1dc;
  --danger: #c0392b;
  --danger-bg: #fbe9e7;
  --shadow: 0 8px 24px rgba(15, 23, 42, .14);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}
body.sheet-open { overflow: hidden; }
h1, h2, h3 { margin: 0; }
h2 { font-size: 16px; }
a { color: var(--brand); }
img { -webkit-user-drag: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small-text { font-size: 12px; }
.tnum { font-variant-numeric: tabular-nums; }
.grow { flex: 1; min-width: 0; }

/* ---------- Estructura ---------- */
.app-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 6px;
  min-height: 54px;
  padding: calc(var(--safe-top) + 8px) 12px 8px 16px;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}
.app-header h1 { flex: 1; font-size: 22px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-header .header-title { font-size: 17px; font-weight: 700; }
.home-brand {
  display: flex; align-items: center; justify-content: flex-start; gap: 10px;
  max-width: 100%; min-height: 0; padding: 0;
  background: none; color: var(--text); border-radius: 0;
  font: inherit; font-weight: inherit; text-align: left;
}
.home-brand img { flex: none; width: 32px; height: 32px; border-radius: 8px; }
.brand-text { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.brand-name { flex: none; font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.brand-greeting {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 14px; font-weight: 500; color: var(--muted);
}
.app-header .icon-btn:first-child { margin-left: -8px; }

.view {
  max-width: 960px;
  margin: 0 auto;
  padding: 8px 16px calc(var(--tabbar-h) + var(--safe-bottom) + 28px);
}
body.has-mini .view { padding-bottom: calc(var(--tabbar-h) + var(--mini-h) + var(--safe-bottom) + 34px); }
.view.flush-top { padding-top: 0; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
}
.tabbar a {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: var(--tabbar-h);
  color: var(--muted);
  font-size: 11px;
  text-decoration: none;
}
.tabbar a span { max-width: 100%; padding: 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabbar a.active { color: var(--text); font-weight: 700; }
.tabbar svg { width: 24px; height: 24px; }
.tabbar a { position: relative; }
.tab-badge {
  position: absolute; top: 5px; left: calc(50% + 5px);
  min-width: 17px; height: 17px; padding: 0 5px;
  border-radius: 9px; background: var(--danger); color: #fff;
  font-size: 10px; font-style: normal; font-weight: 800; line-height: 17px; text-align: center;
}
@media (max-width: 400px) { .tabbar a { font-size: 10px; } }

.boot { display: flex; align-items: center; justify-content: center; min-height: 60vh; color: var(--muted); }

/* ---------- Componentes base ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px;
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  background: var(--brand);
  color: var(--brand-contrast);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  touch-action: manipulation;
}
button svg, .btn svg { width: 18px; height: 18px; flex: none; }
button.secondary, .btn.secondary { background: var(--card-2); color: var(--text); border: 1px solid var(--border); }
button.secondary.active { color: var(--brand); border-color: var(--brand); }
button.danger { background: var(--danger); color: #fff; }
button.ghost { background: none; color: var(--brand); padding: 8px 10px; }
button.small, .btn.small { min-height: 34px; padding: 6px 12px; font-size: 13px; }
button.block { width: 100%; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.danger-text { color: var(--danger); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 42px; min-height: 42px; padding: 8px;
  background: none; border: none; border-radius: 50%;
  color: var(--text); font-size: 20px; font-weight: 400;
}
.icon-btn:active { background: var(--card-2); }
.icon-btn svg { width: 22px; height: 22px; }

label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 5px; }
input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* 16px evita el zoom automatico de iOS al enfocar */
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.error-text { color: var(--danger); font-size: 13px; margin-top: 10px; }
.info-text { color: var(--ok); font-size: 13px; margin-top: 10px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 6px; overflow-wrap: anywhere; }
.segmented { display: flex; gap: 3px; padding: 3px; background: var(--card-2); border-radius: 11px; }
.segmented button {
  flex: 1; min-height: 36px; padding: 6px 8px;
  background: transparent; color: var(--muted);
  border-radius: 8px; font-size: 14px;
}
.segmented button.active { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.neutral { background: var(--card-2); color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 28px 8px; }
.kv { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.kv:last-child { border-bottom: 0; }
.kv .v { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; }
.list-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; }
.list-item .sub { font-size: 12px; color: var(--muted); }
.section-title { margin: 22px 4px 8px; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.92em; overflow-wrap: anywhere; }

/* Interruptor (checkbox con aspecto de switch) */
.switch-row { display: flex; align-items: center; gap: 12px; margin: 0; color: var(--text); font-size: 15px; cursor: pointer; }
.switch-row > span { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.switch-row small { color: var(--muted); font-size: 12px; }
.switch-row input {
  -webkit-appearance: none; appearance: none;
  position: relative; flex: none;
  width: 46px; height: 28px; min-height: 0; padding: 0;
  border: 0; border-radius: 999px;
  background: var(--border);
  cursor: pointer;
  transition: background .2s;
}
.switch-row input::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff;
  transition: transform .2s;
}
.switch-row input:checked { background: var(--brand); }
.switch-row input:checked::after { transform: translateX(18px); }
.switch-row input:focus { outline: none; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 4px -16px 6px; padding: 2px 16px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 6px 14px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--card-2); color: var(--text);
  font-size: 14px; font-weight: 600;
}
.chip.selected { background: var(--text); color: var(--bg); border-color: var(--text); }

/* Cargando */
@keyframes pulse { 50% { opacity: .45; } }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton .sk-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; animation: pulse 1.4s ease-in-out infinite; }
.sk-row i { flex: none; width: 48px; height: 48px; border-radius: 6px; background: var(--card-2); }
.sk-row span { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.sk-row b { display: block; width: 70%; height: 12px; border-radius: 6px; background: var(--card-2); }
.sk-row b + b { width: 42%; }
.spinner {
  display: inline-block; width: 26px; height: 26px;
  border: 3px solid var(--card-2); border-top-color: var(--brand); border-radius: 50%;
  animation: spin .8s linear infinite;
}
.load-more { display: flex; justify-content: center; padding: 18px 0; }

/* ---------- Canciones y elementos ---------- */
.rows { display: flex; flex-direction: column; }
.track-row, .item-row {
  display: flex; align-items: center; gap: 12px;
  min-height: 60px; padding: 6px 0;
  color: var(--text); text-decoration: none;
  cursor: pointer;
  border-radius: 8px;
}
.track-row:active, .item-row:active { background: var(--card-2); }
.tr-art {
  flex: none; width: 48px; height: 48px;
  border-radius: 6px; object-fit: cover;
  background: var(--card-2);
}
.tr-art.round { border-radius: 50%; }
.tr-num { flex: none; width: 30px; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.tr-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.tr-title, .tr-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-title { font-size: 15px; font-weight: 600; }
.tr-sub { font-size: 13px; color: var(--muted); }
.track-row.is-current .tr-title { color: var(--brand); }
.track-row.is-current .tr-num { color: var(--brand); font-weight: 800; }
.explicit {
  display: inline-block; margin-right: 5px; padding: 0 3px;
  border-radius: 2px; background: var(--muted); color: var(--bg);
  font-size: 9px; font-style: normal; font-weight: 800; line-height: 13px; vertical-align: 1px;
}
.tr-like { flex: none; display: inline-flex; color: var(--brand); }
.tr-like svg { width: 16px; height: 16px; }
.tr-more { flex: none; color: var(--muted); margin-right: -8px; }

/* Portadas especiales y mosaicos */
.mosaic { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; overflow: hidden; }
.mosaic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mosaic.empty { display: flex; align-items: center; justify-content: center; color: var(--muted); background: var(--card-2); }
.mosaic.empty svg { width: 40%; height: 40%; }
.tr-art.special, .coll-special { display: flex; align-items: center; justify-content: center; color: #fff; }
.tr-art.special svg { width: 22px; height: 22px; }
.liked { background: linear-gradient(135deg, #4da3ff, #3b3fd8); }
.history { background: linear-gradient(135deg, #0f766e, #2563eb); }

/* Estanterias */
.shelf { margin: 22px 0 6px; }
.shelf > h2 { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.shelf-head { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 10px; }
.shelf-head h2 { font-size: 20px; font-weight: 800; line-height: 1.2; }
.strapline { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.more-link {
  flex: none;
  padding: 5px 12px;
  border: 1px solid var(--border); border-radius: 999px;
  color: var(--text); font-size: 13px; font-weight: 600; text-decoration: none;
}
.carousel, .quick-grid {
  overflow-x: auto; overscroll-behavior-x: contain;
  scrollbar-width: none;
  margin: 0 -16px; padding: 0 16px 4px;
  scroll-padding: 0 16px;
}
.carousel::-webkit-scrollbar, .quick-grid::-webkit-scrollbar { display: none; }
.carousel { display: flex; gap: 14px; scroll-snap-type: x proximity; }
.quick-grid {
  display: grid; grid-auto-flow: column; grid-template-rows: repeat(4, auto);
  grid-auto-columns: min(86%, 380px); column-gap: 16px;
  scroll-snap-type: x mandatory;
}
.quick-grid > * { scroll-snap-align: start; }
.tile {
  flex: none;
  display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 4px;
  width: 148px; min-height: 0; margin: 0; padding: 0;
  background: none; border: 0; border-radius: 0;
  color: var(--text); font-weight: 400; text-align: left; text-decoration: none;
  scroll-snap-align: start;
  cursor: pointer;
}
.tile-art { width: 148px; height: 148px; border-radius: 10px; object-fit: cover; background: var(--card-2); }
.tile-art.round { border-radius: 50%; }
.tile.round { align-items: center; text-align: center; }
.tile-title, .tile-sub {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden;
}
.tile-title { font-size: 14px; font-weight: 600; line-height: 1.25; margin-top: 4px; }
.tile-sub { font-size: 12px; color: var(--muted); }
@media (min-width: 700px) {
  .tile { width: 172px; }
  .tile-art { width: 172px; height: 172px; }
}

/* ---------- Buscar ---------- */
.search-bar {
  flex: 1;
  display: flex; align-items: center; gap: 6px;
  padding: 0 2px 0 12px;
  border-radius: 12px;
  background: var(--card-2);
}
.search-bar > svg { flex: none; width: 20px; height: 20px; color: var(--muted); }
.search-bar input {
  flex: 1; min-width: 0; min-height: 44px;
  padding: 8px 0;
  border: 0; background: none;
}
.search-bar input:focus { outline: none; }
.search-bar input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.search-bar .icon-btn { min-width: 38px; min-height: 38px; }
.search-bar .icon-btn svg { width: 18px; height: 18px; }
.suggest-list { display: flex; flex-direction: column; margin-bottom: 8px; }
.suggest-row { display: flex; align-items: center; }
.suggest-main {
  flex: 1; min-width: 0;
  justify-content: flex-start; gap: 14px;
  padding: 10px 0; min-height: 48px;
  background: none; color: var(--text); font-weight: 500; border-radius: 0;
}
.suggest-main svg { width: 20px; height: 20px; color: var(--muted); }
.suggest-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-hint { padding-top: 60px; }
.search-hint > svg { width: 48px; height: 48px; opacity: .5; }
.top-result {
  display: flex; align-items: center; gap: 14px;
  padding: 14px;
  border-radius: 14px;
  background: var(--card);
  color: var(--text); text-decoration: none;
  cursor: pointer;
}
.top-result img { flex: none; width: 84px; height: 84px; border-radius: 10px; object-fit: cover; background: var(--card-2); }
.top-result img.round { border-radius: 50%; }
.top-result .tr-title { font-size: 18px; font-weight: 800; white-space: normal; }
.play-fab {
  flex: none; display: flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--brand); color: #fff;
}
.play-fab svg { width: 20px; height: 20px; }

/* ---------- Colecciones (album, listas) ---------- */
.coll-hero { display: flex; align-items: flex-end; gap: 18px; padding-top: 10px; }
.coll-art { flex: none; width: 160px; height: 160px; }
.coll-art > img, .coll-art > .coll-mosaic, .coll-art > .coll-special {
  width: 100%; height: 100%;
  border-radius: 12px; object-fit: cover;
  box-shadow: var(--shadow);
}
.coll-special svg { width: 40%; height: 40%; }
.coll-meta { min-width: 0; }
.coll-meta h1 { font-size: 24px; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.coll-sub { margin: 6px 0 2px; color: var(--text); font-weight: 500; }
.coll-sub a { color: inherit; text-decoration: none; font-weight: 700; }
.coll-meta .muted { margin: 0; }
@media (max-width: 560px) {
  .coll-hero { flex-direction: column; align-items: center; text-align: center; }
  .coll-art { width: min(62vw, 240px); height: min(62vw, 240px); }
}
.hero-actions { display: flex; align-items: center; gap: 10px; margin: 18px 0 10px; }
.hero-actions > button:not(.icon-btn), .hero-actions > span > button:not(.icon-btn) { border-radius: 999px; }
.hero-icon svg { width: 24px; height: 24px; }
.hero-icon.active { color: var(--brand); }
.description { margin: 4px 0 10px; color: var(--muted); font-size: 14px; white-space: pre-line; cursor: pointer; }
.description.clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }

/* ---------- Artista ---------- */
.artist-hero {
  position: relative;
  display: flex; align-items: flex-end;
  height: min(56vw, 380px); min-height: 180px;
  margin: 0 -16px;
  overflow: hidden;
  background: var(--card-2);
}
.artist-banner { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 25%; }
.artist-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 35%, var(--bg)); }
.artist-hero-text { position: relative; z-index: 1; padding: 0 16px 4px; }
.artist-hero-text h1 { font-size: 34px; font-weight: 900; line-height: 1.1; }
.artist-hero-text p { margin: 4px 0 0; }

/* ---------- Mini reproductor ---------- */
.mini-player {
  position: fixed; z-index: 29;
  left: 8px; right: 8px;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 6px);
  display: flex; align-items: center; gap: 2px;
  max-width: 720px; height: var(--mini-h);
  margin: 0 auto; padding-right: 4px;
  overflow: hidden;
  border-radius: 12px;
  background: var(--mini-bg);
  box-shadow: var(--shadow);
}
.mini-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: rgba(127, 127, 127, .25); }
.mini-progress i { display: block; width: 0; height: 100%; background: var(--brand); }
.mini-main {
  flex: 1; min-width: 0; height: 100%;
  justify-content: flex-start; gap: 10px;
  padding: 0 0 0 8px;
  background: none; color: var(--text); font-weight: 400; border-radius: 0;
}
.mini-main img { flex: none; width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: var(--card-2); }
.mini-text { min-width: 0; display: flex; flex-direction: column; text-align: left; }
.mini-title, .mini-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-title { font-size: 14px; font-weight: 600; }
.mini-sub { font-size: 12px; color: var(--muted); }
.mini-player .icon-btn svg { width: 24px; height: 24px; }
.mini-player.buffering #miniPlay { animation: pulse 1s ease-in-out infinite; }

/* ---------- Reproductor a pantalla completa ---------- */
.np-backdrop { align-items: stretch !important; background: #000 !important; animation: none !important; }
.sheet.np {
  position: relative;
  width: 100%; max-width: none;
  height: 100vh; height: 100dvh; max-height: none;
  padding: 0; overflow: hidden;
  border-radius: 0;
  background: #121216; color: #fff;
  animation: np-up .25s ease-out;
  transition: transform .2s ease-out;
}
@keyframes np-up { from { transform: translateY(30%); opacity: .4; } }
.np .sheet-body { height: 100%; }
.np-bg { position: absolute; inset: 0; overflow: hidden; }
.np-bg img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.4); filter: blur(48px) saturate(1.5) brightness(.42); }
.np-inner {
  position: relative;
  display: flex; flex-direction: column;
  height: 100%; max-width: 560px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 6px) 22px calc(var(--safe-bottom) + 12px);
}
.np .icon-btn { color: #fff; }
.np .icon-btn:active { background: rgba(255, 255, 255, .12); }
.np-top { display: flex; align-items: center; gap: 6px; }
.np-top .icon-btn svg { width: 26px; height: 26px; }
.np-context {
  flex: 1; min-width: 0; min-height: 0;
  flex-direction: column; gap: 0;
  padding: 4px;
  background: none; color: #fff;
}
.np-context small { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .7; }
.np-context span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.np-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 18px 0; }
.np-art-wrap { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; container-type: size; }
.np-art-wrap img {
  width: min(100cqw, 100cqh); height: min(100cqw, 100cqh);
  border-radius: 12px; object-fit: cover;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .5);
  background: rgba(255, 255, 255, .06);
}
.np-lyrics {
  width: 100%; height: 100%;
  overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(transparent, #000 10%, #000 85%, transparent);
  mask-image: linear-gradient(transparent, #000 10%, #000 85%, transparent);
}
.np-lyrics::-webkit-scrollbar { display: none; }
.np-lyrics-lines { padding: 30% 0 45%; }
.np-lyrics-lines p { margin: 0 0 14px; font-size: 19px; font-weight: 600; line-height: 1.35; color: rgba(255, 255, 255, .9); }
.np-lyrics-lines.synced p { font-size: 23px; font-weight: 800; color: rgba(255, 255, 255, .32); cursor: pointer; transition: color .25s; }
.np-lyrics-lines.synced p.active { color: #fff; }
.np-lyrics-msg { margin-top: 40%; text-align: center; color: rgba(255, 255, 255, .7); }
.np-lyrics-source { margin: 0 0 30px; font-size: 12px; color: rgba(255, 255, 255, .5); }
.np-info { display: flex; align-items: center; gap: 10px; }
.np-titles { flex: 1; min-width: 0; }
.np-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 22px; font-weight: 800; }
.np-artist {
  display: block; max-width: 100%; min-height: 0;
  padding: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: none; color: rgba(255, 255, 255, .72);
  font-size: 16px; font-weight: 500; text-align: left;
}
.np-like svg { width: 28px; height: 28px; }
.np-like.active { color: var(--brand) !important; }
.np-seek { margin-top: 10px; }
.np-seek input[type="range"] {
  -webkit-appearance: none; appearance: none;
  display: block; width: 100%; height: 28px; min-height: 0;
  margin: 0; padding: 0;
  border: 0; background: transparent;
  cursor: pointer;
}
.np-seek input[type="range"]:focus { outline: none; }
.np-seek input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(to right, #fff var(--p, 0%), rgba(255, 255, 255, .25) var(--p, 0%));
}
.np-seek input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px; margin-top: -5px;
  border-radius: 50%; background: #fff;
}
.np-seek input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .25); }
.np-seek input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: #fff; }
.np-seek input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; }
.np-times { display: flex; justify-content: space-between; font-size: 12px; color: rgba(255, 255, 255, .7); font-variant-numeric: tabular-nums; }
.np-controls { display: flex; align-items: center; justify-content: space-between; margin: 8px -6px 14px; }
.np-skip svg { width: 36px; height: 36px; }
.np-mode { color: rgba(255, 255, 255, .55) !important; }
.np-mode.active { color: var(--brand) !important; }
.np-mode svg { width: 24px; height: 24px; }
.np-play {
  width: 74px; height: 74px; min-height: 0; padding: 0;
  border-radius: 50%;
  background: #fff; color: #121216;
}
.np-play svg { width: 34px; height: 34px; }
.np-play.buffering { animation: pulse 1s ease-in-out infinite; }
.np-bottom { display: flex; justify-content: space-around; }
.np-tab {
  flex-direction: column; gap: 3px;
  min-height: 0; padding: 6px 12px;
  background: none; color: rgba(255, 255, 255, .75);
  font-size: 11px; font-weight: 600;
}
.np-tab svg { width: 22px; height: 22px; }
.np-tab.active { color: var(--brand); }
@media (max-height: 640px) {
  .np-title { font-size: 19px; }
  .np-play { width: 62px; height: 62px; }
  .np-controls { margin-bottom: 6px; }
}

/* ---------- Hojas inferiores (modales) ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0, 0, 0, .55);
  animation: fade-in .15s ease-out;
}
.sheet {
  width: 100%; max-width: 560px; max-height: 88vh; max-height: 88dvh;
  overflow-y: auto; overscroll-behavior: contain;
  padding: 6px 16px calc(18px + var(--safe-bottom));
  background: var(--card);
  border-radius: 18px 18px 0 0;
  box-shadow: var(--shadow);
  animation: slide-up .2s ease-out;
}
.sheet-handle { width: 40px; height: 4px; margin: 6px auto 10px; border-radius: 2px; background: var(--border); }
.sheet-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.sheet-header h2 { flex: 1; min-width: 0; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-actions { display: flex; gap: 10px; margin-top: 18px; }
.sheet-actions > * { flex: 1; }
@media (min-width: 700px) {
  .sheet-backdrop:not(.np-backdrop) { align-items: center; }
  .sheet:not(.np) { border-radius: 18px; }
}
@keyframes fade-in { from { opacity: 0; } }
@keyframes slide-up { from { transform: translateY(40px); opacity: .5; } }

.menu-head { display: flex; align-items: center; gap: 12px; padding: 4px 0 12px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.menu-list { display: flex; flex-direction: column; gap: 2px; }
.menu-list > .block { margin-top: 6px; }
.menu-item {
  justify-content: flex-start; gap: 16px;
  width: 100%; min-height: 50px; padding: 10px 6px;
  background: none; color: var(--text); font-weight: 500;
}
.menu-item:active { background: var(--card-2); }
.menu-item svg { width: 22px; height: 22px; color: var(--muted); }
.menu-item span { flex: 1; min-width: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-sheet .tr-art { width: 44px; height: 44px; }
.queue-row.played { opacity: .5; }
.queue-row .icon-btn { color: var(--muted); }
.queue-tools { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding-bottom: 10px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.queue-tools .switch-row { width: 100%; }
.queue-tools .ghost { padding-left: 0; }

/* ---------- Avisos ---------- */
.toast-wrap {
  position: fixed; left: 0; right: 0; z-index: 60;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 0 16px;
  pointer-events: none;
}
body.has-mini .toast-wrap { bottom: calc(var(--tabbar-h) + var(--mini-h) + var(--safe-bottom) + 18px); }
body.sheet-open .toast-wrap { bottom: calc(var(--safe-bottom) + 24px); }
.toast {
  display: flex; align-items: center; gap: 12px;
  width: 100%; max-width: 480px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #2f2f38; color: #fff;
  box-shadow: var(--shadow);
  font-size: 14px;
  pointer-events: auto;
  animation: slide-up .2s ease-out;
}
.toast .msg { flex: 1; }
.toast.error { background: #b3261e; }
.toast button { min-height: 32px; padding: 4px 8px; background: none; color: #8cc4ff; }

/* ---------- Ajustes ---------- */
.sc-lead { margin-top: 0; font-size: 14px; }
.sc-notice { padding: 10px 12px; border-radius: 10px; background: var(--card-2); font-size: 14px; }
.steps { margin: 0; padding-left: 20px; font-size: 14px; }
.steps li { margin: 8px 0; }
textarea { min-height: 80px; resize: vertical; }
textarea.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }
.imp-options { display: flex; flex-direction: column; gap: 10px; margin: 14px 0 4px; }
.imp-progress { display: flex; align-items: center; gap: 14px; padding: 12px 0; }
.imp-progress .tr-title { white-space: normal; }
.guide-section { border-bottom: 1px solid var(--border); }
.guide-section:last-child { border-bottom: 0; }
.guide-section summary { padding: 12px 0; font-weight: 600; cursor: pointer; list-style-position: inside; }
.guide-section .guide-body { padding: 0 0 12px; font-size: 14px; }
.guide-section .guide-body p { margin: 6px 0; }
.about { margin: 24px 4px; text-align: center; }
.about a { color: inherit; }

/* ---------- Login ---------- */
.login-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; min-height: 100dvh;
  padding: calc(var(--safe-top) + 16px) 16px calc(var(--safe-bottom) + 16px);
}
.login-card { width: 100%; max-width: 360px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.login-brand img { width: 48px; height: 48px; border-radius: 12px; }
.login-brand h1 { font-size: 22px; }
.auth-title { font-size: 18px; margin-bottom: 6px; }
.auth-links { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-top: 12px; }
.auth-links .ghost { font-weight: 500; }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 18px 0 12px; color: var(--muted); font-size: 13px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.code-input { font-size: 26px; letter-spacing: 10px; text-align: center; font-variant-numeric: tabular-nums; }
.login-card .card, .login-wrap .card { margin-bottom: 0; }

/* ---------- Avatares y perfil ---------- */
.avatar-img { flex: none; display: block; border-radius: 50%; object-fit: cover; background: var(--card-2); }
.avatar-wrap { position: relative; flex: none; display: inline-flex; }
.profile-row { display: flex; align-items: center; gap: 16px; }
.profile-avatar {
  position: relative; flex: none;
  min-height: 0; padding: 0;
  border-radius: 50%; background: none;
}
.profile-avatar-edit {
  position: absolute; right: -2px; bottom: -2px;
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand); color: #fff;
  box-shadow: 0 0 0 3px var(--card);
}
.profile-avatar-edit svg { width: 15px; height: 15px; }
.profile-name { font-size: 18px; font-weight: 800; overflow-wrap: anywhere; }
.profile-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* ---------- Social ---------- */
.friend-row { min-height: 64px; }
.social-empty > svg { width: 48px; height: 48px; opacity: .5; }
.social-empty button { margin-top: 6px; }
.search-results { min-height: 60px; margin: 8px 0 14px; }
.invite-box { margin: 0; }
.friend-hero { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px 0 4px; text-align: center; }
.friend-hero h1 { margin-top: 8px; font-size: 26px; font-weight: 800; overflow-wrap: anywhere; }
.friend-hero p { margin: 0; }
.friend-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin-top: 6px; font-size: 14px; color: var(--muted); }
.friend-stats strong { color: var(--text); }
.hero-actions.centered { justify-content: center; }
.menu-item.danger-text, .menu-item.danger-text svg { color: var(--danger); }

/* ---------- Administracion ---------- */
.big-number { font-size: 28px; font-weight: 800; }
.avatar {
  position: relative; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  color: #fff; font-weight: 800; font-size: 16px;
}
.online-dot {
  position: absolute; right: -1px; bottom: -1px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--ok); box-shadow: 0 0 0 2px var(--card);
}
.user-row .title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; overflow-wrap: anywhere; }
.user-row .sub { overflow-wrap: anywhere; }
.app-header .secondary.small { flex: none; }

/* Escritorio: algo mas de aire */
@media (min-width: 900px) {
  .view { padding-left: 28px; padding-right: 28px; }
  .carousel, .quick-grid, .chips.scroll { margin-left: -28px; margin-right: -28px; padding-left: 28px; padding-right: 28px; }
  .carousel, .quick-grid { scroll-padding: 0 28px; }
  .artist-hero { margin: 0 -28px; }
}
