/* ==========================================================
   Premium Touch — голосовые, кружки, строка ввода чата
   ========================================================== */

/* ---------- ГОЛОСОВОЕ СООБЩЕНИЕ ---------- */

.vp {
  --vp-bar: var(--vk-line-strong);
  --vp-on: var(--vk-accent);
  --vp-btn-bg: var(--grad);
  --vp-btn-fg: #fff;
  --vp-fg: var(--vk-muted);
  --vp-chip: var(--accent-soft);
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(268px, 66vw);
  min-width: 200px;
  padding: 2px 0;
  text-align: left;
  color: var(--vp-fg);
  -webkit-user-select: none;
  user-select: none;
}

.mail-message-my-form .vp,
.mail-message-my .vp {
  --vp-bar: rgba(255, 255, 255, .38);
  --vp-on: #fff;
  --vp-btn-bg: rgba(255, 255, 255, .95);
  --vp-btn-fg: #5a3fe6;
  --vp-fg: rgba(255, 255, 255, .86);
  --vp-chip: rgba(255, 255, 255, .2);
}

.vp-btn {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--vp-btn-bg);
  color: var(--vp-btn-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 8px 18px -8px var(--grad-glow);
  transition: transform .25s cubic-bezier(.34, 1.56, .64, 1);
}

.vp-btn:active { transform: scale(.88); }

.vp-i-pause { display: none; }
.vp.is-playing .vp-i-play { display: none; }
.vp.is-playing .vp-i-pause { display: block; }
.vp-i-play { margin-left: 2px; }

.vp-body { flex: 1; min-width: 0; }

.vp-wave {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 32px;
  cursor: pointer;
  touch-action: none;
}

.vp-wave i {
  flex: 1;
  min-width: 2px;
  max-width: 4px;
  border-radius: 3px;
  background: var(--vp-bar);
  transition: background .18s, transform .18s;
}

.vp-wave i.on { background: var(--vp-on); }

.vp.is-playing .vp-wave i.on:last-of-type,
.vp.is-playing .vp-wave i.on { transform: scaleY(1.06); }

.vp-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 3px;
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.vp-speed {
  border: none;
  outline: none;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--vp-chip);
  color: inherit;
  font: 700 11px/1.5 inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.vp-err .vp-btn { opacity: .5; }

.vp-gone {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  opacity: .7;
  width: auto;
  min-width: 0;
}

/* ---------- ВИДЕО-КРУЖОК ---------- */

.vc {
  position: relative;
  width: min(248px, 64vw);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  overflow: hidden;
  background: #0b0b12;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 16px 34px -14px rgba(20, 15, 80, .55);
  transition: transform .3s cubic-bezier(.34, 1.56, .64, 1);
  isolation: isolate;
}

.vc:active { transform: scale(.97); }

.vc-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.vc-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  pointer-events: none;
}

.vc-ring circle { fill: none; stroke-width: 2.4; }
.vc-ring-bg { stroke: rgba(255, 255, 255, .22); }
.vc-ring-fg { stroke: #fff; stroke-linecap: round; filter: drop-shadow(0 0 2px rgba(0, 0, 0, .5)); }

.vc-badge {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(10, 10, 20, .55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.vc-sound {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 62px;
  height: 62px;
  margin: -31px 0 0 -31px;
  border-radius: 50%;
  background: rgba(10, 10, 20, .5);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: .95;
  transition: opacity .25s, transform .35s cubic-bezier(.34, 1.56, .64, 1);
}

.vc-playing .vc-sound { opacity: 0; transform: scale(.6); }

.vc-paused::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 62px;
  height: 62px;
  margin: -31px 0 0 -31px;
  border-radius: 50%;
  background: rgba(10, 10, 20, .5) no-repeat center / 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M8 5.5v13a1 1 0 0 0 1.5.86l10.5-6.5a1 1 0 0 0 0-1.72L9.5 4.64A1 1 0 0 0 8 5.5z'/%3E%3C/svg%3E");
}

/* кружок в чате — без пузыря, как в мессенджерах */
.mail-message-my-form:has(.vc),
.mail-message-user-form:has(.vc) {
  background: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.mail-message-my-form:has(.vc) .mess_time,
.mail-message-user-form:has(.vc) .mess_time {
  justify-content: center;
  color: var(--vk-muted) !important;
}

/* ---------- СТРОКА ВВОДА ЧАТА ---------- */

.panel-bottom-comments {
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)) !important;
}

.comments-textarea {
  background: var(--vk-card-2) !important;
  color: var(--vk-text) !important;
  box-shadow: none !important;
  border-radius: 22px !important;
  font-size: 15.5px !important;
}

.comments-textarea:focus { box-shadow: 0 0 0 3px var(--accent-soft) !important; }
.comments-textarea::placeholder { color: var(--vk-muted) !important; }
.comments-attachments, .comments-bb, .comments-smiles { color: var(--vk-muted) !important; }

.comments-button {
  background: var(--grad) !important;
  box-shadow: 0 10px 20px -8px var(--grad-glow);
  transition: transform .25s cubic-bezier(.34, 1.56, .64, 1);
}

.comments-button:active { transform: scale(.88); }

.vc-mic, .vc-cam {
  position: absolute;
  top: 0;
  height: 41px;
  border: none;
  padding: 0;
  display: none;
  align-items: center;
  justify-content: center;
  outline: none;
  cursor: pointer;
  z-index: 2;
  -webkit-tap-highlight-color: transparent;
  transition: transform .25s cubic-bezier(.34, 1.56, .64, 1);
}

.vc-mic {
  right: 0;
  width: 41px;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  box-shadow: 0 10px 20px -8px var(--grad-glow);
}

.vc-cam {
  right: 49px;
  width: 38px;
  background: transparent;
  color: var(--vk-muted);
}

.vc-mic:active, .vc-cam:active { transform: scale(.85); }

.comments.vc-on:not(.vc-has-text) .vc-mic,
.comments.vc-on:not(.vc-has-text) .vc-cam { display: flex; }

.comments.vc-on:not(.vc-has-text) .comments-button,
.comments.vc-on:not(.vc-has-text) .comments-bb { display: none; }

/* панель записи голоса поверх строки */
.vc-rec {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 0 0 0 0;
  border-radius: 22px;
  background: var(--vk-card-2);
}

.comments.vc-recording .vc-rec { display: flex; animation: vkRise .25s ease-out both; }
.comments.vc-sending { opacity: .6; pointer-events: none; }

.vc-rec-cancel, .vc-rec-send {
  flex: 0 0 41px;
  width: 41px;
  height: 41px;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  transition: transform .25s cubic-bezier(.34, 1.56, .64, 1);
}

.vc-rec-cancel { background: transparent; color: var(--vk-badge); }
.vc-rec-send { background: var(--grad); color: #fff; box-shadow: 0 10px 20px -8px var(--grad-glow); }
.vc-rec-cancel:active, .vc-rec-send:active { transform: scale(.85); }

.vc-rec-dot {
  flex: 0 0 10px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--vk-badge);
  animation: vcPulse 1.1s ease-in-out infinite;
}

.vc-rec-time {
  flex: 0 0 auto;
  min-width: 38px;
  font-size: 15px;
  font-weight: 700;
  color: var(--vk-text);
  font-variant-numeric: tabular-nums;
}

.vc-rec-wave {
  flex: 1;
  min-width: 0;
  height: 28px;
  display: flex;
  align-items: center;
  gap: 2px;
  overflow: hidden;
}

.vc-rec-wave i {
  flex: 1;
  min-width: 2px;
  max-width: 4px;
  height: 12%;
  border-radius: 3px;
  background: var(--vk-accent);
  transition: height .07s linear;
}

@keyframes vcPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(.55); opacity: .45; }
}

/* ---------- КНОПКА «КРУЖОК» В МЕНЮ ВЛОЖЕНИЙ ---------- */

.vc-attach-row { padding: 14px 0 4px; }

.vc-attach-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border: none;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--vk-accent);
  font: 700 15px/1 inherit;
  cursor: pointer;
  outline: none;
}

/* ---------- ЭКРАН ЗАПИСИ КРУЖКА ---------- */

html.vcr-open, html.vcr-open body { overflow: hidden; }

.vcr {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 18px calc(26px + env(safe-area-inset-bottom, 0px));
  background: radial-gradient(120% 80% at 50% 25%, rgba(70, 48, 190, .55), rgba(7, 7, 14, .97) 70%);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  color: #fff;
  opacity: 0;
  transition: opacity .25s;
}

.vcr.in { opacity: 1; }

.vcr-top {
  width: 100%;
  max-width: 480px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.vcr-hint { font-size: 14.5px; font-weight: 600; opacity: .8; }

.vcr-x {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  transition: transform .25s cubic-bezier(.34, 1.56, .64, 1);
}

.vcr-x:active { transform: scale(.88); }
.vcr[data-state="recording"] .vcr-flip, .vcr[data-state="review"] .vcr-flip, .vcr[data-state="sending"] .vcr-flip { visibility: hidden; }

.vcr-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.vcr-circle {
  position: relative;
  width: min(78vw, 330px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  overflow: hidden;
  background: #000;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, .07), 0 30px 80px -10px rgba(110, 84, 255, .55);
  transform: scale(.9);
  transition: transform .5s cubic-bezier(.34, 1.56, .64, 1), box-shadow .3s;
}

.vcr.in .vcr-circle { transform: scale(1); }
.vcr-circle.recording { box-shadow: 0 0 0 6px rgba(255, 77, 121, .25), 0 30px 90px -10px rgba(255, 77, 121, .6); }

.vcr-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.vcr-video.mirror { transform: scaleX(-1); }

.vcr-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); pointer-events: none; }
.vcr-ring circle { fill: none; stroke-width: 2.2; }
.vcr-ring-bg { stroke: rgba(255, 255, 255, .18); }
.vcr-ring-fg { stroke: #ff4d79; stroke-linecap: round; }

.vcr-timer { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }

.vcr-msg {
  max-width: 300px;
  text-align: center;
  font-size: 14.5px;
  line-height: 1.4;
  padding: 8px 14px;
  border-radius: 14px;
  background: rgba(255, 77, 121, .22);
}

.vcr-ctrl { min-height: 84px; display: flex; align-items: center; justify-content: center; }

.vcr-rec {
  width: 78px;
  height: 78px;
  padding: 0;
  border-radius: 50%;
  border: 4px solid #fff;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  transition: transform .25s cubic-bezier(.34, 1.56, .64, 1);
}

.vcr-rec:active { transform: scale(.9); }

.vcr-rec span {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #ff4d79;
  transition: width .25s, height .25s, border-radius .25s;
}

.vcr[data-state="recording"] .vcr-rec span { width: 28px; height: 28px; border-radius: 8px; }

.vcr-review { display: none; gap: 12px; }

.vcr[data-state="review"] .vcr-rec,
.vcr[data-state="sending"] .vcr-rec { display: none; }
.vcr[data-state="review"] .vcr-review,
.vcr[data-state="sending"] .vcr-review { display: flex; }
.vcr[data-state="sending"] .vcr-review { opacity: .55; pointer-events: none; }

.vcr-redo, .vcr-send {
  height: 52px;
  padding: 0 24px;
  border: none;
  border-radius: 999px;
  font: 700 16px/1 inherit;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  outline: none;
  transition: transform .25s cubic-bezier(.34, 1.56, .64, 1);
}

.vcr-redo { background: rgba(255, 255, 255, .14); color: #fff; }
.vcr-send { background: var(--grad); color: #fff; box-shadow: 0 14px 30px -10px var(--grad-glow); }
.vcr-redo:active, .vcr-send:active { transform: scale(.93); }
