/* ===== Spectra UI (этап 2): компоненты нового дизайна =====
   Подключается после inline-стилей base.html и выигрывает каскадом.
   Принципы: воздух, минимум текста, одно действие на экран. */

/* Тонкий хедер */
.shell-header { display: flex; align-items: center; gap: 18px;
  padding: 2px 0 18px; }
.shell-logo { font-family: "Unbounded", sans-serif; font-size: 19px;
  font-weight: 700; color: var(--fg); text-decoration: none; letter-spacing: .3px; }
.shell-nav { display: flex; gap: 4px; margin-left: auto; }
.shell-link { color: var(--muted); text-decoration: none; font: 600 13px "Manrope",
  sans-serif; padding: 8px 14px; border-radius: 999px;
  transition: color var(--fast), background var(--fast); }
.shell-link:hover { color: var(--fg); background: var(--surface); }
@media (max-width: 480px) {
  .shell-header { padding-bottom: 12px; }
  .shell-link { padding: 8px 10px; }
}

/* ===== Регистрация и мини-кабинет (Task 2 auth-premium) =====
   Центрированная карточка вместо форм на всю ширину — то же ощущение,
   что и у .card/.btn, но под узкую форму логина/регистрации. */
.auth-wrap { max-width: 380px; margin: 40px auto; }
.auth-card { padding: 24px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px;
  color: var(--muted); }
.field input { background: var(--surface-2); color: var(--fg);
  border: 1px solid var(--border); border-radius: 9px; padding: 9px 12px;
  font: 500 14px "Manrope", sans-serif; }
.field input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.auth-form .btn { margin-top: 4px; }
.auth-error { color: var(--danger); font-size: 13px; margin: 0 0 10px; }
.auth-ok { color: var(--accent); font-size: 13px; margin: 0 0 10px; }
.auth-switch { font-size: 13px; margin-top: 14px; }

/* ===== Главная ===== */
.hero-clean { margin: 48px 0 10px; }
.hero-sub { font-size: 15px; margin-top: 10px; }
.live-card { background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px 24px; margin: 18px auto;
  max-width: 660px; animation: rise .35s cubic-bezier(.2,.8,.3,1) both; }
.live-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.live-title { font-weight: 800; font-size: 15px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.live-state { color: var(--muted); font-size: 12.5px; flex: 0 0 auto; }
.live-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 26px; }
.live-stages { list-style: none; margin: 0; padding: 0; }
.live-stages li { padding: 5px 0 5px 26px; position: relative; font-size: 13.5px;
  color: var(--muted); transition: color var(--fast); }
.live-stages li::before { content: ""; position: absolute; left: 2px; top: 50%;
  width: 14px; height: 14px; transform: translateY(-50%); border-radius: 50%;
  border: 2px solid var(--border); }
.live-stages li[data-status="running"] { color: var(--fg); }
.live-stages li[data-status="running"]::before { border-color: var(--primary);
  border-top-color: transparent; animation: spin 1s linear infinite; }
.live-stages li[data-status="ok"] { color: var(--fg); }
.live-stages li[data-status="ok"]::before { border-color: var(--accent);
  background: var(--accent);
  content: ""; }
.live-stages li[data-status="failed"]::before { border-color: var(--danger); }
@keyframes spin { to { transform: translateY(-50%) rotate(360deg); } }
.live-facts { margin: 0; display: grid; grid-template-columns: auto 1fr;
  gap: 5px 14px; align-content: start; font-size: 13.5px; }
.live-facts dt { color: var(--muted); }
.live-facts dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.live-open { margin-top: 16px; }
@media (max-width: 560px) { .live-grid { grid-template-columns: 1fr; } }

/* ===== Вкладки движков над плеером ===== */
.engine-tabs { display: flex; gap: 6px; margin: 14px 0 -6px; flex-wrap: wrap; }
.etab { color: var(--muted); text-decoration: none; font: 600 12.5px "Manrope",
  sans-serif; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border);
  transition: color var(--fast), border-color var(--fast), background var(--fast); }
.etab:hover { color: var(--fg); border-color: #3A3A66; }
.etab.on { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ===== Дорожки плеера (этап 3, task 3): без спектрограмм, премиальный вид =====
   Разметка (.lane > .lane-strip + .lane-side + .lane-body) и переменная
   --lane-color задаются в track.html; здесь только внешний вид — база
   лейна в base.html (padding/border-bottom) полностью перекрывается. */
.lane { display: flex; align-items: stretch; gap: 14px; padding: 14px 4px;
  border: 0; border-radius: 10px; transition: background var(--fast); }
.lane:hover { background: rgba(255, 255, 255, .03); }
.lane-strip { width: 4px; flex: 0 0 auto; align-self: stretch; border-radius: 3px;
  background: var(--lane-color, var(--border)); opacity: .55;
  transition: opacity var(--fast), box-shadow var(--fast); }
.lane.lane-audible .lane-strip { opacity: 1; }
#mixer.playing .lane.lane-audible .lane-strip { box-shadow: 0 0 10px var(--lane-color, var(--accent)); }
.lane.lane-solo-on .lane-strip { background: var(--warn); opacity: 1; }
.lane:not(.lane-audible) .lane-chip { opacity: .45; }
.lane:not(.lane-audible) .wave { opacity: .55; transition: opacity var(--fast); }

.lane-side { display: flex; flex-direction: column; gap: 8px; flex: 0 0 130px; min-width: 0; }
.lane-chip { font-size: 11px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase;
  color: var(--lane-color, var(--fg)); transition: opacity var(--fast); }
.lane-ctl { display: flex; gap: 6px; flex: 0 0 auto; }
.lane-note { font-size: 10.5px; line-height: 1.4; }

/* Громкость: тонкий трек, круглая ручка со свечением в цвете стема —
   accent-color больше не используется, стилизуем оба движка вручную. */
input.lane-vol { -webkit-appearance: none; appearance: none; width: 110px; height: 16px;
  background: transparent; flex: 0 0 auto; margin: 2px 0; }
input.lane-vol::-webkit-slider-runnable-track { height: 3px; border-radius: 2px;
  background: var(--border); }
input.lane-vol::-moz-range-track { height: 3px; border-radius: 2px; background: var(--border); }
input.lane-vol::-webkit-slider-thumb { -webkit-appearance: none; appearance: none;
  width: 12px; height: 12px; border-radius: 50%; margin-top: -4.5px;
  background: var(--lane-color, var(--primary)); border: 0; cursor: pointer;
  box-shadow: 0 0 8px var(--lane-color, var(--primary)); transition: box-shadow var(--fast); }
input.lane-vol::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; border: 0;
  background: var(--lane-color, var(--primary)); cursor: pointer;
  box-shadow: 0 0 8px var(--lane-color, var(--primary)); }
input.lane-vol:hover::-webkit-slider-thumb { box-shadow: 0 0 12px var(--lane-color, var(--primary)); }
@media (max-width: 640px) { input.lane-vol { display: none; } } /* на мобиле — фейдеры */

/* Скачивание стема: SVG-стрелка в лоток, лёгкий подъём по ховеру */
.lane-dl { display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 7px; color: var(--muted);
  text-decoration: none; margin-left: 0; align-self: flex-start;
  transition: color var(--fast), background var(--fast), transform var(--fast); }
.lane-dl:hover { color: var(--fg); background: var(--surface-2); transform: translateY(-1px); }
.lane-dl svg { display: block; }

.lane-body { flex: 1; min-width: 0; display: flex; align-items: center; }
.lane-body .wave { width: 100%; height: 72px; }

/* ===== Мобильный микшер: вертикальные фейдеры ===== */
#mobile-mixer { display: none; }
@media (max-width: 640px) {
  #mixer .lane { display: none; }         /* дорожки уходят, транспорт остаётся */
  #mobile-mixer { display: block; }
}
#mob-faders { display: flex; gap: 10px; justify-content: center;
  align-items: stretch; height: 300px; padding: 8px 0 14px; }
.mob-fader { position: relative; flex: 1; max-width: 76px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border); overflow: hidden;
  cursor: pointer; touch-action: none; }
.mob-fader-fill { position: absolute; left: 0; right: 0; bottom: 0; height: 100%;
  background: var(--fader-color); opacity: .85; transition: opacity var(--fast); }
.mob-fader.off .mob-fader-fill { opacity: .18; }
.mob-fader-label { position: absolute; left: 0; right: 0; bottom: 10px;
  text-align: center; font: 800 10.5px "Manrope", sans-serif; letter-spacing: .6px;
  text-transform: uppercase; color: rgba(255,255,255,.92); z-index: 2;
  pointer-events: none; }
.mob-transport { display: flex; gap: 14px; align-items: center;
  justify-content: center; margin-top: 6px; }
.mob-skip { min-height: 44px; }

/* ===== Владение: чужой трек — только текст (не предупреждение, тихая строка) ===== */
.audio-locked { color: var(--muted); font-size: 13.5px; padding: 10px 0; margin: 0; }

/* ===== Главная-пульс (этап 2.5): живые линии в hero, счётчики, популярное ===== */
/* Hero — сцена для линий: им нужен вертикальный воздух, текст по центру */
.hero { position: relative; overflow: visible; }
.hero-clean { min-height: 240px; display: flex; flex-direction: column;
  justify-content: center; margin: 24px 0 4px; }
/* canvas — replaced-элемент: inset:0 без явных width/height его не растягивает
   (в отличие от div), поэтому размеры задаём явно */
#pulse-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none;
  opacity: .8; width: 100%; height: 100%; display: block; }
@media (max-width: 640px) { .hero-clean { min-height: 190px; } }

/* Одно чистое поле без карточек и границ (решение владельца 28.07):
   только воздух — виз, число, подпись */
.pulse-grid { display: flex; flex-wrap: wrap; gap: 34px 56px; margin: 22px 0 10px; }
.pulse-row { display: flex; flex-direction: column; gap: 8px; min-width: 128px;
  animation: rise .35s cubic-bezier(.2,.8,.3,1) both; }
.pulse-row:nth-child(2) { animation-delay: .05s } .pulse-row:nth-child(3) { animation-delay: .1s }
.pulse-row:nth-child(4) { animation-delay: .15s } .pulse-row:nth-child(5) { animation-delay: .2s }
.pulse-row:nth-child(6) { animation-delay: .25s } .pulse-row:nth-child(7) { animation-delay: .3s }
.pulse-row:hover .pv { opacity: .95; }
.pulse-row:hover .pulse-num { color: var(--pulse-color); }
.pulse-num { transition: color var(--fast); }
.pulse-num { font-family: "Unbounded", sans-serif; font-size: clamp(26px, 4vw, 40px);
  font-weight: 700; line-height: 1.15; color: var(--fg); font-variant-numeric: tabular-nums; }
.pulse-label { font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .6px; }

/* Мини-визы метрик: каждая говорит на языке своего смысла. Общая база: */
.pv { width: 72px; height: 24px; opacity: .65; transition: opacity var(--fast); }
.pv rect, .pv circle { fill: var(--pulse-color); }
.pv path { fill: none; stroke: var(--pulse-color); stroke-width: 2; stroke-linecap: round; }

/* «Треков разобрано» — силуэт волны: бары дышат вразнобой */
.pv-bars rect { transform-origin: center; transform-box: fill-box;
  animation: pvBreathe 2.8s ease-in-out infinite; }
.pv-bars rect:nth-child(2n) { animation-delay: -.7s; }
.pv-bars rect:nth-child(3n) { animation-delay: -1.4s; }
.pv-bars rect:nth-child(5n) { animation-delay: -2.1s; }
@keyframes pvBreathe { 0%, 100% { transform: scaleY(.6); } 50% { transform: scaleY(1); } }

/* «Вокалов отделено» — дорожка расщепляется на две: половинки дышат врозь */
.pv-split path { animation: pvSplit 3.6s ease-in-out infinite; }
.pv-split .pv-split-b { animation-name: pvSplitB; }
@keyframes pvSplit  { 0%, 100% { transform: translateY(1.5px); } 50% { transform: translateY(-1px); } }
@keyframes pvSplitB { 0%, 100% { transform: translateY(-1.5px); } 50% { transform: translateY(1px); } }

/* «Минусов скачано» — волна с вырезанным вокалом: пустота мерцает пунктиром */
.pv-minus .pv-gap { fill: none; stroke: var(--pulse-color); stroke-width: 1.5;
  stroke-dasharray: 4 4; opacity: .5; animation: pvGap 2.4s linear infinite; }
@keyframes pvGap { to { stroke-dashoffset: -16; } }

/* «Акапелл скачано» — мелодия пропевается: линия прорисовывается заново */
.pv-melody path { stroke-dasharray: 120; animation: pvSing 4.5s ease-in-out infinite; }
.pv-melody circle { animation: pvNote 4.5s ease-in-out infinite; }
@keyframes pvSing { 0% { stroke-dashoffset: 120; } 55%, 100% { stroke-dashoffset: 0; } }
@keyframes pvNote { 0%, 30% { opacity: 0; } 60%, 100% { opacity: 1; } }

/* «Аккордов изучено» — прогрессия: стопки подсвечиваются I -> IV -> V */
.pv-chords g { opacity: .35; animation: pvChord 3.9s ease-in-out infinite; }
.pv-chords g:nth-child(2) { animation-delay: 1.3s; }
.pv-chords g:nth-child(3) { animation-delay: 2.6s; }
@keyframes pvChord { 0%, 25%, 100% { opacity: .35; } 8%, 17% { opacity: 1; } }

/* «Караоке спето» — слова заливаются по очереди, как подсветка строки */
.pv-karaoke rect { opacity: .3; animation: pvWord 4.8s ease-in-out infinite; }
.pv-karaoke rect:nth-child(2) { animation-delay: 1s; }
.pv-karaoke rect:nth-child(3) { animation-delay: 2s; }
.pv-karaoke rect:nth-child(4) { animation-delay: 3s; }
@keyframes pvWord { 0%, 100% { opacity: .3; } 12%, 55% { opacity: 1; } 70% { opacity: .3; } }

/* «Басов и киков» — жирная низкая волна + удары кика по долям */
.pv-bass path { stroke-width: 2.6; }
.pv-bass .pv-kick { transform-origin: center; transform-box: fill-box;
  animation: pvKick 1.8s cubic-bezier(.2,.8,.3,1) infinite; }
.pv-bass .pv-kick:nth-of-type(2) { animation-delay: .6s; }
.pv-bass .pv-kick:nth-of-type(3) { animation-delay: 1.2s; }
@keyframes pvKick { 0%, 100% { transform: scale(.6); opacity: .35; }
  12% { transform: scale(1.25); opacity: 1; } 40% { transform: scale(.85); opacity: .6; } }

/* ===== Сцена анализа в поле загрузки (главная) =====
   Поле одно: idle -> крупный прогресс загрузки -> текущая стадия крупно
   и результаты по одному в языке пульса */
.drop.scene { cursor: default; border-style: solid; border-color: var(--border);
  background: rgba(19, 19, 42, .55); padding: 36px 24px; }
.drop.scene:hover { border-color: var(--border); background: rgba(19, 19, 42, .55); }
#drop-idle { display: flex; flex-direction: column; gap: 10px; align-items: center; }
#drop-idle[hidden] { display: none; }
#drop-scene { display: flex; flex-direction: column; gap: 20px; align-items: center;
  width: 100%; }
#drop-scene[hidden] { display: none; }
#scene-file { font-size: 12.5px; max-width: 90%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
/* Обложка появляется, когда опознание её нашло: до этого места не занимает
   (hidden), потом проявляется — сцена не дёргается рывком */
#scene-cover { width: 96px; height: 96px; border-radius: 12px; object-fit: cover;
  box-shadow: var(--shadow); animation: rise .4s cubic-bezier(.2,.8,.3,1) both;
  transition: width .35s ease, height .35s ease; }
#scene-cover[hidden] { display: none; }
/* Опознание нашло обложку — она «подтверждается» лёгким ростом */
#scene-cover.scene-cover--found { width: 116px; height: 116px; }
#scene-stage { font-family: "Unbounded", sans-serif; font-weight: 700;
  font-size: clamp(18px, 2.6vw, 26px); color: var(--fg); text-align: center;
  min-height: 34px; line-height: 1.3; }
/* «Считаю: …» должно читаться как процесс, а не как ещё один результат
   (фидбек владельца 31.07): факты — белые, стадия — акцентная и со
   спиннером. Прежний пульс прозрачности убран: пригашенная до 55% строка
   выглядела второстепенной и сливалась с уже выложенными результатами. */
#scene-stage.working { color: var(--accent); }
#scene-stage.working::before { content: ""; display: inline-block;
  width: .55em; height: .55em; margin-right: .5em;
  border: 3px solid currentColor; border-top-color: transparent;
  border-radius: 50%; vertical-align: 4%;
  animation: sceneSpin .9s linear infinite; }
@keyframes sceneSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  #scene-stage.working::before { animation: none; border-top-color: currentColor; }
}
#scene-stage.done { color: var(--accent); }
#scene-stage.failed { color: var(--danger); }
#scene-facts { display: flex; flex-wrap: wrap; gap: 18px 46px;
  justify-content: center; }
.scene-fact { display: flex; flex-direction: column; gap: 4px;
  align-items: center; animation: rise .5s cubic-bezier(.2,.8,.3,1) both; }
.scene-fact b { font-family: "Unbounded", sans-serif; font-weight: 700;
  font-size: clamp(22px, 3vw, 34px); line-height: 1.15;
  font-variant-numeric: tabular-nums; }
.scene-fact span { font-size: 10.5px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .6px; }
/* Большой статус-бар сцены — главный индикатор, не тонкая ниточка */
.scene-bar { width: min(560px, 88%); height: 26px; }
.scene-bar .bar-fill { transition: width .5s cubic-bezier(.2,.8,.3,1); }

/* Волна «прослушивания» (спек 30.07, обновлено 30.07): заменяет .scene-bar
   на сцене анализа — с первой секунды загрузки заглушкой, затем настоящими
   пиками трека с плейхедом. Модель на самом деле такая: .scene-bar — это
   индикатор фазы А (выгрузка файла на сервер, см. uploadFile), а волна —
   единственный индикатор фазы B (анализ); они не показываются вместе.
   color-mix в проекте не используется
   (везде готовые rgba), поэтому «непройденная» часть волны — accent
   с прозрачностью через rgba, а не color-mix.
   #live-wave (страница трека, задача 7) делит эти же переменные —
   свою высоту 28px задаёт инлайн-стиль в track.html, каскад это позволяет. */
#scene-wave, #live-wave { display: block; width: min(560px, 88%); height: 44px;
  --wave-played: var(--accent, #22C55E);
  --wave-rest: rgba(34, 197, 94, .25); }
#scene-wave[hidden], #live-wave[hidden] { display: none; }

/* CTA внутри вкладок Текст/Гармония владельцу без данных (задача 5,
   спек 30.07): досчёт по требованию рядом с .stage-wait, по образцу
   существующих пустых состояний — padding, центр, приглушённый текст */
.tab-cta { padding: 24px; text-align: center; }
.tab-cta p { margin: 0 0 12px; }
.tab-cta form { display: inline-flex; }
/* Колонкой, а не в ряд: главное действие — «Полный анализ», и оно должно
   стоять по центру само по себе. «Загрузить ещё» — второстепенное, уходит
   под него и мельче, чтобы не спорить с главным за внимание. */
#scene-actions { display: flex; flex-direction: column; gap: 12px;
  align-items: center; animation: rise .4s both; }
#scene-actions[hidden] { display: none; }
#scene-actions .btn-ghost { font-size: 12px; padding: 7px 16px; }

/* Большая CTA после экспресс-анализа: продаёт переход к полному разбору
   («Полный анализ» + подпись, что внутри) — мягкое дыхание свечения,
   чтобы взгляд сам находил кнопку. Дыхание — это пульсация box-shadow, без
   перемещения, поэтому под prefers-reduced-motion оно намеренно остаётся
   (мягкая политика движения, спек 2026-07-29). */
.cta-full { display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 18px 34px; border-radius: 14px; text-decoration: none; text-align: center;
  cursor: pointer; color: #fff;
  background: linear-gradient(120deg, var(--primary), #4F46E5 60%, var(--accent));
  animation: ctaBreathe 2.6s ease-in-out infinite;
  transition: transform var(--fast); }
.cta-full:hover { transform: translateY(-2px); }
.cta-full b { font-family: "Unbounded", sans-serif; font-weight: 700; font-size: 17px; }
.cta-full span { font-size: 11.5px; color: rgba(255, 255, 255, .75); }
@keyframes ctaBreathe {
  0%, 100% { box-shadow: 0 0 24px rgba(99, 102, 241, .35); }
  50% { box-shadow: 0 0 40px rgba(99, 102, 241, .6); }
}

/* ===== Подсказки пульса (data-tip) ===== */
.pulse-row { position: relative; }
.pulse-row[data-tip]:hover::after { content: attr(data-tip); position: absolute;
  bottom: calc(100% + 10px); left: 0; z-index: 30; width: max-content;
  max-width: 250px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 13px; font-size: 12px; font-weight: 500;
  line-height: 1.5; color: var(--fg); text-transform: none; letter-spacing: 0;
  box-shadow: var(--shadow); pointer-events: none;
  animation: rise .18s cubic-bezier(.2,.8,.3,1) both; }

/* ===== Страница трека: спокойные волны за шапкой + чистые показатели ===== */
.track-hero { position: relative; }
#track-lines { position: absolute; inset: 0; z-index: -1; width: 100%;
  height: 100%; display: block; pointer-events: none; opacity: .75; }
/* Плитки-показатели шапки — в языке пульса: без коробок, только цифры и воздух */
.track-hero .stats { gap: 6px 30px; }
.track-hero .stat { background: none; border: 0; box-shadow: none;
  padding: 8px 0; min-height: auto; animation: rise .35s cubic-bezier(.2,.8,.3,1) both; }
.track-hero .stat b { font-family: "Unbounded", sans-serif; font-size: 30px;
  height: auto; line-height: 1.2; }

/* ===== Прогресс-бары в языке пульса: эквалайзерные слайсы со свечением =====
   API прежний (.bar > .bar-fill с width%), поэтому апгрейд действует везде:
   загрузка, живая карточка, кнопки модулей на странице трека */
.bar { height: 14px; background: none; border-radius: 0; overflow: visible;
  position: relative; }
.bar::before { content: ""; position: absolute; left: 0; right: 0; top: 50%;
  height: 1px; background: var(--border); }
.bar-fill { position: relative; height: 100%; border-radius: 0;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 3px, transparent 3px 6px);
  mask: repeating-linear-gradient(90deg, #000 0 3px, transparent 3px 6px);
  filter: drop-shadow(0 0 6px rgba(99, 102, 241, .45)); }
.module-progress .bar { height: 9px; }

/* Текстовые значения пульса (аккорд, тональность) — чуть меньше чисел */
.pulse-value { font-size: clamp(22px, 3vw, 32px); letter-spacing: .5px; }

/* «Минут музыки» — таймлайн: точка пробегает по шкале */
.pv-time path { stroke-width: 1.4; opacity: .5; }
.pv-time-dot { animation: pvTimeDot 5.4s cubic-bezier(.45,0,.55,1) infinite; }
@keyframes pvTimeDot { 0% { transform: translateX(0); } 50% { transform: translateX(67px); } 100% { transform: translateX(0); } }

/* «Слов распознано» — строки печатаются по очереди */
.pv-words rect { transform-origin: left center; transform-box: fill-box;
  animation: pvType 5.1s ease-in-out infinite; }
.pv-words rect:nth-child(2) { animation-delay: .5s; }
.pv-words rect:nth-child(3) { animation-delay: 1s; }
@keyframes pvType { 0% { transform: scaleX(0); } 28%, 78% { transform: scaleX(1); }
  92%, 100% { transform: scaleX(0); } }

/* «Самый частый аккорд» — стопка звучит: дуги расходятся */
.pv-topchord .pv-arc { stroke-width: 1.6; animation: pvArc 2.6s ease-out infinite; }
.pv-topchord .pv-arc:nth-of-type(2) { animation-delay: .35s; }
@keyframes pvArc { 0% { opacity: 0; transform: translateX(-3px); }
  35% { opacity: .9; } 100% { opacity: 0; transform: translateX(4px); } }

/* «Самая частая тональность» — квинтовый круг, точка обходит круг */
.pv-topkey .pv-ring { fill: none; stroke: var(--pulse-color); stroke-width: 1;
  opacity: .35; }
.pv-topkey .pv-tick { r: 1.1; opacity: .45; }
.pv-topkey .pv-key-dot { transform-origin: 36px 12px;
  animation: pvOrbit 14s linear infinite; }
@keyframes pvOrbit { to { transform: rotate(360deg); } }

/* Эквалайзер в зоне загрузки: инструмент «слушает» */
.drop-eq rect { fill: currentColor; transform-origin: center; transform-box: fill-box;
  animation: pvBreathe 1.6s ease-in-out infinite; }
.drop-eq rect:nth-child(2) { animation-delay: -.3s; }
.drop-eq rect:nth-child(3) { animation-delay: -.6s; }
.drop-eq rect:nth-child(4) { animation-delay: -.9s; }
.drop-eq rect:nth-child(5) { animation-delay: -1.2s; }
.drop:hover .drop-eq { color: var(--primary); }

#latest .latest-row { display: flex; gap: 12px; align-items: center; padding: 9px 6px;
  margin: 0 -6px; border-radius: 8px; border-bottom: 1px solid var(--border);
  color: inherit; text-decoration: none; transition: background var(--fast); }
#latest .latest-row:last-child { border-bottom: 0; }
#latest .latest-row:hover { background: var(--surface-2); }
#latest .latest-rank { font-family: "Unbounded", sans-serif; font-size: 13px;
  font-weight: 700; color: var(--muted); width: 18px; flex: 0 0 auto;
  text-align: center; }
#latest .latest-title { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cover-xs { width: 32px; height: 32px; border-radius: 6px; font-size: 13px; }

/* Мобильная сетка пульса: был flex с min-width: calc(50% - 14px), а flex-элемент
   берёт ширину по содержимому — длинная подпись распирала карточку шире половины
   и роняла соседнюю на новую строку, колонки шли вразнобой. Грид с minmax(0, 1fr)
   держит колонки равными: подпись переносится внутри своей ячейки, а высота ряда
   у соседей общая. Порог 640, а не 480: между ними была та же каша. */
@media (max-width: 640px) {
  .pulse-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px 20px; }
  .pulse-row { min-width: 0; }
  /* Симметрия узкого экрана: hero и поле загрузки центрованы по макету, а
     заголовки секций и содержимое ячеек липли к левому краю — на двух
     колонках это читалось как перекос. Список популярного не центруем:
     ранг, обложка и название — строка списка, по центру она разваливается. */
  #pulse > h2, #latest > h2 { text-align: center; }
  .pulse-row { align-items: center; text-align: center; }
  /* Нечётная последняя карточка не висит одна в левой колонке, а встаёт
     по центру во всю ширину — счётчиков сейчас 11, и без этого низ блока
     всегда кривой */
  .pulse-row:nth-child(odd):last-child { grid-column: span 2; }
}

/* ===== Бейдж GPU-воркера (этап 3, task 3): иконка + текст, без имени хоста ===== */
.gpu-badge { display: inline-flex; align-items: center; gap: 5px; }
.gpu-badge-ico { flex: 0 0 auto; display: block; }

/* ===== Жанр строкой (этап 3, task 3): типографика вместо пилюль =====
   Мини-полоска танцевальности переиспользует .bar/.bar-fill (эквалайзерный
   стиль уже задан выше) в узком варианте. */
.genre-strip { display: flex; align-items: center; justify-content: space-between;
  gap: 20px; margin: 4px 0 2px; flex-wrap: wrap; }
.genre-strip-text { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.genre-strip-text b { font-family: "Unbounded", sans-serif; font-size: 15px;
  font-weight: 700; color: var(--fg); }
.genre-dance { display: flex; flex-direction: column; gap: 4px; flex: 0 0 auto; }
.genre-dance .bar { width: 60px; height: 10px; }
.genre-dance-label { font-size: 10.5px; white-space: nowrap; }

/* ===== Вкладка «Обработка» (этап 3, task 4): волна с визуальным фрагментом
   + инструменты строками, без карточек-форм. Оверлей региона — свой div
   поверх волны (pointerdown/move/up), не плагин wavesurfer. ===== */
.edit-wave-wrap { position: relative; touch-action: none; cursor: crosshair;
  border-radius: 10px; overflow: hidden; background: var(--surface-2);
  /* padding-top освобождает место под таймкод региона (top: -22px у
     .edit-region-time) — иначе overflow: hidden вкладки его обрезает,
     т.к. top у абсолютных потомков считается от padding-box, а не от
     значения padding. .edit-region ниже сдвинут на ту же величину. */
  padding-top: 22px; }
.edit-wave { width: 100%; height: 96px; opacity: .45; transition: opacity var(--fast); }
.edit-wave-wrap.ready .edit-wave { opacity: 1; }
.edit-region { position: absolute; top: 22px; bottom: 0; left: 0; width: 0;
  background: rgba(99, 102, 241, .22); border-left: 2px solid var(--primary);
  border-right: 2px solid var(--primary); pointer-events: none; }
.edit-region-handle { position: absolute; top: 0; bottom: 0; width: 14px;
  pointer-events: auto; cursor: ew-resize; }
.edit-region-handle-l { left: -7px; } .edit-region-handle-r { right: -7px; }
.edit-region-handle::after { content: ""; position: absolute; top: 50%; left: 50%;
  width: 4px; height: 28px; transform: translate(-50%, -50%); border-radius: 3px;
  background: var(--primary); box-shadow: 0 0 8px rgba(99, 102, 241, .6); }
.edit-region-time { position: absolute; top: -22px; transform: translateX(-50%);
  font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--fg); background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 1px 6px; pointer-events: none; white-space: nowrap; }
.edit-region-time-l { left: 0; } .edit-region-time-r { left: 100%; }
.edit-wave-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px;
  flex-wrap: wrap; }
.edit-wave-actions button { display: inline-flex; align-items: center; gap: 6px; }
.edit-wave-actions button:disabled { opacity: .4; cursor: not-allowed; }
/* Грабля [hidden] vs display: без этого override кнопка пресета секции
   (hidden выставляется в шаблоне, когда structure.sections пуст) осталась
   бы видимой — правило выше даёт ей display: inline-flex с бОльшим весом,
   чем базовый [hidden] браузера. */
.edit-wave-actions button[hidden] { display: none; }

/* Инструменты — вертикальный список строк: иконка, название, параметры
   инлайн, кнопка «Применить»/«Конвертировать» прижата вправо. Разделитель —
   только воздух. Единый шаблон строки для всех операций «Весь трек»
   (задача 30.07: свести к одному виду — подпись слева, контролы по центру,
   кнопка справа). */
.tool-row { display: flex; align-items: center; gap: 14px; padding: 13px 0;
  flex-wrap: wrap; }
.tool-row + .edit-status { display: block; margin: -8px 0 4px; }
.tool-ico { flex: 0 0 auto; color: var(--muted); }
.tool-name { flex: 0 0 auto; font-weight: 700; font-size: 13.5px; min-width: 110px; }
.tool-params { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  flex: 1; min-width: 220px; color: var(--muted); font-size: 12.5px; }
.tool-params label { display: flex; align-items: center; gap: 6px; }
.tool-row .btn-run { margin-left: auto; flex: 0 0 auto; }
.tool-name-wrap { display: flex; flex-direction: column; gap: 1px; flex: 0 0 auto; min-width: 110px; }
.tool-name-wrap .tool-name { min-width: 0; }
.tool-hint { font-size: 10.5px; color: var(--muted); font-weight: 400; }

/* ===== Полоса углубления под плеером (спек 2026-07-29) =====
   Не карточки, а строки таблицы: четыре кубика в ряд теснились и читались
   как сломанные. .pack раскрывается в ячейки родительской сетки
   (display: contents), поэтому колонки выровнены по всем строкам сразу.
   align-items: stretch обязателен: при center ячейки разной высоты
   центруются каждая по себе, и разделитель под текстом оказывается выше
   разделителя под кнопкой — строка выглядит сломанной. */
.packs { display: grid; grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch; column-gap: 28px; margin: 14px 0 8px; }
.pack { display: contents; }
.pack > * { display: flex; align-items: center; padding: 15px 0;
  border-bottom: 1px solid var(--border); }
.packs > .pack:last-child > * { border-bottom: 0; }
.pack-text { flex-direction: column; align-items: flex-start;
  justify-content: center; gap: 3px; min-width: 0; }
.pack-text b { font-size: 14.5px; }
.pack-text .pack-desc { font-size: 12px; line-height: 1.4; }
.pack .module-action { justify-content: flex-end; gap: 14px; flex-wrap: wrap; }
.pack .module-action form { display: flex; align-items: center; gap: 12px;
  margin: 0; flex-wrap: wrap; justify-content: flex-end; }
.pack select[name=mode] { max-width: 240px; }
.packs-done { padding: 12px 0; }
@media (max-width: 640px) {
  /* В столбик: текст, под ним действие. Разделитель — один на строку, под
     действием, иначе внутри одного пакета их было бы два. */
  .packs { grid-template-columns: 1fr; column-gap: 0; }
  .pack > * { border-bottom: 0; padding: 12px 0 0; }
  .pack .module-action { justify-content: space-between; padding: 10px 0 16px;
    border-bottom: 1px solid var(--border); }
  .packs > .pack:last-child .module-action { border-bottom: 0; }
  /* Движок — на своей строке во всю ширину: рядом с кнопкой он сжимался
     до нечитаемого огрызка */
  .pack .module-action form { width: 100%; justify-content: space-between; }
  .pack select[name=mode] { flex: 1 0 100%; max-width: 100%; }
}

/* ===== Выбор движка в пакете «Дорожки» =====
   Родной select владелец забраковал: «выглядит плохо и дёшево». Здесь строки
   с именем, пояснением и ценой во времени — от движка зависит чистота вокала
   и минуса, и выбор должен быть виден целиком, а не спрятан в поле. Свёрнут
   по умолчанию: тем, кого устраивает режим по умолчанию, он не мешает. */
.engine-pick { grid-column: 1 / -1; padding: 0 0 14px;
  border-bottom: 1px solid var(--border); }
.packs > .pack:last-child .engine-pick { border-bottom: 0; }
.engine-pick > summary { list-style: none; cursor: pointer; display: flex;
  align-items: baseline; gap: 8px; padding: 2px 0 10px; font-size: 12.5px; }
.engine-pick > summary::-webkit-details-marker { display: none; }
.engine-pick > summary::after { content: ""; width: 7px; height: 7px;
  border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg) translate(-2px, -2px); transition: transform var(--fast); }
.engine-pick[open] > summary::after { transform: rotate(225deg) translate(1px, 1px); }
.engine-pick > summary b { color: var(--fg); font-size: 13px; }
.engine-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 6px; }
.engine { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: center; column-gap: 12px; padding: 9px 12px; border-radius: 10px;
  cursor: pointer; transition: background var(--fast); }
.engine:hover { background: var(--surface-2); }
.engine.on { background: rgba(99, 102, 241, .13); }
.engine input { grid-column: 1; grid-row: 1 / span 2; margin: 0;
  accent-color: var(--primary); }
.engine b { grid-column: 2; grid-row: 1; font-size: 13.5px; }
.engine span { grid-column: 2; grid-row: 2; font-size: 11.5px; line-height: 1.35; }
.engine em { grid-column: 3; grid-row: 1 / span 2; font-style: normal;
  font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Кнопка HQ в шапке плеера (спек 30.07): инлайн-форма в строке .transport
   (#mixer), рядом с остальными контролами — кнопка мелкая, не тянет на
   отдельный блок; karaoke-btn уже даёт margin-left:auto всей правой группе. */
form.hq-inline { display: inline-flex; align-items: center; margin: 0; }
form.hq-inline .btn-ghost { font-size: 12px; padding: 5px 10px; }
.engine.on em { color: var(--fg); }
