/* ============================================================================
   HarmonyAI — стили музыкального плеера и карточек в чате.

   Два вида плеера:
     1. .music-bar    — компактная строка в колонке чата.
     2. .music-screen — полноэкранное окно трека (открывается по нажатию).

   Оба построены на «жидком стекле»: под полупрозрачным слоем лежит СИЛЬНО
   размытая обложка текущего трека, поэтому плеер каждый раз перекрашивается
   в цвет альбома. Плеер намеренно тёмный в обеих темах — так же, как
   системные медиаплееры: это отдельная медийная поверхность, а не часть чата.

   Карточки в чате (.music-card) и подключение аккаунта (.music-connect)
   продолжают использовать переменные темы проекта.
   ========================================================================== */

:root {
  --music-bar-h: 56px;
  --music-fg: #f4f6f8;
  --music-dim: rgba(235, 240, 245, .62);
  --music-red: #ff375f;
  --music-yellow: #ffc800;
  --music-glass: rgba(22, 23, 26, .58);
  --music-edge: rgba(255, 255, 255, .14);
  --music-hi: rgba(255, 255, 255, .18);

  /* Цвета карточек в чате берём из темы проекта. */
  --music-card-bg: var(--bg2, #14161a);
  --music-card-fg: var(--text, #e9edf2);
  --music-card-dim: var(--text2, #99a2ad);
  --music-accent: var(--accent, #2f8fff);
  --music-line: var(--border, rgba(255, 255, 255, .10));
}

/* ============================================================== общие иконки */

.music-ico {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--music-fg);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  transition: background .16s ease, color .16s ease, transform .12s ease, opacity .16s ease;
}
.music-ico svg { width: 22px; height: 22px; display: block; }
.music-ico:hover { background: rgba(255, 255, 255, .12); }
.music-ico:active { transform: scale(.9); }
.music-ico:focus-visible { outline: 2px solid rgba(255, 255, 255, .7); outline-offset: 2px; }

/* Лайк: красное сердце — как в Яндекс.Музыке и на локскрине iOS. */
.music-ico--like.is-on { color: var(--music-red); }
.music-ico--like.is-on:hover { background: rgba(255, 55, 95, .16); }

/* ================================================================== панель

   Плеер живёт В ПОТОКЕ внутри колонки чата: JS вставляет его в #main перед
   .chat-area — то есть сразу ПОД кнопкой выбора модели в топбаре.
   Ширина ограничена рамками чата, поэтому панель никогда не вылезает
   за пределы чата и не перекрывает поле ввода. */

.music-bar {
  position: relative;
  z-index: 3;
  width: min(1180px, calc(100% - 32px));
  margin: 10px auto 4px;
  border-radius: 20px;
  overflow: hidden;
  isolation: isolate;
  color: var(--music-fg);
  background: var(--music-glass);
  border: 1px solid var(--music-edge);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow:
    inset 0 1px 0 var(--music-hi),
    0 8px 28px rgba(0, 0, 0, .34);
  font-size: 14px;
  user-select: none;
  display: none;
}

.music-bar.is-visible {
  display: block;
  animation: music-bar-in .3s cubic-bezier(.22, .8, .3, 1);
}
@keyframes music-bar-in {
  from { opacity: 0; transform: translateY(-10px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

/* Размытая обложка — источник цвета всей панели. */
.music-bar__amb {
  position: absolute;
  inset: -40%;
  z-index: -1;
  background-size: cover;
  background-position: center;
  filter: blur(38px) saturate(190%);
  transform: scale(1.25);
  opacity: 0;
  transition: opacity .45s ease;
}
.music-bar.has-art .music-bar__amb { opacity: .58; }

.music-bar__row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  min-height: 68px;
  box-sizing: border-box;
  cursor: pointer;
}
.music-bar__row:focus-visible { outline: 2px solid rgba(255, 255, 255, .6); outline-offset: -2px; border-radius: 20px; }

/* Обложка и названия — левая часть, клик открывает большой экран. */
.music-bar__lead {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
}
.music-bar__coverwrap {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, .1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .35), inset 0 0 0 .5px rgba(255, 255, 255, .18);
}
.music-bar__cover { width: 100%; height: 100%; object-fit: cover; display: block; }

.music-bar__meta { min-width: 0; flex: 0 1 auto; max-width: 340px; display: block; }
.music-bar__title {
  display: block;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .1px;
  line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.music-bar__artist {
  display: block;
  color: var(--music-dim);
  font-size: 12.5px;
  line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Центральные транспортные кнопки — как в Яндекс Музыке. */
.music-bar__ctrls {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}
.music-bar__ctrls .music-ico { width: 40px; height: 40px; }
.music-bar__ctrls .music-ico svg { width: 22px; height: 22px; }
.music-bar__ctrls .music-ico--step svg { width: 26px !important; height: 26px !important; }
.music-bar__ctrls .music-ico.is-on { color: var(--music-yellow); }

/* Главная кнопка бара — жёлтый круг (фирменный цвет Яндекса). */
.music-bar .music-ico--play {
  width: 46px;
  height: 46px;
  background: var(--music-yellow);
  color: #161616;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .4);
}
.music-bar .music-ico--play:hover { background: var(--music-yellow); filter: brightness(1.06); }
.music-bar .music-ico--play svg { width: 26px; height: 26px; }

/* Правая часть: кнопка очереди. */
.music-bar__acts { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; margin-left: auto; }
.music-bar__acts .music-ico { width: 38px; height: 38px; }
.music-bar__acts .music-ico svg { width: 22px; height: 22px; }

/* Тонкая линия прогресса по нижней кромке — не отвлекает, но всё видно. */
.music-bar__line {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: rgba(255, 255, 255, .1);
}
.music-bar__line i {
  display: block;
  height: 100%;
  width: 0;
  background: rgba(255, 255, 255, .85);
  border-radius: 0 2px 2px 0;
  transition: width .2s linear;
}

/* Загрузка ссылки — деликатная пульсация кнопки. */
.music-bar.is-loading .music-ico--play { animation: music-pulse 1s ease-in-out infinite; }
@keyframes music-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

/* ========================================================= окно трека */

.music-screen {
  position: fixed;
  inset: 0;
  z-index: 900;
  color: var(--music-fg);
  overflow: hidden;
  opacity: 0;
  transition: opacity .26s ease;
}
.music-screen.is-open { opacity: 1; }
.music-screen[hidden] { display: none; }

/* Обложка во весь экран, размытая до состояния цветного тумана. */
.music-screen__amb {
  position: absolute;
  inset: -25%;
  background-size: cover;
  background-position: center;
  filter: blur(70px) saturate(200%);
  transform: scale(1.2);
  opacity: 0;
  transition: opacity .5s ease;
}
.music-screen.has-art .music-screen__amb { opacity: .55; }

/* Тёмная вуаль поверх тумана — именно она делает фон «чёрным стеклом». */
.music-screen__veil {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(0, 0, 0, .35), rgba(0, 0, 0, .82) 70%),
    rgba(8, 8, 10, .72);
  backdrop-filter: blur(40px) saturate(160%);
  -webkit-backdrop-filter: blur(40px) saturate(160%);
}

.music-screen__inner {
  position: relative;
  height: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) clamp(20px, 4vw, 56px) max(18px, env(safe-area-inset-bottom));
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transform: translateY(22px) scale(.98);
  opacity: 0;
  transition: transform .32s cubic-bezier(.22, .8, .3, 1), opacity .28s ease;
}
.music-screen.is-open .music-screen__inner { transform: none; opacity: 1; }

.music-screen__grip {
  width: 38px; height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .28);
  margin: 2px auto 0;
  flex: 0 0 auto;
}

.music-screen__top {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex: 0 0 auto;
}

/* ------- сцена: обложка с кнопками внутри + крупные названия справа ------- */

.music-screen__stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  gap: clamp(28px, 5vw, 72px);
}

.music-screen__artwrap {
  position: relative;
  flex: 0 1 auto;
  width: min(44vh, 420px);
  max-width: 44%;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
}
.music-screen__artwrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 24px;
  background: rgba(255, 255, 255, .06);
  box-shadow:
    0 26px 60px rgba(0, 0, 0, .55),
    inset 0 0 0 .5px rgba(255, 255, 255, .14);
  transition: transform .3s cubic-bezier(.22, .8, .3, 1);
}
.music-screen:not(.is-playing) .music-screen__artwrap img { transform: scale(.965); }

/* Кнопки прямо на обложке: prev / play / next по центру, повтор и лайк — по углам. */
.music-screen__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 2.2vw, 26px);
}
.music-screen__overlay .music-ico--step {
  width: 54px; height: 54px;
  color: #fff;
}
.music-screen__overlay .music-ico--step svg { width: 34px !important; height: 34px !important; }
.music-ico--onart { filter: drop-shadow(0 2px 12px rgba(0, 0, 0, .55)); }
.music-ico--onart:hover { background: rgba(0, 0, 0, .22); }

.music-screen__corner { position: absolute; bottom: 14px; display: flex; gap: 6px; }
.music-screen__corner--l { left: 14px; }
.music-screen__corner--r { right: 14px; }
.music-screen__corner .music-ico { width: 42px; height: 42px; color: #fff; }
.music-screen__corner .music-ico svg { width: 24px; height: 24px; }
.music-screen__corner .music-ico--like.is-on { color: var(--music-red); }

/* Крупная типографика — как в Яндекс Музыке. */
.music-screen__info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 2vh, 22px);
}
.music-screen__title {
  font-size: clamp(26px, 4.2vw, 56px);
  font-weight: 800;
  letter-spacing: .2px;
  line-height: 1.08;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.music-screen__artist {
  font-size: clamp(17px, 2.4vw, 30px);
  font-weight: 600;
  color: var(--music-dim);
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.music-screen__seekwrap { max-width: 560px; }

/* Нижний ряд: «Ещё» слева, очередь справа — круглые тёмные кнопки. */
.music-screen__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  padding: 2px 2px 4px;
}
.music-round {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .09);
  border: 1px solid rgba(255, 255, 255, .07);
}
.music-round svg { width: 23px; height: 23px; }
.music-round:hover { background: rgba(255, 255, 255, .16); }

/* Кнопка play — жёлтый круг на обложке. */
.music-main {
  appearance: none;
  border: 0;
  width: clamp(72px, 12vh, 104px);
  height: clamp(72px, 12vh, 104px);
  border-radius: 50%;
  background: var(--music-yellow);
  color: #161616;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .45);
  transition: transform .12s ease, filter .16s ease;
}
.music-main svg { width: 38px; height: 38px; display: block; }
.music-main:hover { filter: brightness(1.06); }
.music-main:active { transform: scale(.93); }
.music-main:focus-visible { outline: 3px solid rgba(255, 255, 255, .55); outline-offset: 3px; }

.music-screen.is-loading .music-main { animation: music-pulse 1s ease-in-out infinite; }

/* ------------------------------------------------------------- перемотка */

.music-screen__seekwrap { flex: 0 0 auto; }

.music-seek {
  position: relative;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .18);
  cursor: pointer;
  touch-action: none;
  transition: height .14s ease;
}
.music-seek:hover,
.music-seek.is-dragging { height: 8px; }
.music-seek:focus-visible { outline: 2px solid rgba(255, 255, 255, .7); outline-offset: 4px; }

.music-seek__buf,
.music-seek__played {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 0;
  border-radius: inherit;
}
.music-seek__buf { background: rgba(255, 255, 255, .16); }
.music-seek__played { background: #fff; }

.music-seek__thumb {
  position: absolute;
  top: 50%; left: 0;
  width: 13px; height: 13px;
  margin-left: -6.5px;
  border-radius: 50%;
  background: #fff;
  transform: translateY(-50%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .5);
  transition: transform .14s ease;
}
.music-seek.is-dragging .music-seek__thumb { transform: translateY(-50%) scale(1.25); }

.music-screen__times {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: var(--music-dim);
  font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------- кнопки */

/* Шаг вперёд/назад поверх обложки: крупнее и с тенью, чтобы читались
   на любом альбоме. */
.music-ico--step svg { width: 32px !important; height: 32px !important; }
.music-ico--onart {
  color: #fff;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, .55));
}

/* Главная кнопка — жёлтый круг, как в Яндекс.Музыке. */
.music-main {
  appearance: none;
  border: 0;
  width: clamp(72px, 11vh, 104px);
  height: clamp(72px, 11vh, 104px);
  border-radius: 50%;
  background: var(--music-yellow);
  color: #17150e;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  box-shadow: 0 14px 36px rgba(0, 0, 0, .5);
  transition: transform .12s ease, filter .16s ease;
}
.music-main svg { width: 34px; height: 34px; display: block; }
.music-main:hover { filter: brightness(.94); }
.music-main:active { transform: scale(.93); }
.music-main:focus-visible { outline: 3px solid rgba(255, 255, 255, .55); outline-offset: 3px; }

.music-screen.is-loading .music-main { animation: music-pulse 1s ease-in-out infinite; }

/* ==================================================== шторка «Ещё» */

.music-sheet {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  background: rgba(0, 0, 0, .4);
  animation: music-fade .2s ease;
}
.music-sheet[hidden] { display: none; }
@keyframes music-fade { from { opacity: 0; } to { opacity: 1; } }

.music-sheet__panel {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: 8px 14px max(16px, env(safe-area-inset-bottom));
  box-sizing: border-box;
  border-radius: 22px 22px 0 0;
  background: rgba(28, 29, 33, .82);
  border: 1px solid var(--music-edge);
  border-bottom: 0;
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  box-shadow: inset 0 1px 0 var(--music-hi), 0 -12px 40px rgba(0, 0, 0, .5);
  animation: music-sheet-in .28s cubic-bezier(.22, .8, .3, 1);
}
@keyframes music-sheet-in { from { transform: translateY(26px); } to { transform: none; } }

.music-sheet__grip {
  width: 38px; height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .3);
  margin: 2px auto 10px;
}

.music-sheet__rows { display: flex; flex-direction: column; gap: 2px; }

.music-sheet__row {
  appearance: none;
  border: 0;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 10px;
  border-radius: 12px;
  background: transparent;
  color: var(--music-fg);
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  transition: background .14s ease;
}
.music-sheet__row:hover { background: rgba(255, 255, 255, .1); }
.music-sheet__row svg { width: 21px; height: 21px; flex: 0 0 auto; color: currentColor; }
.music-sheet__row span { flex: 1 1 auto; }
.music-sheet__row b { font-weight: 500; color: var(--music-dim); font-size: 13.5px; }
.music-sheet__row.is-on { color: #6ea8ff; }
.music-sheet__row.is-on b { color: #6ea8ff; }
.music-sheet__row--vol { cursor: default; }
.music-sheet__row--vol:hover { background: transparent; }
.music-sheet__row--vol input {
  flex: 1 1 auto;
  accent-color: #fff;
  cursor: pointer;
}
#shClose { color: #ff6b6b; }

.music-sheet__title {
  padding: 12px 10px 6px;
  font-size: 12.5px;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: var(--music-dim);
}

/* ------------------------------------------------- панель очереди треков */

/* Отдельная поверхность уровня body: открывается и поверх чата (кнопка «…»
   в плеере), и поверх большого экрана (кнопка очереди). */
.music-qp {
  position: fixed;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: min(420px, calc(100vw - 24px));
  z-index: 950;
  display: flex;
  flex-direction: column;
  border-radius: 24px;
  color: var(--music-fg);
  background: rgba(38, 39, 42, .92);
  border: 1px solid var(--music-edge);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  box-shadow: inset 0 1px 0 var(--music-hi), 0 24px 80px rgba(0, 0, 0, .5);
  opacity: 0;
  visibility: hidden;
  transform: translateX(26px);
  transition: opacity .24s ease, transform .28s cubic-bezier(.22, .8, .3, 1), visibility .24s;
}
.music-qp.is-open { opacity: 1; visibility: visible; transform: none; }

.music-qp__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 6px;
  flex: 0 0 auto;
}
.music-qp__caption {
  font-size: 13px;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: var(--music-dim);
}

.music-qp__list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 10px 76px;
  -webkit-overflow-scrolling: touch;
}

.music-qp__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 14px;
  cursor: pointer;
  transition: background .14s ease;
}
.music-qp__row:hover, .music-qp__row.is-current { background: rgba(255, 255, 255, .09); }
.music-qp__row.is-current { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1); }
.music-qp__cover {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border-radius: 10px;
  object-fit: cover;
  background: rgba(255, 255, 255, .1);
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .14);
}
.music-qp__meta { flex: 1 1 auto; min-width: 0; display: block; }
.music-qp__t {
  display: block;
  font-weight: 700;
  font-size: 14.5px;
  line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.music-qp__a {
  display: block;
  color: var(--music-dim);
  font-size: 12.5px;
  line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.music-qp__more { width: 36px; height: 36px; flex: 0 0 auto; }
.music-qp__more svg { width: 20px; height: 20px; }
.music-qp__row.is-current .music-qp__t { color: var(--music-yellow); }

/* Плавающая кнопка очереди — как на референсе, справа внизу панели. */
.music-qp__fab {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .08);
  background: rgba(255, 255, 255, .1);
  color: var(--music-fg);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .4);
  transition: background .16s ease, transform .12s ease;
}
.music-qp__fab svg { width: 24px; height: 24px; }
.music-qp__fab:hover { background: rgba(255, 255, 255, .18); }
.music-qp__fab:active { transform: scale(.93); }

/* ------------------------------------------------- контекст-меню трека */

.music-ctx {
  position: fixed;
  z-index: 960;
  min-width: 250px;
  padding: 6px;
  border-radius: 20px;
  color: var(--music-fg);
  background: rgba(56, 57, 61, .96);
  border: 1px solid var(--music-edge);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .5);
  display: none;
}
.music-ctx.is-open { display: block; animation: music-fade .16s ease; }

.music-ctx__row {
  appearance: none;
  border: 0;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 14px;
  background: transparent;
  color: var(--music-fg);
  font-size: 14.5px;
  text-align: left;
  cursor: pointer;
  transition: background .14s ease;
}
.music-ctx__row:hover { background: rgba(255, 255, 255, .1); }
.music-ctx__row svg { width: 20px; height: 20px; flex: 0 0 auto; }
.music-ctx__row[data-act="like"].is-liked { color: var(--music-red); }

/* Пока окно трека открыто, фон под ним не должен прокручиваться. */
body.music-screen-open { overflow: hidden; }

/* ====================================================== карточки в чате */

.music-card {
  border: 1px solid var(--music-line);
  border-radius: 14px;
  overflow: hidden;
  margin: 8px 0;
  background: rgba(127, 127, 127, .05);
  color: var(--music-card-fg);
}

.music-card__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
}

.music-card__cover {
  width: 56px; height: 56px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--music-line);
  flex: 0 0 auto;
}

.music-card__info { min-width: 0; flex: 1 1 auto; }
.music-card__title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-card__sub { color: var(--music-card-dim); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.music-card__play {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 0;
  background: var(--music-accent);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .1s ease, filter .14s ease;
}
.music-card__play:hover { filter: brightness(1.12); }
.music-card__play:active { transform: scale(.92); }

.music-card__list { border-top: 1px solid var(--music-line); }

.music-card__row {
  display: grid;
  grid-template-columns: 26px 1fr auto auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  background: transparent;
  color: var(--music-card-fg);
  text-align: left;
  cursor: pointer;
  font-size: 13.5px;
}
.music-card__row + .music-card__row { border-top: 1px solid var(--music-line); }
.music-card__row:hover { background: rgba(127, 127, 127, .12); }
.music-card__row[disabled] { opacity: .45; cursor: not-allowed; }
.music-card__n { color: var(--music-card-dim); font-variant-numeric: tabular-nums; }
.music-card__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-card__artist { color: var(--music-card-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 34%; }
.music-card__dur { color: var(--music-card-dim); font-variant-numeric: tabular-nums; }

/* Одиночный трек: компактная «таблетка». */
.music-card--single { border-radius: 999px; padding: 5px; max-width: 430px; }
.music-card--single .music-card__head { padding: 4px 14px 4px 4px; gap: 13px; }
.music-card--single .music-card__cover { width: 46px; height: 46px; border-radius: 999px; }
.music-card--single .music-card__title { font-size: 15px; font-weight: 700; }
.music-card--single .music-card__sub { font-size: 13px; }
.music-card--single .music-card__play { width: 38px; height: 38px; }

/* ============================================================ подключение */

.music-connect { padding: 14px; color: var(--music-card-fg, inherit); line-height: 1.5; }
.music-connect__code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 3px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(127, 127, 127, .18);
  border: 1px solid rgba(127, 127, 127, .28);
  color: var(--music-card-fg, inherit);
  display: inline-block;
  margin: 8px 0;
  user-select: all;
}
.music-connect__btn,
.music-connect__btn:link,
.music-connect__btn:visited,
.music-connect__btn:hover,
.music-connect__btn:active {
  display: inline-block;
  padding: 11px 20px;
  margin-top: 4px;
  border-radius: 10px;
  background: var(--music-accent, #3b6ef5);
  color: #ffffff;
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.25;
  letter-spacing: .1px;
  border: 1px solid rgba(0, 0, 0, .18);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .22);
  text-shadow: 0 1px 1px rgba(0, 0, 0, .28);
  cursor: pointer;
}
.music-connect__btn:hover { filter: brightness(1.1); }
.music-connect__btn:active { transform: translateY(1px); }
.music-connect__hint { color: var(--music-card-dim); font-size: 12.5px; margin-top: 8px; }

/* ============================================================== мобильные */

@media (max-width: 760px) {
  .music-bar { width: calc(100% - 16px); margin-top: 6px; border-radius: 15px; }
  .music-bar__row { gap: 10px; padding: 7px 8px; }
  .music-card--single { max-width: 100%; }
  .music-card--single .music-card__title { font-size: 14.5px; }
  .music-card__artist { display: none; }

  .music-screen__inner { padding-left: 18px; padding-right: 18px; gap: 12px; }
  /* На узких экранах центральные кнопки бара уступают мета-данным:
     громкость/шафл/повтор убираем, остаются prev/play/next/лайк и «…». */
  .music-bar__ctrls { position: static; transform: none; margin-left: auto; }
  .music-bar__ctrls .music-ico--mute,
  .music-bar__ctrls .music-ico--shuffle,
  .music-bar__ctrls .music-ico--repeat { display: none; }
  .music-bar__ctrls .music-ico--play { width: 42px; height: 42px; }
  .music-bar__lead { min-width: 0; }
  .music-bar__meta { max-width: 40vw; }

  /* Экран трека: колонка — обложка сверху, названия ниже. */
  .music-screen__stage { flex-direction: column; justify-content: center; gap: 18px; }
  .music-screen__artwrap { width: min(72vw, 320px); max-width: none; }
  .music-screen__title { font-size: 24px; }
  .music-screen__artist { font-size: 15px; }
  .music-screen__seekwrap { max-width: none; width: 100%; }
  .music-main { width: 64px; height: 64px; }
  .music-main svg { width: 30px; height: 30px; }
  .music-round { width: 46px; height: 46px; }

  /* Панель очереди на мобильных — во всю ширину с отступами. */
  .music-qp { top: 8px; right: 8px; bottom: 8px; width: calc(100vw - 16px); border-radius: 20px; }
}

/* Низкие экраны: обложка уступает место кнопкам, чтобы ничего не срезалось. */
@media (max-height: 620px) {
  .music-screen__artwrap { width: min(48vh, 260px); }
  .music-screen__title { font-size: 20px; }
  .music-screen__artist { font-size: 14px; }
  .music-main { width: 58px; height: 58px; }
  .music-main svg { width: 26px; height: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  .music-bar.is-visible,
  .music-sheet,
  .music-sheet__panel { animation: none; }
  .music-bar.is-loading .music-ico--play,
  .music-screen.is-loading .music-main { animation: none; }
  .music-screen,
  .music-screen__inner,
  .music-screen__artwrap img,
  .music-qp,
  .music-bar__line i { transition: none; }
}

/* Совсем старые движки без backdrop-filter: делаем фон плотным,
   чтобы текст оставался читаемым. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .music-bar { background: rgba(22, 23, 26, .94); }
  .music-screen__veil { background: rgba(8, 8, 10, .96); }
  .music-sheet__panel { background: rgba(28, 29, 33, .97); }
}


/* Текстовый ответ под карточкой трека.
   Нужен для составных просьб вроде «найди Believer и расскажи, кто написал»:
   карточка и ответ живут в ОДНОМ пузыре, а не в двух сообщениях. */
.music-answer{margin-top:10px;line-height:1.55;}
.music-answer:empty{display:none;}
.music-answer > :first-child{margin-top:0;}
.music-answer > :last-child{margin-bottom:0;}

/* ====================================================== Плейлисты (окно настроек)

   Экраны живут внутри окна настроек, поэтому цвета берём из темы проекта
   (--bg2 / --border / --text), а не из тёмной палитры плеера: список треков —
   часть интерфейса, а не медиа-поверхность. Исключение — шапка плейлиста
   с размытой обложкой: она намеренно тёмная в обеих темах.
   ========================================================================== */

/* Кнопка справа в шапке: «создать плейлист» и «ещё». */
.pl-head-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  line-height: 0;
  font: inherit;
  -webkit-appearance: none;
  appearance: none;
  transition: background .12s;
}
.pl-head-btn:hover { background: var(--hover); }
.pl-head-btn svg { display: block; width: 18px; height: 18px; }

/* ---------------------------------------------------------- список плейлистов */

.pl-rows {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.pl-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 14px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: background .12s;
}
.pl-row + .pl-row { border-top: 1px solid var(--border2); }
.pl-row:hover { background: var(--hover); }

.pl-row__cover {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: 8px;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--hover);
  overflow: hidden;
}
.pl-row__cover.is-empty { background: linear-gradient(135deg, rgba(124, 92, 255, .35), rgba(124, 92, 255, .12)); }

.pl-cover--liked { background: linear-gradient(140deg, #ff4d6d, #c9184a); color: #fff; }
.pl-cover--liked svg { width: 24px; height: 24px; display: block; }

.pl-cover--found {
  background: linear-gradient(140deg, #f3f4f6, #c7ccd4);
  color: #14161a;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: .5px;
}

.pl-row__meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pl-row__title { font-size: 14.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-row__sub { font-size: 12.5px; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-row__chev { color: var(--text2); flex-shrink: 0; line-height: 0; }

.pl-note {
  margin-top: 12px;
  padding: 0 2px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text2);
}

/* ------------------------------------------------------------ шапка плейлиста */

.pl-hero {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 14px;
  isolation: isolate;
  background: var(--bg2);
  border: 1px solid var(--border);
}

/* Сильное размытие обложки — шапка каждый раз перекрашивается в цвет альбома. */
.pl-hero__bg {
  position: absolute;
  inset: -30%;
  z-index: 0;
  background-size: cover;
  background-position: center;
  filter: blur(34px) saturate(1.5);
  transform: scale(1.15);
  opacity: .85;
}
.pl-hero__veil {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(10, 11, 13, .35), rgba(10, 11, 13, .78));
}
.pl-hero__inner {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
}

.pl-hero__cover {
  width: 74px;
  height: 74px;
  flex-shrink: 0;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .38);
  background: rgba(255, 255, 255, .12);
}
.pl-hero__cover.is-empty { background: rgba(255, 255, 255, .14); }

.pl-hero__meta { flex: 1; min-width: 0; }
.pl-hero__title {
  font-size: 21px;
  font-weight: 800;
  line-height: 1.2;
  color: #fff;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.pl-hero__sub { margin-top: 5px; font-size: 12.5px; color: rgba(255, 255, 255, .72); }

.pl-hero__play {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  background: #ffdb4d;
  color: #16171a;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .3);
  transition: transform .12s;
}
.pl-hero__play:hover { transform: scale(1.05); }
.pl-hero__play:active { transform: scale(.96); }
.pl-hero__play svg { width: 26px; height: 26px; display: block; margin-left: 2px; }

/* ------------------------------------------------------------- жанровые чипы */

.pl-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.pl-chips::-webkit-scrollbar { display: none; }

.pl-chip {
  flex-shrink: 0;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: background .12s, color .12s, border-color .12s;
}
.pl-chip:hover { background: var(--hover); color: var(--text); }
.pl-chip.is-on { border-color: var(--text); color: var(--text); font-weight: 600; }

/* ---------------------------------------------------------------- список треков */

.pl-tracks { display: flex; flex-direction: column; padding-bottom: 24px; }

.pl-track {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px;
  border-radius: 10px;
  transition: background .12s;
}
.pl-track:hover { background: var(--hover); }
.pl-track.is-current .pl-track__title { color: var(--accent, #7c5cff); font-weight: 700; }
.pl-track.is-off { opacity: .45; }

.pl-track__cover {
  position: relative;
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  background: var(--hover);
  cursor: pointer;
  line-height: 0;
}
.pl-track__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Кружок play/pause появляется поверх обложки — отдельная кнопка не нужна. */
.pl-track__state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .45);
  color: #fff;
  opacity: 0;
  transition: opacity .12s;
}
.pl-track__state svg { width: 20px; height: 20px; display: block; }
.pl-track__cover:hover .pl-track__state,
.pl-track.is-current .pl-track__state { opacity: 1; }

.pl-track__meta { flex: 1; min-width: 0; cursor: pointer; }
.pl-track__title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pl-track__artist {
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--text2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pl-track__like,
.pl-track__dots {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  transition: background .12s, color .12s;
}
.pl-track__like svg,
.pl-track__dots svg { width: 20px; height: 20px; display: block; }
.pl-track__like:hover,
.pl-track__dots:hover { background: var(--hover); color: var(--text); }
.pl-track__like.is-on { color: var(--music-red, #ff375f); }

.pl-empty {
  padding: 26px 6px;
  text-align: center;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text2);
}

/* -------------------------------------------------------------- меню «три точки» */

.pl-menu {
  position: fixed;
  z-index: 940;
  min-width: 216px;
  max-width: 280px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg2);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .34);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pl-menu__row {
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background .12s;
}
.pl-menu__row:hover { background: var(--hover); }
.pl-menu__row.is-danger { color: #ff5c5c; }

/* ------------------------------------------------------------------ уведомление */

.pl-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--music-bar-h, 56px) + 24px);
  transform: translate(-50%, 12px);
  z-index: 960;
  max-width: min(92vw, 420px);
  padding: 11px 16px;
  border-radius: 12px;
  background: rgba(24, 25, 28, .94);
  color: #f4f6f8;
  font-size: 13.5px;
  line-height: 1.45;
  text-align: center;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .38);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
}
.pl-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* На узких экранах шапка ниже, а кнопка воспроизведения крупнее под палец. */
@media (max-width: 600px) {
  .pl-hero__inner { padding: 14px; gap: 12px; }
  .pl-hero__cover { width: 66px; height: 66px; }
  .pl-hero__title { font-size: 19px; }
  .pl-track__like, .pl-track__dots { width: 38px; height: 38px; }
  .pl-menu { min-width: 200px; }
}

/* ============ АУДИТ (раунд 7): плейлисты на мобильных ============ */
@media (max-width: 600px) {
  .pl-track__like, .pl-track__dots { width: 42px; height: 42px; }
  .pl-menu__row { min-height: 44px; }
  .pl-chip { padding: 9px 15px; }
  /* правый край ленты жанров растворяется — видно, что её можно листать */
  .pl-chips{-webkit-mask-image:linear-gradient(to right,#000 86%,transparent 100%);
            mask-image:linear-gradient(to right,#000 86%,transparent 100%);}
}
/* тост поднимается только когда плеер виден (класс раньше ничего не делал) */
body:not(.has-music-bar) .pl-toast{bottom:24px;}
