/* Переписка: список собеседников, сообщения, поле ввода как в Телеграме, голосовые */
.chat-log { display: flex; flex-direction: column; gap: 8px; padding-bottom: 8px; }
.msg { align-self: flex-start; max-width: 82%; padding: 9px 12px 7px; border-radius: 4px 14px 14px 14px; background: var(--glass); box-shadow: inset 0 0 0 1px var(--line); user-select: text; -webkit-user-select: text; }
.msg.mine { align-self: flex-end; border-radius: 14px 4px 14px 14px; background: rgba(207, 174, 106, .14); box-shadow: inset 0 0 0 1px rgba(207, 174, 106, .35); }
.msg span { display: block; font-size: 15px; word-wrap: break-word; white-space: pre-wrap; }
.msg small { display: block; text-align: right; font-size: 11px; color: var(--muted); }
/* уведомления веб-версии — строка в списке переписок */
.btn.push-on { width: 100%; margin: 2px 0 12px; min-height: 44px; font-size: 15px; }
.push-row { margin: 0 0 12px; }
.push-row .vlink { font-size: inherit; }

/* поле сообщения: растёт до 5 строк; пустое — микрофон, есть текст — стрелка */
.chat-input { display: flex; gap: 8px; align-items: flex-end; padding-bottom: max(env(safe-area-inset-bottom), 10px); }
.chat-input textarea { flex: 1; min-width: 0; min-height: 46px; max-height: 126px; padding: 12px 14px; border: 0; border-radius: 14px; resize: none; overflow-y: auto; line-height: 1.4;
  background: rgba(5, 8, 16, .85); box-shadow: inset 0 0 0 1px var(--line); outline: none; font: inherit; font-size: 16px; color: var(--ink); user-select: text; -webkit-user-select: text; }
.chat-input textarea:focus { box-shadow: inset 0 0 0 1.5px var(--brass); }
.chat-input .btn { width: 52px; height: 46px; min-height: 46px; padding: 0; flex: none; font-size: 20px; }

/* ---------- голосовые (как в Телеграме) ---------- */
#chat-foot { position: relative; z-index: 3; }
.chat-act { touch-action: none; -webkit-touch-callout: none; }
.chat-act svg { width: 24px; height: 24px; display: block; }
.chat-act .i-send, #chat-foot.has-text .chat-act .i-mic { display: none; }
#chat-foot.has-text .chat-act .i-send { display: block; }

.vrec { --dx: 0px; --dy: 0px; --k: 0; --c: 0; --lv: 0; position: absolute; left: 16px; right: 16px; bottom: max(env(safe-area-inset-bottom), 10px); height: 46px; pointer-events: none; }
.vbar { position: absolute; left: 0; right: 60px; top: 0; bottom: 0; display: flex; align-items: center; gap: 10px; padding: 0 12px 0 14px; border-radius: 14px; overflow: hidden; pointer-events: auto;
  background: #070b15; box-shadow: inset 0 0 0 1px var(--line); animation: vbar-in .18s ease-out; }
#chat-foot.vr-wait #chat-text, #chat-foot.vr-rec #chat-text, #chat-foot.vr-lock #chat-text, #chat-foot.vr-prev #chat-text,
#chat-foot.vr-wait .chat-act, #chat-foot.vr-rec .chat-act, #chat-foot.vr-lock .chat-act, #chat-foot.vr-prev .chat-act { opacity: 0; }
@keyframes vbar-in { from { opacity: 0; transform: translateX(24px); } }
.vrec-now { display: flex; align-items: center; gap: 8px; flex: none; min-width: 70px; font-size: 15px; font-variant-numeric: tabular-nums; }
.vdot { width: 10px; height: 10px; border-radius: 50%; background: var(--minus); box-shadow: 0 0 10px rgba(255, 81, 104, .8); animation: vdot 1s ease-in-out infinite; }
@keyframes vdot { 50% { opacity: .25; } }
.vrec.late .vtime { color: #ff8a98; }
.vslide { flex: 1; min-width: 0; text-align: center; white-space: nowrap; font-size: 14px; color: var(--muted);
  transform: translateX(calc(var(--dx) * .65)); opacity: calc(1 - var(--c) * .85); }
.vslide b { display: inline-block; font-weight: 400; margin-right: 2px; animation: vnudge 1.4s ease-in-out infinite; }
@keyframes vnudge { 50% { transform: translateX(-4px); } }
.vcancel { display: none; flex: 1; height: 100%; font-size: 15px; font-weight: 600; letter-spacing: .02em; color: var(--brass-hi); }
.vprev-now { display: none; flex: 1; min-width: 0; align-items: center; gap: 4px; }
.vtrash { flex: none; width: 36px; height: 36px; margin-left: -8px; display: grid; place-items: center; border-radius: 10px; color: var(--muted); }
.vtrash svg { width: 22px; height: 22px; }
.vtrash:active { color: var(--minus); background: rgba(255, 81, 104, .12); }
.vprev-slot { flex: 1; min-width: 0; display: flex; }

/* замок над кнопкой: тянем вверх — замок защёлкивается */
.vlock { position: absolute; right: 6px; bottom: 82px; width: 40px; height: calc(84px - 34px * var(--k)); display: flex; justify-content: center; padding-top: 9px;
  border-radius: 20px; background: rgba(14, 22, 40, .92); box-shadow: inset 0 0 0 1px var(--line), 0 6px 18px rgba(0, 0, 0, .45);
  transform: translateY(calc(var(--dy) * -.3)); animation: vlock-in .22s ease-out; }
@keyframes vlock-in { from { opacity: 0; transform: translateY(14px); } }
.vlock-in { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--ink); }
.vlock-ic { width: 20px; height: 20px; }
.vlock-ic .sh { transform: translateY(calc(-3px * (1 - var(--k)))); transition: transform .08s; }
.vlock-up { width: 20px; height: 20px; color: var(--muted); opacity: calc(1 - var(--k) * 1.6); animation: vup 1.2s ease-in-out infinite; }
@keyframes vup { 50% { transform: translateY(-4px); } }
.vstop { position: absolute; right: 4px; bottom: 82px; width: 44px; height: 44px; display: none; place-items: center; border-radius: 50%; pointer-events: auto; color: var(--minus);
  background: rgba(14, 22, 40, .95); box-shadow: inset 0 0 0 1px rgba(255, 81, 104, .45), 0 6px 18px rgba(0, 0, 0, .45); animation: vpop .2s ease-out; }
.vstop svg { width: 22px; height: 22px; }
@keyframes vpop { from { opacity: 0; transform: scale(.6); } }

/* большая кнопка записи — растёт из кнопки поля и «дышит» в такт голосу */
.vbig { position: absolute; right: -11px; top: -21px; width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; pointer-events: none; color: #1b1305;
  background: radial-gradient(circle at 50% 35%, #f6e2ad, #cfae6a 60%, #a8853f); box-shadow: inset 0 0 0 1px rgba(255, 240, 200, .6), 0 0 26px rgba(207, 174, 106, .45), 0 8px 22px rgba(0, 0, 0, .5);
  transform: translate(var(--dx), calc(var(--dy) * -1)); animation: vbig-in .2s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes vbig-in { from { transform: scale(.55); opacity: .4; } }
.vring { position: absolute; inset: 0; z-index: -1; border-radius: 50%; background: rgba(241, 215, 154, .22); transform: scale(calc(1 + var(--lv) * .8)); transition: transform .09s linear; }
.vbig-in svg { width: 30px; height: 30px; display: block; }
.vbig .i-send { display: none; }

/* фазы записи */
.vr-wait .vdot { animation: none; opacity: .4; }
.vr-lock .vslide, .vr-lock .vlock, .vr-prev .vslide, .vr-prev .vlock, .vr-prev .vrec-now, .vr-prev .vstop { display: none; }
.vr-lock .vcancel { display: block; animation: vbar-in .18s ease-out; }
.vr-lock .vstop { display: grid; }
.vr-lock .vbig, .vr-prev .vbig { pointer-events: auto; transform: none; }
.vr-lock .vbig .i-mic, .vr-prev .vbig .i-mic { display: none; }
.vr-lock .vbig .i-send, .vr-prev .vbig .i-send { display: block; }
.vr-prev .vring { transform: none; opacity: 0; }
.vr-prev .vprev-now { display: flex; }
.vrec.vcanceled .vbar { transition: opacity .2s, transform .2s; opacity: 0; transform: translateX(-30px); }
.vrec.vcanceled .vbig, .vrec.vcanceled .vlock { transition: opacity .18s, transform .18s; opacity: 0; transform: scale(.4); }

/* пузырь голосового (у .msg span задан display:block — поэтому селекторы с .msg.voice) */
.msg.voice span { font-size: inherit; white-space: nowrap; }
.msg.voice { display: flex; align-items: center; gap: 10px; padding: 8px 12px 6px 8px; }
.vplay { position: relative; flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--holo);
  background: rgba(142, 232, 255, .14); box-shadow: inset 0 0 0 1px rgba(142, 232, 255, .45); }
.msg.voice.mine .vplay { color: #1b1305; background: radial-gradient(circle at 50% 35%, #f6e2ad, #cfae6a 62%, #a8853f); box-shadow: inset 0 0 0 1px rgba(255, 240, 200, .55); }
.vplay svg { width: 20px; height: 20px; }
.vplay .i-play { margin-left: 2px; }
.vplay .i-pause, .msg.voice.playing .vplay .i-play, .msg.voice.loading .vplay svg { display: none; }
.msg.voice.playing .vplay .i-pause { display: block; }
.vspin { display: none; position: absolute; inset: 5px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: vspin .8s linear infinite; }
.msg.voice.loading .vspin, .msg.voice.pending .vspin { display: block; }
@keyframes vspin { to { transform: rotate(360deg); } }
.msg.voice .vbody { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.msg.voice .vwave { position: relative; display: block; height: 26px; max-width: 100%; cursor: pointer; }
.msg.voice .vw-base, .msg.voice .vw-top { position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
.msg.voice .vw-base i, .msg.voice .vw-top i { flex: none; width: 3px; min-height: 3px; border-radius: 2px; background: currentColor; }
.msg.voice .vw-base { color: rgba(232, 238, 247, .26); }
.msg.voice .vw-top { color: var(--holo); clip-path: inset(0 calc((1 - var(--p, 0)) * 100%) 0 0); }
.msg.voice.mine .vw-base { color: rgba(241, 215, 154, .32); }
.msg.voice.mine .vw-top { color: var(--brass-hi); }
.msg.voice .vmeta { display: flex; align-items: center; gap: 6px; text-align: left; font-size: 11.5px; color: var(--muted); }
.msg.voice .vdur { font-variant-numeric: tabular-nums; }
.vnew { display: none; width: 6px; height: 6px; border-radius: 50%; background: var(--holo); box-shadow: 0 0 6px rgba(142, 232, 255, .8); }
.msg.voice.unheard .vnew { display: inline-block; }
.msg.voice .vhm { margin-left: auto; padding-left: 10px; }
.msg.voice.pending .vplay { color: var(--brass-hi); background: rgba(207, 174, 106, .14); box-shadow: inset 0 0 0 1px rgba(207, 174, 106, .4); }
.msg.voice.pending .vwave { opacity: .6; cursor: default; }
.msg.voice.failed .vplay { color: #ffd3d9; background: rgba(255, 81, 104, .16); box-shadow: inset 0 0 0 1px rgba(255, 81, 104, .55); }
.msg.voice.failed .vhm { color: #ff9aa7; }
.vlink { padding: 0; font-size: inherit; color: var(--brass-hi); text-decoration: underline; text-underline-offset: 2px; }

/* прослушивание своей записи перед отправкой — в строке поля */
.msg.voice.vprev-player { flex: 1; min-width: 0; max-width: none; gap: 8px; padding: 0; background: none; box-shadow: none; border-radius: 0; align-self: center; }
.vprev-player .vplay { width: 34px; height: 34px; }
.vprev-player .vplay svg { width: 18px; height: 18px; }
.msg.voice.vprev-player .vbody { flex: 1; flex-direction: row; align-items: center; gap: 8px; }
.msg.voice.vprev-player .vwave { flex: 1; min-width: 0; width: auto; height: 24px; }
.msg.voice.vprev-player .vmeta { flex: none; font-size: 13px; }
.msg.voice.vprev-player .vw-base { color: rgba(232, 238, 247, .3); }
.msg.voice.vprev-player .vw-top { color: var(--brass-hi); }
@media (prefers-reduced-motion: reduce) { .vdot, .vslide b, .vlock-up, .vspin { animation: none; } }
