/* Moment · голосовой модуль. Стили в духе рабочей поверхности Moment.
 *
 * Запись — ПОЛОСА на экране, а не окно поверх: ложится на поле, куда придёт текст, без
 * затемнения. Содержимое и размеры — по эталону (design/prototype, VoiceSheet, П07:91-111;
 * значения сняты с отрисованного эталона на 390px): «Говорите» 25px с красной точкой,
 * таймер 40px, 28 полос волны 4×56px, пояснение ⓘ, кнопки 48px столбиком — «Отмена»
 * сверху, «Готово» снизу. Цвета — токены --m-* (с запасными значениями: модуль подключается
 * и на проверочной странице без темы). Позицию над полем ставит voice/ui.js.
 */

.voice-bar {
  position: fixed;
  z-index: 50;                       /* над строкой ввода и нижним меню, под шторками оплаты (60+) */
  left: calc(12px + var(--moment-safe-left, 0px));
  right: auto;
  width: calc(100% - 24px - var(--moment-safe-left, 0px) - var(--moment-safe-right, 0px));
  max-width: 756px;
  bottom: calc(12px + var(--moment-safe-bottom, env(safe-area-inset-bottom, 0px)));
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  color: var(--m-text, #e8eaf0);
  font-family: inherit;
  animation: voiceBarIn .18s ease-out both;
}
.voice-bar[hidden] { display: none; }
.voice-bar[data-docked='screen'] { left: 50%; transform: translateX(-50%); }

.voice-bar .voice-sheet {
  display: flex;
  flex-direction: column;
  padding: 24px 20px 28px;
  border-radius: 24px;
  background: var(--m-card, #171a23);
  border: 1px solid var(--m-line, #262b38);
  box-shadow: 0 10px 30px rgba(5, 6, 10, .45);
}

/* Заголовки состояний: «Говорите», «Распознаём…», «Не расслышал». */
.voice-bar .voice-sheet h2 { font-size: 25px; font-weight: 620; letter-spacing: -.7px; line-height: 28px; margin: 0 0 16px; color: var(--m-text, #e8eaf0); }
.voice-bar .vs-h { display: flex; align-items: center; gap: 10px; }
.voice-bar .vs-dot { width: 10px; height: 10px; flex: 0 0 10px; border-radius: 50%; background: var(--m-error, #ef4444); animation: vsDot 1.2s ease-in-out infinite; }
.voice-bar .vs-timer { font-size: 40px; font-weight: 600; letter-spacing: -1.2px; font-variant-numeric: tabular-nums; text-align: center; margin: 0 0 10px; }
.voice-bar .vs-bars { display: flex; align-items: center; justify-content: center; gap: 3px; height: 56px; margin: 0 0 16px; }
.voice-bar .vs-bars i { width: 4px; height: 20%; border-radius: 2px; background: var(--m-accent-soft, #8b7cf6); animation: vsBar .9s ease-in-out infinite; }
/* Пришёл настоящий уровень микрофона — высоту ставит voice/ui.js, анимация эталона не нужна. */
.voice-bar .vs-bars.live i { animation: none; transition: height .1s linear; }
.voice-bar .vs-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 14px; background: var(--m-deep, #12141b); border: 1px solid var(--m-line-soft, #1f2430); font-size: 13px; line-height: 1.45; color: var(--m-muted, #9aa2b4); }
.voice-bar .voice-hint.vs-wait { margin: 10px 0 0; }
.voice-bar .vs-wait[hidden] { display: none; }

/* Распознавание: полоса 2,3 с и три шага (П07:100-105). */
.voice-bar .vs-prog { height: 6px; border-radius: 3px; background: var(--m-raised, #1b1f2a); overflow: hidden; margin: 0 0 14px; }
.voice-bar .vs-prog i { display: block; height: 100%; width: 0; background: var(--m-accent, #6c5ce7); animation: vsProg 2.3s cubic-bezier(.3, .7, .4, 1) forwards; }
.voice-bar .vs-steps { display: flex; flex-direction: column; }
.voice-bar .voice-hint.vs-after { margin: 12px 0 0; }

/* «Не расслышал»: значок «?» (П07:107). */
.voice-bar .fail-ico { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; font-weight: 700; background: var(--m-raised, #1b1f2a); color: var(--m-warn, #f5b74e); border: 1px solid var(--m-line, #262b38); margin-bottom: 14px; }

.voice-bar .voice-text { font-size: 14px; line-height: 1.45; color: var(--m-text, #e8eaf0); margin: 0; }
.voice-bar .voice-hint { font-size: 12px; line-height: 1.5; color: var(--m-muted, #9aa2b4); margin: 0; }
.voice-bar .voice-note { font-size: 13px; line-height: 1.45; color: var(--m-text, #e8eaf0); margin: 0; }
.voice-bar .voice-error { font-size: 13px; line-height: 1.45; color: #f0a08c; background: rgba(239, 68, 68, .14); border-radius: 12px; padding: 10px 12px; margin: 0; }

/* Кнопки столбиком, как отрисован эталон на телефоне: вторичная сверху, основная снизу. */
.voice-bar .voice-actions { display: flex; flex-direction: column; gap: 10px; margin: 18px 0 0; }
.voice-bar .voice-actions button { flex: none; width: 100%; min-height: 48px; margin: 0; border-radius: 14px; font-size: 15px; }
.voice-bar .voice-actions .primary { background: var(--m-accent, #6c5ce7); color: #fff; border: 0; font-weight: 550; }
.voice-bar .voice-actions .secondary { background: var(--m-raised, #1b1f2a); color: var(--m-text, #e8eaf0); border: 1px solid var(--m-line, #262b38); font-weight: 400; }
.voice-bar .voice-actions button:disabled { opacity: .4; }
.voice-bar .voice-actions button:focus-visible { outline: 3px solid #8b7cf6; outline-offset: 3px; }

/* Пока идёт запись, большой микрофон знакомства пульсирует (как .mic-big.rec в прототипе). */
body[data-voice='recording'] .mic-big,
body[data-voice='starting'] .mic-big { animation: voiceRing 1s ease-in-out infinite; }

@keyframes voiceBarIn { from { opacity: 0; transform: translateY(8px); } }
.voice-bar[data-docked='screen'] { animation-name: voiceBarInCenter; }
@keyframes voiceBarInCenter { from { opacity: 0; transform: translate(-50%, 8px); } to { transform: translateX(-50%); } }
@keyframes vsDot { 50% { opacity: .3; } }
@keyframes vsBar { 50% { height: 92%; } }
@keyframes vsProg { to { width: 100%; } }
@keyframes voiceRing { 50% { box-shadow: 0 0 0 16px var(--m-accent-deep, #241f3d); } }

/* Кнопка микрофона в панели ввода Moment. */
.dictate { width: 32px; height: 39px; border: 0; background: none; font-size: 22px; }
.dictate[aria-pressed='true'] { color: #6c5ce7; }
.dictate:disabled { opacity: .35; }

/* Кнопка озвучивания ответа. */
.speak { font-size: 12px; color: #e8eaf0; background: none; padding: 4px 0; min-height: 28px; }
.speak[aria-pressed='true'] { color: #6c5ce7; }
.speak:disabled { color: #262b38; }

@media (prefers-reduced-motion: reduce) {
  .voice-bar, .voice-bar .vs-dot, .voice-bar .vs-bars i, body[data-voice] .mic-big { animation: none !important; transition: none !important; }
}
