/* Group voice chat (game.md Phase G6): the button in an open group's header and the bar that
   stays across the top of every screen while you are in a voice chat. Theme variables --p-*. */

/* Header button, beside the call buttons: in groups and two-person chats (voice.js sets
   [hidden] when no such chat is open, e.g. Saved Messages). !important because premium.css styles
   every header button with #chatView .header-actions :is(.header-call-btn,…){display:grid}, which
   out-ranks [hidden] and a plain #voiceChatBtn rule. */
#voiceChatBtn{position:relative;display:inline-grid;place-items:center}
#voiceChatBtn[hidden]{display:none!important}
.voice-chat-btn svg{fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round}
.voice-chat-btn.live{color:var(--p-online,#22c55e)}
.voice-chat-btn.mine{background:color-mix(in srgb,var(--p-online,#22c55e) 22%,transparent)!important}
.voice-count{position:absolute;top:-4px;right:-4px;min-width:18px;height:18px;padding:0 4px;border-radius:999px;background:var(--p-online,#22c55e);color:#04210f;font-size:11px;font-weight:800;line-height:18px;text-align:center}
.voice-count.hidden{display:none}

/* The bar. Everything else moves down by its height (--voice-h). */
body.voice-on{--voice-h:calc(56px + env(safe-area-inset-top))}
.voice-bar{position:fixed;top:0;left:0;right:0;z-index:1240;height:var(--voice-h,56px);padding:env(safe-area-inset-top) 12px 0;box-sizing:border-box;display:flex;align-items:center;gap:10px;background:linear-gradient(90deg,#15803d,#0e7490);color:#fff;font-family:var(--p-font,inherit);box-shadow:0 6px 18px -8px rgba(0,0,0,.6)}
.voice-bar-wave{flex:0 0 22px;width:22px;height:22px}
.voice-bar svg{width:100%;height:100%;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.voice-bar-wave path{animation:voice-wave 1.1s ease-in-out infinite alternate}
.voice-bar-wave path:nth-child(odd){animation-delay:.3s}
.voice-bar-copy{flex:1;min-width:0;display:flex;flex-direction:column;line-height:1.2}
.voice-bar-copy strong{font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.voice-bar-copy small{font-size:12px;opacity:.85;white-space:nowrap}
.voice-bar-people{display:flex;flex:0 1 auto;min-width:0}
.voice-person{flex:0 0 30px;width:30px;height:30px;margin-left:-6px;font-size:10px;overflow:hidden;border:2px solid rgba(255,255,255,.35)!important;box-sizing:border-box;transition:box-shadow .15s,border-color .15s}
.voice-person:first-child{margin-left:0}
.voice-person.speaking{border-color:#fff!important;box-shadow:0 0 0 3px rgba(255,255,255,.55);z-index:1}
.voice-person.muted{border-color:#ef4444!important}   /* muted: red ring (and "muted" in the full-screen list) */
.voice-person.connecting{opacity:.45}
.voice-bar-btn{flex:0 0 38px;width:38px;height:38px;padding:9px;border:0;border-radius:50%;background:rgba(255,255,255,.2);color:#fff;cursor:pointer}
.voice-bar-btn.off{background:#fff;color:#b91c1c}
.voice-bar-btn.danger{background:#dc2626}
.voice-bar-btn:focus-visible{outline:2px solid #fff;outline-offset:2px}
@keyframes voice-wave{from{transform:scaleY(.55)}to{transform:scaleY(1)}}
.voice-bar-wave path{transform-origin:center;transform-box:fill-box}

/* Make room for the bar: the app itself, and the full-screen layers of groups and games. */
body.voice-on .app-shell{padding-top:calc(var(--voice-h) + 12px)!important;box-sizing:border-box}
body.voice-on #chatView.chat-layout{height:min(860px,calc(100dvh - var(--voice-h) - 32px))!important;min-height:0!important}
@media (max-width:760px){
  body.voice-on .app-shell{padding-top:var(--voice-h)!important}
  body.voice-on #chatView.chat-layout{height:calc(100dvh - var(--voice-h))!important}
}
body.voice-on.iphone-route .app-shell,body.voice-on .iphone-route .app-shell{padding-top:var(--voice-h)!important}
body.voice-on.iphone-route #chatView.chat-layout,body.voice-on .iphone-route #chatView.chat-layout{height:calc(100dvh - var(--voice-h))!important}
body.voice-on .group-screen,body.voice-on .game-layer{top:var(--voice-h)}
body.voice-on .game-layer-inner,body.voice-on .group-screen-inner{padding-top:0}
@media (prefers-reduced-motion:reduce){.voice-bar-wave path{animation:none}}

/* Phones: thumb-sized Mute and Leave. */
.voice-bar{touch-action:manipulation;-webkit-user-select:none;user-select:none}
.voice-bar-btn{-webkit-tap-highlight-color:transparent}
@media (pointer:coarse){.voice-bar-btn{flex-basis:44px;width:44px;height:44px;padding:11px}}

/* The voice chat full screen, opened by tapping the bar (owner, 2026-10-03: "like Telegram"):
   the chat's name and how many are in it, everyone with their face, "this is you" / "speaking"
   / "listening" and their mic, then Speaker, a big Mute / Unmute and Leave at the bottom. */
.voice-bar{cursor:pointer}
.voice-panel{position:fixed;inset:0;z-index:1260;display:flex;flex-direction:column;padding:calc(10px + env(safe-area-inset-top)) 16px calc(18px + env(safe-area-inset-bottom));box-sizing:border-box;background:#000;color:#fff;font-family:var(--p-font,inherit);animation:vp-up .22s cubic-bezier(.2,.9,.3,1)}
@keyframes vp-up{from{transform:translateY(24px);opacity:0}}
.voice-panel svg{width:100%;height:100%;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.vp-head{display:grid;grid-template-columns:44px 1fr 44px;align-items:center;gap:10px;margin-bottom:18px}
.vp-round{width:44px;height:44px;padding:11px;border:0;border-radius:50%;background:#1c1c1e;color:#fff;cursor:pointer}
.vp-title{display:flex;flex-direction:column;align-items:center;min-width:0;text-align:center}
.vp-title strong{max-width:100%;font-size:18px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.vp-title small{font-size:13px;color:#8e8e93}
.vp-list{flex:1;min-height:0;align-self:stretch;overflow-y:auto;overscroll-behavior:contain}
.vp-list:not(:empty){flex:0 1 auto;border-radius:22px;background:#1c1c1e}
.vp-person{display:flex;align-items:center;gap:14px;padding:10px 16px}
.vp-person+.vp-person{border-top:1px solid #2c2c2e}
.vp-face{flex:0 0 46px;width:46px;height:46px;font-size:15px;overflow:hidden;transition:box-shadow .15s}
.vp-person.speaking .vp-face{box-shadow:0 0 0 3px #34c759}
.vp-who{flex:1;min-width:0;display:flex;flex-direction:column}
.vp-who strong{font-size:16px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.vp-who small{font-size:14px;color:#8e8e93}
.vp-who small[data-state="you"]{color:#4ea1ff}
.vp-person.speaking .vp-who small{color:#34c759}
.vp-mic-state{flex:0 0 24px;width:24px;height:24px;color:#8e8e93}
.vp-person.speaking .vp-mic-state{color:#34c759}
.vp-mic-state.off{color:#ff453a}
.vp-who small[data-state="muted"]{color:#ff453a}
.vp-foot{display:flex;align-items:flex-end;justify-content:space-around;gap:12px;margin-top:auto;padding-top:18px}
.vp-btn,.vp-mic{display:flex;flex-direction:column;align-items:center;gap:7px;border:0;background:none;color:#fff;font:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent}
.vp-btn .vp-ico{width:58px;height:58px;padding:16px;box-sizing:border-box;border-radius:50%;background:#2c2c2e}
.vp-btn.off .vp-ico{background:#fff;color:#000}
.vp-btn.danger .vp-ico{background:#3a1212;color:#ff453a}
.vp-btn small,.vp-mic small{font-size:13px}
.vp-mic .vp-ico{width:82px;height:82px;padding:24px;box-sizing:border-box;border-radius:50%;background:linear-gradient(160deg,#5ac8fa,#007aff);box-shadow:0 0 0 7px rgba(0,122,255,.22);transition:box-shadow .2s,background .2s}
.vp-mic.off .vp-ico{background:linear-gradient(160deg,#64d2ff,#0a84ff);box-shadow:0 0 0 7px rgba(10,132,255,.16)}
.vp-mic.live .vp-ico{background:linear-gradient(160deg,#4cd964,#22a347);box-shadow:0 0 0 10px rgba(52,199,89,.28)}
.vp-round:focus-visible,.vp-btn:focus-visible .vp-ico,.vp-mic:focus-visible .vp-ico{outline:2px solid #fff;outline-offset:3px}
@media (prefers-reduced-motion:reduce){.voice-panel{animation:none}}

/* Audio settings, from the Speaker button: microphone, speaker and "Hear the others" */
.vp-sheet{position:absolute;left:12px;right:12px;bottom:calc(16px + env(safe-area-inset-bottom));z-index:2;display:flex;flex-direction:column;gap:10px;padding:14px;border-radius:22px;background:#1c1c1e;box-shadow:0 -10px 40px rgba(0,0,0,.7);animation:vp-up .18s ease-out}
.vp-sheet header{display:flex;align-items:center;justify-content:space-between}
.vp-sheet header strong{font-size:17px}
.vp-row{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:48px;padding:0 14px;border-radius:14px;background:#2c2c2e;color:#fff;font:inherit;font-size:15px}
.vp-row select{flex:1;min-width:0;max-width:62%;height:40px;border:0;border-radius:10px;background:#3a3a3c;color:#fff;font:inherit;font-size:16px;padding:0 8px}
.vp-toggle{border:0;cursor:pointer;text-align:left}
.vp-toggle b{color:#34c759}
.vp-toggle[aria-pressed="false"] b{color:#ff453a}
.vp-hint{margin:0;padding:0 4px;font-size:13px;line-height:1.4;color:#8e8e93}
