/* RIDDY v8 — стили P2P-звонков и мелкие SVG-анимации интерфейса */

/* ---- SVG-иконки в интерфейсе оживают при наведении ---- */
.tbtn svg, .dr-tile svg { transition: transform .22s cubic-bezier(.3,1.4,.5,1), color .2s; }
.tbtn:hover svg, .dr-tile:hover svg { transform: scale(1.14) rotate(-4deg); }
.tbtn:active svg, .dr-tile:active svg { transform: scale(.92); }
.call-open:hover svg { animation: callRing .6s ease-in-out 2; }
@keyframes callRing { 0%,100% { transform: rotate(0) } 20% { transform: rotate(-16deg) } 40% { transform: rotate(14deg) } 60% { transform: rotate(-10deg) } 80% { transform: rotate(8deg) } }

/* ---- карточка звонка ---- */
#call { background: rgba(0,0,0,.9); backdrop-filter: blur(6px); z-index: 60; }
.call-box { position: relative; width: 100%; max-width: 380px; max-height: 100%; overflow-y: auto; background: var(--c0f0f0f); border: 1px solid var(--c2a2a2a); border-radius: 18px; padding: 24px 20px 22px; color: var(--cddd); display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.call-box.in { animation: callIn .28s cubic-bezier(.2,.9,.3,1.1); }
@keyframes callIn { from { opacity: 0; transform: translateY(14px) scale(.97) } to { opacity: 1; transform: none } }

.call-x { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; background: none; border: 0; border-radius: 50%; color: var(--c999); cursor: pointer; transition: background .2s, transform .25s; }
.call-x:hover { background: var(--c222); transform: rotate(90deg); color: var(--cddd); }

.call-title { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; color: var(--cfff, var(--cddd)); }
.call-title svg { color: var(--acc); }
.call-sub { font-size: 13px; line-height: 1.45; color: var(--c999); max-width: 300px; }
.call-err { min-height: 18px; font-size: 13px; color: #e5484d; max-width: 320px; }
.call-wait { font-size: 13px; color: var(--c999); animation: callBlink 1.6s ease-in-out infinite; }
@keyframes callBlink { 50% { opacity: .45 } }

.call-big { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 13px 16px; background: var(--acc); color: #fff; border: 0; border-radius: 12px; font-size: 15px; font-weight: 700; cursor: pointer; position: relative; overflow: hidden; transition: transform .15s, filter .2s; }
.call-big:hover { filter: brightness(1.1); transform: translateY(-1px); }
.call-big:active { transform: scale(.98); }
.call-big svg { transition: transform .3s; }
.call-big:hover svg { transform: rotate(90deg); }
.call-big::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.25) 50%, transparent 70%); transform: translateX(-100%); animation: callShine 3.4s ease-in-out infinite; }
@keyframes callShine { 55%, 100% { transform: translateX(100%) } }

.call-or { display: flex; align-items: center; gap: 10px; width: 100%; color: var(--c777, var(--c999)); font-size: 12px; }
.call-or::before, .call-or::after { content: ''; flex: 1; height: 1px; background: var(--c2a2a2); }
.call-join { display: flex; gap: 8px; width: 100%; }
.call-input { flex: 1; min-width: 0; padding: 12px 14px; background: var(--c111); color: var(--cddd); border: 1px solid var(--c2a2a2); border-radius: 12px; font: 600 18px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .2em; text-align: center; text-transform: uppercase; outline: none; transition: border-color .2s, box-shadow .2s; }
.call-input:focus { border-color: var(--acc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--acc) 25%, transparent); }
.call-go { width: 48px; display: flex; align-items: center; justify-content: center; background: var(--c222); color: var(--cddd); border: 0; border-radius: 12px; cursor: pointer; transition: background .2s, transform .2s; }
.call-go:hover:not(:disabled) { background: var(--acc); color: #fff; transform: translateX(2px); }
.call-go:disabled { opacity: .5; cursor: default; }

.call-code { font: 700 34px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .14em; color: var(--cfff, var(--cddd)); user-select: all; padding: 8px 4px; }
.call-copy { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; background: var(--c222); color: var(--cddd); border: 0; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer; transition: background .2s, color .2s, transform .15s; }
.call-copy:hover { background: var(--c2a2a2); }
.call-copy:active { transform: scale(.95); }
.call-copy.ok { background: #3fb27f; color: #fff; }
.call-link { background: none; border: 0; color: var(--acc); font-size: 13px; font-weight: 600; cursor: pointer; padding: 4px 8px; }
.call-link:hover { text-decoration: underline; }

.call-radar { overflow: visible; margin: -4px 0; }

/* ---- кнопки управления ---- */
.call-ctrl { display: flex; align-items: center; justify-content: center; gap: 18px; width: 100%; }
.cbtn { width: 54px; height: 54px; display: flex; align-items: center; justify-content: center; background: var(--c222); color: var(--cddd); border: 0; border-radius: 50%; cursor: pointer; transition: transform .18s cubic-bezier(.3,1.5,.5,1), background .2s, color .2s; }
.cbtn:hover { transform: scale(1.1); background: var(--c2a2a2); }
.cbtn:active { transform: scale(.92); }
.cbtn.off { background: #fff; color: #111; }
.cbtn.on { background: var(--acc); color: #fff; }
.cbtn.end { background: #e5484d; color: #fff; width: 62px; height: 62px; box-shadow: 0 0 0 0 rgba(229,72,77,.5); }
.cbtn.end:hover { background: #f0585d; animation: callEnd .9s ease-out infinite; }
@keyframes callEnd { to { box-shadow: 0 0 0 16px rgba(229,72,77,0) } }
.cbtn svg { transition: transform .25s; }
.cbtn:hover svg { transform: scale(1.1); }

/* ---- экран разговора ---- */
.call-box.live { max-width: 440px; padding: 0 0 22px; gap: 18px; overflow: hidden; background: var(--c0a0a0a); }
.call-stage { position: relative; width: 100%; min-height: 380px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 36px 16px 20px; background: radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--acc) 22%, var(--c0a0a0a)), var(--c0a0a0a) 70%); overflow: hidden; }
.call-ring { position: relative; z-index: 2; width: 128px; height: 128px; border-radius: 50%; padding: 5px; background: var(--c222); transition: box-shadow .15s, transform .15s; }
.call-ring.speak { box-shadow: 0 0 0 4px color-mix(in srgb, var(--acc) 70%, transparent), 0 0 34px color-mix(in srgb, var(--acc) 55%, transparent); transform: scale(1.04); }
.call-av { width: 100%; height: 100%; border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--acc); color: #fff; font-size: 52px; font-weight: 700; }
.call-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.call-name { position: relative; z-index: 2; display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 20px; font-weight: 700; color: var(--cfff, var(--cddd)); }
.call-pmuted { display: none; color: #e5484d; }
.call-pmuted.on { display: inline-flex; }
.call-time { position: relative; z-index: 2; font: 600 15px/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--c999); }
.call-status { position: relative; z-index: 2; min-height: 16px; font-size: 12px; color: #e5a04d; }
.call-bars { position: relative; z-index: 2; margin-top: 6px; }
.call-bars rect { transition: height .06s linear, y .06s linear; }

.call-remote-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; display: none; z-index: 1; }
.call-box.remote-cam .call-remote-video { display: block; }
.call-box.remote-cam .call-ring { position: absolute; top: 14px; left: 14px; width: 54px; height: 54px; padding: 2px; }
.call-box.remote-cam .call-av { font-size: 22px; }
.call-box.remote-cam .call-name, .call-box.remote-cam .call-time { position: absolute; left: 78px; text-shadow: 0 1px 6px rgba(0,0,0,.8); color: #fff; }
.call-box.remote-cam .call-name { top: 18px; margin: 0; font-size: 15px; }
.call-box.remote-cam .call-time { top: 40px; }
.call-box.remote-cam .call-bars { position: absolute; bottom: 14px; left: 14px; transform: scale(.7); transform-origin: left bottom; }

.call-local-video { display: none; position: absolute; right: 12px; bottom: 12px; z-index: 3; width: 104px; height: 140px; object-fit: cover; border-radius: 12px; border: 2px solid rgba(255,255,255,.85); background: #000; transform: scaleX(-1); box-shadow: 0 6px 20px rgba(0,0,0,.45); animation: callIn .25s ease-out; }
.call-box.local-cam .call-local-video { display: block; }

.call-box.done, .call-box.wait, .call-box.menu { gap: 14px; }

@media (max-width: 520px) {
  #call { padding: 0; align-items: stretch; }
  .call-box { max-width: none; border-radius: 0; border: 0; justify-content: center; }
  .call-box.live { justify-content: flex-start; }
  .call-box.live .call-stage { flex: 1; min-height: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .call-box.in, .call-wait, .call-big::after, .cbtn.end:hover, .call-open:hover svg, .call-local-video { animation: none !important; }
  .tbtn svg, .dr-tile svg, .cbtn, .call-big { transition: none; }
}

/* ---- встроенные SVG-иконки в чипах, окнах-пояснениях и списках (вместо символов-эмодзи) ---- */
.ci-inl { flex: none; vertical-align: -2px; margin-right: 4px; }
.rate-chip .ci-inl { animation: starPop .55s cubic-bezier(.3,1.6,.5,1) both; }
.is-ic .ci-inl { margin: 0; color: var(--acc); animation: starPop .6s cubic-bezier(.3,1.6,.5,1) both; }
.bd-chip .ci-inl, .chip .ci-inl { stroke-dasharray: 26; stroke-dashoffset: 26; animation: checkDraw .5s .1s ease-out forwards; }
.ub-x .ci-inl { margin: 0; vertical-align: middle; transition: transform .25s; }
.ub-x:hover .ci-inl { transform: rotate(90deg); }
.perk-t .ci-inl { opacity: .75; }
@keyframes starPop { from { transform: scale(0) rotate(-90deg); opacity: 0 } to { transform: none; opacity: 1 } }
@keyframes checkDraw { to { stroke-dashoffset: 0 } }
@media (prefers-reduced-motion: reduce) { .rate-chip .ci-inl, .is-ic .ci-inl, .bd-chip .ci-inl, .chip .ci-inl { animation: none; stroke-dashoffset: 0; } }

/* в каналах звонок не нужен: канал — это односторонняя лента */
#app[data-room="channel"] #call-btn { display: none !important; }

/* звонок виден только в личной переписке */
#call-btn { display: none; }
#app[data-dm]:not([data-dm=""]) #call-btn { display: flex; }
/* входящий звонок: зелёная кнопка «Принять» и кнопки в ряд */
.cbtn.accept { background: #2fb344; color: #fff; width: 62px; height: 62px; box-shadow: 0 0 0 0 rgba(47,179,68,.5); }
.cbtn.accept:hover { background: #3cc455; animation: callAccept .9s ease-out infinite; }
@keyframes callAccept { 0% { box-shadow: 0 0 0 0 rgba(47,179,68,.5); } 100% { box-shadow: 0 0 0 16px rgba(47,179,68,0); } }
.call-box.incoming .call-ctrl { display: flex; gap: 44px; justify-content: center; margin-top: 10px; }
.call-box.incoming .call-ring { animation: callPulse 1.2s ease-in-out infinite; }
@keyframes callPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .cbtn.accept:hover, .call-box.incoming .call-ring { animation: none !important; } }

/* v16.5: демонстрация экрана */
.call-box.remote-screen .call-remote-video { object-fit: contain; }
.call-box.local-screen .call-local-video { transform: none; object-fit: contain; width: 150px; height: 96px; }
