/*
 * Оформление строки «сейчас играет».
 *
 * Отдельный файл, потому что этот же CSS подключает панель для живого превью:
 * если бы правила лежали рядом со сбросом html/body из оверлея, панель
 * получила бы overflow:hidden и прозрачный фон на всю страницу.
 */

/* ------------------------------------------------------------------ */
/* Основа                                                              */
/* ------------------------------------------------------------------ */

.np-root {
  /* Графит. Один набор правил для OBS и превью в кабинете. */
  --np-font: "Manrope", Inter, system-ui, sans-serif;
  --np-size: 22px;
  --np-title: #ffffff;
  --np-artist: #aeb6c4;
  --np-accent: #ff6a2b;
  --np-bg: rgba(35, 38, 45, 0.94);
  --np-radius: 14px;
  --np-max: 460px;

  position: fixed;
  display: flex;
  align-items: center;
  gap: 14px;
  box-sizing: border-box;
  max-width: min(var(--np-max), calc(100vw - 48px));
  padding: 16px 20px 16px 16px;
  border: 1px solid rgba(173, 185, 204, .15);
  box-shadow: 0 8px 24px rgba(0,0,0,.16);
  border-radius: var(--np-radius);
  background: var(--np-bg);
  font-family: var(--np-font);
  /* Строка не должна ловить клики: в OBS источник лежит поверх сцены. */
  pointer-events: none;
  /* Появление и уход — свойством, а не display: иначе смена трека мигает. */
  transition: opacity 320ms ease, transform 320ms ease;
}

.np-root[hidden] { display: none; }

/* Положение в сцене. Отступ небольшой: обрезать источник удобнее в OBS. */
.np-root[data-position="top-left"] { top: 24px; left: 24px; }
.np-root[data-position="top-right"] { top: 24px; right: 24px; }
.np-root[data-position="bottom-left"] { bottom: 24px; left: 24px; }
.np-root[data-position="bottom-right"] { bottom: 24px; right: 24px; }

/* Уезжает в свою сторону, а не всегда вниз. */
.np-root.is-leaving { opacity: 0; }
.np-root[data-position^="top"].is-leaving { transform: translateY(-14px); }
.np-root[data-position^="bottom"].is-leaving { transform: translateY(14px); }

.np-art {
  flex: 0 0 auto;
  width: calc(var(--np-size) * 2.4);
  height: calc(var(--np-size) * 2.4);
  border-radius: max(0px, calc(var(--np-radius) - 5px));
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}
.np-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.np-root .np-art-stub { display: grid; place-items: center; width: 100%; height: 100%; font-size: calc(var(--np-size) * 1.15); color: var(--np-accent); }
.np-art:has(img[hidden]) { display: none; }

.np-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.np-eyebrow {
  font-size: calc(var(--np-size) * 0.44);
  font-weight: 700;
  letter-spacing: 0.025em;
  color: var(--np-artist);
}

/* Заголовок обрезается многоточием; бегущая строка включается отдельно. */
.np-title-wrap { overflow: hidden; }
.np-title {
  display: block;
  font-size: var(--np-size);
  font-weight: 650;
  line-height: 1.25;
  color: var(--np-title);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.np-artist {
  font-size: calc(var(--np-size) * 0.62);
  font-weight: 450;
  line-height: 1.3;
  color: var(--np-artist);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.np-progress {
  margin-top: 6px;
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.10);
  overflow: hidden;
}
.np-progress i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--np-accent);
  /* Плавно между пакетами приложения, без рывка на каждом обновлении. */
  transition: width 900ms linear;
}

/* Эквалайзер: по умолчанию спрятан, его показывает только скин equalizer. */
.np-bars { display: none; gap: 3px; align-items: flex-end; height: calc(var(--np-size) * 1.2); }
.np-bars i {
  width: 4px;
  border-radius: 2px;
  background: var(--np-accent);
  animation: np-bounce 900ms ease-in-out infinite;
}
.np-bars i:nth-child(1) { height: 40%; animation-delay: 0ms; }
.np-bars i:nth-child(2) { height: 85%; animation-delay: 140ms; }
.np-bars i:nth-child(3) { height: 60%; animation-delay: 280ms; }
.np-bars i:nth-child(4) { height: 95%; animation-delay: 90ms; }

@keyframes np-bounce {
  0%, 100% { transform: scaleY(0.35); }
  50% { transform: scaleY(1); }
}

/* ------------------------------------------------------------------ */
/* Скины                                                               */
/* ------------------------------------------------------------------ */

/* bar — базовый: плашка с обложкой слева. Оформление уже задано выше. */

/* card — крупнее, обложка сверху, всё столбиком. */
.np-root[data-skin="card"] {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 14px;
}
.np-root[data-skin="card"] .np-art {
  width: 100%;
  height: calc(var(--np-size) * 6);
  border-radius: max(0px, calc(var(--np-radius) - 4px));
}
.np-root[data-skin="card"] .np-title { white-space: normal; }

/* vinyl — круглая крутящаяся обложка. */
.np-root[data-skin="vinyl"] .np-art {
  border-radius: 50%;
  width: calc(var(--np-size) * 2.8);
  height: calc(var(--np-size) * 2.8);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08) inset;
  animation: np-spin 7s linear infinite;
}
@keyframes np-spin { to { transform: rotate(360deg); } }

/* ticker — узкая строка без обложки, всё в одну линию. */
.np-root[data-skin="ticker"] {
  padding: 8px 16px;
  border-radius: var(--np-radius);
  align-items: baseline;
  gap: 10px;
}
.np-root[data-skin="ticker"] .np-art { display: none; }
.np-root[data-skin="ticker"] .np-body { flex-direction: row; align-items: baseline; gap: 10px; min-width: 0; }
.np-root[data-skin="ticker"] .np-artist::before { content: "— "; }
.np-root[data-skin="ticker"] .np-progress { display: none; }
/* Строка задумана как одна короткая линия: служебная подпись съедала бы
   половину ширины и переносилась на две строки, а название резалось. */
.np-root[data-skin="ticker"] .np-eyebrow { display: none; }
.np-root[data-skin="ticker"] .np-title-wrap { flex: 0 1 auto; min-width: 0; }
.np-root[data-skin="ticker"] .np-artist { flex: 0 1 auto; }

/* minimal — без подложки и без служебных надписей, только текст. */
.np-root[data-skin="minimal"] {
  border: 0;
  box-shadow: none;
  background: none;
  padding: 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.75);
}
.np-root[data-skin="minimal"] .np-art,
.np-root[data-skin="minimal"] .np-eyebrow,
.np-root[data-skin="minimal"] .np-progress { display: none; }

/* equalizer — вместо обложки живые полоски. */
.np-root[data-skin="equalizer"] .np-art { display: none; }
.np-root[data-skin="equalizer"] .np-bars { display: flex; }

/* Бегущая строка для длинных названий — включается настройкой. */
.np-root.is-scrolling .np-title {
  overflow: visible;
  text-overflow: clip;
  animation: np-marquee 12s linear infinite;
}
@keyframes np-marquee {
  0%, 12% { transform: translateX(0); }
  88%, 100% { transform: translateX(var(--np-shift, 0px)); }
}

@media (prefers-reduced-motion: reduce) {
  .np-root { transition: none; }
  .np-root.is-scrolling .np-title { animation: none; }
  .np-root[data-skin="vinyl"] .np-art { animation: none; }
  .np-bars i { animation: none; }
  .np-progress i { transition: none; }
}
