/* Twipe 1.6.0 — голосовые, кружки, запись, плашка «сейчас играет» */

/* ---------- кружки в ленте ---------- */
.msg-bubble.msg-bubble-cnote { background: transparent !important; border: 0 !important; box-shadow: none !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; padding: 0 !important; overflow: visible; }
.msg-bubble-cnote .msg-bubble-footer { justify-content: flex-end; margin-top: 4px; }
.msg-bubble-cnote .msg-bubble-footer > * { background: color-mix(in srgb, #0f172a 55%, transparent); color: #fff; border-radius: 999px; padding: 1px 7px; }
.cnote {
  --cnote-size: 216px;
  --circle-clip: circle(50% at 50% 50%);
  position: relative; width: var(--cnote-size); aspect-ratio: 1; margin-left: auto; cursor: pointer;
  border-radius: 50%; outline: none; -webkit-tap-highlight-color: transparent; user-select: none;
  transition: width .42s cubic-bezier(.22, 1, .36, 1), filter .3s ease;
}
.msg:not(.out) .cnote { margin-left: 0; margin-right: auto; }
.cnote.is-active { --cnote-size: min(300px, 76vw); filter: drop-shadow(0 16px 30px rgba(15, 23, 42, .28)); }
.cnote:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #4f7cff) 60%, transparent); }
.cnote-clip { position: absolute; inset: 5px; border-radius: 50%; overflow: hidden; background: radial-gradient(circle at 30% 30%, #334155, #0f172a); clip-path: var(--circle-clip); }
.cnote:not(.circle-shape--circle) .cnote-clip { border-radius: 0; inset: 0; }
.cnote.circle-shape--heart .cnote-clip { clip-path: none; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M50 92 C 20 70 2 52 2 30 C 2 14 14 4 28 4 C 38 4 46 10 50 18 C 54 10 62 4 72 4 C 86 4 98 14 98 30 C 98 52 80 70 50 92 Z'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M50 92 C 20 70 2 52 2 30 C 2 14 14 4 28 4 C 38 4 46 10 50 18 C 54 10 62 4 72 4 C 86 4 98 14 98 30 C 98 52 80 70 50 92 Z'/%3E%3C/svg%3E") center / contain no-repeat; }
.cnote-video, .cnote-float-clip video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; transform: scale(1.01); }
.cnote.cnote-frame--accent .cnote-clip { box-shadow: inset 0 0 0 3px var(--accent, #4f7cff); }
.cnote.cnote-frame--gradient::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(#f472b6, #818cf8, #22d3ee, #f472b6); }
.cnote.cnote-frame--neon .cnote-clip { box-shadow: 0 0 14px 3px rgba(34, 211, 238, .55); }

.cnote-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); pointer-events: none; overflow: visible; }
.cnote-ring circle { fill: none; stroke-width: 3; }
.cnote-ring-track { stroke: transparent; transition: stroke .3s ease; }
.cnote-ring-prog { stroke: var(--accent, #4f7cff); stroke-linecap: round; opacity: 0; transition: opacity .3s ease; filter: drop-shadow(0 0 4px color-mix(in srgb, var(--accent, #4f7cff) 60%, transparent)); }
.cnote.is-active .cnote-ring-track, .cnote-float .cnote-ring-track { stroke: color-mix(in srgb, #94a3b8 35%, transparent); }
.cnote.is-active .cnote-ring-prog, .cnote-float .cnote-ring-prog { opacity: 1; }
.cnote:not(.circle-shape--circle) .cnote-ring { display: none; }
.cnote.is-scrubbing .cnote-ring circle { stroke-width: 5; }

.cnote-state { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(15, 23, 42, .45); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); opacity: 0; transform: scale(.7); transition: opacity .2s ease, transform .25s cubic-bezier(.2, .9, .3, 1.3); pointer-events: none; }
.cnote-state::before { content: ""; border-style: solid; border-width: 11px 0 11px 18px; border-color: transparent transparent transparent #fff; margin-left: 4px; }
.cnote.is-active.is-paused .cnote-state, .cnote-float.is-paused .cnote-state { opacity: 1; transform: scale(1); }

.cnote-chip { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  border-radius: 999px; font-size: 12px; font-weight: 700; color: #fff; background: rgba(15, 23, 42, .5); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  font-variant-numeric: tabular-nums; pointer-events: none; transition: bottom .3s ease; }
.cnote.is-active .cnote-chip { bottom: 16px; }
.cnote-mute { width: 12px; height: 12px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5 6 9H2v6h4l5 4V5z'/%3E%3Cpath d='m22 9-6 6M16 9l6 6'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5 6 9H2v6h4l5 4V5z'/%3E%3Cpath d='m22 9-6 6M16 9l6 6'/%3E%3C/svg%3E") center / contain no-repeat; }
.cnote.is-active .cnote-mute { display: none; }
.cnote-dot { width: 7px; height: 7px; border-radius: 50%; background: #60a5fa; box-shadow: 0 0 0 2px rgba(96, 165, 250, .3); }
.cnote.is-watched .cnote-dot, .cnote.is-active .cnote-dot { display: none; }

.cnote-rate, .cnote-full { position: absolute; border: 0; cursor: pointer; color: #fff; font: inherit; font-weight: 800; background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); opacity: 0; transform: scale(.6); transition: opacity .2s ease, transform .25s cubic-bezier(.2, .9, .3, 1.3); pointer-events: none; }
.cnote-rate { right: 4%; bottom: 8%; padding: 4px 9px; border-radius: 999px; font-size: 12px; }
.cnote-full { right: 6%; top: 6%; width: 32px; height: 32px; border-radius: 50%; font-size: 15px; display: grid; place-items: center; }
.cnote.is-active .cnote-rate, .cnote.is-active .cnote-full { opacity: 1; transform: none; pointer-events: auto; }
@media (hover: hover) { .cnote:hover .cnote-full { opacity: 1; transform: none; pointer-events: auto; } }
.cnote.is-floating .cnote-clip::after { content: "Играет в окне"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 700; background: rgba(15, 23, 42, .6); }
.cnote-upload { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: #fff; font-weight: 800; font-size: 13px; background: rgba(15, 23, 42, .6); padding: 4px 10px; border-radius: 999px; }

/* ---------- плавающий мини-кружок ---------- */
.cnote-float { position: fixed; z-index: 1200; width: 132px; height: 132px; border-radius: 50%; right: 16px; bottom: 112px; touch-action: none; cursor: grab;
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, .35)); opacity: 0; transform: scale(.4); transition: opacity .3s ease, transform .4s cubic-bezier(.22, 1, .36, 1), left .35s ease, top .35s ease; }
.cnote-float.is-shown { opacity: 1; transform: none; }
.cnote-float.is-dragging { transition: none; cursor: grabbing; }
.cnote-float[data-corner="tr"] { top: 88px; bottom: auto; }
.cnote-float[data-corner="tl"] { top: 88px; bottom: auto; left: 16px; right: auto; }
.cnote-float[data-corner="bl"] { left: 16px; right: auto; }
.cnote-float-clip { position: absolute; inset: 4px; border-radius: 50%; overflow: hidden; background: #0f172a; }
.cnote-float .cnote-state { width: 42px; height: 42px; margin: -21px 0 0 -21px; }
.cnote-float-btn { position: absolute; width: 28px; height: 28px; border-radius: 50%; border: 0; color: #fff; background: rgba(15, 23, 42, .72); font-size: 13px; font-weight: 800; cursor: pointer; display: grid; place-items: center; }
.cnote-float-close { top: -2px; right: -2px; }
.cnote-float-back { top: -2px; left: -2px; }

/* ---------- плашка «сейчас играет» ---------- */
.note-bar { position: relative; z-index: 6; display: none; align-items: center; gap: 10px; margin: 6px 10px 0; padding: 7px 8px 9px 8px; border-radius: 16px; overflow: hidden;
  background: color-mix(in srgb, var(--bg-elevated, #fff) 82%, transparent); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid color-mix(in srgb, var(--line, #e2e8f0) 80%, transparent); box-shadow: 0 10px 26px -14px rgba(15, 23, 42, .35); }
.note-bar.is-shown { display: flex; animation: noteBarIn .38s cubic-bezier(.22, 1, .36, 1) both; }
.note-bar.is-leaving { display: flex; animation: noteBarOut .26s ease both; pointer-events: none; }
@keyframes noteBarIn { from { opacity: 0; transform: translateY(-14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes noteBarOut { to { opacity: 0; transform: translateY(-10px) scale(.97); height: 0; margin-top: 0; padding-top: 0; padding-bottom: 0; } }
.note-bar-play { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; color: #fff;
  background: linear-gradient(135deg, var(--accent, #4f7cff), #8b5cf6); box-shadow: 0 6px 14px -6px var(--accent, #4f7cff); transition: transform .18s ease; }
.note-bar-play:active { transform: scale(.9); }
.note-bar-shape { width: 0; height: 0; margin-left: 3px; border-style: solid; border-width: 6px 0 6px 10px; border-color: transparent transparent transparent currentColor; transition: all .18s ease; }
.note-bar.is-playing .note-bar-shape { width: 10px; height: 12px; margin-left: 0; border: 0; border-left: 3px solid currentColor; border-right: 3px solid currentColor; box-sizing: border-box; }
.note-bar-info { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 8px; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; padding: 0; }
.note-bar-kind { flex: 0 0 auto; width: 18px; height: 18px; border-radius: 50%; background: color-mix(in srgb, var(--accent, #4f7cff) 16%, transparent); position: relative; }
.note-bar-kind::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--accent, #4f7cff); }
.note-bar.is-playing .note-bar-kind::after { animation: noteKindPulse 1.2s ease-in-out infinite; }
@keyframes noteKindPulse { 50% { transform: scale(.55); opacity: .6; } }
.note-bar[data-kind="voice"] .note-bar-kind { border-radius: 6px; }
.note-bar-text { display: flex; flex-direction: column; min-width: 0; }
.note-bar-title { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-bar-sub { font-size: 12px; opacity: .65; font-variant-numeric: tabular-nums; white-space: nowrap; }
.note-bar-rate, .note-bar-close { flex: 0 0 auto; border: 0; cursor: pointer; font: inherit; color: inherit; }
.note-bar-rate { padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; background: color-mix(in srgb, currentColor 10%, transparent); }
.note-bar-close { width: 30px; height: 30px; border-radius: 50%; background: transparent; opacity: .55; font-size: 14px; }
.note-bar-close:hover { opacity: 1; background: color-mix(in srgb, currentColor 8%, transparent); }
.note-bar-track { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; cursor: pointer; background: color-mix(in srgb, currentColor 8%, transparent); }
.note-bar-track::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 14px; }
.note-bar-fill { position: absolute; inset: 0; transform-origin: left; transform: scaleX(var(--nb-p, 0)); background: linear-gradient(90deg, var(--accent, #4f7cff), #8b5cf6); transition: transform .25s linear; }
html[data-theme="dark"] .note-bar { background: color-mix(in srgb, #0f172a 78%, transparent); border-color: rgba(148, 163, 184, .18); }
.msg--flash .msg-bubble { animation: msgFlash 1.2s ease; }
@keyframes msgFlash { 30% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent, #4f7cff) 45%, transparent); } }

/* ---------- голосовые: пузырь ---------- */
.msg-bubble-voice--tg .voice-tg-row { gap: 10px; align-items: center; }
.voice-play--tg { width: 44px !important; height: 44px !important; border-radius: 50% !important; flex: 0 0 auto; }
.msg:not(.out) .voice-play--tg { background: linear-gradient(135deg, var(--accent, #4f7cff), #8b5cf6) !important; color: #fff !important; border: 0 !important; }
.voice-wave--tg { height: 30px; gap: 2.5px; }
.voice-wave--tg span { border-radius: 3px; max-width: 3.5px; background: var(--accent, #4f7cff); }
.msg-bubble-voice.is-playing .voice-play--tg { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent, #4f7cff) 50%, transparent); animation: voiceRing 1.6s ease-out infinite; }
@keyframes voiceRing { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent, #4f7cff) 45%, transparent); } 100% { box-shadow: 0 0 0 12px transparent; } }
.msg.out .msg-bubble-voice.is-playing .voice-play--tg { animation-name: voiceRingOut; }
@keyframes voiceRingOut { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .6); } 100% { box-shadow: 0 0 0 12px rgba(255, 255, 255, 0); } }
.msg-bubble-voice.is-playing .voice-rate { opacity: 1; }

/* ---------- запись ---------- */
.recording-bar { position: relative; overflow: hidden; border-radius: 22px !important; margin: 0 8px 6px; border: 1px solid color-mix(in srgb, #ef4444 28%, var(--line, #e2e8f0)) !important;
  background: color-mix(in srgb, var(--bg-elevated, #fff) 88%, transparent) !important; box-shadow: 0 -8px 30px -12px rgba(239, 68, 68, .35) !important; animation: recBarIn .3s cubic-bezier(.22, 1, .36, 1); }
@keyframes recBarIn { from { opacity: 0; transform: translateY(12px); } }
.recording-bar-main { gap: 10px !important; padding: 8px 10px !important; flex-wrap: nowrap !important; }
.rec-pulse { flex: 0 0 auto; animation: recPulse 1.1s ease-in-out infinite !important; box-shadow: 0 0 0 4px rgba(239, 68, 68, .18); }
.recording-bar-main .rec-time { order: -1; margin-left: 0 !important; font-weight: 800; font-size: 15px; color: inherit !important; min-width: 40px; }
.recording-bar-main .rec-pulse { order: -2; }
#recordingLabel { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; font-size: 13px; opacity: calc(.75 - var(--rec-slide, 0) * .6);
  transform: translateX(calc(var(--rec-slide, 0) * -36px)); transition: transform .12s ease-out; text-align: center;
  background: linear-gradient(90deg, currentColor 40%, color-mix(in srgb, currentColor 30%, transparent) 50%, currentColor 60%) 0 0 / 300% 100%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; animation: recHint 2.4s linear infinite; }
@keyframes recHint { from { background-position: 100% 0; } to { background-position: -50% 0; } }
.recording-bar--handsfree #recordingLabel { animation: none; -webkit-text-fill-color: currentColor; opacity: .8; transform: none; }
.recording-bar-main .recording-level { flex: 0 1 120px; min-width: 48px; height: 22px; align-items: center; }
.recording-bar--sliding { border-color: rgba(239, 68, 68, .6) !important; }
.recording-bar--cancelled { animation: recCancel .45s ease both; }
@keyframes recCancel { 20% { transform: translateX(-10px); } 40% { transform: translateX(8px); } 100% { transform: translateX(-40px); opacity: 0; } }
.rec-ctl { display: none; flex: 0 0 auto; border: 0; cursor: pointer; font: inherit; font-weight: 700; color: inherit; }
.recording-bar--handsfree .rec-ctl { display: inline-grid; place-items: center; animation: recCtlIn .3s cubic-bezier(.2, .9, .3, 1.3) both; }
@keyframes recCtlIn { from { opacity: 0; transform: scale(.5); } }
.rec-ctl--trash { width: 36px; height: 36px; border-radius: 50%; background: rgba(239, 68, 68, .12); color: #ef4444; }
.rec-ctl--trash .ui-icon { width: 18px; height: 18px; background-color: currentColor; }
.rec-ctl--review { padding: 0 12px; height: 34px; border-radius: 999px; background: color-mix(in srgb, currentColor 8%, transparent); font-size: 13px; }
.rec-ctl--send { width: 40px; height: 40px; border-radius: 50%; color: #fff; background: linear-gradient(135deg, var(--accent, #4f7cff), #8b5cf6); box-shadow: 0 6px 16px -6px var(--accent, #4f7cff); }
.rec-ctl--send .ui-icon { width: 18px; height: 18px; background-color: #fff; }
#pauseRecordBtn.rec-ctl { width: 36px; height: 36px; border-radius: 50%; padding: 0; background: color-mix(in srgb, currentColor 8%, transparent); }
.recording-bar--handsfree .rec-handsfree { display: none !important; }
.recording-bar-preview-wrap:not(.hidden) { width: min(220px, 60vw); aspect-ratio: 1; margin: 10px auto 0; border-radius: 50% !important; max-height: none !important; background: #0f172a;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, .25), 0 18px 40px -16px rgba(0, 0, 0, .5); }
.recording-bar-preview-wrap .record-preview-video { width: 100%; height: 100%; max-height: none !important; object-fit: cover; }
.recording-bar-preview-wrap .record-preview-zoom { display: none; }
.recording-bar-preview-wrap .record-flip-btn { top: auto !important; bottom: 10px; right: 50% !important; transform: translateX(50%); border-radius: 999px; }
.circle-lock-rail-hint { font-size: 11px; }
html[data-theme="dark"] .recording-bar { background: color-mix(in srgb, #0f172a 86%, transparent) !important; }

@media (prefers-reduced-motion: reduce) {
  .cnote, .cnote-float, .note-bar.is-shown, .recording-bar, #recordingLabel { animation: none !important; transition: none !important; }
}

/* ---------- защита исчезающих от скриншотов ---------- */
.vo-viewer.shield-armed { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.vo-viewer.shield-armed .vo-media { pointer-events: none; -webkit-user-drag: none; }
.vo-viewer .vo-stage { transition: filter .12s ease; }
.vo-viewer.is-shielded .vo-stage { filter: blur(48px) brightness(.25) saturate(.4); }
.shield-label { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.92); z-index: 5; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 18px 22px; border-radius: 22px; color: #fff; text-align: center; background: rgba(15, 23, 42, .72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  opacity: 0; pointer-events: none; transition: opacity .15s ease, transform .25s cubic-bezier(.2, .9, .3, 1.3); }
.shield-label .shield-ico { font-size: 30px; }
.shield-label b { font-size: 16px; }
.shield-label small { font-size: 12.5px; opacity: .7; }
.vo-viewer.is-shielded .shield-label { opacity: 1; transform: translate(-50%, -50%); }
@media print { .vo-viewer, html.screen-shield-on body { display: none !important; } }
.recording-bar--handsfree #recordingLabel { display: none; }
.recording-bar--handsfree .recording-bar-main .recording-level { flex: 1 1 auto; min-width: 24px; }
.recording-bar-main #pauseRecordBtn.rec-ctl:not(.hidden) { display: inline-grid; place-items: center; font-size: 15px; line-height: 1; min-width: 36px; color: inherit; border: 0; }
.recording-bar-main { min-width: 0; }
.recording-bar-main > * { flex-shrink: 0; }
.msg.out .msg-bubble-voice .voice-dur { color: #fff !important; opacity: .9; }
.msg.out .msg-bubble-voice .voice-rate { color: #fff; background: rgba(255, 255, 255, .22); }
.recording-bar-main .recording-level { overflow: hidden; }
.recording-bar-main #pauseRecordBtn.rec-ctl { font-size: 0 !important; width: 36px !important; height: 36px !important; min-height: 0; position: relative; }
.recording-bar-main #pauseRecordBtn.rec-ctl::before { content: ""; width: 10px; height: 12px; box-sizing: border-box; border-left: 3.5px solid currentColor; border-right: 3.5px solid currentColor; }
.recording-bar-main #pauseRecordBtn.rec-ctl.active::before { width: 0; height: 0; border-style: solid; border-width: 7px 0 7px 11px; border-color: transparent transparent transparent currentColor; margin-left: 3px; }
