/* =====================================================================
   Purple Wave Sync · Reproductor
   Sistema visual: tokens (color, tipo, espacio, radios, elevación, movimiento)
   → base → escenario de fondo → HUD → escenario → dock → listas → paneles
   → controles → guía → overlays → responsivo → movimiento reducido.
   ===================================================================== */

@property --energy { syntax: "<number>"; inherits: true; initial-value: 0.35; }
@property --glow { syntax: "<color>"; inherits: true; initial-value: #5b2bb5; }
@property --song-accent { syntax: "<color>"; inherits: true; initial-value: #b58cff; }
@property --song-accent-2 { syntax: "<color>"; inherits: true; initial-value: #7cc4ff; }

/* ---------- Tokens ---------- */
:root {
  /* Superficies (de atrás hacia adelante) */
  --bg: #06061a;
  --bg-deep: #03030c;
  --surface-0: rgba(14, 12, 30, 0.62);   /* vidrio ligero: HUD, chips */
  --surface-1: rgba(17, 14, 34, 0.8);    /* vidrio: dock, lista lateral */
  --surface-2: rgba(21, 18, 40, 0.95);   /* paneles, coach */
  --surface-solid: #15122a;              /* fondo opaco de referencia (contraste) */
  --surface-hover: rgba(255, 255, 255, 0.06);
  --surface-active: rgba(255, 255, 255, 0.1);
  --surface-field: rgba(255, 255, 255, 0.05);
  --field-solid: #1d1a2b;                /* selects y listas nativas de opciones */

  /* Texto (contraste sobre --surface-solid / --field-solid) */
  --text: #f4f1fa;     /* 16.9:1 */
  --text-2: #cfc8de;   /* 11.6:1 secundario */
  --muted: #a39cb8;    /* 6.9:1 (6.4:1 sobre campos) apoyo, metadatos, placeholder */
  --text-ink: #120a24; /* texto sobre fondos claros */

  /* Acento y estados */
  --accent: #b58cff;        /* 7.1:1 sobre superficie */
  --accent-strong: #9d6bff;
  --accent-soft: rgba(181, 140, 255, 0.16);
  --accent-ink: #14072b;    /* 8.3:1 sobre --accent */
  --success: #4fe0a0;
  --success-soft: rgba(79, 224, 160, 0.14);
  --warn: #ffcb5c;
  --warn-bg: #2f2408;
  --warn-text: #ffe39a;
  --error: #ff7a8c;
  --error-soft: rgba(255, 122, 140, 0.14);
  --focus: #ff8fcb;

  /* Bordes */
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --hairline-top: inset 0 1px 0 rgba(255, 255, 255, 0.06);

  /* Tema dinámico (lo actualiza app.js con la canción) */
  --glow: #5b2bb5;
  --glow-soft: color-mix(in srgb, var(--glow) 35%, transparent);
  /* Luz de escena: el color de la canción, siempre luminoso (aunque esté en pausa) */
  --light: color-mix(in srgb, var(--glow) 62%, #8f5cff);

  /* Tipografía */
  --font-display: "Unbounded Variable", "Unbounded", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  --font-body: "Plus Jakarta Sans Variable", "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  --font-ko: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Nanum Gothic", var(--font-body);
  --fs-12: 0.75rem;
  --fs-14: 0.875rem;
  --fs-16: 1rem;
  --fs-20: 1.25rem;
  --fs-28: 1.75rem;
  --fs-40: 2.5rem;
  --lh-tight: 1.15;
  --lh-snug: 1.3;
  --lh-body: 1.5;
  --track-display: -0.02em;
  --track-caps: 0.08em;

  /* Espaciado (8 pt, con medio paso de 4) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 40px;
  --s-8: 48px;

  /* Radios */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-pill: 999px;

  /* Elevación */
  --e-1: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 12px -4px rgba(0, 0, 0, 0.4);
  --e-2: 0 12px 32px -12px rgba(0, 0, 0, 0.7);
  --e-3: 0 32px 80px -24px rgba(0, 0, 0, 0.85);
  --blur: blur(20px) saturate(1.4);

  /* Movimiento */
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --dur-1: 120ms;
  --dur-2: 200ms;
  --dur-3: 320ms;
  --dur-4: 480ms;

  /* Capas */
  --z-side: 5;
  --z-overlay: 4;
  --z-panel: 10;
  --z-coach: 12;
  --z-toast: 30;
  --z-skip: 50;

  /* Medidas de layout */
  --pad: var(--s-4);
  --hud-h: 44px;
  --dock-h: 84px;
  --side-w: 320px;
  --tap: 44px;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-16);
  line-height: var(--lh-body);
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: #cdb0ff; }
h2, h3, p { margin: 0; }
h2 { font-family: var(--font-display); font-size: var(--fs-16); font-weight: 600; line-height: var(--lh-snug); letter-spacing: var(--track-display); }
h3 { font-size: var(--fs-14); font-weight: 700; line-height: var(--lh-snug); }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--s-1) 0; width: 100%; }
svg { width: 20px; height: 20px; display: block; flex: none; }
button { font: inherit; letter-spacing: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--accent) 45%, transparent); }
.skip { position: absolute; left: -999px; top: var(--s-2); background: var(--accent); color: var(--accent-ink); padding: var(--s-2) var(--s-4); border-radius: var(--r-sm); z-index: var(--z-skip); font-weight: 700; }
.skip:focus { left: var(--s-4); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
kbd {
  font-family: var(--font-body); font-size: var(--fs-12); font-weight: 600; color: var(--text-2);
  background: var(--surface-hover); border: 1px solid var(--border-strong); border-bottom-width: 2px;
  border-radius: var(--r-xs); padding: 0 var(--s-1); min-width: 1.6em; display: inline-block; text-align: center; line-height: 1.5;
}

/* Barras de desplazamiento discretas */
* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.16) transparent; }

/* =====================================================================
   App y escenario de fondo
   ===================================================================== */
.app {
  position: fixed; inset: 0;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  padding: calc(var(--pad) + var(--safe-t)) calc(var(--pad) + var(--safe-r)) calc(var(--pad) + var(--safe-b)) calc(var(--pad) + var(--safe-l));
  gap: var(--s-3);
  grid-template-columns: minmax(0, 1fr);
  transition: --glow 0.25s linear, --energy 1.2s ease, --song-accent 0.8s ease, --song-accent-2 0.8s ease;
  overflow: hidden;
  overflow: clip; /* evita que el foco desplace la app cuando una hoja entra animada desde abajo */
  isolation: isolate;
}

/* 1 · Luz de fondo: degradados volumétricos con el color de la canción */
.ambient {
  position: absolute; inset: -10%; z-index: -6;
  background:
    radial-gradient(46% 40% at 50% 18%, color-mix(in srgb, var(--light) 42%, transparent), transparent 70%),
    radial-gradient(60% 30% at 50% 58%, color-mix(in srgb, var(--light) 22%, transparent), transparent 75%),
    radial-gradient(38% 46% at 10% 72%, color-mix(in srgb, var(--glow) 26%, #0b1648), transparent 72%),
    radial-gradient(38% 46% at 90% 72%, color-mix(in srgb, var(--glow) 26%, #1a0b40), transparent 72%),
    linear-gradient(180deg, #0a0b26 0%, var(--bg) 45%, var(--bg-deep) 100%);
}

/* 2 · Haces de luz desde el techo del escenario (conos suaves, sin filtros caros) */
.beams { position: absolute; inset: 0; z-index: -5; pointer-events: none; overflow: hidden;
  opacity: calc(0.35 + 0.55 * var(--energy));
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 35%, transparent 88%); mask-image: linear-gradient(to bottom, #000 0%, #000 35%, transparent 88%); }
.beams i {
  position: absolute; top: -6%; left: var(--x); width: 90vmax; height: 120vh; margin-left: -45vmax;
  transform-origin: 50% 0; transform: rotate(var(--r));
  background: conic-gradient(from 180deg at 50% 0%,
    transparent calc(180deg - var(--w)),
    color-mix(in srgb, var(--light) 70%, #fff) 180deg,
    transparent calc(180deg + var(--w)));
  opacity: var(--o);
  mix-blend-mode: screen;
  animation: beam-sweep var(--t) ease-in-out infinite alternate;
  animation-delay: var(--d);
}
.beams i:nth-child(1) { --x: 18%; --r: -16deg; --w: 5deg; --o: 0.34; --t: 11s; --d: -2s; }
.beams i:nth-child(2) { --x: 36%; --r: -6deg;  --w: 3.5deg; --o: 0.28; --t: 9s;  --d: -5s; }
.beams i:nth-child(3) { --x: 50%; --r: 0deg;   --w: 7deg; --o: 0.22; --t: 14s; --d: -1s; }
.beams i:nth-child(4) { --x: 64%; --r: 6deg;   --w: 3.5deg; --o: 0.28; --t: 10s; --d: -7s; }
.beams i:nth-child(5) { --x: 82%; --r: 16deg;  --w: 5deg; --o: 0.34; --t: 12s; --d: -3s; }
@keyframes beam-sweep { from { transform: rotate(calc(var(--r) - 7deg)); } to { transform: rotate(calc(var(--r) + 7deg)); } }

/* 3 · Multitud (canvas, src/crowd.js) */
.crowd-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -4; pointer-events: none; }

/* 4 · Neblina sobre el público */
.haze {
  position: absolute; left: -20%; right: -20%; top: 30%; height: 50%; z-index: -3; pointer-events: none;
  background:
    radial-gradient(40% 50% at 30% 55%, color-mix(in srgb, var(--light) 20%, transparent), transparent 70%),
    radial-gradient(35% 45% at 72% 45%, color-mix(in srgb, var(--light) 16%, transparent), transparent 70%);
  opacity: calc(0.45 + 0.4 * var(--energy));
  animation: haze-drift 38s ease-in-out infinite alternate;
}
@keyframes haze-drift { to { transform: translate3d(6%, -3%, 0) scale(1.06); } }

/* 5 · Viñeta + grano de película */
.vignette { position: absolute; inset: 0; z-index: -2; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 40%, transparent 55%, rgba(2, 2, 10, 0.72) 100%); }
.vignette::after { content: ""; position: absolute; inset: 0; background: url(assets/grain.svg) 0 0 / 240px 240px; opacity: 0.07; mix-blend-mode: overlay; }

/* =====================================================================
   HUD superior
   ===================================================================== */
.hud-top {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  min-height: var(--hud-h); flex-wrap: nowrap;
  transition: opacity var(--dur-3) var(--ease-out), transform var(--dur-3) var(--ease-out);
}
.hud-start { display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
.top-actions { display: flex; gap: var(--s-2); align-items: center; }
/* Logo: lleva a la página de inicio (mismo lugar en teléfono, tablet y escritorio) */
.m-brand {
  display: inline-flex; align-items: center; gap: var(--s-2); min-height: var(--tap); padding: 0 var(--s-2) 0 2px; border-radius: var(--r-pill);
  color: var(--text); text-decoration: none; font: 800 var(--fs-16)/1 var(--font-body); letter-spacing: -0.01em; white-space: nowrap;
}
.m-brand img { width: 30px; height: 30px; flex: none; }
.m-brand:hover { color: var(--text); }
.m-nav { display: none; }

.menu, .seg, .pill, .round {
  background: var(--surface-0); border: 1px solid var(--border);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--hairline-top), var(--e-1);
}

/* Menú */
.menu { display: inline-flex; gap: 2px; border-radius: var(--r-pill); padding: 3px; }
.menu-item {
  font-size: var(--fs-14); font-weight: 600; color: var(--text-2); background: transparent; border: 0; text-decoration: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: var(--s-2); padding: 0 var(--s-3) 0 10px; min-height: 36px; border-radius: var(--r-pill);
  transition: background var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out);
}
.menu-item svg { width: 18px; height: 18px; }
.menu-item:hover { background: var(--surface-hover); color: var(--text); }
.menu-item[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); }
/* Pantallas medianas: logo, Biblioteca y CTA compactos para que la cabecera quepa en una línea */
@media (max-width: 1099px) {
  /* Ocultos a la vista pero no al lector de pantalla (el CTA sigue llamándose "Conectar ARMY Bomb") */
  .m-brand span, .menu-label, .cta-ext { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .menu-item { width: 38px; justify-content: center; padding: 0; }
}

/* Pestañas segmentadas con indicador deslizante (2 o 3 opciones) */
.seg, .tabs {
  --n: 2; --i: 0;
  position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  border-radius: var(--r-pill); padding: 3px; isolation: isolate;
}
.seg:has(> :nth-child(3)), .tabs:has(> :nth-child(3)) { --n: 3; }
.seg:has(> :nth-child(2)[aria-selected="true"]), .tabs:has(> :nth-child(2)[aria-selected="true"]) { --i: 1; }
.seg:has(> :nth-child(3)[aria-selected="true"]), .tabs:has(> :nth-child(3)[aria-selected="true"]) { --i: 2; }
.seg::before, .tabs::before {
  content: ""; position: absolute; z-index: -1; top: 3px; bottom: 3px; left: 3px;
  width: calc((100% - 6px) / var(--n)); border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.94); box-shadow: 0 2px 10px -2px rgba(0, 0, 0, 0.5);
  transform: translateX(calc(100% * var(--i)));
  transition: transform var(--dur-3) var(--ease-spring);
}
.seg button, .tabs button {
  font-size: var(--fs-14); font-weight: 600; border: 0; background: transparent; color: var(--text-2);
  border-radius: var(--r-pill); padding: 0 var(--s-4); cursor: pointer; min-height: 36px; white-space: nowrap;
  transition: color var(--dur-2) var(--ease-out);
}
.seg button:hover, .tabs button:hover { color: var(--text); }
.seg [aria-selected="true"], .tabs [aria-selected="true"], .seg [aria-selected="true"]:hover, .tabs [aria-selected="true"]:hover { color: var(--text-ink); }
.view-tabs button { min-width: 84px; }
.tabs { background: var(--surface-field); border: 1px solid var(--border); }

/* Botón de conexión y redondos */
.pill, .round {
  font-size: var(--fs-14); font-weight: 600; color: var(--text);
  display: inline-flex; align-items: center; gap: var(--s-2); cursor: pointer; min-height: var(--tap);
  transition: background var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out), transform var(--dur-1) var(--ease-out);
}
.pill { position: relative; border-radius: var(--r-pill); padding: 0 var(--s-4) 0 var(--s-3); }
.pill svg, .round svg { width: 18px; height: 18px; }
/* Un solo lugar por acción ----------------------------------------------------------
   Con la biblioteca a la vista, sus accesos (Cola, Mis videos, Conciertos) no se repiten en el pie ni en Explorar,
   y se cierra con el botón Biblioteca de la cabecera: el ✕ interno solo existe en modo cajón (tablet). */
.app:not(.side-drawer):has(#side:not([hidden])) #btn-cola,
.app:not(.side-drawer):has(#side:not([hidden])) .ex-links { display: none; }
.app:not(.side-drawer) #side-close { display: none; }
/* Rendimiento en teléfonos y pantallas táctiles -------------------------------------------------------
   El desenfoque de fondo (backdrop-filter) es lo más caro para la GPU de un teléfono: se cambia por superficies
   casi opacas. Los haces de luz pierden la mezcla "screen" y quedan 3; la neblina deja de moverse. */
@media (max-width: 640px), (pointer: coarse) {
  *, *::before, *::after { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
  :root { --surface-0: rgba(14, 12, 30, 0.9); --surface-1: rgba(17, 14, 34, 0.95); }
  :root[data-theme="light"] { --surface-0: rgba(255, 255, 255, 0.94); --surface-1: rgba(255, 255, 255, 0.97); }
  .beams i { mix-blend-mode: normal; will-change: transform; }
  .beams i:nth-child(2), .beams i:nth-child(4) { display: none; }
  .haze { animation: none; }
}
/* Las filas de Explorar que no se ven no se dibujan (cientos de tarjetas con imagen). */
.shelf, .explore-list > * { content-visibility: auto; contain-intrinsic-size: auto 320px; }

/* Nota "¿Por qué no están todos los videos?" en el inicio */
.info-note { margin: 0 0 var(--s-4); padding: var(--s-2) var(--s-4); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-1); font-size: var(--fs-14); }
.info-note summary { min-height: var(--tap); display: flex; align-items: center; gap: var(--s-2); cursor: pointer; font-weight: 700; color: var(--text); list-style: none; }
.info-note summary::-webkit-details-marker { display: none; }
.info-note summary::before { content: "ⓘ"; color: var(--accent); font-size: 1.1em; }
.info-note summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; rotate: 45deg; transition: rotate var(--dur-2); }
.info-note[open] summary::after { rotate: -135deg; }
.info-note summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }
.info-note p { margin: 0 0 var(--s-2); color: var(--text-2); line-height: var(--lh-body); max-width: 70ch; }
.lang-btn { font-size: var(--fs-12); font-weight: 800; letter-spacing: 0.04em; }
.pill:hover, .round:hover { background: var(--surface-active); border-color: var(--border-strong); }
.pill:active, .round:active { transform: scale(0.97); }
.pill.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 8px 28px -8px var(--accent); }
.pill.on::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-ink); box-shadow: 0 0 0 3px rgba(20, 7, 43, 0.2); }
.round { width: var(--tap); height: var(--tap); border-radius: 50%; justify-content: center; padding: 0; }

/* =====================================================================
   Escenario: video, vista Luces
   ===================================================================== */
.stage { position: relative; display: grid; place-items: center; min-height: 0; container-type: size; }
.stage::before { /* reflejo de luz bajo la pantalla */
  content: ""; position: absolute; left: 15%; right: 15%; bottom: 2%; height: 18%; z-index: -1; pointer-events: none;
  background: radial-gradient(50% 50% at 50% 50%, color-mix(in srgb, var(--glow) 45%, transparent), transparent 70%);
  opacity: calc(0.4 + 0.5 * var(--energy));
}
.style-chip {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%); z-index: 2;
  display: inline-flex; align-items: center; gap: var(--s-2);
  background: var(--surface-0); border: 1px solid var(--border); border-radius: var(--r-pill); padding: var(--s-1) var(--s-3) var(--s-1) 10px;
  font-size: var(--fs-12); font-weight: 600; letter-spacing: 0.01em; color: var(--text-2); line-height: 1.5;
  white-space: nowrap; max-width: 90%; overflow: hidden; text-overflow: ellipsis;
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.style-chip::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: color-mix(in srgb, var(--glow) 70%, #fff 30%); box-shadow: 0 0 10px var(--glow); }

.video-card {
  position: relative;
  width: min(100%, calc((100dvh - 250px) * 16 / 9));
  width: min(100cqw, calc((100cqh - 80px) * 16 / 9));
  aspect-ratio: 16 / 9;
  border-radius: var(--r-xl); overflow: hidden; background: #000;
  box-shadow: 0 0 0 1px var(--border-strong), 0 40px 120px -40px var(--glow), var(--e-3);
  animation: view-in var(--dur-4) var(--ease-out);
}
.video-card::after { /* velo para el cambio de canción */
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: radial-gradient(70% 70% at 50% 50%, color-mix(in srgb, var(--glow) 40%, #000), #000);
  opacity: 0;
}
.app.song-change .video-card::after { animation: song-veil 900ms var(--ease-out); }
@keyframes song-veil { 0% { opacity: 1; } 100% { opacity: 0; } }
@keyframes view-in { from { opacity: 0; transform: scale(0.985); } }
.video-box, .video-box iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.empty {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: var(--s-2); text-align: center; padding: var(--s-5);
  background:
    radial-gradient(60% 70% at 50% 38%, color-mix(in srgb, var(--glow) 30%, #161036), transparent 75%),
    linear-gradient(180deg, #0f0c26, #07061a);
}
.empty::before { /* rejilla sutil de escenario */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.5;
  background-image: linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: radial-gradient(60% 60% at 50% 50%, #000, transparent); mask-image: radial-gradient(60% 60% at 50% 50%, #000, transparent);
}
.empty > * { position: relative; }
.empty-art { width: clamp(112px, 22cqw, 180px); height: auto; margin-bottom: var(--s-1); filter: drop-shadow(0 16px 40px var(--glow-soft)); animation: float 6s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px); } }
.eyebrow { font-size: var(--fs-12); font-weight: 700; letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--accent); }

.lights-view { display: grid; justify-items: center; align-content: center; gap: var(--s-5); text-align: center; width: 100%; height: 100%; animation: view-in var(--dur-4) var(--ease-out); }
.big-bulb {
  --c: #5b2bb5;
  width: min(56vw, 42dvh); width: min(60cqw, 52cqh); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #ffffffc0 0 9%, var(--c) 46%, color-mix(in srgb, var(--c) 55%, #000) 100%);
  box-shadow: 0 0 80px 20px var(--c), 0 0 180px 70px color-mix(in srgb, var(--c) 40%, transparent), inset 0 -20px 40px rgba(0, 0, 0, 0.35);
}
.sim { display: flex; gap: clamp(6px, 2.4vw, 16px); justify-content: center; }
.bulb {
  --c: #28104a;
  width: clamp(18px, 6vw, 32px); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff8 0 12%, var(--c) 45%);
  box-shadow: 0 0 16px 3px var(--c);
}
.section-label { font-family: var(--font-display); font-size: var(--fs-16); font-weight: 600; letter-spacing: var(--track-display); color: var(--text); }
.hint { color: var(--muted); font-size: var(--fs-14); line-height: var(--lh-body); }
.hint.small { font-size: var(--fs-12); }
.lights-view .hint { max-width: 36ch; }

/* =====================================================================
   Dock: reproductor
   ===================================================================== */
.dock {
  justify-self: center; width: min(1180px, 100%); min-height: var(--dock-h);
  display: grid; align-items: center; column-gap: var(--s-4); row-gap: 2px;
  grid-template-columns: minmax(140px, 1fr) minmax(260px, 1.3fr) auto;
  grid-template-areas: "np transport actions" "np progress actions";
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--r-xl); padding: var(--s-2) var(--s-3);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--hairline-top), var(--e-2);
  transition: opacity var(--dur-3) var(--ease-out), transform var(--dur-3) var(--ease-out), box-shadow var(--dur-4) var(--ease-out), border-color var(--dur-4) var(--ease-out);
}
.dock:focus { outline: none; }
.dock:focus-visible { outline: 2px solid var(--focus); }
.playing-now .dock { border-color: color-mix(in srgb, var(--glow) 35%, var(--border)); box-shadow: var(--hairline-top), var(--e-2), 0 -10px 50px -30px var(--glow); }
.np { grid-area: np; display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.art {
  flex: none; width: 48px; height: 48px; border-radius: 50%; position: relative;
  background: conic-gradient(from 0deg, var(--a1, #8a2be2), var(--a2, #4fc3f7), var(--a3, #ff80ab), var(--a1, #8a2be2));
  box-shadow: inset 0 0 0 14px #0d0b18, inset 0 0 0 15px rgba(255, 255, 255, 0.18), 0 6px 18px -6px rgba(0, 0, 0, 0.8);
}
.art::after { content: ""; position: absolute; inset: 21px; border-radius: 50%; background: #ece6f7; }
.playing-now .art { animation: spin 6s linear infinite; box-shadow: inset 0 0 0 14px #0d0b18, inset 0 0 0 15px rgba(255, 255, 255, 0.18), 0 0 24px -4px var(--glow); }
@keyframes spin { to { transform: rotate(360deg); } }
.np-text { min-width: 0; display: grid; gap: 2px; }
.np-title { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-14); line-height: var(--lh-snug); letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-sub { font-size: var(--fs-12); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app.song-change .np-sub { animation: np-in var(--dur-4) var(--ease-out) 120ms both; }
@keyframes np-in { from { opacity: 0; transform: translateY(6px); } }

.transport { grid-area: transport; display: flex; align-items: center; justify-content: center; gap: var(--s-2); }
.dock-actions { grid-area: actions; display: flex; align-items: center; justify-content: flex-end; gap: 2px; }

/* Botones de icono */
.ibtn {
  position: relative; color: var(--text-2); background: transparent; border: 0; cursor: pointer;
  width: var(--tap); height: var(--tap); border-radius: 50%; display: grid; place-items: center; padding: 0; font-size: var(--fs-16);
  transition: background var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out), transform var(--dur-1) var(--ease-out);
}
.ibtn:hover { background: var(--surface-hover); color: var(--text); }
.ibtn:active { transform: scale(0.92); }
.ibtn svg { width: 20px; height: 20px; }
.ibtn.sm svg { width: 19px; height: 19px; }
.ibtn.play {
  background: #fff; color: var(--text-ink); width: 48px; height: 48px;
  box-shadow: 0 6px 20px -6px rgba(0, 0, 0, 0.7);
  transition: transform var(--dur-2) var(--ease-spring), box-shadow var(--dur-4) var(--ease-out), background var(--dur-2);
}
.ibtn.play svg { width: 22px; height: 22px; }
.ibtn.play:hover { background: #fff; color: var(--text-ink); transform: scale(1.05); }
.ibtn.play:active { transform: scale(0.94); }
.playing-now .ibtn.play { box-shadow: 0 6px 20px -6px rgba(0, 0, 0, 0.7), 0 0 0 4px color-mix(in srgb, var(--glow) 35%, transparent), 0 0 32px -4px var(--glow); }
.ibtn[aria-pressed="true"], .ibtn.active { color: var(--accent); background: var(--accent-soft); }
.ibtn[aria-pressed="true"]::after { /* indicador de activo */
  content: ""; position: absolute; bottom: 5px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: currentColor;
}

/* Progreso */
.progress { grid-area: progress; display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.times { display: contents; }
.times > span { font-size: var(--fs-12); font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 4.2ch; }
#t-cur { order: -1; text-align: right; }
.t-sep { display: none; }
.timeline { position: relative; flex: 1; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.16); cursor: pointer; touch-action: none; transition: height var(--dur-2) var(--ease-out); }
.timeline::before { content: ""; position: absolute; inset: -16px 0; } /* área táctil */
.timeline:hover, .timeline:focus-visible { height: 6px; }
.timeline:focus-visible { outline-offset: 6px; border-radius: 4px; }
.seg-part { position: absolute; top: 0; bottom: 0; opacity: 0.85; }
.seg-part:first-of-type { border-radius: 2px 0 0 2px; }
.playhead {
  position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: #fff; left: 0;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.35), 0 0 14px var(--glow);
  transition: transform var(--dur-2) var(--ease-spring);
}
.timeline:hover .playhead, .timeline:focus-visible .playhead { transform: scale(1.15); }

/* =====================================================================
   Listas de canciones (lista lateral y panel)
   ===================================================================== */
.albums { display: grid; gap: 2px; }
.album-title {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; gap: var(--s-2);
  font-family: var(--font-body); font-size: var(--fs-12); font-weight: 700; line-height: var(--lh-snug);
  text-transform: uppercase; letter-spacing: var(--track-caps); color: var(--muted);
  margin: var(--s-3) 0 var(--s-1); padding: var(--s-2);
  background: var(--list-bg, var(--surface-solid));
}
.album-title:first-child { margin-top: 0; }
.swatches { display: inline-flex; gap: 3px; flex: none; }
.swatches i { width: 8px; height: 8px; border-radius: 50%; display: block; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3); }
.song {
  position: relative; width: 100%; text-align: left; color: var(--text); background: transparent; border: 0; border-radius: var(--r-md);
  padding: var(--s-2); display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: var(--s-3); align-items: center; cursor: pointer; min-height: 52px;
  transition: background var(--dur-2) var(--ease-out), transform var(--dur-1) var(--ease-out);
}
.song:hover { background: var(--surface-hover); }
.song:active { transform: scale(0.99); }
.song.playing { background: var(--accent-soft); }
.song.playing::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.song.playing .s-title { color: #e3d4ff; }
.thumb { width: 64px; height: 36px; border-radius: var(--r-sm); background: #1d1930 center / cover; position: relative; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06); overflow: hidden; }
.song.playing .thumb::after { /* ecualizador */
  content: ""; position: absolute; inset: 0; background-color: rgba(10, 6, 25, 0.6);
  background-image: linear-gradient(var(--song-accent), var(--song-accent)), linear-gradient(var(--song-accent), var(--song-accent)), linear-gradient(var(--song-accent), var(--song-accent));
  background-repeat: no-repeat; background-size: 3px 40%, 3px 70%, 3px 50%;
  background-position: calc(50% - 6px) 60%, 50% 60%, calc(50% + 6px) 60%;
  animation: eq 0.9s ease-in-out infinite alternate;
}
@keyframes eq { 50% { background-size: 3px 70%, 3px 30%, 3px 60%; } 100% { background-size: 3px 30%, 3px 60%, 3px 40%; } }
.s-title { display: block; font-size: var(--fs-14); font-weight: 600; line-height: var(--lh-snug); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-meta { font-size: var(--fs-12); color: var(--muted); line-height: var(--lh-snug); font-variant-numeric: tabular-nums; }
/* Insignia "Con letra" para canciones con video oficial con letra */
.badge-lyrics {
  display: inline-flex; align-items: center; gap: 3px; vertical-align: middle; margin-left: var(--s-1);
  font-size: 0.6875rem; font-weight: 700; line-height: 1; letter-spacing: 0.02em; white-space: nowrap;
  color: #e3d4ff; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: var(--r-pill); padding: 3px 6px;
}

.films, .mine { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.mine > li.row { gap: var(--s-1); }
.mine > li.row .song { flex: 1; min-width: 0; }
.mine > li.hint { padding: var(--s-5) var(--s-4); text-align: center; border: 1px dashed var(--border-strong); border-radius: var(--r-lg); }
.film { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-3) var(--s-3) var(--s-4); background: var(--surface-field); border: 1px solid var(--border); border-radius: var(--r-md); }
.film strong { font-size: var(--fs-14); font-weight: 600; }
.film small { display: block; color: var(--muted); font-size: var(--fs-12); }
.add-form { display: grid; gap: var(--s-3); padding: var(--s-4); border-radius: var(--r-lg); background: var(--surface-field); border: 1px solid var(--border); }
.add-form > label { font-size: var(--fs-14); font-weight: 600; }
.add-form input[type="url"] { width: 100%; }
.kind { border: 0; padding: 0; margin: 0; display: flex; gap: var(--s-2); flex-wrap: wrap; }
.kind legend { font-size: var(--fs-14); font-weight: 600; padding: 0; margin-bottom: var(--s-2); }

/* Buscador */
.search { position: relative; margin: 0 0 var(--s-2); }
.search svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.song-search { width: 100%; padding-left: 42px !important; border-radius: var(--r-pill) !important; }
.search-empty { padding: var(--s-2) var(--s-3) var(--s-3); }
.song[hidden], .album-title[hidden] { display: none !important; }

/* Lista lateral */
.side {
  --list-bg: #110e24;
  position: absolute; z-index: var(--z-side);
  left: calc(var(--pad) + var(--safe-l)); top: calc(var(--pad) + var(--hud-h) + var(--s-3) + var(--safe-t)); bottom: calc(var(--pad) + var(--safe-b));
  width: var(--side-w);
  display: flex; flex-direction: column; background: color-mix(in srgb, var(--list-bg) 94%, transparent); border: 1px solid var(--border); border-radius: var(--r-xl);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--hairline-top), var(--e-2);
  transition: opacity var(--dur-3) var(--ease-out), transform var(--dur-3) var(--ease-out), display var(--dur-3) allow-discrete;
}
.side[hidden] { opacity: 0; transform: translateX(-16px); }
@starting-style { .side:not([hidden]) { opacity: 0; transform: translateX(-16px); } }
.side-head { display: flex; justify-content: space-between; align-items: center; padding: var(--s-3) var(--s-2) var(--s-2) var(--s-4); }
.side-head h2 { font-size: var(--fs-16); }
.app.with-side .stage, .app.with-side .dock { margin-left: calc(var(--side-w) + var(--s-4)); }
.app.with-side .dock { width: auto; justify-self: stretch; }
.app.with-side.fs .side { display: none; }
.app.with-side.fs .stage, .app.with-side.fs .dock { margin-left: 0; }
/* Con la barra fija se cierra con "Biblioteca" (arriba); en el cajón no se contrae a íconos. */
.app.with-side #side-close, .app.side-drawer #side-rail { display: none; }
@media (max-width: 1099px) {
  .app:not(.side-drawer) .side { display: none !important; }
  .app.with-side .stage, .app.with-side .dock { margin-left: 0; }
  /* Cajón (641–1099 px): flota sobre el contenido, por encima de los paneles */
  .app.side-drawer .side {
    z-index: calc(var(--z-panel) + 2); width: min(var(--side-w), calc(100% - 2 * var(--pad)));
    bottom: calc(var(--pad) + var(--dock-h) + var(--s-3) + var(--safe-b)); /* no tapa el reproductor */
    box-shadow: var(--hairline-top), var(--e-3);
    overflow-y: auto; overscroll-behavior: contain; /* en horizontal no cabe entero: se desplaza todo el cajón */
  }
}
@media (max-width: 640px) { .side { display: none !important; } }

/* =====================================================================
   Paneles (diálogos no modales) y hojas inferiores en teléfono
   ===================================================================== */
.panel {
  --list-bg: #16132c;
  position: absolute; z-index: var(--z-panel);
  right: calc(var(--pad) + var(--safe-r)); bottom: calc(var(--pad) + var(--dock-h) + var(--s-3) + var(--safe-b));
  width: min(420px, calc(100% - 2 * var(--pad))); max-height: calc(100dvh - var(--dock-h) - var(--hud-h) - 4 * var(--pad) - 56px); /* deja ver la píldora de la guía */
  display: flex; flex-direction: column;
  background: color-mix(in srgb, var(--list-bg) 98%, transparent); border: 1px solid var(--border-strong); border-radius: var(--r-xl);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--hairline-top), var(--e-3);
  transform-origin: 100% 100%;
  transition: opacity var(--dur-3) var(--ease-out), transform var(--dur-3) var(--ease-out), display var(--dur-3) allow-discrete;
}
.panel[hidden] { opacity: 0; transform: translateY(12px) scale(0.97); transition-duration: var(--dur-2); transition-timing-function: var(--ease-in); }
@starting-style { .panel:not([hidden]) { opacity: 0; transform: translateY(12px) scale(0.97); } }
.panel-head { position: relative; display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-2) var(--s-3) var(--s-4); }
.ph-title { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.ph-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-md); background: var(--accent-soft); color: var(--accent); flex: none; }
.ph-icon svg { width: 18px; height: 18px; }
.panel-body { padding: var(--s-1) var(--s-4) var(--s-4); overflow: auto; display: grid; gap: var(--s-3); align-content: start; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.panel-body[role="tabpanel"]:not([hidden]) { animation: tab-in var(--dur-3) var(--ease-out); }
@keyframes tab-in { from { opacity: 0; transform: translateY(6px); } }
.panel > .tabs { margin: 0 var(--s-4) var(--s-3); }

/* Grupos de ajustes */
.group { display: grid; gap: var(--s-3); padding: var(--s-4); border-radius: var(--r-lg); background: var(--surface-field); border: 1px solid var(--border); }
.group-title { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-12); font-weight: 700; letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--muted); }
.group-title svg { width: 16px; height: 16px; color: var(--accent); }
.legal { padding: 0 var(--s-1); }
.shortcuts { line-height: 2; }

/* =====================================================================
   Controles
   ===================================================================== */
.btn {
  position: relative; cursor: pointer; border: 1px solid var(--border-strong); background: var(--surface-hover); color: var(--text);
  padding: 0 var(--s-4); border-radius: var(--r-md); text-decoration: none; font-size: var(--fs-14); font-weight: 600; line-height: 1.2;
  display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap); gap: var(--s-2);
  transition: background var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out), color var(--dur-2), box-shadow var(--dur-2), transform var(--dur-1) var(--ease-out);
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { background: var(--surface-active); border-color: rgba(255, 255, 255, 0.26); color: var(--text); }
.btn:active { transform: scale(0.97); }
.btn.secondary { background: var(--surface-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn.primary {
  background: linear-gradient(180deg, #c3a1ff, var(--accent) 60%, #a77dfb); color: var(--accent-ink); border-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 8px 24px -10px var(--accent);
}
.btn.primary:hover { background: linear-gradient(180deg, #cfb3ff, #c09cff 60%, #b08aff); color: var(--accent-ink); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 10px 28px -8px var(--accent); }
.btn.danger { color: var(--error); border-color: color-mix(in srgb, var(--error) 35%, transparent); background: var(--error-soft); }
.btn.danger:hover { color: #ffb0bb; border-color: color-mix(in srgb, var(--error) 60%, transparent); background: rgba(255, 122, 140, 0.2); }
.btn.lg { min-height: 48px; padding: 0 var(--s-5); font-size: var(--fs-16); border-radius: var(--r-lg); }
.btn.small { padding: 0 var(--s-3); min-height: 40px; font-size: var(--fs-14); border-radius: var(--r-md); }
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn:disabled::after { /* indicador de carga */
  content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite;
}
.panel-body > .btn, .add-form > .btn, .group > .btn { justify-self: start; }
.row { display: flex; gap: var(--s-3); align-items: center; }
.row.wrap { flex-wrap: wrap; }

/* Campos */
select, input[type="number"], input[type="text"], input[type="url"], input[type="search"], textarea {
  font: inherit; font-size: 16px; /* evita el zoom automático en iOS */
  color: var(--text); background-color: var(--surface-field); border: 1px solid var(--border-strong); border-radius: var(--r-md);
  padding: 0 var(--s-3); min-height: var(--tap); max-width: 100%;
  transition: border-color var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out), background-color var(--dur-2);
}
textarea { padding: var(--s-3); resize: vertical; width: 100%; line-height: var(--lh-body); }
select:hover, input:hover, textarea:hover { border-color: rgba(255, 255, 255, 0.26); }
select:focus-visible, input[type="number"]:focus-visible, input[type="text"]:focus-visible, input[type="url"]:focus-visible, input[type="search"]:focus-visible, textarea:focus-visible {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); background-color: rgba(255, 255, 255, 0.07);
}
::placeholder { color: var(--muted); opacity: 1; }
:is(select, input, textarea):disabled { opacity: 0.6; cursor: not-allowed; }
/* Menús desplegables: fondo opaco + color-scheme oscuro para que la lista nativa de opciones sea legible. */
select {
  appearance: none; -webkit-appearance: none; color-scheme: dark; padding-right: 40px; cursor: pointer; width: 100%;
  background-color: var(--field-solid); color: var(--text);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m7 10 5 5 5-5' fill='none' stroke='%23cfc8de' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 18px;
}
select:focus-visible { background-color: #24203a; }
select option, select optgroup { background-color: var(--field-solid); color: var(--text); }
select option:checked { background-color: #5b2bb5; color: #fff; }
select option:disabled, select option[value=""] { color: var(--muted); }
input[type="number"] { width: 6.5rem; font-variant-numeric: tabular-nums; }
input[type="text"] { width: 12rem; }
input[type="search"]::-webkit-search-cancel-button { filter: invert(0.7); cursor: pointer; }
input[aria-invalid="true"] { border-color: var(--error); box-shadow: 0 0 0 3px var(--error-soft); }
.field { display: grid; gap: var(--s-2); }
.field > label { font-size: var(--fs-14); font-weight: 600; display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-2); }
output { color: var(--accent); font-size: var(--fs-14); font-weight: 700; font-variant-numeric: tabular-nums; }
.select { display: grid; gap: var(--s-2); font-size: var(--fs-14); font-weight: 600; }
.select select, .select input { font-weight: 400; }
.warning { background: var(--warn-bg); color: var(--warn-text); padding: var(--s-3) var(--s-4); border-radius: var(--r-md); border: 1px solid rgba(255, 203, 92, 0.25); font-size: var(--fs-14); }
.warning a { color: inherit; font-weight: 700; }

/* Deslizadores (el relleno usa --p, que pone app.js) */
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; cursor: pointer; margin: 0;
  --track: linear-gradient(90deg, var(--accent) var(--p, 50%), rgba(255, 255, 255, 0.14) var(--p, 50%));
}
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--track); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.14); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; margin-top: -7px; border-radius: 50%; background: #fff; border: 0;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent), 0 2px 6px rgba(0, 0, 0, 0.5);
  transition: transform var(--dur-2) var(--ease-spring), box-shadow var(--dur-2);
}
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent), 0 2px 6px rgba(0, 0, 0, 0.5); }
input[type="range"]:hover::-webkit-slider-thumb, input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.12); box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 30%, transparent), 0 2px 6px rgba(0, 0, 0, 0.5); }
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--surface-solid), 0 0 0 5px var(--focus); }
input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px var(--surface-solid), 0 0 0 5px var(--focus); }

/* Casillas, interruptores y opciones */
.check { display: flex; gap: var(--s-3); align-items: center; font-size: var(--fs-14); line-height: var(--lh-snug); cursor: pointer; min-height: var(--tap); }
.check > span { display: grid; gap: 2px; }
.check small { color: var(--muted); font-size: var(--fs-12); }
.check input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; flex: none; margin: 0; cursor: pointer;
  width: 20px; height: 20px; border-radius: var(--r-xs); border: 1.5px solid rgba(255, 255, 255, 0.4); background: var(--surface-field) center / 14px no-repeat;
  transition: background-color var(--dur-2) var(--ease-out), border-color var(--dur-2);
}
.check input[type="checkbox"]:checked {
  background-color: var(--accent); border-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5' fill='none' stroke='%2314072b' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.check.switch { justify-content: space-between; }
.check.switch > span { order: -1; }
.check.switch input[type="checkbox"] {
  width: 44px; height: 26px; border-radius: var(--r-pill); border: 0; background-color: rgba(255, 255, 255, 0.2);
  background-image: radial-gradient(circle, #fff 0 9px, transparent 9.5px); background-size: 26px 26px; background-position: 0 50%;
  transition: background-color var(--dur-2) var(--ease-out), background-position var(--dur-3) var(--ease-spring);
}
.check.switch input[type="checkbox"]:checked { background-color: var(--accent); background-image: radial-gradient(circle, #fff 0 9px, transparent 9.5px); background-size: 26px 26px; background-position: 100% 50%; }
.kind .check { min-height: 40px; padding: 0 var(--s-4) 0 var(--s-3); border-radius: var(--r-pill); border: 1px solid var(--border-strong); background: var(--surface-field); gap: var(--s-2); transition: background var(--dur-2), border-color var(--dur-2), color var(--dur-2); }
.kind .check:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: #e3d4ff; }
.kind .check:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.kind input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }

/* Bluetooth */
.sticks { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s-2); }
.sticks:empty { display: none; }
.stick-item { display: grid; grid-template-columns: auto 1fr auto; gap: var(--s-3); align-items: center; padding: var(--s-2) var(--s-2) var(--s-2) var(--s-3); background: var(--surface-field); border: 1px solid var(--border); border-radius: var(--r-md); animation: tab-in var(--dur-3) var(--ease-out); }
.stick-item strong { font-size: var(--fs-14); }
.stick-item small { display: block; color: var(--muted); font-size: var(--fs-12); }
/* Ficha del dispositivo conectado */
.stick-info { grid-column: 1 / -1; display: grid; gap: var(--s-2); }
.stick-info dl { display: grid; grid-template-columns: auto 1fr; gap: 4px var(--s-3); margin: 0; font-size: var(--fs-12); }
.stick-info dt { color: var(--muted); }
.stick-info dd { margin: 0; color: var(--text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stick-info dd.na { color: var(--text-2); font-style: italic; }
.batt { display: inline-flex; align-items: center; gap: var(--s-2); }
.batt meter { width: 72px; height: 10px; }
.stick-low { margin: 0; padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); border: 1px solid var(--error); background: var(--error-soft); color: var(--text); font-size: var(--fs-14); font-weight: 700; }
.stick-low::before { content: "🔋 "; }
.stick-item.low { border-color: var(--error); }
@media (forced-colors: active) { .stick-low { border: 2px solid CanvasText; } }
.dot { width: 14px; height: 14px; border-radius: 50%; background: #8a2be2; }

/* Reto de ritmo */
.tap-pad {
  font-family: var(--font-display); font-size: var(--fs-20); font-weight: 600; letter-spacing: var(--track-display);
  min-height: 120px; border-radius: var(--r-xl); cursor: pointer; color: var(--text);
  border: 1.5px dashed color-mix(in srgb, var(--accent) 70%, transparent);
  background: radial-gradient(80% 120% at 50% 100%, color-mix(in srgb, var(--accent) 22%, transparent), transparent), var(--surface-field);
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
  transition: transform var(--dur-1) var(--ease-out), background var(--dur-1), border-color var(--dur-2);
}
.tap-pad:not(:disabled):hover { border-color: var(--accent); }
.tap-pad:disabled { opacity: 0.45; cursor: not-allowed; }
.tap-pad.hit { background: radial-gradient(80% 120% at 50% 100%, color-mix(in srgb, var(--accent) 45%, transparent), transparent), var(--surface-active); transform: scale(0.985); }
.score-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-2); font-variant-numeric: tabular-nums; }
.score-row > span { display: grid; gap: 2px; padding: var(--s-3); border-radius: var(--r-md); background: var(--surface-field); border: 1px solid var(--border); font-size: var(--fs-12); color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.score-row strong { font-family: var(--font-display); font-size: var(--fs-20); font-weight: 600; color: var(--text); letter-spacing: var(--track-display); text-transform: none; }
.judge { font-family: var(--font-display); font-weight: 600; min-height: 1.5em; color: var(--accent); text-align: center; }
.judge.miss { color: var(--muted); }
.rank { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: var(--fs-14); }
.rank caption { text-align: left; color: var(--muted); font-size: var(--fs-12); padding-bottom: var(--s-2); }
.rank th { font-size: var(--fs-12); color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.rank th, .rank td { text-align: left; padding: var(--s-2); border-bottom: 1px solid var(--border); }
.rank td:last-child, .rank th:last-child { text-align: right; }
.rank tbody tr:nth-child(-n + 3) td:first-child { color: var(--warn); font-weight: 700; }
.rank tr.me td { background: var(--accent-soft); font-weight: 600; }
.rank .net { color: var(--muted); font-size: var(--fs-12); }
#panel-game .row.wrap { align-items: end; }
#panel-game .row.wrap > .select { flex: 1 1 140px; }
#panel-game .row.wrap > .select input { width: 100%; }

/* Opiniones */
.stars { border: 0; padding: 0; margin: 0; }
.stars legend { font-size: var(--fs-14); font-weight: 600; margin-bottom: var(--s-2); padding: 0; }
.star-row { display: inline-flex; flex-direction: row-reverse; gap: 2px; }
.star-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.star-row label { font-size: 2rem; line-height: 1; cursor: pointer; color: rgba(255, 255, 255, 0.22); padding: var(--s-1); border-radius: var(--r-sm); min-width: var(--tap); text-align: center; transition: color var(--dur-2), transform var(--dur-2) var(--ease-spring); }
.star-row input:checked ~ label, .star-row label:hover, .star-row label:hover ~ label { color: var(--warn); }
.star-row label:hover { transform: scale(1.12); }
.star-row input:focus-visible + label { outline: 2px solid var(--focus); }

/* =====================================================================
   Overlays del escenario: fanchant y barra de letra
   ===================================================================== */
.chant {
  position: absolute; inset: 0; z-index: var(--z-overlay); display: grid; place-content: center; justify-items: center; gap: var(--s-2); text-align: center;
  background: radial-gradient(70% 70% at 50% 50%, rgba(10, 6, 28, 0.9), rgba(10, 6, 28, 0.7) 70%, rgba(10, 6, 28, 0.35) 100%);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-radius: var(--r-xl);
  pointer-events: none;
  transition: opacity var(--dur-4) var(--ease-out), display var(--dur-4) allow-discrete;
}
.chant[hidden] { opacity: 0; }
@starting-style { .chant:not([hidden]) { opacity: 0; } }
.chant::before { /* halo que respira (lento, sin destellos) */
  content: ""; position: absolute; left: 50%; top: 50%; width: min(70cqw, 560px); aspect-ratio: 1; translate: -50% -50%; border-radius: 50%; z-index: -1;
  background: radial-gradient(circle, color-mix(in srgb, var(--glow) 45%, transparent), transparent 65%);
  animation: breathe 2.8s ease-in-out infinite;
}
@keyframes breathe { 50% { transform: scale(1.08); opacity: 0.8; } }
.chant .btn { pointer-events: auto; margin-top: var(--s-4); }
.chant-label { font-size: var(--fs-12); font-weight: 700; letter-spacing: 0.24em; text-transform: uppercase; color: var(--accent); padding: var(--s-1) var(--s-3); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); border-radius: var(--r-pill); }
.chant-name {
  font-family: var(--font-ko); font-size: clamp(2.75rem, 12cqw, 6.5rem); font-weight: 800; line-height: 1.05; letter-spacing: -0.02em;
  color: #fff; text-shadow: 0 0 24px var(--glow), 0 0 64px var(--glow), 0 2px 0 rgba(0, 0, 0, 0.3);
}
.chant-roman { font-family: var(--font-display); font-size: clamp(var(--fs-16), 3cqw, var(--fs-28)); color: var(--text-2); font-weight: 500; letter-spacing: var(--track-display); }
.chant-name.pop { animation: chant-pop 0.5s var(--ease-spring); }
@keyframes chant-pop { from { transform: scale(1.35); opacity: 0; filter: blur(6px); } to { transform: none; opacity: 1; filter: none; } }

/* Barra de letra: chip de estado discreto bajo el video, simétrico al chip de luces. */

/* =====================================================================
   Guía integrada (coach) y su píldora
   ===================================================================== */
.coach {
  position: absolute; z-index: var(--z-coach);
  top: calc(var(--pad) + var(--hud-h) + var(--s-3) + var(--safe-t)); right: calc(var(--pad) + var(--safe-r));
  width: min(440px, calc(100% - 2 * var(--pad)));
  display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: var(--s-4); align-items: center;
  padding: var(--s-3) var(--s-4) var(--s-3) var(--s-3); border-radius: var(--r-xl);
  background: var(--surface-2); border: 1px solid var(--border-strong);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--hairline-top), var(--e-3), 0 24px 70px -30px var(--glow);
  transform-origin: 100% 0;
  transition: opacity var(--dur-3) var(--ease-out), transform var(--dur-3) var(--ease-out), box-shadow var(--dur-4), display var(--dur-3) allow-discrete;
}
.coach[hidden] { opacity: 0; transform: translateY(-8px) scale(0.97); }
@starting-style { .coach:not([hidden]) { opacity: 0; transform: translateY(-8px) scale(0.97); } }
.coach::before { /* flecha hacia el botón Conectar */
  content: ""; position: absolute; top: -7px; right: 96px; width: 12px; height: 12px; rotate: 45deg;
  background: #17142d; border-left: 1px solid var(--border-strong); border-top: 1px solid var(--border-strong); border-radius: 3px 0 0 0;
}
.c-scene {
  position: relative; width: 104px; height: 124px; border-radius: var(--r-lg); overflow: hidden;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: radial-gradient(80% 90% at 50% 100%, #2c1460, #0a0b1f 75%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.c-scene > * { transform: scale(0.5); flex: none; }
.c-scene .g-timer { position: absolute; right: -6px; bottom: -4px; }
.c-body { min-width: 0; display: grid; gap: var(--s-2); }
.c-top { display: flex; align-items: center; gap: var(--s-2); }
.c-top .ibtn { width: 36px; height: 36px; font-size: var(--fs-16); }
.c-step { font-size: var(--fs-12); font-weight: 700; letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--accent); white-space: nowrap; font-variant-numeric: tabular-nums; }
.g-progress { flex: 1; display: flex; gap: var(--s-1); }
.g-progress i { flex: 1; height: 4px; border-radius: 2px; background: var(--border-strong); transition: background var(--dur-3); }
.g-progress i.on { background: var(--accent); }
.coach h2 { font-size: var(--fs-16); outline: none; }
.c-text { color: var(--text-2); font-size: var(--fs-14); line-height: var(--lh-body); }
.c-actions { display: flex; align-items: center; gap: var(--s-2); justify-content: flex-end; margin-top: var(--s-1); }
.c-link { margin-right: auto; background: none; border: 0; color: var(--muted); font-size: var(--fs-14); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; min-height: 40px; padding: 0 var(--s-1); border-radius: var(--r-sm); }
.c-link:hover { color: var(--text); }
.coach .g-connected { padding: var(--s-2) var(--s-3); }
.coach .g-connected strong { font-size: var(--fs-14); }
.coach.done { box-shadow: var(--hairline-top), var(--e-3), 0 24px 70px -24px rgba(79, 224, 160, 0.55); }
.coach .spotlight { animation: g-spot 1.6s infinite; }
.coach-pill {
  position: absolute; z-index: var(--z-coach); top: calc(var(--pad) + var(--hud-h) + var(--s-3) + var(--safe-t)); right: calc(var(--pad) + var(--safe-r));
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-size: var(--fs-14); font-weight: 700; color: var(--accent-ink); background: var(--accent); border: 0; border-radius: var(--r-pill);
  padding: 0 var(--s-4); cursor: pointer; box-shadow: 0 10px 30px -10px var(--accent); min-height: var(--tap);
  transition: transform var(--dur-2) var(--ease-spring), opacity var(--dur-3), display var(--dur-3) allow-discrete;
}
.coach-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-ink); animation: g-blink 1.6s ease-in-out infinite; }
.coach-pill:hover { transform: translateY(-1px); }
@starting-style { .coach-pill:not([hidden]) { opacity: 0; transform: translateY(-6px); } }

/* Estado de conexión de la guía */
.g-connected { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-radius: var(--r-md); border: 1px solid var(--accent); background: var(--accent-soft); }
.g-connected strong { display: block; font-size: var(--fs-16); }
.g-connected small { color: var(--text-2); font-size: var(--fs-12); }
.g-connected.ok { border-color: var(--success); background: var(--success-soft); }
.g-connected.fail { border-color: var(--error); background: var(--error-soft); }
.g-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); flex: none; animation: g-blink 1s infinite; }
.g-connected.ok .g-dot { background: var(--success); animation: none; box-shadow: 0 0 12px var(--success); }
.g-connected.fail .g-dot { background: var(--error); animation: none; }
#g-action.spotlight { position: relative; box-shadow: 0 0 0 0 rgba(255, 209, 102, 0.6); animation: g-spot 1.6s infinite; }
@keyframes g-spot { 0% { box-shadow: 0 0 0 0 rgba(255, 209, 102, 0.6); } 70% { box-shadow: 0 0 0 12px rgba(255, 209, 102, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 209, 102, 0); } }

/* Escenas animadas de la guía (src/guide.js) */
.g-stick { position: relative; display: grid; justify-items: center; }
.g-globe { width: 92px; height: 92px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff9 0 12%, #555 50%, #333); box-shadow: 0 0 0 4px #ddd3 inset; }
.g-handle { width: 30px; height: 96px; margin-top: -4px; border-radius: 6px 6px 14px 14px; background: linear-gradient(90deg, #1c1a26, #3a3648, #1c1a26); position: relative; }
.g-btn { position: absolute; left: 50%; top: 26px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: #777; }
.g-stick.small .g-globe { width: 56px; height: 56px; } .g-stick.small .g-handle { width: 18px; height: 58px; }
/* Paso 3 (4 s): 0–15 % la mano llega · 15–65 % mantiene los dos botones (2 s, anillo) · 65 % suelta · 70–100 % parpadeo */
.on-power { perspective: 400px; }
.on-power .g-handle { transform: rotateY(-14deg); box-shadow: inset -6px 0 8px rgba(0, 0, 0, 0.45), inset 4px 0 6px rgba(255, 255, 255, 0.08); }
.on-power .g-globe { animation: g-on 4s ease-in-out infinite; }
.on-power .g-btn { width: 12px; height: 12px; margin-left: -6px; background: radial-gradient(circle at 40% 35%, #aaa, #555); box-shadow: 0 2px 0 #222, inset 0 1px 1px #fff5; animation: g-btn 4s infinite; }
.g-hand { position: absolute; left: 40px; top: 98px; width: 96px; height: 70px; overflow: visible; filter: drop-shadow(-4px 6px 6px rgba(0, 0, 0, 0.5)); transform-origin: 100% 50%; animation: g-hand 4s cubic-bezier(.4, 0, .2, 1) infinite; }
@keyframes g-hand {
  0% { transform: translateX(46px) rotateY(30deg); opacity: 0; }
  8% { opacity: 1; }
  15%, 62% { transform: translateX(0) scale(0.97, 1); opacity: 1; }
  17%, 60% { transform: translateX(-2px) scale(0.95, 1); }
  72%, 100% { transform: translateX(46px) rotateY(30deg); opacity: 0; }
}
@keyframes g-btn {
  0%, 15% { transform: none; box-shadow: 0 2px 0 #222, inset 0 1px 1px #fff5; }
  17%, 62% { transform: translateY(1px) scale(0.85); box-shadow: 0 0 0 #222, 0 0 8px #c9a6ff; background: #c9a6ff; }
  66%, 100% { transform: none; }
}
@keyframes g-on {
  0%, 66% { background: radial-gradient(circle at 35% 30%, #fff9 0 12%, #555 50%, #333); box-shadow: none; }
  70%, 78%, 86%, 94% { background: radial-gradient(circle at 35% 30%, #fff 0 12%, #4f8dff 50%, #2a3f9a); box-shadow: 0 0 40px 10px #4f8dff; }
  74%, 82%, 90%, 100% { background: radial-gradient(circle at 35% 30%, #fff9 0 12%, #555 50%, #333); box-shadow: none; }
}
.g-phone { width: 104px; height: 176px; border-radius: 18px; border: 3px solid #cfc8e0; background: #101020; display: grid; place-content: center; justify-items: center; gap: 10px; color: #fff; font-weight: 700; position: relative; }
.g-bt { font-size: 2.2rem; color: #4fc3f7; animation: g-blink 1.6s infinite; }
.g-toggle { width: 52px; height: 28px; border-radius: 14px; background: #444; position: relative; animation: g-tog 3s infinite; }
.g-toggle b { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; animation: g-knob 3s infinite; }
@keyframes g-tog { 0%, 30% { background: #444; } 45%, 100% { background: #34c759; } }
@keyframes g-knob { 0%, 30% { transform: none; } 45%, 100% { transform: translateX(24px); } }
@keyframes g-blink { 50% { opacity: 0.35; } }
.g-phone.list { place-content: start stretch; padding: 22px 8px; gap: 6px; font-size: 0.62rem; font-weight: 600; }
.g-phone.list span { padding: 6px; border-radius: 6px; background: #ffffff12; }
.g-cap { font-size: 0.62rem; color: #b8b1cc; text-transform: uppercase; letter-spacing: 0.06em; }
.g-forget { display: flex; justify-content: space-between; gap: 4px; animation: g-sel 2.4s infinite; }
.g-forget em { font-style: normal; color: #ff8a8a; }
@keyframes g-sel { 0%, 40% { background: #ffffff12; } 55%, 100% { background: #8a2be2; } }
.g-stick.test .g-globe { animation: g-test 3s infinite; }
@keyframes g-test { 0%, 100% { background: radial-gradient(circle at 35% 30%, #fff 0 12%, #8a2be2 50%, #4b1590); box-shadow: 0 0 50px 14px #8a2be2; } 50% { background: radial-gradient(circle at 35% 30%, #fff 0 12%, #a66bff 50%, #5b2bb5); box-shadow: 0 0 70px 24px #a66bff; } }
.g-handle .b1 { top: 22px; } .g-handle .b2 { top: 44px; }
.g-timer { position: relative; width: 64px; height: 64px; display: grid; place-items: center; font-weight: 800; }
.g-timer svg { position: absolute; inset: 0; width: 64px; height: 64px; transform: rotate(-90deg); }
.g-timer circle { fill: none; stroke: #a66bff; stroke-width: 4; stroke-dasharray: 107; stroke-dashoffset: 107; animation: g-ring 4s linear infinite; }
@keyframes g-ring { 0%, 16% { stroke-dashoffset: 107; } 62%, 100% { stroke-dashoffset: 0; } }
.c-scene .on-power + .g-timer { right: auto; bottom: auto; left: -10px; top: -8px; }
.g-chooser { width: 170px; background: #f4f1fa; color: #111; border-radius: 12px; padding: 10px; display: grid; gap: 5px; font-size: 0.68rem; box-shadow: 0 10px 30px #0008; }
.g-chooser .g-cap { color: #555; }
.g-row { padding: 6px 8px; border-radius: 6px; background: #e6e1ef; }
.g-row.sel { background: #8a2be2; color: #fff; font-weight: 700; outline: 3px solid #ffd166; outline-offset: 1px; animation: g-pulse 1.4s ease-in-out infinite; }
.g-row b { color: #9ad1ff; }
@keyframes g-pulse { 50% { outline-color: #ffd16600; } }

/* =====================================================================
   Aviso (toast)
   ===================================================================== */
.toast {
  position: absolute; left: 50%; top: calc(var(--pad) + var(--hud-h) + var(--s-3) + var(--safe-t)); transform: translateX(-50%); z-index: var(--z-toast);
  display: flex; align-items: center; gap: var(--s-2);
  background: rgba(250, 248, 255, 0.97); color: var(--text-ink); padding: var(--s-3) var(--s-4); border-radius: var(--r-md);
  width: max-content; max-width: min(480px, calc(100% - 2 * var(--pad))); font-size: var(--fs-14); font-weight: 600; line-height: var(--lh-snug);
  box-shadow: var(--e-3);
  transition: opacity var(--dur-3) var(--ease-out), transform var(--dur-3) var(--ease-spring), display var(--dur-3) allow-discrete;
}
.toast[hidden] { opacity: 0; transform: translate(-50%, -8px) scale(0.98); transition-timing-function: var(--ease-in); }
@starting-style { .toast:not([hidden]) { opacity: 0; transform: translate(-50%, -8px) scale(0.98); } }

/* =====================================================================
   Pantalla completa e inactividad
   ===================================================================== */
.app.idle .hud-top, .app.idle .dock, .app.idle .style-chip { opacity: 0; }
.app.idle .hud-top { transform: translateY(-8px); }
.app.idle .dock { transform: translateY(8px); }
.app.idle { cursor: none; }
.app.idle .dock:focus-within, .app.idle .hud-top:focus-within { opacity: 1; transform: none; }
.app.fs .video-card { width: min(100cqw, calc((100cqh - 24px) * 16 / 9)); }
.app.fs .style-chip { top: var(--s-2); }

/* =====================================================================
   Responsivo
   ===================================================================== */
/* Escritorio amplio */
@media (min-width: 1280px) {
  :root { --pad: var(--s-5); --side-w: 336px; }
  .app { gap: var(--s-4); }
}


/* Teléfono */
@media (max-width: 640px) {
  :root { --pad: var(--s-3); --r-xl: 20px; }
  .app { gap: var(--s-3); grid-template-rows: auto minmax(0, 1fr) auto auto; }
  .view-tabs button { min-width: 0; padding: 0 var(--s-3); }
  .pill span { max-width: 9ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pill { padding: 0 var(--s-3); }
  .dock { grid-row: 4; grid-column: 1; position: relative; z-index: 2; }
  .coach { box-shadow: var(--hairline-top), var(--e-1); }
  .coach-pill { align-self: center; }
  /* La tira de letra queda justo debajo del video (que aquí va arriba del escenario). */
  .art { width: 44px; height: 44px; }
  .art::after { inset: 19px; }
  .video-card { width: min(100cqw, calc((100cqh - 64px) * 16 / 9)); border-radius: var(--r-lg); }
  .empty { gap: var(--s-1); padding: var(--s-4); }
  .empty-art { width: 84px; }

  /* La guía entra en el flujo, entre el video y el reproductor: no tapa nada. */
  .stage { place-items: start center; }
  .video-card { margin-top: 36px; }
  .lights-view { align-content: center; }
  .coach, .coach-pill { position: relative; top: auto; right: auto; left: auto; grid-row: 3; grid-column: 1; z-index: 1; }
  .coach { width: 100%; grid-template-columns: 76px minmax(0, 1fr); gap: var(--s-3); padding: var(--s-3); transform-origin: 50% 100%; }
  .coach[hidden] { transform: translateY(8px) scale(0.98); }
  .coach::before { display: none; }
  .coach-pill { justify-self: center; }
  .c-scene { width: 76px; height: 100%; min-height: 100px; }
  .c-scene > * { transform: scale(0.4); }

  .panel {
    left: 0; right: 0; bottom: 0; width: 100%; max-height: 86dvh;
    border-radius: var(--r-xl) var(--r-xl) 0 0; border-bottom: 0; padding-bottom: var(--safe-b);
    transform-origin: 50% 100%;
  }
  .panel[hidden] { transform: translateY(100%); opacity: 1; transition-duration: var(--dur-3); }
  .panel-head { padding-top: var(--s-5); }
  .panel-head::before { content: ""; position: absolute; left: 50%; top: var(--s-2); width: 40px; height: 4px; border-radius: 2px; background: var(--border-strong); transform: translateX(-50%); }
  .toast { top: calc(var(--pad) + var(--hud-h) + var(--s-2) + var(--safe-t)); }
}
@media (max-width: 640px) {
  @starting-style { .coach:not([hidden]) { opacity: 0; transform: translateY(8px) scale(0.98); } }
  @starting-style { .panel:not([hidden]) { transform: translateY(100%); opacity: 1; } }
}
@media (max-width: 400px) {
  .pill span { display: none; }
  .pill { width: var(--tap); padding: 0; justify-content: center; }
  .pill.on::after { position: absolute; top: 6px; right: 6px; }
  .hud-top { gap: var(--s-2); }
}
@media (max-width: 360px) {
  .view-tabs button { padding: 0 10px; font-size: var(--fs-12); }
}

/* Teléfono en horizontal: video a toda la altura. */
@media (max-height: 500px) and (orientation: landscape) {
  :root { --pad: var(--s-2); --hud-h: 40px; --dock-h: 60px; }
  .app { gap: var(--s-2); grid-template-rows: auto minmax(0, 1fr) auto; }
  .np-sub { display: none; }
  .art { width: 36px; height: 36px; box-shadow: inset 0 0 0 10px #0d0b18; }
  .art::after { inset: 14px; }
  .ibtn.play { width: 44px; height: 44px; }
  .video-card { width: min(100cqw, calc((100cqh - 8px) * 16 / 9)); border-radius: var(--r-lg); }
  .style-chip { display: none; }
  .coach, .coach-pill { position: absolute; grid-row: auto; top: calc(var(--pad) + var(--hud-h) + var(--s-2)); right: calc(var(--pad) + var(--safe-r)); left: auto; }
  .coach { width: min(380px, 60vw); grid-template-columns: minmax(0, 1fr); max-height: calc(100dvh - var(--hud-h) - var(--dock-h) - 4 * var(--pad)); overflow: auto; }
  .coach::before { display: none; }
  .c-scene { display: none; }
  .panel { max-height: calc(100dvh - 2 * var(--pad)); bottom: var(--pad); }
  .empty-art { width: 72px; }
  .eyebrow { display: none; }
}

/* Pantallas táctiles: todos los controles a 44 px. */
@media (pointer: coarse) {
  .btn.small, .c-link { min-height: var(--tap); }
  .c-top .ibtn { width: var(--tap); height: var(--tap); }
}

/* =====================================================================
   Movimiento reducido: sin animaciones continuas ni desplazamientos
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, .app {
    animation: none !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }
}

/* Textos de la vista Luces: legibles sobre el público iluminado */
.lights-view .section-label, .lights-view .hint { text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8), 0 0 18px rgba(4, 3, 14, 0.9); }
.lights-view .hint { color: var(--text-2); }

/* =====================================================================
   Paleta por canción
   app.js pone --song-accent / --song-accent-2 (derivados de la paleta del álbum,
   con contraste AA garantizado en src/palette.js). Solo se usan en lo decorativo (brillos, degradados,
   título de lo que suena, ecualizador). CTA, interruptores, estados activos y foco usan el acento de marca.
   ===================================================================== */
:root { --song-accent: #b58cff; --song-accent-2: #7cc4ff; --song-ink: #120a24; }
.app {
  --brand-line: color-mix(in srgb, var(--accent) 42%, transparent);
  --song-line: color-mix(in srgb, var(--song-accent) 42%, transparent);
  --title-grad: linear-gradient(100deg, #fff 0%, #fff 28%, var(--song-accent) 68%, var(--song-accent-2) 100%);
}
.btn.primary { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 72%, #fff), var(--accent) 62%); color: var(--accent-ink); }
.btn.primary:hover { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 60%, #fff), color-mix(in srgb, var(--accent) 88%, #fff)); color: var(--accent-ink); }
.playing-now .dock { border-color: var(--song-line); box-shadow: var(--hairline-top), var(--e-2), 0 -12px 56px -28px var(--song-accent); }

/* =====================================================================
   Tipografía expresiva
   ===================================================================== */
/* Título del dock: grande, con degradado del color de la canción, letras que entran escalonadas. */
.np-title { font-size: var(--fs-20); font-weight: 650; line-height: 1.2; letter-spacing: -0.025em; }
.np-letters { position: relative; }
.np-letters .ch {
  display: inline-block; white-space: pre;
  background-image: var(--title-grad); background-size: calc(var(--n, 1) * 100%) 100%; background-position: calc(var(--i, 0) / (var(--n, 2) - 1) * 100%) 0; background-repeat: no-repeat;
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.app.song-change .np-letters .ch { animation: ch-in 0.62s var(--ease-out) both; animation-delay: calc(min(var(--i), 30) * 22ms); }
@keyframes ch-in {
  from { opacity: 0; transform: translateY(0.6em) rotate(5deg); font-variation-settings: "wght" 260; }
  55% { font-variation-settings: "wght" 820; }
}
/* En los coros el título "respira": el peso sube y baja despacio (sin destellos). */
.app.chorus.playing-now .np-letters { animation: np-breathe 2.8s ease-in-out infinite alternate; }
@keyframes np-breathe { from { font-variation-settings: "wght" 600; } to { font-variation-settings: "wght" 800; } }

/* Encabezados de álbum: color de su paleta */
.album-title { color: var(--text-2); }
.album-title::after { content: ""; flex: 1 1 24px; min-width: 24px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--p1, var(--accent)), var(--p2, transparent), var(--p3, transparent), transparent); opacity: 0.55; }

/* Chips de filtro: cada integrante con su acento */
.filter-chip { min-height: 36px; padding: 0 var(--s-3); font-size: var(--fs-12); font-weight: 700; border-color: var(--border-strong); background: var(--surface-field); display: inline-flex; align-items: center; gap: 6px; transition: background var(--dur-2), color var(--dur-2), border-color var(--dur-2); }
.filter-chip:hover { border-color: rgba(255, 255, 255, 0.3); }
.filter-chip.member::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--chip); box-shadow: 0 0 8px var(--chip); }
.filter-chip.member { color: color-mix(in srgb, var(--chip) 70%, #fff); }
.filter-chip[aria-pressed="true"] { background: var(--text); color: var(--text-ink); }
.filter-chip.member[aria-pressed="true"] { background: var(--chip); color: var(--text-ink); border-color: transparent; }
.filter-chip.member[aria-pressed="true"]::before { background: var(--text-ink); box-shadow: none; }
.filter-chip .n { margin-left: 2px; }
@media (pointer: coarse) { .filter-chip { min-height: var(--tap); } }

/* Fanchant: letras enormes con contorno que se llenan de color */
.chant-name {
  font-size: clamp(4rem, 19cqw, 10rem); font-weight: 900; letter-spacing: -0.01em; line-height: 1;
  color: transparent; -webkit-text-stroke: 2px color-mix(in srgb, var(--accent) 80%, #fff);
  background-image: linear-gradient(to top, var(--accent), color-mix(in srgb, var(--accent) 35%, #fff));
  background-repeat: no-repeat; background-position: 50% 100%; background-size: 100% 100%;
  -webkit-background-clip: text; background-clip: text;
  text-shadow: none; filter: drop-shadow(0 0 28px var(--glow)) drop-shadow(0 0 64px color-mix(in srgb, var(--glow) 60%, transparent));
}
.chant-name.pop { animation: chant-pop 0.5s var(--ease-spring), chant-fill 0.7s var(--ease-out) 0.12s both; }
@keyframes chant-pop { from { transform: scale(1.3); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes chant-fill { from { background-size: 100% 0%; } to { background-size: 100% 100%; } }
.chant-roman { font-size: clamp(var(--fs-16), 3.4cqw, var(--fs-28)); font-weight: 600; letter-spacing: 0.02em; color: #fff; }

/* =====================================================================
   Inicio: sugerencias (solo mientras no suena nada)
   ===================================================================== */
/* (el inicio se muestra u oculta con [hidden] desde setView) */
.stage:has(#lights-view:not([hidden])) .home-view { display: none; }
.app.home .video-card { visibility: hidden; }
.app.home .style-chip, .app[data-view="lights"] .style-chip { display: none; }
.app.home .progress { visibility: hidden; }
.home-view {
  position: absolute; inset: 0; z-index: 3; overflow: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: var(--s-6); padding: 0 var(--s-1) var(--s-5);
  scrollbar-gutter: stable;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 32px), transparent);
  animation: view-in var(--dur-4) var(--ease-out);
}
.home-view > * { flex: none; }
.home-hero {
  position: relative; overflow: hidden;
  display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s-4) var(--s-5); flex-wrap: wrap;
  padding: var(--s-5); border-radius: var(--r-xl);
  background:
    radial-gradient(70% 140% at 0% 0%, color-mix(in srgb, var(--accent) 28%, transparent), transparent 60%),
    radial-gradient(60% 120% at 100% 100%, color-mix(in srgb, var(--song-accent-2) 18%, transparent), transparent 60%),
    var(--surface-1);
  border: 1px solid var(--border); box-shadow: var(--hairline-top), var(--e-2);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.hero-text { display: grid; gap: var(--s-1); min-width: 0; }
.hero-title {
  margin: 0; font-family: var(--font-display); font-size: clamp(1.75rem, 4.6cqw, 3rem); font-weight: 700; line-height: 1.05; letter-spacing: -0.035em;
  background-image: var(--title-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: hero-in 1s var(--ease-out) both;
}
@keyframes hero-in { from { opacity: 0; letter-spacing: 0.04em; font-variation-settings: "wght" 250; } }
.hero-sub { color: var(--text-2); font-size: var(--fs-14); }
.hero-cta { display: flex; gap: var(--s-2); flex-wrap: wrap; }

.shelves { display: grid; gap: var(--s-6); }
.shelf { --shelf-c: var(--accent); display: grid; gap: var(--s-3); }
.shelf-likes { --shelf-c: #ff8fb8; }
.shelf-start { --shelf-c: #c3a1ff; }
.shelf-lyrics { --shelf-c: #8fd0ff; }
.shelf-solo { --shelf-c: #ffa8d2; }
.shelf-hype { --shelf-c: #ffd36b; }
.shelf-head { position: relative; display: grid; gap: 2px; padding: 0 var(--s-1); min-height: 56px; align-content: end; }
.shelf-eyebrow { font-size: var(--fs-12); font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--shelf-c); }
.shelf-title { font-family: var(--font-display); font-size: clamp(var(--fs-20), 2.6cqw, var(--fs-28)); font-weight: 700; line-height: 1.1; letter-spacing: -0.03em; position: relative; }
.shelf-ko {
  position: absolute; right: var(--s-1); bottom: -0.12em; z-index: -1; pointer-events: none;
  font-family: var(--font-ko); font-size: clamp(3rem, 8cqw, 5.5rem); font-weight: 800; line-height: 1;
  color: transparent; -webkit-text-stroke: 1.5px color-mix(in srgb, var(--shelf-c) 40%, transparent);
}

/* Filas de tarjetas: cuadrícula en escritorio, carrusel horizontal en teléfono */
.sg-row { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: var(--s-4) var(--s-3); }
.sg-item { position: relative; min-width: 0; }
.sg-play {
  display: grid; gap: 6px; width: 100%; padding: 0; margin: 0; text-align: left; color: var(--text);
  background: none; border: 0; border-radius: var(--r-lg); cursor: pointer;
}
.sg-play:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
.sg-thumb {
  position: relative; display: block; aspect-ratio: 16 / 9; border-radius: var(--r-lg); overflow: hidden;
  background: linear-gradient(135deg, var(--p1, #2a1356), var(--p2, #0a0b1f));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), var(--e-2);
  transition: box-shadow var(--dur-3) var(--ease-out), transform var(--dur-3) var(--ease-out);
}
.sg-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease-out); }
.sg-thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(6, 4, 20, 0.72), transparent 55%); }
/* Indicador de reproducción (al pasar el cursor, enfocar con teclado o elegir): sombreado suave y un ▶ grande
   al centro. El resplandor del recuadro con el color de la canción (--p1) lo da .sg-thumb. Desaparece al sonar.
   El ♥ queda encima (z-index 2) con su propio fondo oscuro, en la esquina: no compite con el ▶ del centro. */
.sg-icon {
  position: absolute; inset: 0; z-index: 1; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 50%, rgba(8, 6, 20, 0.18), rgba(8, 6, 20, 0.42) 75%);
  opacity: 0; transition: opacity var(--dur-2) var(--ease-out);
  pointer-events: none;
}
.sg-icon svg, .al-play svg {
  width: clamp(28px, 26%, 56px); height: auto; aspect-ratio: 1; margin-left: 3%; color: #fff;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 14px color-mix(in srgb, var(--p1, #a66bff) 70%, transparent));
  transform: scale(0.85); transition: transform var(--dur-3) var(--ease-spring);
}
/* Resplandor alrededor del recuadro con el color de la canción, al pasar el cursor o enfocar con teclado. */
.sg-play:hover .sg-thumb, .sg-play:focus-visible .sg-thumb { transform: translateY(-2px); box-shadow: 0 0 0 1px color-mix(in srgb, var(--p1, var(--accent)) 60%, transparent), 0 18px 40px -16px var(--p1, var(--accent)); }
.sg-play:hover img { transform: scale(1.05); }
.sg-play:hover .sg-icon, .sg-play:focus-visible .sg-icon, .sg-play:active .sg-icon, .sg-play.playing .sg-icon { opacity: 1; }
.sg-play:hover .sg-icon svg, .sg-play:focus-visible .sg-icon svg, .sg-play.playing .sg-icon svg { transform: none; }
.playing-now .sg-play.playing .sg-icon { opacity: 0; }
/* Canción elegida: el mismo resaltado luminoso del cursor, con el color de cada canción (--p1), fijo. */
.sg-play.playing .sg-thumb { box-shadow: 0 0 0 2px var(--p1, var(--accent)), 0 0 0 5px color-mix(in srgb, var(--p1, var(--accent)) 30%, transparent), 0 18px 40px -14px var(--p1, var(--accent)); }
.sg-badge { position: absolute; left: 8px; top: 8px; z-index: 1; margin: 0; background: rgba(12, 8, 28, 0.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.sg-title { display: block; padding: 0 2px; font-size: var(--fs-14); font-weight: 700; line-height: var(--lh-snug); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-meta { display: block; padding: 0 2px; margin-top: -4px; font-size: var(--fs-12); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-like {
  position: absolute; top: 4px; right: 4px; z-index: 2; width: var(--tap); height: var(--tap);
  color: #fff; background: rgba(8, 6, 20, 0.5); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transform: scale(0.82);
}
.sg-like:hover { background: rgba(8, 6, 20, 0.75); }

/* Variante compacta (panel de canciones y "A continuación") */
.sg-row.compact { grid-auto-flow: column; grid-auto-columns: 152px; grid-template-columns: none; overflow-x: auto; padding-bottom: var(--s-2); scroll-snap-type: x proximity; scrollbar-width: thin; }
.sg-row.compact .sg-item { scroll-snap-align: start; }
.q-upnext { display: grid; gap: var(--s-2); padding-bottom: var(--s-2); border-bottom: 1px solid var(--border); }

/* Tarjeta "A continuación" cerca del final */
.upnext {
  position: absolute; z-index: var(--z-overlay); right: var(--s-3); bottom: var(--s-3); width: min(320px, calc(100% - 2 * var(--s-3)));
  display: grid; gap: var(--s-2); padding: var(--s-3); border-radius: var(--r-xl);
  background: var(--surface-2); border: 1px solid var(--border-strong); box-shadow: var(--hairline-top), var(--e-3);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  transition: opacity var(--dur-3) var(--ease-out), transform var(--dur-3) var(--ease-out), display var(--dur-3) allow-discrete;
}
.upnext[hidden] { opacity: 0; transform: translateY(10px); }
@starting-style { .upnext:not([hidden]) { opacity: 0; transform: translateY(10px); } }
.un-head { display: flex; justify-content: space-between; align-items: center; padding-left: var(--s-1); }
.un-head .ibtn { width: 36px; height: 36px; }
.un-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-1); }
.un-list .sg-play { grid-template-columns: 96px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: var(--s-3); row-gap: 0; align-items: center; padding: var(--s-1); border-radius: var(--r-md); }
.un-list .sg-play:hover { background: var(--surface-hover); }
.un-list .sg-thumb { grid-row: 1 / 3; border-radius: var(--r-sm); }
.un-list .sg-icon svg { width: 26px; }
.un-list .sg-meta { margin-top: 0; }
.un-list .sg-badge, .un-list .sg-like { display: none; }

/* =====================================================================
   Jerarquía de acciones
   Primarias: reproducir, Conectar ARMY Bomb, elegir canción.
   Secundarias con etiqueta: Letra, Concierto (cámara o micrófono). Terciarias en "Más".
   ===================================================================== */
.pill.cta { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 72%, #fff), var(--accent) 62%); color: var(--accent-ink); border-color: transparent; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 8px 26px -10px var(--accent); padding: 0 var(--s-4) 0 var(--s-3); }
.pill.cta:hover { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 60%, #fff), color-mix(in srgb, var(--accent) 88%, #fff)); }
.pill.cta.on { background: var(--surface-0); color: var(--text); border-color: var(--border-strong); box-shadow: var(--hairline-top), var(--e-1); }
.pill.cta.on::after { background: var(--success); box-shadow: 0 0 10px var(--success); }

.dbtn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: var(--tap); padding: 0 var(--s-3); border-radius: var(--r-pill); border: 1px solid transparent;
  background: transparent; color: var(--text-2); font-size: var(--fs-14); font-weight: 600; white-space: nowrap; cursor: pointer;
  transition: background var(--dur-2) var(--ease-out), color var(--dur-2), border-color var(--dur-2), transform var(--dur-1);
}
.dbtn svg { width: 19px; height: 19px; }
.dbtn:hover { background: var(--surface-hover); color: var(--text); }
.dbtn:active { transform: scale(0.96); }
.dbtn[aria-pressed="true"], .dbtn.on { color: var(--accent); background: var(--accent-soft); border-color: var(--brand-line); }
.dbtn[aria-expanded="true"] { background: var(--surface-active); color: var(--text); }
.phone-only { display: none; }

/* ---------------------------------------------------------------------
   Dock: un solo lugar para su diseño según el ancho disponible
   · ancho (≥ 800 px de dock): título | transporte + progreso | acciones con etiqueta en línea
   · medio (< 800 px): igual, con la etiqueta corta bajo el ícono (nunca íconos sueltos)
   · teléfono (≤ 640 px de pantalla): título + transporte / progreso / fila de acciones
   · teléfono en horizontal: una sola fila tipo píldora, acciones solo con ícono (nombre accesible intacto)
   --------------------------------------------------------------------- */
.dock { container: dock / inline-size; grid-template-columns: minmax(160px, 1fr) minmax(240px, 1.3fr) auto; }
.transport { gap: var(--s-2); }
.dock-actions { gap: var(--s-1); }
/* Pantalla completa: ícono con tooltip en pantallas anchas (es un símbolo conocido) */
.dbtn-icon { width: var(--tap); padding: 0; }
.dbtn-icon span, .dbtn-sr span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@container dock (max-width: 799px) {
  .dock-actions { gap: 2px; }
  .dbtn { flex-direction: column; gap: 2px; min-width: 56px; min-height: 52px; padding: var(--s-1) var(--s-1); border-radius: var(--r-md); font-size: 0.6875rem; letter-spacing: 0.01em; }
  .dbtn-icon { width: auto; }
  .dbtn-icon span { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .transport { gap: var(--s-1); }
}
@media (max-width: 640px) {
  :root { --dock-h: 148px; }
  .phone-only { display: inline-flex; }
  /* --dock-h aquí solo ubica avisos y hojas encima del dock: la altura real la da el contenido */
  .dock { min-height: 0; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "np transport" "progress progress" "actions actions"; row-gap: var(--s-1); padding: var(--s-2) var(--s-3) var(--s-1); }
  .dock-actions { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); /* tantas columnas como botones visibles */ gap: 2px; }
  .dbtn { min-width: 0; min-height: 48px; padding: 2px 0; }
  .dbtn span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .dbtn svg { width: 20px; height: 20px; }
  #dock-bt:not(.on) { color: var(--accent); }
  .np-title { font-size: var(--fs-16); }
  /* Sin canción: solo "reproducir" (anterior/siguiente no hacen nada) y sin barra de tiempo */
  .app.home .progress, .app.home #btn-prev, .app.home #btn-next { display: none; }
  .app.home { --dock-h: 128px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .dock {
    grid-row: auto; min-height: 0;
    grid-template-columns: minmax(120px, 1fr) auto minmax(140px, 2fr) auto; grid-template-areas: "np transport progress actions";
    border-radius: var(--r-pill); padding: var(--s-1) var(--s-3) var(--s-1) var(--s-1); row-gap: 0;
  }
  .dock-actions { display: flex; justify-content: flex-end; gap: 2px; }
  .dbtn { width: var(--tap); min-width: 0; min-height: var(--tap); padding: 0; }
  .dbtn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .np-title { font-size: var(--fs-14); }
}

/* Menús compactos */
.menu-pop {
  position: absolute; z-index: calc(var(--z-panel) + 1); width: min(320px, calc(100vw - 24px));
  display: grid; gap: 2px; padding: var(--s-2); border-radius: var(--r-xl);
  background: var(--surface-2); border: 1px solid var(--border-strong); box-shadow: var(--hairline-top), var(--e-3);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  transform-origin: 50% 100%;
  transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out), display var(--dur-2) allow-discrete;
}
.menu-pop[hidden] { opacity: 0; transform: translateY(8px) scale(0.97); }
@starting-style { .menu-pop:not([hidden]) { opacity: 0; transform: translateY(8px) scale(0.97); } }
.mp-title { padding: var(--s-2) var(--s-3) var(--s-1); font-size: var(--fs-12); font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.mi {
  display: flex; align-items: center; gap: var(--s-3); width: 100%; min-height: 48px; padding: var(--s-2) var(--s-3);
  border: 0; border-radius: var(--r-md); background: transparent; color: var(--text); text-align: left; cursor: pointer;
  font-size: var(--fs-14); font-weight: 600; line-height: var(--lh-snug);
  transition: background var(--dur-2);
}
.mi > svg { width: 20px; height: 20px; color: var(--accent); }
.mi:hover, .mi:focus-visible { background: var(--surface-hover); }
.mi:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.mi-text { display: grid; gap: 2px; min-width: 0; flex: 1; }
.mi small { font-size: var(--fs-12); font-weight: 500; color: var(--muted); }
.mi[aria-pressed]::after { /* interruptor que muestra el estado */
  content: ""; flex: none; width: 36px; height: 22px; border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.2) radial-gradient(circle, #fff 0 7px, transparent 7.5px) 0 50% / 22px 22px no-repeat;
  transition: background-color var(--dur-2), background-position var(--dur-3) var(--ease-spring);
}
.mi[aria-pressed="true"]::after { background-color: var(--accent); background-position: 100% 50%; }
.mi[aria-pressed="true"] { background: var(--accent-soft); }

/* Teléfono: cabecera mínima; Explorar compacto */
@media (max-width: 640px) {
  #btn-side, .top-actions { display: none; }
  .hud-top { justify-content: space-between; }
  .home-view { padding: 0 0 var(--s-4); gap: var(--s-5); }
  .home-hero { padding: var(--s-4); gap: var(--s-3); }
  .hero-cta { width: 100%; }
  .hero-cta .btn { flex: 1 1 auto; min-height: var(--tap); font-size: var(--fs-14); padding: 0 var(--s-3); }
  .shelves { gap: var(--s-5); }
  .sg-row { grid-auto-flow: column; grid-auto-columns: 164px; grid-template-columns: none; overflow-x: auto; scroll-snap-type: x mandatory; gap: var(--s-3); padding: 0 var(--s-1) var(--s-2); scroll-padding-inline: var(--s-1); scrollbar-width: none; }
  .sg-row::-webkit-scrollbar { display: none; }
  .sg-item { scroll-snap-align: start; }
  .upnext { left: 0; right: 0; bottom: 0; width: auto; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .home-view { gap: var(--s-4); }
  .home-hero { padding: var(--s-3) var(--s-4); }
  .hero-sub, .home-hero .eyebrow { display: none; }
  .upnext { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .np-letters .ch, .chant-name.pop, .hero-title, .app.chorus.playing-now .np-letters { animation: none !important; }
}

/* La píldora de la guía minimizada no compite con el botón principal "Conectar". */
.coach-pill { background: var(--surface-2); color: var(--text); border: 1px solid var(--brand-line); box-shadow: var(--hairline-top), var(--e-2); }
.coach-pill::before { background: var(--accent); box-shadow: 0 0 10px var(--accent); }

/* =====================================================================
   Filas compactas: lo que importa (artista solista, tipo de video, letra, intensidad)
   ===================================================================== */
.s-text { display: grid; gap: 3px; min-width: 0; }
.meta-line { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; white-space: nowrap; }
.meta-line > span { flex: none; }
.meta-line .m-artist { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); font-weight: 600; }
.meta-line .m-tag { color: var(--accent); font-weight: 700; }
.chip-type, .meta-line .badge-lyrics {
  display: inline-flex; align-items: center; margin: 0; padding: 2px 6px; border-radius: var(--r-pill);
  font-size: 0.6875rem; font-weight: 700; line-height: 1; letter-spacing: 0.02em;
}
.chip-type { color: var(--text-2); background: rgba(255, 255, 255, 0.08); border: 1px solid var(--border-strong); }
/* Intensidad de luces: lightstick con 1–3 barras */
.lights-glyph { display: inline-grid; place-items: center; width: 20px; height: 20px; flex: none; color: var(--accent); }
.lights-glyph svg { width: 20px; height: 20px; overflow: visible; }
.lg-halo { fill: currentColor; transform-origin: 10px 8px; transform: scale(var(--h, 0.5)); opacity: var(--ho, 0.14); }
.lg-globe { fill: color-mix(in srgb, currentColor 75%, #fff); stroke: rgba(255, 255, 255, 0.5); stroke-width: 0.8; }
.lg-stick { stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.lg-rays { stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; opacity: 0; }
.lights-glyph[data-level="1"] { --h: 0.55; --ho: 0.16; }
.lights-glyph[data-level="1"] .lg-globe { fill: color-mix(in srgb, currentColor 45%, #4a4560); }
.lights-glyph[data-level="2"] { --h: 0.8; --ho: 0.26; }
.lights-glyph[data-level="3"] { --h: 1; --ho: 0.34; }
.lights-glyph[data-level="3"] .lg-rays { opacity: 0.9; }
.sg-meta { display: flex; }
.sg-meta .lights-glyph { margin-left: auto; }
/* "Escuchada": punto discreto en la miniatura */
.was-played .thumb::before, .sg-play.was-played .sg-thumb::before {
  content: ""; position: absolute; z-index: 1; left: 5px; bottom: 5px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-2); box-shadow: 0 0 0 2px rgba(8, 6, 20, 0.7);
}
.song.playing .thumb::before { display: none; }
.shelf-sub { font-size: var(--fs-14); color: var(--text-2); margin-top: 2px; }

/* Diálogo de confirmación (modo seguro) */
.dlg {
  width: min(420px, calc(100vw - 32px)); padding: var(--s-5); border-radius: var(--r-xl);
  background: #17142d; color: var(--text); border: 1px solid var(--border-strong); box-shadow: var(--e-3);
}
.dlg::backdrop { background: rgba(3, 2, 12, 0.7); backdrop-filter: blur(4px); }
.dlg h2 { font-size: var(--fs-20); margin-bottom: var(--s-2); }
.dlg p { color: var(--text-2); font-size: var(--fs-14); line-height: var(--lh-body); }
.dlg-actions { display: flex; gap: var(--s-2); justify-content: flex-end; flex-wrap: wrap; margin-top: var(--s-5); }

/* =====================================================================
   Explorar a pantalla completa + mini reproductor
   ===================================================================== */
.explore-head {
  position: sticky; top: 0; z-index: 4; display: grid; gap: var(--s-2); padding: var(--s-1) var(--s-1) var(--s-2);
  background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 92%, transparent) 75%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.explore-head .search { margin: 0; }
.explore-head .filters {
  padding: 0 var(--s-6) 0 0; scroll-padding-inline-end: var(--s-6);
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - var(--s-6)), transparent); mask-image: linear-gradient(to right, #000 calc(100% - var(--s-6)), transparent);
}
.explore-results { display: grid; gap: var(--s-3); }
.explore-list { gap: 2px; }
.explore-list .album-title { position: static; background: none; margin-top: var(--s-4); }
.app.exploring .home-hero { display: none; }
.app.exploring .style-chip, .app.exploring .lyrics-bar, .app.exploring .upnext { display: none; }
.app.exploring .home-view { padding-bottom: 280px; animation: none; }

.mini-bar { display: none; }
/* Miniatura oculta (el video queda en pausa; ver hideMini en src/app.js) */
.app.exploring.mini-off .video-card { visibility: hidden; pointer-events: none; }
.app.exploring .video-card {
  --mini-w: min(356px, calc(100cqw - 24px));
  position: absolute; left: 0; top: 0; z-index: 7; width: var(--mini-w); aspect-ratio: auto;
  transform: translate(var(--mx, 12px), var(--my, 12px));
  border-radius: var(--r-lg); animation: mini-in var(--dur-3) var(--ease-out);
  box-shadow: 0 0 0 1px var(--border-strong), var(--e-3), 0 20px 60px -20px var(--glow);
}
@keyframes mini-in { from { opacity: 0; transform: translate(var(--mx, 12px), calc(var(--my, 12px) + 16px)) scale(0.92); } }
.app.exploring .video-card.snapping { transition: transform var(--dur-3) var(--ease-spring); }
.app.exploring .video-box { position: relative; inset: auto; height: 200px; } /* YouTube pide ≥ 200 × 200 px */
.app.exploring .empty { display: none; }
.app.exploring .mini-bar {
  display: flex; align-items: center; gap: 2px; height: 48px; padding: 0 var(--s-1) 0 var(--s-3);
  background: var(--surface-2); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
}
.app.exploring .video-card.dragging .mini-bar { cursor: grabbing; }
.mini-grip { flex: none; width: 10px; height: 18px; margin-right: var(--s-1); background: radial-gradient(circle, var(--muted) 1.4px, transparent 1.6px) 0 0 / 5px 6px; opacity: 0.8; }
.mini-title { flex: 1; min-width: 0; font-size: var(--fs-14); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Botón ⋯ en filas y tarjetas */
.more-btn {
  flex: none; width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; cursor: pointer;
  display: grid; place-items: center; color: var(--muted); transition: background var(--dur-2), color var(--dur-2);
}
.more-btn svg { width: 18px; height: 18px; }
.more-btn:hover, .more-btn[aria-expanded="true"] { background: var(--surface-hover); color: var(--text); }
.sg-item .more-btn { position: absolute; top: 4px; right: 48px; z-index: 2; width: var(--tap); height: var(--tap); color: #fff; background: rgba(8, 6, 20, 0.5); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transform: scale(0.82); }
.un-list .more-btn { display: none; }
@media (pointer: coarse) { .more-btn, .like-btn { width: var(--tap); height: var(--tap); } }
.song-menu { transform-origin: 50% 0; width: min(280px, calc(100vw - 24px)); }
.song-menu .mp-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: none; letter-spacing: 0; font-size: var(--fs-14); color: var(--text); }

/* Aleatorio / repetir */
.ibtn.mode { width: 40px; height: 40px; }
.ibtn.mode svg { width: 18px; height: 18px; }
@media (max-width: 640px) { .no-phone { display: none !important; } }

/* Panel Cola */
.cq-modes { display: flex; align-items: center; gap: 2px; }
.cq-sec { display: grid; gap: var(--s-2); }
.cq-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s-2); }
.cq-head .btn { min-height: 36px; }
.cq-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
#cq-user-sec.is-empty .cq-list { display: none; }
#cq-user-sec:not(.is-empty) .cq-empty { display: none; }
.cq-empty { padding: var(--s-3) var(--s-4); border: 1px dashed var(--border-strong); border-radius: var(--r-md); text-align: center; }
.cq-item { display: grid; grid-template-columns: 36px minmax(0, 1fr) 40px; align-items: center; gap: 2px; border-radius: var(--r-md); touch-action: pan-y; transition: background var(--dur-2), transform var(--dur-2) var(--ease-out); }
.cq-item:hover, .cq-item:focus-within { background: var(--surface-hover); }
.cq-handle { width: 36px; height: var(--tap); border: 0; border-radius: var(--r-sm); background: none; color: var(--muted); cursor: grab; touch-action: none; display: grid; place-items: center; }
.cq-handle:hover { color: var(--text); }
.cq-handle svg { width: 18px; height: 18px; }
.cq-main { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: var(--s-3); align-items: center; min-height: 52px; padding: var(--s-1); border: 0; border-radius: var(--r-sm); background: none; color: inherit; text-align: left; cursor: pointer; }
.cq-remove { width: 40px; height: 40px; }
.cq-item.dragging { opacity: 0.3; }
.cq-ghost {
  position: fixed; z-index: 100; pointer-events: none; list-style: none; margin: 0;
  display: grid; grid-template-columns: 36px minmax(0, 1fr) 40px; align-items: center; gap: 2px;
  background: #1d1934; color: var(--text); border-radius: var(--r-md); outline: 2px solid var(--accent); box-shadow: var(--e-3);
  font-family: var(--font-body); transform: scale(1.02);
}
.cq-drop { list-style: none; height: 3px; margin: 3px 4px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.cq-now { color: var(--muted); font-size: var(--fs-14); }
.cq-nowrow { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: var(--s-3); align-items: center; padding: var(--s-2); border-radius: var(--r-md); background: var(--accent-soft); border: 1px solid var(--song-line); color: var(--text); }

/* Aviso con acción (Deshacer) */
.toast-action { flex: none; margin-left: var(--s-2); min-height: 32px; padding: 0 var(--s-3); border: 0; border-radius: var(--r-pill); background: var(--text-ink); color: #fff; font-weight: 700; font-size: var(--fs-14); cursor: pointer; }
.toast-action:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (pointer: coarse) { .toast-action { min-height: var(--tap); } }

.meta-line[hidden] { display: none; }

/* Un solo "Conectar" por pantalla: el de la barra superior (escritorio) o el del dock (teléfono). */
/* Botones sobre las tarjetas: aparecen al pasar el mouse o con el foco (siempre visibles en pantallas táctiles). */
.sg-item > .more-btn, .sg-item > .sg-like { opacity: 0; transition: opacity var(--dur-2), background var(--dur-2); }
.sg-item:hover > .more-btn, .sg-item:hover > .sg-like, .sg-item:focus-within > .more-btn, .sg-item:focus-within > .sg-like,
.sg-item > .more-btn[aria-expanded="true"], .sg-item > .sg-like[aria-pressed="true"] { opacity: 1; }
@media (hover: none) { .sg-item > .more-btn, .sg-item > .sg-like { opacity: 1; } }
@media (max-width: 640px) {
  .hero-cta, .hero-sub { display: none; }
  .home-hero { padding: var(--s-3) var(--s-4); }
  .hero-title { font-size: var(--fs-28); }
  .app:not(.exploring) .explore-head .filters { display: none; }
}

/* Tooltip propio (src/tooltip.js) */
.tip {
  position: fixed; z-index: 80; max-width: min(260px, calc(100vw - 16px)); pointer-events: none;
  padding: 6px 10px; border-radius: 6px; font-family: var(--font-body); font-size: 0.8125rem; font-weight: 600; line-height: 1.35;
  color: #f4f1fa; background: rgba(18, 14, 36, 0.92); border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.8); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  opacity: 0; transform: translateY(4px); transition: opacity 120ms ease-out, transform 120ms ease-out;
}
.tip[data-side="bottom"] { transform: translateY(-4px); }
.tip.in { opacity: 1; transform: none; }
.tip-arrow { position: absolute; width: 8px; height: 8px; background: inherit; border: inherit; border-width: 0 1px 1px 0; transform: translateX(-50%) rotate(45deg); bottom: -5px; }
.tip[data-side="bottom"] .tip-arrow { bottom: auto; top: -5px; border-width: 1px 0 0 1px; }
@media (prefers-reduced-motion: reduce) { .tip { transition: none; transform: none; } }
/* La píldora de la guía no tapa el buscador de Explorar */
@media (min-width: 641px) { .app:has(#coach-pill:not([hidden])) .explore-head { margin-right: 280px; } }

/* =====================================================================
   Explorar: resultados, Mis álbumes, Canciones que me gustan
   ===================================================================== */
.home-view.searching .home-hero, .home-view.searching .shelves, .home-view.searching #my-albums, .home-view.searching #liked-songs { display: none; }
.er-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: 0 var(--s-1); }
.explore-list .album-title { position: sticky; top: 104px; z-index: 2; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-radius: var(--r-sm); }
.album-title .album-like { margin-left: auto; width: 36px; height: 36px; flex: none; }
.album-title::after { order: 0; }
.album-title .album-like { order: 1; }
/* Álbumes: la portada entera reproduce; al pasar el cursor, el mismo velo con el color del álbum con ▶ grande que las canciones. */
.al-play {
  position: absolute; z-index: 1; left: 0; right: 0; top: 0; aspect-ratio: 16 / 9; border: 0; padding: 0; cursor: pointer;
  border-radius: var(--r-lg); display: grid; place-items: center; color: #fff;
  background: radial-gradient(circle at 50% 50%, rgba(8, 6, 20, 0.18), rgba(8, 6, 20, 0.42) 75%);
  opacity: 0; transition: opacity var(--dur-2) var(--ease-out);
}
.al-play:hover, .al-play:focus-visible, .al-play:active { opacity: 1; }
.al-play:hover svg, .al-play:focus-visible svg { transform: none; }
.al-play { display: grid; }
.al-play:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
.al-item:has(> .al-play:hover) .sg-thumb, .al-item:has(> .al-play:focus-visible) .sg-thumb { transform: translateY(-2px); box-shadow: 0 0 0 1px color-mix(in srgb, var(--p1, var(--accent)) 60%, transparent), 0 18px 40px -16px var(--p1, var(--accent)); }
.al-item:has(> .al-play:hover) .sg-thumb img { transform: scale(1.05); }
.al-item:has(> .al-play:hover) .al-play { transform: translateY(-2px); }
.al-item .sg-like { right: auto; left: 4px; }
.al-cover::before { /* degradado de la paleta del álbum sobre la portada */
  content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(160deg, color-mix(in srgb, var(--p1, #8a2be2) 55%, transparent), transparent 55%, color-mix(in srgb, var(--p2, #4fc3f7) 45%, transparent));
  mix-blend-mode: soft-light;
}
.ls-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; padding: 0 var(--s-1); }
.empty-state { display: grid; justify-items: start; gap: var(--s-2); padding: var(--s-5); border-radius: var(--r-lg); border: 1px dashed var(--border-strong); background: var(--surface-field); }
.es-title { font-family: var(--font-display); font-size: var(--fs-16); font-weight: 600; letter-spacing: var(--track-display); }
.empty-state .btn { margin-top: var(--s-1); }

/* =====================================================================
   Espaciado: 8 pt en todo (gap icono–texto 8, grupos 8–12, secciones 16–24,
   etiqueta–control 8, entre campos 16; alturas de botón 36 / 44 / 52)
   ===================================================================== */
.btn.small { min-height: 36px; padding: 0 var(--s-3); }
.btn { gap: var(--s-2); }
.hero-cta { gap: var(--s-3); }
.panel-body { gap: var(--s-4); padding: var(--s-2) var(--s-4) var(--s-5); }
.group { gap: var(--s-4); padding: var(--s-4); }
.field { gap: var(--s-2); }
.panel-head { padding: var(--s-4) var(--s-3) var(--s-3) var(--s-4); }
.filters { gap: var(--s-2); }
.filter-chip { padding: 0 var(--s-3); gap: var(--s-2); }
.ibtn.mode { width: 36px; height: 36px; }
.cq-remove { width: 36px; height: 36px; }
.toast-action { min-height: 36px; }
.sg-play { gap: var(--s-2); }
.sg-meta { margin-top: -6px; }
.coach { padding: var(--s-4); gap: var(--s-4); }
.c-actions { gap: var(--s-2); margin-top: var(--s-2); }
.menu-pop { padding: var(--s-2); gap: var(--s-1); }
.mi { gap: var(--s-3); padding: var(--s-2) var(--s-3); }
.dlg-actions { gap: var(--s-3); }
.mini-bar { gap: var(--s-1); }
.song { gap: var(--s-3); }
.song-row { gap: var(--s-1); }
.cq-sec { gap: var(--s-3); }
.shelf { gap: var(--s-4); }
.ls-actions { margin-top: calc(-1 * var(--s-1)); }
@media (pointer: coarse) {
  .ibtn.mode, .cq-remove, .toast-action, .btn.small, .album-title .album-like { min-width: var(--tap); min-height: var(--tap); }
}
.explore-head { background: color-mix(in srgb, #0a0920 94%, transparent); border-radius: 0 0 var(--r-lg) var(--r-lg); box-shadow: 0 12px 24px -16px rgba(0, 0, 0, 0.8); }
/* Títulos largos en el dock: se desvanecen al final (las letras animadas no admiten "…") */
.np-title.is-overflowing { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent); }


/* =====================================================================
   Ronda 3 · Biblioteca, Ahora suena, tema claro, apoyo
   ===================================================================== */

/* El título del dock es un botón que abre "Ahora suena" */
button.np { font: inherit; color: inherit; text-align: left; background: transparent; border: 0; padding: var(--s-1) var(--s-2) var(--s-1) var(--s-1); margin: calc(-1 * var(--s-1)); border-radius: var(--r-lg); cursor: pointer; transition: background var(--dur-2); }
button.np:hover { background: var(--surface-hover); }
button.np[aria-expanded="true"] { background: var(--accent-soft); }
.np-text { display: grid; }
.np-title, .np-sub { display: block; }

/* Barra superior: tema y ajustes */
.top-actions .round { width: var(--tap); height: var(--tap); }


/* ---------- Biblioteca ---------- */
.side.lib { --side-pad: var(--s-3); display: flex; flex-direction: column; gap: var(--s-2); padding-bottom: var(--s-3); }
.lib .side-head { gap: var(--s-1); padding: var(--s-3) var(--s-2) var(--s-1) var(--s-4); }
.lib .side-head h2 { flex: 1; }
.lib-nav { display: grid; gap: 2px; padding: 0 var(--s-2); }
.lib-item {
  position: relative; display: flex; align-items: center; gap: var(--s-3); width: 100%; min-height: var(--tap); padding: 0 var(--s-3);
  border: 0; border-radius: var(--r-md); background: transparent; color: var(--text-2); font: inherit; font-size: var(--fs-14); font-weight: 600; text-align: left; cursor: pointer; text-decoration: none;
  transition: background var(--dur-2), color var(--dur-2);
}
.lib-item svg { width: 20px; height: 20px; }
.lib-item:hover { background: var(--surface-hover); color: var(--text); }
.lib-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-n { min-width: 24px; padding: 2px 8px; border-radius: var(--r-pill); background: var(--surface-active); color: var(--text-2); font-size: var(--fs-12); font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.lib-kbd { font-size: 0.6875rem; }
.lib-scroll { flex: 1; min-height: 0; overflow: auto; display: grid; align-content: start; gap: var(--s-4); padding: var(--s-2) var(--s-2) 0; border-top: 1px solid var(--border); margin-top: var(--s-1); }
.lib-sec { display: grid; gap: var(--s-1); }
.lib-h { padding: 0 var(--s-3); font-size: var(--fs-12); font-weight: 700; letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--muted); }
.lib-sec .hint { padding: 0 var(--s-3); }
.lib-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.lib-row { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: var(--s-3); align-items: center; width: 100%; min-height: 48px; padding: var(--s-1) var(--s-2); border: 0; border-radius: var(--r-md); background: none; color: var(--text); text-align: left; cursor: pointer; font: inherit; }
.lib-row:hover { background: var(--surface-hover); }
.lib-row .thumb { width: 48px; height: 27px; border-radius: 6px; }
.lib-row-text { display: grid; gap: 2px; min-width: 0; }
.lib-row .s-title { font-size: var(--fs-14); }
.lib-dots { width: 48px; height: 32px; border-radius: var(--r-sm); background: radial-gradient(circle at 30% 50%, var(--p1) 0 22%, transparent 24%), radial-gradient(circle at 52% 50%, var(--p2) 0 22%, transparent 24%), radial-gradient(circle at 74% 50%, var(--p3) 0 22%, transparent 24%), var(--surface-field); box-shadow: inset 0 0 0 1px var(--border); }
.lib-foot { display: grid; gap: var(--s-1); padding: var(--s-2) var(--s-2) 0; border-top: 1px solid var(--border); }

/* Apoyo: pastilla con un lightstick que brilla suave */
.support-pill { display: flex; align-items: center; gap: var(--s-3); min-height: var(--tap); padding: 0 var(--s-3); border-radius: var(--r-md); color: var(--text); font-size: var(--fs-14); font-weight: 700; text-decoration: none; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 16%, transparent), transparent); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.support-pill:hover { color: var(--text); background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 26%, transparent), transparent); }
.sp-stick { position: relative; flex: none; width: 14px; height: 20px; }
.sp-stick::before { content: ""; position: absolute; left: 1px; top: 0; width: 12px; height: 12px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff 0 15%, var(--accent) 55%); box-shadow: 0 0 10px var(--accent); }
.sp-stick::after { content: ""; position: absolute; left: 5px; top: 11px; width: 4px; height: 9px; border-radius: 2px; background: var(--muted); }
.sp-stick.glow::before { animation: sp-glow 2.4s ease-in-out 2; }
@keyframes sp-glow { 50% { box-shadow: 0 0 22px 6px var(--accent); } }
.support-card { display: flex; align-items: center; gap: var(--s-4); padding: var(--s-4) var(--s-5); border-radius: var(--r-lg); text-decoration: none; color: var(--text); background: linear-gradient(100deg, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%), var(--surface-field); border: 1px solid var(--border); }
.support-card strong { display: block; font-size: var(--fs-14); }
.support-card small { display: block; color: var(--text-2); font-size: var(--fs-12); margin-top: 2px; }
.support-card:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.support-nudge {
  position: absolute; z-index: var(--z-toast); left: 50%; bottom: calc(var(--pad) + var(--dock-h) + var(--s-3) + var(--safe-b)); transform: translateX(-50%);
  display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-2) var(--s-2) var(--s-4); border-radius: var(--r-pill);
  background: var(--surface-2); border: 1px solid var(--song-line); box-shadow: var(--e-2); font-size: var(--fs-14);
  transition: opacity var(--dur-3), transform var(--dur-3) var(--ease-out), display var(--dur-3) allow-discrete;
}
.support-nudge[hidden] { opacity: 0; transform: translate(-50%, 8px); }
@starting-style { .support-nudge:not([hidden]) { opacity: 0; transform: translate(-50%, 8px); } }
.support-nudge p { white-space: nowrap; }
.support-nudge a { font-weight: 700; }
.ex-links { display: flex; gap: var(--s-2); flex-wrap: wrap; padding: 0 var(--s-1); }

/* Riel de íconos (escritorio angosto o a elección) */
.app.rail { --side-w: 72px; }
.app.rail .lib .side-head h2, .app.rail .lib-label, .app.rail .lib-kbd, .app.rail .lib-scroll, .app.rail #side-close { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.app.rail .lib-scroll { display: none; }
.app.rail .lib .side-head { justify-content: center; padding: var(--s-3) 0 var(--s-1); }
.app.rail .lib-item, .app.rail .support-pill { justify-content: center; padding: 0; gap: 0; }
.app.rail .lib-n { position: absolute; top: 2px; right: 2px; min-width: 18px; padding: 1px 5px; font-size: 0.625rem; }
.app.rail .lib-nav, .app.rail .lib-foot { padding: 0 var(--s-2); }
.app.rail .lib-foot { margin-top: auto; }
.app.rail .support-pill { border-color: transparent; background: none; }

/* ---------- Ahora suena ---------- */
:root { --np-w: 340px; }
.nps-body { gap: var(--s-4); }
.nps-main { display: grid; gap: var(--s-4); }
.nps-cover { aspect-ratio: 16 / 9; border-radius: var(--r-lg); overflow: hidden; background: var(--surface-field); box-shadow: var(--e-2); }
.nps-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nps-id { display: grid; gap: var(--s-1); }
.nps-title { font-family: var(--font-display); font-size: var(--fs-20); font-weight: 700; line-height: var(--lh-tight); letter-spacing: var(--track-display); }
.nps-artist { font-size: var(--fs-14); font-weight: 700; color: var(--accent); }
.nps-album { display: inline-flex; align-items: center; gap: var(--s-2); justify-self: start; min-height: 32px; padding: 0 var(--s-2) 0 0; border: 0; background: none; color: var(--text-2); font: inherit; font-size: var(--fs-14); cursor: pointer; border-radius: var(--r-sm); }
.nps-album:hover:not(:disabled) { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.nps-album:disabled { cursor: default; }
.nps-chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.nps-chips .meta-line { overflow: visible; }
.nps-lights { display: inline-flex; align-items: center; gap: var(--s-1); font-size: var(--fs-12); font-weight: 600; color: var(--text-2); }
.nps-channel { font-size: var(--fs-12); color: var(--muted); }
.nps-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.nps-actions .btn[aria-pressed="true"] { color: var(--accent); border-color: var(--brand-line); background: var(--accent-soft); }
.nps-sec { display: grid; gap: var(--s-1); }
.nps-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
/* Columna derecha (≥ 1280 px) */
@media (min-width: 1280px) {
  .app.with-np .np-side {
    top: calc(var(--pad) + var(--hud-h) + var(--s-3) + var(--safe-t)); bottom: calc(var(--pad) + var(--dock-h) + var(--s-3) + var(--safe-b));
    right: calc(var(--pad) + var(--safe-r)); width: var(--np-w); max-height: none; z-index: var(--z-side);
    transform-origin: 100% 50%; box-shadow: var(--hairline-top), var(--e-2);
  }
  .app.with-np .np-side[hidden] { transform: translateX(16px); }
  .app.with-np .stage { margin-right: calc(var(--np-w) + var(--s-4)); }
  .app.with-np .coach, .app.with-np .coach-pill { right: calc(var(--pad) + var(--np-w) + var(--s-4)); }
}

/* Ajustes: interruptor "Seguir al terminar" con el mismo ritmo que los demás */
.setting-toggle { padding: var(--s-2) 0; background: none; }
.setting-toggle:hover, .setting-toggle:focus-visible { background: none; }
.setting-toggle > svg { display: none; }
.setting-toggle[aria-pressed="true"] { background: none; }

/* =====================================================================
   Tema claro (AA): sigue prefers-color-scheme y se puede fijar con el botón ☀/☾
   ===================================================================== */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f0fb; --bg-deep: #e7dff5;
  --surface-0: rgba(255, 255, 255, 0.72); --surface-1: rgba(255, 255, 255, 0.86); --surface-2: rgba(255, 255, 255, 0.97);
  --surface-solid: #ffffff; --surface-hover: rgba(40, 20, 80, 0.06); --surface-active: rgba(40, 20, 80, 0.1); --surface-field: rgba(40, 20, 80, 0.045); --field-solid: #ffffff;
  --text: #1b1430;   /* 17:1 sobre blanco */
  --text-2: #463d5c; /* 9.6:1 */
  --muted: #5f5675;  /* 6.6:1 sobre blanco, 6:1 sobre el fondo */
  --border: rgba(30, 15, 60, 0.12); --border-strong: rgba(30, 15, 60, 0.2);
  --hairline-top: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --e-1: 0 1px 2px rgba(40, 20, 80, 0.08), 0 4px 12px -4px rgba(40, 20, 80, 0.14);
  --e-2: 0 12px 32px -14px rgba(40, 20, 80, 0.28);
  --e-3: 0 28px 70px -24px rgba(40, 20, 80, 0.38);
  --focus: #b0166f; --success: #0f7a4a; --success-soft: rgba(15, 122, 74, 0.1); --error: #b3243b; --error-soft: rgba(179, 36, 59, 0.1);
  --warn: #8a5a00; --warn-bg: #fff3d1; --warn-text: #5c3d00;
}
:root[data-theme="light"] .app {
  --accent: #6b3fd1;          /* marca en claro: 6.3:1 sobre blanco, texto blanco encima 6.3:1 */
  --accent-ink: #ffffff;
  --accent-soft: rgba(107, 63, 209, 0.12);
  --brand-line: rgba(107, 63, 209, 0.38);
  --song-line: color-mix(in srgb, var(--song-accent-l, #6b3fd1) 36%, transparent);
  --list-bg: #ffffff;
  --title-grad: linear-gradient(100deg, var(--text) 0%, var(--text) 30%, var(--song-accent-l, #6b3fd1) 70%, var(--song-accent-l2, #1f6fb2) 100%);
}
:root[data-theme="light"] body { background: var(--bg); }
:root[data-theme="light"] .ambient {
  background:
    radial-gradient(46% 40% at 50% 14%, color-mix(in srgb, var(--light) 26%, transparent), transparent 70%),
    radial-gradient(60% 30% at 50% 58%, color-mix(in srgb, var(--light) 14%, transparent), transparent 75%),
    linear-gradient(180deg, #ebe4fa 0%, var(--bg) 45%, #e9e1f7 100%);
}
:root[data-theme="light"] .beams i { mix-blend-mode: normal; opacity: calc(var(--o) * 0.55); }
:root[data-theme="light"] .vignette { background: radial-gradient(120% 90% at 50% 40%, transparent 60%, rgba(120, 100, 170, 0.18) 100%); }
:root[data-theme="light"] .vignette::after { opacity: 0.04; mix-blend-mode: multiply; }
:root[data-theme="light"] .side, :root[data-theme="light"] .panel { --list-bg: #ffffff; }
:root[data-theme="light"] .seg::before, :root[data-theme="light"] .tabs::before { background: var(--text); }
:root[data-theme="light"] .seg [aria-selected="true"], :root[data-theme="light"] .tabs [aria-selected="true"] { color: #fff; }
:root[data-theme="light"] .ibtn.play { background: var(--text); color: #fff; }
:root[data-theme="light"] .ibtn.play:hover { background: #2c2348; color: #fff; }
:root[data-theme="light"] .toast { background: #1b1430; color: #fff; }
:root[data-theme="light"] .toast-action { background: #fff; color: #1b1430; }
:root[data-theme="light"] .timeline { background: rgba(30, 15, 60, 0.16); }
:root[data-theme="light"] .playhead { background: var(--text); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.8); }
:root[data-theme="light"] input[type="range"] { --track: linear-gradient(90deg, var(--accent) var(--p, 50%), rgba(30, 15, 60, 0.14) var(--p, 50%)); }
:root[data-theme="light"] input[type="range"]::-webkit-slider-thumb { background: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent), 0 1px 4px rgba(0, 0, 0, 0.3); }
:root[data-theme="light"] .check input[type="checkbox"] { border-color: rgba(30, 15, 60, 0.45); }
:root[data-theme="light"] .check.switch input[type="checkbox"]:not(:checked) { background-color: rgba(30, 15, 60, 0.22); }
:root[data-theme="light"] .mi[aria-pressed]::after { background-color: rgba(30, 15, 60, 0.22); }
:root[data-theme="light"] .mi[aria-pressed="true"]::after { background-color: var(--accent); }
:root[data-theme="light"] select { color-scheme: light; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m7 10 5 5 5-5' fill='none' stroke='%23463d5c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
:root[data-theme="light"] select option:checked { background-color: #e4d9fb; color: #1b1430; }
:root[data-theme="light"] .song.playing .s-title, :root[data-theme="light"] .badge-lyrics, :root[data-theme="light"] .kind .check:has(input:checked), :root[data-theme="light"] .lyrics-bar a { color: var(--accent); }
:root[data-theme="light"] .sg-badge { color: #e3d4ff; }
:root[data-theme="light"] .filter-chip.member { color: color-mix(in srgb, var(--chip) 40%, #1b1430); }
:root[data-theme="light"] .filter-chip.member::before { box-shadow: none; }
:root[data-theme="light"] .filter-chip[aria-pressed="true"] { background: var(--text); color: #fff; }
:root[data-theme="light"] .filter-chip.member[aria-pressed="true"] { background: color-mix(in srgb, var(--chip) 45%, #1b1430); color: #fff; }
:root[data-theme="light"] .explore-head { background: color-mix(in srgb, var(--bg) 94%, transparent); box-shadow: 0 12px 24px -18px rgba(40, 20, 80, 0.35); }
:root[data-theme="light"] .cq-ghost { background: #fff; }
:root[data-theme="light"] .dlg { background: #fff; }
:root[data-theme="light"] .coach::before { background: #fff; }
:root[data-theme="light"] .lights-view .section-label, :root[data-theme="light"] .lights-view .hint { text-shadow: 0 1px 10px rgba(255, 255, 255, 0.9); }
/* En claro, el público lila queda detrás del texto: el aviso va en una pastilla clara (contraste AA) */
:root[data-theme="light"] .lights-view .hint { color: var(--text-2); background: var(--surface-1); padding: var(--s-1) var(--s-3); border-radius: var(--r-pill); box-shadow: var(--e-1); text-shadow: none; }
:root[data-theme="light"] .shelf-likes { --shelf-c: #b3245f; }
:root[data-theme="light"] .shelf-start { --shelf-c: #5b2fc0; }
:root[data-theme="light"] .shelf-lyrics { --shelf-c: #1d5f9e; }
:root[data-theme="light"] .shelf-solo { --shelf-c: #a3246a; }
:root[data-theme="light"] .shelf-hype { --shelf-c: #8a5200; }
:root[data-theme="light"] .lg-stick { stroke: #8f86a3; }
:root[data-theme="light"] .lg-globe { stroke: rgba(30, 15, 60, 0.25); }
:root[data-theme="light"] .album-title { color: var(--text-2); }
:root[data-theme="light"] .pill.cta { background: var(--accent); }
:root[data-theme="light"] .pill.cta:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
:root[data-theme="light"] .btn.primary { background: var(--accent); color: #fff; box-shadow: 0 8px 22px -12px var(--accent); }
:root[data-theme="light"] .btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); color: #fff; }
:root[data-theme="light"] .tip { color: #fff; background: rgba(27, 20, 48, 0.94); }
/* Antes de que cargue el JS, se respeta el tema del sistema */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) { color-scheme: light; --bg: #f4f0fb; --text: #1b1430; --text-2: #463d5c; --muted: #5f5675; }
}
/* Tema claro: el público se ve, pero detrás de un velo para que los textos de Explorar se lean bien */
:root[data-theme="light"] .home-view { background: linear-gradient(to bottom, rgba(244, 240, 251, 0.8), rgba(244, 240, 251, 0.62)); border-radius: var(--r-xl); }

/* =====================================================================
   Auditoría UX (docs/ux-audit.md) · ajustes "ahora"
   ===================================================================== */
/* UI-08 · áreas de toque: ≥ 36 px con mouse, ≥ 44 px con dedo */
.like-btn { width: 36px; height: 36px; }
.song-row { gap: var(--s-2); } /* ≥ 8 px entre ♡ y ⋯ */
.filter-chip { min-height: 36px; }
.seg button, .tabs button { min-height: 36px; }
@media (pointer: coarse) {
  .like-btn, .more-btn, .filter-chip, .seg button, .tabs button, .menu-item, .lib-item { min-height: var(--tap); }
  .like-btn, .more-btn { min-width: var(--tap); }
  .menu-item { min-width: var(--tap); }
}
/* IA-02 · pestañas completas en teléfono (360 px) */
@media (max-width: 640px) {
  .hud-top { gap: var(--s-2); }
  .view-tabs { flex: 1 1 auto; max-width: calc(100% - var(--tap) - var(--s-2)); }
  .view-tabs button { padding: 0 var(--s-2); font-size: 0.8125rem; min-width: 0; }
}
/* L-07 · el título del dock cabe: sin canción, tamaño menor; columna más ancha en escritorio */
.app.home .np-title { font-size: var(--fs-16); }
/* L-06 · contadores de los chips legibles (sin opacidad) */
.filter-chip .n { opacity: 1; color: var(--text-2); }
.filter-chip[aria-pressed="true"] .n { color: inherit; }
/* L-05 / V-01 · texto sobre el escenario: tarjetas con fondo propio y velo detrás de Explorar */
.sg-play { background: var(--surface-1); border-radius: var(--r-lg); padding-bottom: var(--s-2); box-shadow: 0 0 0 1px var(--border); }
.sg-play .sg-thumb { border-radius: var(--r-lg) var(--r-lg) var(--r-sm) var(--r-sm); }
.sg-title, .sg-meta { padding: 0 var(--s-2); }
.home-view { background: linear-gradient(to bottom, rgba(6, 6, 26, 0.72), rgba(6, 6, 26, 0.58)); border-radius: var(--r-xl); }
.app.home .crowd-canvas, .app:has(#home:not([hidden])) .crowd-canvas { opacity: 0.35; }
.app:has(#home:not([hidden])) .beams { opacity: 0.15; }
.shelf-head { background: none; }
/* L-10 · rótulos coreanos más discretos y fuera del camino en teléfono */
.shelf-ko { opacity: 0.45; }
@media (max-width: 480px) { .shelf-ko { display: none; } }
/* V-06 · glifo de intensidad: neutro (no parece un estado activo) */
.lights-glyph { color: var(--text-2); }
.lights-legend { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) var(--s-3); padding: 0 var(--s-1); font-size: var(--fs-12); font-weight: 600; color: var(--text-2); }
.ll-item { display: inline-flex; align-items: center; gap: var(--s-1); }
/* UI-02 · primera visita: una tarjeta para conectar (sin guía automática) */
.connect-card { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-4); padding: var(--s-4); border-radius: var(--r-lg); background: var(--surface-1); border: 1px solid var(--brand-line); box-shadow: var(--e-1); }
.connect-card p { flex: 1 1 200px; display: grid; gap: 2px; }
.connect-card strong { font-size: var(--fs-16); }
.connect-card span:not(.sp-stick) { font-size: var(--fs-14); color: var(--text-2); }
.cc-actions { display: flex; gap: var(--s-2); }
/* I-10 · teléfono: "A continuación" ocupa el hueco bajo el video (no flota) */
@media (max-width: 640px) {
  /* Debajo del video; deja el hueco de la tira de letra solo si está visible */
  .upnext {
    --un-top: calc(36px + min(100cqw, (100cqh - 64px) * 16 / 9) * 9 / 16 + var(--s-3));
    top: var(--un-top); bottom: auto; left: 0; right: 0; width: auto;
    max-height: calc(100cqh - var(--un-top)); overflow: auto;
    background: var(--surface-1); box-shadow: var(--e-1);
  }
  /* UI-04 · Explorar en teléfono: el mini video mide 200 px y su barra va debajo, nunca encima del reproductor de
     YouTube (sus políticas no permiten tapar el reproductor ni sus controles). */
  .app.exploring .video-card { --mini-w: calc(100cqw - 16px); }
  .app.exploring .mini-bar { height: 44px; }
  .app.exploring .progress { display: none; }
  .app.exploring .home-view { padding-bottom: 272px; }
  /* UI-05 · avisos encima del dock (zona del pulgar) */
  .toast { top: auto; bottom: calc(var(--pad) + var(--dock-h) + var(--s-3) + var(--safe-b)); }
  .toast[hidden] { transform: translate(-50%, 8px) scale(0.98); }
}
:root[data-theme="light"] .home-view { background: linear-gradient(to bottom, rgba(244, 240, 251, 0.86), rgba(244, 240, 251, 0.72)); }
:root[data-theme="light"] .sg-play { background: rgba(255, 255, 255, 0.92); }
/* UI-07 / UI-01 · en los paneles, cada fila mide lo que su contenido (las filas con scroll horizontal,
   como los chips, ya no se aplastan a 0 px cuando el panel es más bajo que su contenido) */
.panel-body { grid-auto-rows: max-content; }
.filters { min-height: max-content; }

/* =====================================================================
   Teléfono: logo + menú desplegable, ⋯ junto al título, ♡ visible, minimizar video
   ===================================================================== */
/* ⋯ junto al nombre de la canción (no encima de la miniatura) */
.sg-item .more-btn {
  top: auto; bottom: 0; right: -6px; width: 36px; height: 44px; border-radius: var(--r-md);
  color: var(--text-2); background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; transform: none; opacity: 1;
}
.sg-item .more-btn:hover, .sg-item .more-btn[aria-expanded="true"] { background: var(--surface-hover); color: var(--text); }
.sg-item:has(> .more-btn) .sg-title, .sg-item:has(> .more-btn) .sg-meta { padding-right: 30px; }
.sg-item > .more-btn { opacity: 1; }
/* ♡ más visible sobre la miniatura */
.sg-item > .like-btn.sg-like { background: rgba(8, 6, 20, 0.68); color: #fff; font-size: 22px; line-height: 1; opacity: 1;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3), 0 2px 8px rgba(0, 0, 0, 0.35); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); transform: scale(0.88); }
.sg-item > .like-btn.sg-like:hover { background: rgba(8, 6, 20, 0.85); color: #fff; }
.sg-item > .like-btn.sg-like[aria-pressed="true"] { color: #ff6fb5; }
.al-item > .like-btn.sg-like { opacity: 1; }
/* Minimizar video (teléfono): píldora en el hueco sobre el video, fuera de los controles de YouTube */
.video-min { display: none; }
@media (max-width: 640px) {
  .app[data-view="video"]:not(.home) .video-min {
    display: inline-flex; align-items: center; gap: 4px; position: absolute; top: 2px; left: var(--s-1); z-index: 3;
    min-height: 36px; padding: 0 var(--s-3) 0 var(--s-2); border-radius: 999px; border: 1px solid var(--border-strong);
    background: var(--surface-1); color: var(--text); font: 700 var(--fs-12)/1 inherit; cursor: pointer; box-shadow: var(--e-1);
  }
  .video-min svg { width: 18px; height: 18px; }
  .video-min::before { content: ""; position: absolute; inset: -4px; } /* área táctil ≥ 44 px */
}
#mini-size svg, #mini-back svg { width: 18px; height: 18px; }
/* Mini reproductor chico: 200 × 200 px (el mínimo que pide YouTube) en una esquina */
.app.exploring .video-card.mini-sm { --mini-w: 200px; }
.app.exploring .video-card.mini-sm .mini-title { display: none; }
.app.exploring .video-card.mini-sm .mini-bar { justify-content: flex-end; }
/* Teléfono en horizontal: mini de 200 px en su propia columna a la derecha (no tapa tarjetas ni el dock) */
@media (max-height: 500px) and (orientation: landscape) {
  .app.exploring .video-card { --mini-w: 200px; }
  .app.exploring .video-card .mini-title { display: none; }
  .app.exploring .video-card .mini-bar { justify-content: flex-end; height: 44px; }
  .app.exploring .home-view { padding-right: 212px; padding-bottom: var(--s-5); }
}

@media (max-width: 640px) {
  .hud-top .menu, .hud-top .view-tabs { display: none; }
  .m-brand span { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .m-nav { display: block; position: relative; margin-left: auto; }
  .m-nav-btn {
    display: inline-flex; align-items: center; gap: var(--s-1); min-height: var(--tap); padding: 0 var(--s-3) 0 var(--s-4);
    border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface-1); color: var(--text);
    font: 700 var(--fs-14)/1 inherit; cursor: pointer; box-shadow: var(--e-1);
  }
  .m-nav-btn svg { width: 18px; height: 18px; transition: transform var(--dur-2); }
  .m-nav-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
  .m-nav-menu {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: min(260px, calc(100vw - 24px)); display: grid; gap: 2px;
    padding: var(--s-2); border-radius: var(--r-lg); background: var(--surface-2, var(--surface-1)); border: 1px solid var(--border-strong);
    box-shadow: var(--e-3, 0 12px 40px rgba(0, 0, 0, 0.35)); transform-origin: 100% 0; animation: m-nav-in var(--dur-2) var(--ease-out);
  }
  .m-nav-menu[hidden] { display: none; }
  .m-nav-menu > button, .m-nav-menu > a {
    display: flex; align-items: center; gap: var(--s-3); min-height: var(--tap); padding: 0 var(--s-3); border: 0; border-radius: var(--r-md);
    background: transparent; color: var(--text); font: 600 var(--fs-14)/1.2 inherit; text-align: left; text-decoration: none; cursor: pointer;
  }
  .m-nav-menu > button:hover, .m-nav-menu > a:hover, .m-nav-menu > :focus-visible { background: var(--surface-hover); }
  .m-nav-menu svg { width: 18px; height: 18px; flex: none; color: var(--text-2); }
  .m-nav-menu [aria-checked="true"] { color: var(--brand, var(--text)); font-weight: 800; background: var(--brand-soft, var(--surface-hover)); }
  .m-nav-menu [aria-checked="true"] svg { color: currentColor; }
  .m-nav-h { margin: var(--s-1) var(--s-3) 2px; font-size: var(--fs-12); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
  .m-nav-menu hr { border: 0; border-top: 1px solid var(--border); margin: var(--s-1) var(--s-2); }
  /* Explorar en teléfono: solo las miniaturas de las canciones */
  .connect-card, .lights-legend { display: none !important; }
}
@keyframes m-nav-in { from { opacity: 0; transform: translateY(-6px) scale(0.97); } }
@media (prefers-reduced-motion: reduce) { .m-nav-menu { animation: none; } }
@media (max-width: 640px) {
  /* Con el botón Minimizar a la derecha, el aviso de luces se alinea a la izquierda */
  .app[data-view="video"]:not(.home) .video-min { left: auto; right: var(--s-1); }
  .app[data-view="video"]:not(.home) .style-chip { justify-self: start; left: var(--s-1); right: auto; transform: none; translate: none; max-width: calc(100% - 140px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 640px) { .hud-top { position: relative; z-index: 20; } }

/* =====================================================================
   Accesibilidad visual (docs/accesibilidad-visual.md)
   A-12 foco no tapado · objetivos táctiles · A-17 más contraste · A-18 interfaz tranquila · A-06 colores forzados
   ===================================================================== */

/* ---------- A-12 · zoom 400 %: el foco no queda bajo la cabecera, el dock ni la barra de Explorar ---------- */
html {
  scroll-padding-top: calc(var(--hud-h) + var(--safe-t) + var(--s-2));
  scroll-padding-bottom: calc(var(--dock-h) + var(--safe-b) + var(--s-2));
}
.home-view { scroll-padding-top: var(--s-3); scroll-padding-bottom: var(--s-5); }
.app.exploring .home-view { scroll-padding-top: 120px; } /* .explore-head fija + título de álbum (top: 104px) */
.panel-body, .lib-scroll, .app.side-drawer .side, .coach, .upnext, .menu-pop { scroll-padding-block: var(--s-3); }
.sg-row { scroll-padding-inline: var(--s-1); }
/* Ventanas muy bajas en vertical (lupa, zoom alto): dock compacto, etiquetas solo para el lector.
   (En horizontal ya lo resuelve el bloque max-height: 500px de arriba.) */
@media (max-height: 500px) and (orientation: portrait) {
  :root { --pad: var(--s-2); }
  .app { gap: var(--s-2); }
  .np-sub { display: none; }
  .art { width: 36px; height: 36px; box-shadow: inset 0 0 0 10px #0d0b18; }
  .art::after { inset: 14px; }
  .dock { row-gap: 0; padding-block: var(--s-1); }
  .dbtn { min-height: var(--tap); padding: 0; }
  .dbtn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* ---------- §2.13 · áreas táctiles de 44 px con el dedo ---------- */
@media (pointer: coarse) {
  .more-btn, .like-btn, .sg-item .more-btn, .sg-item > .like-btn.sg-like { min-width: var(--tap); min-height: var(--tap); }
  .sg-item .more-btn { width: var(--tap); height: var(--tap); right: -8px; }
  .sg-item:has(> .more-btn) .sg-title, .sg-item:has(> .more-btn) .sg-meta { padding-right: 38px; }
  .sg-item > .like-btn.sg-like { transform: none; }
  .lb-opt { min-height: var(--tap); min-width: var(--tap); }
  .nps-album { min-height: var(--tap); }
}

/* ---------- A-17 · más contraste: superficies opacas, bordes ≥ 3:1, sin texto tenue ---------- */
@media (prefers-contrast: more) {
  :root {
    --surface-0: #15122a; --surface-1: #15122a; --surface-2: #1b1733; --surface-field: #1d1a2b;
    --border: rgba(255, 255, 255, 0.45);        /* ≈ 4:1 sobre --surface-solid */
    --border-strong: rgba(255, 255, 255, 0.6);
    --muted: var(--text-2);
  }
  :root:not([data-theme]) { --muted: var(--text-2); }
  :root[data-theme="light"] {
    --surface-0: #ffffff; --surface-1: #ffffff; --surface-2: #ffffff; --surface-field: #f4f0fb;
    --border: rgba(30, 15, 60, 0.55);           /* ≈ 4:1 sobre blanco */
    --border-strong: rgba(30, 15, 60, 0.7);
    --muted: var(--text-2);
  }
  *, *::before, *::after, .dlg::backdrop { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
  .side, .panel { background: var(--list-bg); }
  .home-view, :root[data-theme="light"] .home-view { background: var(--bg); }
  .explore-head, :root[data-theme="light"] .explore-head, .explore-list .album-title { background: var(--bg); }
  .sg-play, :root[data-theme="light"] .sg-play { background: var(--surface-1); box-shadow: 0 0 0 1px var(--border); }
  .tip { background: #120e24; border-color: rgba(255, 255, 255, 0.6); }
  .sg-badge, .sg-item > .like-btn.sg-like { background: #08061a; }
  .lights-view .section-label, .lights-view .hint { background: var(--surface-solid); color: var(--text); padding: var(--s-1) var(--s-3); border-radius: var(--r-pill); border: 1px solid var(--border); text-shadow: none; }
  /* Límites de los controles */
  .check input[type="checkbox"], :root[data-theme="light"] .check input[type="checkbox"] { border-color: var(--border-strong); }
  .check.switch input[type="checkbox"], .mi[aria-pressed]::after { box-shadow: inset 0 0 0 2px var(--border-strong); }
  .check.switch input[type="checkbox"]:checked, .mi[aria-pressed="true"]::after { box-shadow: none; }
  .timeline, :root[data-theme="light"] .timeline { background: var(--border); }
  input[type="range"], :root[data-theme="light"] input[type="range"] { --track: linear-gradient(90deg, var(--accent) var(--p, 50%), var(--border) var(--p, 50%)); }
  input[type="range"]::-moz-range-track { background: var(--border); }
  .seg, .tabs, .menu, .filter-chip, .chip-type, .lyrics-bar, .style-chip, .dbtn[aria-pressed="true"], .dbtn.on { border-color: var(--border-strong); }
  .lb-seg { border: 1px solid var(--border-strong); }
  .btn.ghost { border-color: var(--border); }
  /* Enlaces dentro de texto: siempre subrayados */
  a:not([class]), p a, small a, .hint a, .legal a, .warning a, .lyrics-bar a, .support-nudge a, .c-text a { text-decoration-line: underline; }
}

/* ---------- A-18 · interfaz tranquila (.app.calm, ajuste "Interfaz tranquila") ----------
   El color de la canción no tiñe la interfaz, sin haces, neblina ni público, bombilla de Luces con brillo
   limitado y sin degradados animados. El brillo del ARMY Bomb por Bluetooth no cambia (JS y #rng-bright).
   Las mismas reglas se repiten abajo para prefers-reduced-transparency. */
.app.calm {
  --glow: #2a2440 !important; /* !important: app.js lo pone en línea con cada color */
  --light: #3a3358;
  --glow-soft: rgba(42, 36, 64, 0.35);
  --song-accent: var(--accent) !important; --song-accent-2: var(--accent) !important;
  --song-accent-l: var(--accent) !important; --song-accent-l2: var(--accent) !important;
  --song-line: var(--border-strong);
  transition: none;
}
.app.calm .beams, .app.calm .haze, .app.calm .crowd-canvas, .app.calm .stage::before, .app.calm .chant::before { display: none; }
.app.calm .ambient { background: linear-gradient(180deg, #0a0b26 0%, var(--bg) 45%, var(--bg-deep) 100%); }
:root[data-theme="light"] .app.calm .ambient { background: linear-gradient(180deg, #ebe4fa 0%, var(--bg) 45%, #e9e1f7 100%); }
.app.calm .big-bulb { filter: brightness(0.7); box-shadow: 0 0 40px 6px color-mix(in srgb, var(--c) 50%, transparent), inset 0 -20px 40px rgba(0, 0, 0, 0.35); }
.app.calm .bulb { filter: brightness(0.8); }
.app.calm .video-card, .app.calm.exploring .video-card { box-shadow: 0 0 0 1px var(--border-strong), var(--e-3); }
.app.calm.playing-now .dock { border-color: var(--border); box-shadow: var(--hairline-top), var(--e-2); }
.app.calm.playing-now .ibtn.play { box-shadow: 0 6px 20px -6px rgba(0, 0, 0, 0.7); }
.app.calm.playing-now .art, .app.calm .song.playing .thumb::after, .app.calm .chant-name.pop,
.app.calm .np-letters, .app.calm .np-letters .ch, .app.calm .hero-title, .app.calm .empty-art { animation: none !important; }
.app.calm .chant-name { filter: none; }
@media (prefers-reduced-transparency: reduce) {
  .app {
    --glow: #2a2440 !important;
    --light: #3a3358;
    --glow-soft: rgba(42, 36, 64, 0.35);
    --song-accent: var(--accent) !important; --song-accent-2: var(--accent) !important;
    --song-accent-l: var(--accent) !important; --song-accent-l2: var(--accent) !important;
    --song-line: var(--border-strong);
    transition: none;
  }
  .beams, .haze, .crowd-canvas, .stage::before, .chant::before { display: none; }
  .ambient { background: linear-gradient(180deg, #0a0b26 0%, var(--bg) 45%, var(--bg-deep) 100%); }
  :root[data-theme="light"] .ambient { background: linear-gradient(180deg, #ebe4fa 0%, var(--bg) 45%, #e9e1f7 100%); }
  .big-bulb { filter: brightness(0.7); box-shadow: 0 0 40px 6px color-mix(in srgb, var(--c) 50%, transparent), inset 0 -20px 40px rgba(0, 0, 0, 0.35); }
  .bulb { filter: brightness(0.8); }
  .video-card, .app.exploring .video-card { box-shadow: 0 0 0 1px var(--border-strong), var(--e-3); }
  .playing-now .dock { border-color: var(--border); box-shadow: var(--hairline-top), var(--e-2); }
  .playing-now .ibtn.play { box-shadow: 0 6px 20px -6px rgba(0, 0, 0, 0.7); }
  .playing-now .art, .song.playing .thumb::after, .chant-name.pop, .np-letters, .np-letters .ch, .hero-title, .empty-art { animation: none !important; }
  .chant-name { filter: none; }
  /* Menos transparencia también en las superficies de vidrio */
  :root { --surface-0: #15122a; --surface-1: #15122a; }
  :root[data-theme="light"] { --surface-0: #ffffff; --surface-1: #ffffff; }
}

/* ---------- A-06 · colores forzados (Windows Contraste alto) ---------- */
@media (forced-colors: active) {
  /* Foco visible en todo, también en campos y deslizadores que usaban outline: none + box-shadow */
  :focus-visible,
  select:focus-visible, input:focus-visible, textarea:focus-visible, input[type="range"]:focus-visible,
  .dock:focus-visible, .mi:focus-visible, .sg-play:focus-visible, .al-play:focus-visible { outline: 3px solid Highlight !important; outline-offset: 2px !important; }
  .kind .check:has(input:focus-visible), .star-row input:focus-visible + label { outline: 3px solid Highlight; outline-offset: 2px; }

  /* Fondos decorativos: el sistema quita los degradados; la multitud (canvas) no debe quedar detrás del texto */
  .ambient, .beams, .haze, .crowd-canvas, .vignette, .stage::before, .chant::before, .seg::before, .tabs::before { display: none; }

  /* Estados pulsado / elegido / marcado: fondo Highlight (forced-color-adjust: none para que se vea) */
  [aria-pressed="true"], [aria-selected="true"], [aria-checked="true"], .lb-opt[aria-pressed="true"], .filter-chip[aria-pressed="true"],
  .seg [aria-selected="true"], .tabs [aria-selected="true"], .dbtn.on, .pill.on {
    forced-color-adjust: none;
    background: Highlight !important; color: HighlightText !important; border-color: Highlight !important;
    outline: 2px solid CanvasText; outline-offset: 1px;
  }
  :is([aria-pressed="true"], [aria-selected="true"], [aria-checked="true"], .dbtn.on, .pill.on) * { color: inherit !important; }
  .seg button, .tabs button, .lb-opt, .filter-chip, .dbtn, .ibtn, .more-btn, .like-btn, .menu-item, .mi, .lib-item { border: 1px solid transparent; }
  [aria-current]:not([aria-current="false"]) { outline: 2px solid Highlight; outline-offset: 1px; text-decoration: underline; }
  [aria-expanded="true"] { outline: 2px dashed Highlight; outline-offset: 1px; }
  /* Canción que suena / tarjeta elegida en Explorar */
  .song.playing, .sg-play.playing, .cq-nowrow, .rank tr.me td { outline: 3px solid Highlight; outline-offset: 2px; }
  .song.playing::before { forced-color-adjust: none; background: Highlight; }
  .kind .check:has(input:checked) { outline: 2px solid Highlight; border-color: Highlight; }
  .star-row input:checked ~ label { color: Highlight; }

  /* Casillas e interruptores: el estado se dibuja con colores del sistema */
  .check input[type="checkbox"] { forced-color-adjust: none; border: 2px solid ButtonText; background-color: Canvas; }
  .check input[type="checkbox"]:checked { background-color: Highlight; border-color: Highlight; }
  .check.switch input[type="checkbox"] {
    forced-color-adjust: none; border: 2px solid ButtonText; background-color: Canvas;
    background-image: radial-gradient(circle, ButtonText 0 8px, transparent 8.5px); background-size: 22px 22px; background-position: 0 50%;
  }
  .check.switch input[type="checkbox"]:checked {
    background-color: Highlight; border-color: Highlight;
    background-image: radial-gradient(circle, HighlightText 0 8px, transparent 8.5px); background-size: 22px 22px; background-position: 100% 50%;
  }
  .mi[aria-pressed]::after {
    forced-color-adjust: none; border: 2px solid ButtonText;
    background: Canvas radial-gradient(circle, ButtonText 0 6px, transparent 6.5px) 0 50% / 18px 18px no-repeat;
  }
  .mi[aria-pressed="true"]::after { border-color: HighlightText; background: Highlight radial-gradient(circle, HighlightText 0 6px, transparent 6.5px) 100% 50% / 18px 18px no-repeat; }

  /* Deslizadores y barra de tiempo */
  input[type="range"] { forced-color-adjust: none; --track: linear-gradient(90deg, Highlight var(--p, 50%), GrayText var(--p, 50%)); }
  input[type="range"]::-webkit-slider-thumb { background: ButtonText; border: 2px solid Canvas; box-shadow: none; }
  input[type="range"]::-moz-range-thumb { background: ButtonText; border: 2px solid Canvas; box-shadow: none; }
  input[type="range"]::-moz-range-track { background: GrayText; }
  input[type="range"]::-moz-range-progress { background: Highlight; }
  .timeline { border: 1px solid CanvasText; }
  .playhead { forced-color-adjust: none; background: CanvasText; box-shadow: 0 0 0 2px Canvas; }

  /* Superficies flotantes: borde propio (sin sombra ni vidrio no se distinguen del fondo) */
  .panel, .np-side, .dock, .side, .menu-pop, #song-menu, .m-nav-menu, .toast, .tip, .coach, .coach-pill, .upnext, .support-nudge,
  .dlg, .lyrics-bar, .style-chip, .cq-ghost, .app.exploring .video-card, .explore-head { border: 1px solid CanvasText; }
  .app.exploring .mini-bar { border-bottom: 1px solid CanvasText; }
  .toast-action, .ibtn.play { border: 1px solid ButtonText; }

  /* El color de las luces y las paletas es contenido: se conserva */
  .seg-part, .big-bulb, .bulb, .sim, .dot, .g-globe, .g-dot, .swatches i, .lib-dots, .art, .filter-chip.member::before,
  .style-chip::before, .lights-glyph, .sp-stick { forced-color-adjust: none; }
}
