/* ==========================================================================
   Flow — "3D oscuro minimalista" (Three.js)
   Capas: canvas #gl (partículas + carátula 3D) → aura → vistas → mini/tabs (blur) → player → sheet → toast
   Sólo mini, tabs y sheet usan backdrop-filter (máx. 3 capas; caro en iOS). El resto: superficies planas.
   ========================================================================== */

:root {
  --bg: #050507;
  --fg: #f5f5f7;
  --muted: rgba(245, 245, 247, .56);
  --faint: rgba(245, 245, 247, .1);
  --accent: #c7c2ff;
  --surface: rgba(255, 255, 255, .035);
  --surface-hi: rgba(255, 255, 255, .06);
  --glass: rgba(255, 255, 255, .035);
  --glass-strong: rgba(10, 10, 13, .72);
  --line: rgba(255, 255, 255, .075);
  --line-hi: rgba(255, 255, 255, .14);
  --blur: blur(22px) saturate(140%);
  --r: 16px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.3, .5, 1);

  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);

  --tabs-h: 58px;
  --tabs-b: max(10px, calc(var(--sab) - 6px));
  --mini-h: 62px;
  --gutter: 20px;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); }
body {
  position: fixed; inset: 0; overflow: hidden;
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { width: 22px; height: 22px; flex: none; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; }
input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- Escena 3D (Three.js) ---------- */
#gl {
  position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; display: block;
  opacity: 0; transition: opacity .9s var(--ease);
}
.gl-on #gl { opacity: 1; }
.no-webgl #gl { display: none; }
/* Aura: velo muy tenue del color de la portada arriba (CSS, sin coste de GPU por frame). */
.aura {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(90% 55% at 50% -8%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 70%);
}
body.no-webgl {
  background: radial-gradient(100% 70% at 50% 0%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 65%), var(--bg);
}

/* ---------- Superficies ---------- */
/* .glass ya no desenfoca: sobre negro OLED el blur no aporta y cada capa cuesta en iOS. */
.glass { background: var(--glass); border: 1px solid var(--line); }

/* ---------- Vistas ---------- */
#app { position: fixed; inset: 0; z-index: 2; perspective: 1400px; }
.view {
  position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain;
  padding: calc(var(--sat) + 14px) calc(var(--sar)) 0 calc(var(--sal));
  outline: none;
  transform-origin: 50% 0;
  transition: transform .55s var(--ease), opacity .45s var(--ease), filter .45s;
}
/* Al cerrar, la vista vuelve tras el aterrizaje de la carátula en el mini (delay). */
.view { transition-delay: .12s; }
.player-open .view { transform: translateZ(-160px) translateY(10px); opacity: 0; pointer-events: none; transition-delay: 0s; }
.view > * { max-width: 1100px; margin-left: auto; margin-right: auto; }
.spacer { height: calc(var(--tabs-h) + var(--tabs-b) + 30px); }
.has-mini .spacer { height: calc(var(--tabs-h) + var(--tabs-b) + var(--mini-h) + 40px); }

.hero { padding: 18px var(--gutter) 18px; }
.hero h1 { font-size: 34px; font-weight: 750; }
.hero.compact { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; }
.hero.compact h1 { flex: 1; }
.hero-actions { display: flex; gap: 8px; }
.hero-actions .icon-btn { border-radius: 50%; }
.eyebrow { margin: 0 0 4px; font-size: 12px; font-weight: 650; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }

/* ---------- Botones ---------- */
.icon-btn {
  width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 12px;
  color: var(--fg); transition: transform .2s var(--spring), color .2s, opacity .2s;
  position: relative;
}
.icon-btn:active { transform: scale(.86); }
.icon-btn.sm svg { width: 21px; height: 21px; }
.icon-btn.lg { width: 60px; height: 60px; }
.icon-btn.lg svg { width: 34px; height: 34px; }
.icon-btn.on { color: var(--accent); }
.icon-btn.on::after { content: ""; position: absolute; bottom: 4px; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 20px; border-radius: 999px; font-weight: 620;
  background: var(--surface); border: 1px solid var(--line-hi);
  transition: transform .2s var(--spring), background .2s;
}
.btn svg { width: 19px; height: 19px; }
.btn:active { transform: scale(.95); }
.btn.primary { background: var(--fg); color: var(--bg); border-color: transparent; }
.btn.danger { background: #ff4d6a; color: #fff; }
.btn.wide { width: 100%; margin-top: 14px; }
.btn:disabled { opacity: .4; }
.row-btns { display: flex; gap: 10px; flex-wrap: wrap; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 16px; border-radius: 999px;
  font-size: 14px; font-weight: 600; background: var(--surface); border: 1px solid var(--line-hi);
}
.chip svg { width: 18px; height: 18px; }
.chip:active { transform: scale(.95); }

/* ---------- Carátulas ---------- */
.cover {
  position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; flex: none;
  background: linear-gradient(145deg, hsl(var(--h, 260) 14% 17%), hsl(calc(var(--h, 260) + 40) 12% 8%));
  box-shadow: 0 8px 22px rgba(0, 0, 0, .5);
}
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .4s; }
.cover img.ok { opacity: 1; }
.cover::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07); pointer-events: none; }
.cover-ph { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255,255,255,.45); }
.cover img.ok ~ .cover-ph { display: none; }
.cover.sm { width: 48px; border-radius: 8px; }
.cover.xs { width: 52px; border-radius: 9px; }
.cover.xl { width: min(60vw, 250px); border-radius: 16px; box-shadow: 0 30px 70px -24px rgba(0,0,0,.9), 0 0 70px -24px color-mix(in srgb, var(--accent) 40%, transparent); }
.cover.xl .cover-ph svg { width: 56px; height: 56px; }
.mosaic.n4 { display: grid; grid-template-columns: 1fr 1fr; }
.mosaic.n4 img { position: static; }
.fav-cover, .hist-cover { display: grid; place-items: center; background: linear-gradient(150deg, #17171c, #0a0a0d); }
.fav-cover { color: #ff6b93; }
.hist-cover { color: #8fd3ff; }
.cover.xl.fav-cover svg, .cover.xl.hist-cover svg { width: 72px; height: 72px; }

/* ---------- Estanterías / carruseles ---------- */
.shelf { margin: 8px 0 22px; }
.shelf-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 var(--gutter) 12px; }
.shelf-head h2 { font-size: 21px; font-weight: 700; }
.shelf-head a { color: var(--muted); font-size: 14px; font-weight: 600; }
.carousel {
  display: flex; gap: 14px; overflow-x: auto; padding: 4px var(--gutter) 14px;
  scroll-snap-type: x mandatory; scroll-padding: 0 var(--gutter); scrollbar-width: none;
}
.carousel::-webkit-scrollbar { display: none; }
.tile {
  width: 148px; flex: none; display: flex; flex-direction: column; gap: 3px; text-align: left; scroll-snap-align: start;
}
.tile .cover { width: 100%; margin-bottom: 8px; }
.tile b { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile small { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card3d { transform: perspective(700px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .35s var(--ease); transform-style: preserve-3d; }
.card3d .cover { transform: translateZ(18px); transition: transform .35s var(--ease); }
.card3d:active { transform: perspective(700px) scale(.96); }

/* ---------- Accesos rápidos ---------- */
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 var(--gutter) 24px; }
.quick-item { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 14px; min-width: 0; transition: transform .2s var(--spring), background .2s, border-color .2s; }
@media (hover: hover) { .quick-item:hover { background: var(--surface-hi); border-color: var(--line-hi); } }
.quick-item:active { transform: scale(.97); }
.quick-item .cover { width: 46px; border-radius: 9px; }
.quick-item > span:last-child { display: flex; flex-direction: column; min-width: 0; font-weight: 650; font-size: 14px; }
.quick-item > span:last-child, .quick-item small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quick-item small { color: var(--muted); font-weight: 500; font-size: 12px; }
.quick-ico { width: 46px; height: 46px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.quick-ico.fav { background: linear-gradient(150deg, #1b1b21, #0b0b0e); color: #ff6b93; box-shadow: inset 0 0 0 1px var(--line); }

/* ---------- Onboarding ---------- */
.onboard, .onboard.tile { position: relative; overflow: hidden; margin: 0 var(--gutter) 24px; padding: 26px 22px 22px; border-radius: 24px; width: auto; }
.onboard h2 { font-size: 24px; margin-bottom: 8px; position: relative; }
.onboard p { color: var(--muted); margin: 0 0 18px; position: relative; max-width: 46ch; }
.onboard-orb {
  position: absolute; right: -40px; top: -50px; width: 180px; height: 180px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0, color-mix(in srgb, var(--accent) 80%, #fff) 12%, var(--accent) 35%, #3b1e8a 75%);
  filter: blur(.3px); opacity: .28; animation: orb 9s ease-in-out infinite alternate;
  box-shadow: 0 0 80px color-mix(in srgb, var(--accent) 40%, transparent);
}
@keyframes orb { to { transform: translate(-24px, 18px) scale(1.08); } }

/* ---------- Listas de pistas ---------- */
.list { list-style: none; margin: 0; padding: 0 calc(var(--gutter) - 8px); }
.row {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 12px;
  padding: 7px 0 7px 8px; border-radius: 12px; cursor: pointer; transition: background .15s;
  content-visibility: auto; contain-intrinsic-size: auto 62px;
}
.row:active { background: var(--surface-hi); }
@media (hover: hover) { .row:hover { background: var(--surface); } }
.row-n { width: 26px; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 14px; }
.row-meta { min-width: 0; display: flex; flex-direction: column; }
.row-title { font-weight: 560; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-dur { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.row .more { color: var(--muted); width: 38px; }
.row.playing .row-title { color: var(--accent); }
.e { display: inline-grid; place-items: center; width: 15px; height: 15px; font-size: 9px; border-radius: 3px; background: var(--faint); color: var(--muted); vertical-align: 1px; }
.empty { color: var(--muted); text-align: center; padding: 40px var(--gutter); list-style: none; }

/* ---------- Búsqueda ---------- */
.searchbar {
  display: flex; align-items: center; gap: 10px; margin: 0 var(--gutter) 18px; padding: 0 6px 0 14px;
  height: 48px; border-radius: 14px; position: sticky; top: 0; z-index: 3;
}
.searchbar input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: none; font-size: 17px; -webkit-appearance: none; }
.searchbar input::-webkit-search-cancel-button { display: none; }
.searchbar svg { color: var(--muted); }
.searchbar .clear { width: 36px; height: 36px; }
#results { transition: opacity .2s; }
#results.busy { opacity: .5; }
.hints { display: flex; flex-wrap: wrap; gap: 10px; padding: 6px var(--gutter); }

/* ---------- Biblioteca ---------- */
.lib { list-style: none; margin: 0; padding: 0 calc(var(--gutter) - 8px); }
.lib a { display: flex; align-items: center; gap: 14px; padding: 8px; border-radius: 14px; }
.lib a:active { background: rgba(255,255,255,.06); }
.lib .row-title { font-size: 16px; }
.lib-foot { padding: 26px var(--gutter) 0; text-align: center; }

/* ---------- Colección ---------- */
.collection { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 0 var(--gutter) 18px; position: relative; }
.collection .back { position: absolute; left: var(--gutter); top: 0; border-radius: 50%; z-index: 2; }
.collection-art { margin: 8px 0 20px; perspective: 900px; }
.collection-art .cover { transform: rotateX(8deg); animation: rise .8s var(--ease) both; }
@keyframes rise { from { transform: rotateX(28deg) translateY(30px) scale(.9); opacity: 0; } }
.collection h1 { font-size: 26px; font-weight: 750; }
.collection-sub { color: var(--muted); margin: 6px 0 16px; font-size: 14px; }
.collection-actions { display: flex; gap: 10px; align-items: center; }
.loading-view { display: grid; place-items: center; height: 50dvh; }
.back { color: var(--fg); }

.spinner { width: 28px; height: 28px; border-radius: 50%; border: 2.5px solid var(--faint); border-top-color: var(--fg); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Barra de pestañas (pill flotante) ---------- */
.tabs {
  position: fixed; z-index: 10; left: 50%; bottom: var(--tabs-b);
  width: min(calc(100% - 24px - var(--sal) - var(--sar)), 380px); height: var(--tabs-h);
  transform: translateX(-50%); border-radius: 999px;
  display: grid; grid-template-columns: repeat(3, 1fr); padding: 0 6px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  transition: transform .5s var(--ease), opacity .4s;
  box-shadow: 0 12px 40px rgba(0,0,0,.6);
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 10.5px; font-weight: 600; color: var(--muted); transition: color .2s;
}
.tabs a svg { width: 23px; height: 23px; transition: transform .3s var(--spring); }
.tabs a.on { color: var(--fg); }
.tabs a.on svg { transform: translateY(-1px) scale(1.06); }
.tabs a:active svg { transform: scale(.85); }
.player-open .tabs { transform: translate(-50%, calc(100% + 40px)); opacity: 0; }

/* ---------- Mini-reproductor ---------- */
.mini {
  position: fixed; z-index: 11; left: 50%;
  bottom: calc(var(--tabs-b) + var(--tabs-h) + 8px);
  width: min(calc(100% - 20px - var(--sal) - var(--sar)), 560px); height: var(--mini-h);
  transform: translateX(-50%); border-radius: 18px; overflow: hidden;
  display: flex; align-items: center; gap: 10px; padding: 0 6px 0 8px; cursor: pointer;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: 0 14px 40px rgba(0,0,0,.6);
  transition: transform .5s var(--ease), opacity .35s;
  animation: miniIn .6s var(--spring) both;
}
@keyframes miniIn { from { transform: translate(-50%, 30px) scale(.9); opacity: 0; } }
.mini:active { transform: translateX(-50%) scale(.98); }
.player-open .mini { transform: translate(-50%, -40px) scale(.9); opacity: 0; pointer-events: none; }
.mini-art { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; background: var(--faint); flex: none; box-shadow: 0 4px 12px rgba(0,0,0,.5); transition: opacity .18s; }
/* Mientras la carátula 3D vuela hacia el mini, la imagen DOM se oculta (evita verla duplicada). */
.gl-flying .mini-art { opacity: 0; }
.mini-art:not([src]) { visibility: hidden; }
.mini-meta { flex: 1; min-width: 0; }
.mini-title { font-weight: 620; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-artist { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini .icon-btn svg { width: 26px; height: 26px; }
.mini-progress { position: absolute; left: 14px; right: 14px; bottom: 0; height: 2px; background: var(--faint); border-radius: 2px; overflow: hidden; }
.mini-progress i { display: block; height: 100%; background: var(--fg); transform-origin: 0 50%; transform: scaleX(0); }
.is-loading .mini-art { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }

/* ---------- Reproductor completo ---------- */
.player {
  position: fixed; inset: 0; z-index: 20;
  display: flex; flex-direction: column;
  padding: calc(var(--sat) + 4px) calc(var(--sar) + 18px) calc(var(--sab) + 18px) calc(var(--sal) + 18px);
  /* Transparente: carátula y partículas se pintan en el canvas de debajo. El "zoom" lo hace la carátula 3D. */
  background: linear-gradient(to bottom, transparent 45%, rgba(5,5,7,.55) 75%, rgba(5,5,7,.85));
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .35s var(--ease), transform .5s var(--ease), visibility 0s .5s;
}
.player-open .player { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity .45s var(--ease) .08s, transform .5s var(--ease), visibility 0s; }
.player-top, .player-body { transition: transform .6s var(--ease); }
.player[aria-hidden="true"] .player-top { transform: translateY(-14px); }
.player[aria-hidden="true"] .player-body { transform: translateY(28px); }
.player-top { display: flex; align-items: center; justify-content: space-between; height: 48px; flex: none; touch-action: none; }
.player-top svg { width: 26px; height: 26px; }
.player-context { font-size: 12px; font-weight: 650; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); max-width: 60%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }

.stage { flex: 1; min-height: 0; position: relative; touch-action: pan-y; cursor: grab; }
.stage:active { cursor: grabbing; }
.stage-track { position: absolute; inset: 0; pointer-events: none; }
/* Fallback sin WebGL: carátula plana en el DOM. */
.stage-flat {
  position: absolute; left: 50%; top: 50%; width: min(84vw, calc(100% - 20px), 430px); aspect-ratio: 1; max-height: 100%;
  transform: translate(-50%, -50%); border-radius: 18px; overflow: hidden; background: linear-gradient(150deg, #17171c, #0a0a0d);
  box-shadow: 0 40px 80px -30px rgba(0,0,0,.9), inset 0 0 0 1px var(--line);
}
.stage-flat img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .5s; }
.stage-flat img.ok { opacity: 1; }

.player-body { flex: none; width: 100%; max-width: 520px; margin: 0 auto; padding-top: 10px; }
.player-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.player-titles { flex: 1; min-width: 0; }
.player-titles h2 { font-size: 22px; font-weight: 720; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-titles p { margin: 2px 0 0; color: var(--muted); font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fav svg { width: 26px; height: 26px; }
.fav.on { color: #ff5c8a; }
.fav.on svg { animation: pop .45s var(--spring); }
@keyframes pop { 40% { transform: scale(1.35); } }

.scrub { padding: 10px 0 4px; cursor: pointer; touch-action: none; }
.scrub-rail { position: relative; height: 5px; border-radius: 5px; background: var(--faint); transition: height .2s var(--ease); }
.scrub.active .scrub-rail { height: 9px; }
.scrub-rail i { position: absolute; inset: 0; border-radius: inherit; transform-origin: 0 50%; transform: scaleX(0); }
.scrub-buf { background: rgba(255,255,255,.12); }
.scrub-fill { background: var(--fg); }
.scrub-knob {
  position: absolute; top: 50%; left: 0; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
  background: var(--fg); box-shadow: 0 2px 8px rgba(0,0,0,.4); transform: scale(.0); transition: transform .2s var(--spring);
}
.scrub.active .scrub-knob, .scrub:hover .scrub-knob { transform: scale(1); }
.scrub-times { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.badge { padding: 2px 8px; border-radius: 999px; background: var(--faint); font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; }

.controls { display: flex; align-items: center; justify-content: space-between; margin: 10px 0 14px; }
.play-btn {
  width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center;
  background: var(--fg); color: var(--bg); position: relative;
  box-shadow: 0 18px 50px -14px color-mix(in srgb, var(--accent) 65%, transparent);
  transition: transform .25s var(--spring), box-shadow .4s;
}
.play-btn svg { width: 34px; height: 34px; }
.play-btn:active { transform: scale(.9); }
.is-loading .play-btn::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 2px solid transparent; border-top-color: var(--fg); animation: spin .9s linear infinite;
}
.player-foot { display: flex; justify-content: center; }

/* ---------- Hoja inferior ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.6); opacity: 0; transition: opacity .3s; }
.sheet-backdrop.open { opacity: 1; }
.sheet {
  position: fixed; z-index: 41; left: 50%; bottom: 0; width: min(100%, 560px);
  max-height: 82dvh; display: flex; flex-direction: column;
  border-radius: 24px 24px 0 0; border-bottom: 0;
  background: rgba(12, 12, 15, .9); border-color: var(--line-hi);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  padding: 0 0 calc(var(--sab) + 12px);
  transform: translate(-50%, 105%); transition: transform .38s var(--ease);
}
.sheet.open { transform: translate(-50%, 0); }
.sheet.tall { height: 82dvh; }
.sheet-grip { width: 38px; height: 5px; border-radius: 5px; background: rgba(255,255,255,.25); margin: 9px auto 6px; flex: none; }
.sheet-body { overflow-y: auto; padding: 4px 16px 6px; -webkit-overflow-scrolling: touch; }
.sheet-title { font-size: 19px; padding: 8px 4px 14px; }
.sheet-title small { color: var(--muted); font-weight: 500; font-size: 14px; }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 6px 4px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.sheet-head > div:last-child { min-width: 0; }
.menu { list-style: none; margin: 0; padding: 0; }
.menu li { display: flex; align-items: center; gap: 14px; padding: 13px 6px; border-radius: 12px; cursor: pointer; font-weight: 520; }
.menu li:active { background: var(--surface-hi); }
@media (hover: hover) { .menu li:hover { background: var(--surface); } }
.menu li svg { color: var(--muted); }
.menu li.danger { color: #ff6b81; }
.menu li.danger svg { color: inherit; }
.menu-n { margin-left: auto; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note { color: var(--muted); font-size: 13.5px; margin: 12px 4px 0; }
.q-label { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: 12px 4px 4px; }
.q-label small { font-weight: 500; }
.sheet .list { padding: 0; }
.sheet .row { grid-template-columns: auto 1fr auto; }
.ask { display: flex; flex-direction: column; gap: 12px; padding-bottom: 6px; }
.field {
  height: 50px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); font-size: 17px; outline: none; -webkit-user-select: text; user-select: text;
}
.field:focus { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }

.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 16px; width: 38px; justify-content: center; }
.eq i { width: 3px; background: var(--accent); border-radius: 2px; height: 30%; }
.is-playing .eq i { animation: eq .9s ease-in-out infinite alternate; }
.eq i:nth-child(2) { animation-delay: -.3s !important; }
.eq i:nth-child(3) { animation-delay: -.6s !important; }
@keyframes eq { to { height: 100%; } }

/* ---------- Ajustes ---------- */
.settings { display: flex; flex-direction: column; gap: 18px; padding-bottom: 8px; }
.settings small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 400; margin-top: 2px; }
.settings .stack { display: flex; flex-direction: column; gap: 8px; }
.settings .btn.wide { margin-top: 0; }
.settings select.field { -webkit-appearance: none; appearance: none; }
.switch { display: flex; align-items: center; gap: 14px; cursor: pointer; }
.switch > span { flex: 1; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { width: 51px; height: 31px; border-radius: 31px; background: var(--faint); position: relative; flex: none; transition: background .25s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.3); transition: transform .3s var(--spring); }
.switch input:checked + i { background: #34c759; }
.switch input:checked + i::after { transform: translateX(20px); }
.diag { margin: 0; padding: 12px 14px; border-radius: 12px; background: rgba(0,0,0,.3); font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; -webkit-user-select: text; user-select: text; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; z-index: 60; left: 50%; top: calc(var(--sat) + 12px);
  transform: translate(-50%, -20px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 40px); padding: 11px 18px; border-radius: 999px;
  background: rgba(18, 18, 22, .96); color: var(--fg); font-weight: 560; font-size: 14px;
  border: 1px solid var(--line-hi); box-shadow: 0 12px 34px rgba(0,0,0,.6);
  transition: transform .35s var(--spring), opacity .25s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- Escritorio ---------- */
@media (min-width: 900px) {
  :root { --gutter: 32px; }
  .hero h1 { font-size: 42px; }
  .tile { width: 176px; }
  .quick { grid-template-columns: repeat(3, 1fr); }
  .player { padding-left: calc(var(--sal) + 48px); padding-right: calc(var(--sar) + 48px); }
}
@media (min-width: 900px) and (min-aspect-ratio: 4/3) {
  .player { display: grid; grid-template-columns: 1.15fr 1fr; grid-template-rows: auto 1fr; column-gap: 40px; }
  .player-top { grid-column: 1 / -1; }
  .stage { height: 100%; }
  .player-body { position: relative; z-index: 1; }
  .stage-flat { width: min(42vw, 70dvh, 520px); }
  .player-body { align-self: center; max-width: 440px; margin: 0; }
}

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .12s !important; }
}

/* ---------- Descargas / sin conexión ---------- */
.dl-cover { display: grid; place-items: center; color: #34d399; background: linear-gradient(150deg, #17171c, #0a0a0d); }
.cover.xl.dl-cover svg { width: 72px; height: 72px; }
/* Indicador en la fila: punto verde (descargada), anillo de progreso (descargando), anillo tenue (en cola) */
.row .row-dur { position: relative; padding-left: 18px; min-width: 18px; }
.row.dl .row-dur::before, .row.dling .row-dur::before, .row.dlq .row-dur::before {
  content: ""; position: absolute; left: 0; top: 50%; width: 12px; height: 12px; margin-top: -6px; border-radius: 50%;
}
.row.dl .row-dur::before {
  background: #10b981 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round' d='M12 5v11m-5-5 5 5 5-5'/%3E%3C/svg%3E") center/9px no-repeat;
}
.row.dling .row-dur::before {
  background: conic-gradient(#10b981 calc(var(--p, 0) * 360deg), var(--faint) 0);
  -webkit-mask: radial-gradient(circle, transparent 3px, #000 3.5px); mask: radial-gradient(circle, transparent 3px, #000 3.5px);
}
.row.dlq .row-dur::before { border: 1.5px dashed var(--muted); }
.dl-btn.on { color: #10b981; }
.dl-btn.busy svg { animation: pulse 1.2s ease-in-out infinite; }
.is-offline .list .row:not(.dl) { opacity: .35; }
.is-offline .tabs::before {
  content: "Sin conexión"; position: absolute; left: 50%; top: -26px; transform: translateX(-50%);
  font-size: 11px; font-weight: 650; padding: 3px 10px; border-radius: 999px; background: #111114; border: 1px solid var(--line-hi); color: var(--muted);
}
.has-mini.is-offline .tabs::before { display: none; }
