/* ==========================================================================
   AnySync v2 — comms: Chat · Video Call · Walkie-Talkie
   (src/client/orbit-v2-comms-*.ts). Semantic tokens only, prefix v2-comms-.
   ========================================================================== */

/* ------------------------------------------------------- theme vars --- */
/* Comms-local looks per theme (bubbles, waves, the hold-to-talk button).
   Bright is the :root default; Dark / Universe override; an unset theme on a
   dark system is Universe, like the tokens. */
:root {
  --comms-bubble: #eef2f9;
  --comms-bubble-border: rgba(84, 92, 190, .06);
  --comms-mine: linear-gradient(135deg, #198b8c, #0d7071);
  --comms-mine-border: transparent;
  --comms-mine-ink: #ffffff;
  --comms-mine-shadow: 0 8px 18px -10px rgba(12, 106, 108, .7);
  --comms-wave: rgba(12, 106, 108, .34);
  --comms-ptt: linear-gradient(160deg, #ff9b55 0%, #ec6224 42%, #cf4612 100%);
  --comms-ptt-ink: #ffffff;
  --comms-ptt-glow: rgba(242, 107, 42, .42);
  --comms-ptt-halo: rgba(255, 140, 80, .16);
  --comms-tile-edge: rgba(255, 255, 255, .9);
}
:root[data-theme="dark"] {
  --comms-bubble: rgba(148, 196, 230, .08);
  --comms-bubble-border: rgba(103, 232, 249, .12);
  --comms-mine: linear-gradient(135deg, rgba(34, 211, 238, .30), rgba(20, 150, 190, .20));
  --comms-mine-border: rgba(34, 211, 238, .55);
  --comms-mine-ink: var(--foreground);
  --comms-mine-shadow: 0 0 calc(16px * var(--glow-scale, 1)) rgba(34, 211, 238, .2);
  --comms-wave: rgba(148, 210, 235, .42);
  --comms-ptt: linear-gradient(150deg, #6ff7cc 0%, #2ee0b0 45%, #11b79c 100%);
  --comms-ptt-ink: #04261f;
  --comms-ptt-glow: rgba(46, 224, 176, .5);
  --comms-ptt-halo: rgba(46, 224, 176, .1);
  --comms-tile-edge: rgba(103, 232, 249, .14);
}
:root[data-theme="universe"] {
  --comms-bubble: rgba(28, 40, 120, .55);
  --comms-bubble-border: rgba(110, 230, 255, .3);
  --comms-mine: linear-gradient(135deg, rgba(62, 230, 255, .36), rgba(45, 120, 255, .26));
  --comms-mine-border: rgba(120, 236, 255, .8);
  --comms-mine-ink: #ffffff;
  --comms-mine-shadow: 0 0 calc(18px * var(--glow-scale, 1)) rgba(62, 230, 255, .3);
  --comms-wave: rgba(150, 225, 255, .5);
  --comms-ptt: linear-gradient(160deg, #ff9a5a 0%, #ec6224 45%, #c9401a 100%);
  --comms-ptt-ink: #ffffff;
  --comms-ptt-glow: rgba(255, 110, 60, .5);
  --comms-ptt-halo: rgba(255, 130, 80, .12);
  --comms-tile-edge: rgba(110, 230, 255, .3);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]):not([data-theme="universe"]) {
    --comms-bubble: rgba(28, 40, 120, .55);
    --comms-bubble-border: rgba(110, 230, 255, .3);
    --comms-mine: linear-gradient(135deg, rgba(62, 230, 255, .36), rgba(45, 120, 255, .26));
    --comms-mine-border: rgba(120, 236, 255, .8);
    --comms-mine-ink: #ffffff;
    --comms-mine-shadow: 0 0 calc(18px * var(--glow-scale, 1)) rgba(62, 230, 255, .3);
    --comms-wave: rgba(150, 225, 255, .5);
    --comms-ptt: linear-gradient(160deg, #ff9a5a 0%, #ec6224 45%, #c9401a 100%);
    --comms-ptt-ink: #ffffff;
    --comms-ptt-glow: rgba(255, 110, 60, .5);
    --comms-ptt-halo: rgba(255, 130, 80, .12);
    --comms-tile-edge: rgba(110, 230, 255, .3);
  }
}

/* ------------------------------------------------------------- shared --- */

.v2-comms-badge {
  display: inline-grid;
  place-items: center;
  flex: none;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: .75rem;
  font-weight: 650;
  box-shadow: 0 0 calc(10px * var(--glow-scale, 1)) var(--glow);
}

/* Waveforms: bar heights come from --v (0..1). */
.v2-comms-wave { display: flex; align-items: center; gap: 2px; height: 28px; flex: 1; min-width: 0; overflow: hidden; }
.v2-comms-wave-bar {
  flex: none;
  width: 3px;
  height: calc(var(--v) * 100%);
  border-radius: 2px;
  background: var(--comms-wave);
  transition: background .1s;
}
.v2-comms-wave-bar.is-played { background: var(--primary); }

.v2-comms-voice { display: flex; align-items: center; gap: 10px; min-width: 0; }
.v2-comms-voice-play {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  padding: 0 0 0 2px;
  border: 0;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  cursor: pointer;
  box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--primary) 70%, transparent), 0 0 calc(12px * var(--glow-scale, 1)) color-mix(in srgb, var(--primary) 30%, transparent);
  transition: transform .1s, background .15s;
}
.v2-comms-voice-play svg { fill: currentColor; }
.v2-comms-voice.is-playing .v2-comms-voice-play { padding-left: 0; }
.v2-comms-voice-play:hover { background: var(--primary-strong); }
.v2-comms-voice-play:active { transform: scale(.94); }
.v2-comms-voice-play:focus-visible { outline: none; box-shadow: var(--ring); }
.v2-comms-voice-time { flex: none; min-width: 34px; color: var(--muted); font-size: .8125rem; font-weight: 500; font-variant-numeric: tabular-nums; }

.v2-comms-livewave { display: inline-flex; align-items: center; gap: 2px; height: 20px; }
.v2-comms-livewave > span {
  width: 3px;
  height: 100%;
  border-radius: 2px;
  background: currentColor;
  transform: scaleY(.3);
  animation: v2-comms-wave .9s ease-in-out infinite;
  animation-delay: calc(var(--i) * -.13s);
}
@keyframes v2-comms-wave { 50% { transform: scaleY(1); } }

.v2-comms-level { display: flex; align-items: center; gap: 2px; height: 28px; flex: 1; min-width: 0; overflow: hidden; }
.v2-comms-level > span { flex: none; width: 3px; height: calc(var(--v) * 100%); border-radius: 2px; background: var(--live); transition: height .08s; }

/* The stylised map (location messages, the call's Map tab). */
.v2-comms-map { position: relative; overflow: hidden; background: var(--surface); }
.v2-comms-map > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; stroke: none; fill: none; }
.v2-comms-map .m-land { fill: color-mix(in srgb, var(--sky) 6%, var(--surface)); }
.v2-comms-map .m-park { fill: color-mix(in srgb, var(--green) 20%, var(--surface)); }
.v2-comms-map .m-water { fill: color-mix(in srgb, var(--sky) 28%, var(--surface)); }
.v2-comms-map .m-road { stroke: color-mix(in srgb, var(--foreground) 16%, var(--surface)); stroke-width: 5; fill: none; stroke-linecap: round; }
.v2-comms-map .m-street { stroke: color-mix(in srgb, var(--foreground) 9%, var(--surface)); stroke-width: 2; fill: none; stroke-linecap: round; }
.v2-comms-map-pin { position: absolute; transform: translate(-50%, -92%); color: var(--tone, var(--primary)); filter: drop-shadow(0 3px 4px color-mix(in srgb, var(--avatar-base) 45%, transparent)); line-height: 0; }
.v2-comms-map-pin svg { stroke-width: 1.4; }
.v2-comms-map-area {
  position: absolute;
  width: 44%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: color-mix(in srgb, var(--tone, var(--primary)) 20%, transparent);
  border: 2px dashed color-mix(in srgb, var(--tone, var(--primary)) 65%, transparent);
}
.v2-comms-map-person { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 2px; transform: translate(-50%, -30%); }
.v2-comms-map-person .v2-avatar { box-shadow: 0 0 0 2px var(--surface), 0 4px 10px color-mix(in srgb, var(--avatar-base) 35%, transparent); }
.v2-comms-map-person.is-me .v2-avatar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 5px var(--primary); }
.v2-comms-map-label {
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-glass-strong);
  color: var(--foreground);
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow);
}

/* Inputs inside a styled pill: drop orbit.css's input[type] glass (its focus ring is on the pill). */
input.v2-comms-search-field,
input.v2-comms-input-field,
input.v2-comms-side-input { padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; -webkit-appearance: none; appearance: none; }
input.v2-comms-search-field:focus-visible,
input.v2-comms-input-field:focus-visible,
input.v2-comms-side-input:focus-visible { box-shadow: none; }
input.v2-comms-search-field::-webkit-search-decoration { -webkit-appearance: none; }

/* Emoji / reaction picker (in a kit popover). */
.v2-comms-emoji { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.v2-comms-emoji-btn {
  display: grid;
  place-items: center;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: none;
  font-size: 1.375rem;
  cursor: pointer;
}
.v2-comms-emoji-btn:hover { background: color-mix(in srgb, var(--foreground) 8%, transparent); }
.v2-comms-emoji-btn:focus-visible { outline: none; box-shadow: var(--ring); }

/* Menus and pickers in sheets. */
.v2-comms-menu { display: flex; flex-direction: column; gap: 2px; }
.v2-comms-menu .v2-btn { justify-content: flex-start; border-radius: 14px; }
.v2-comms-menu-title { margin: 10px 4px 4px; font-size: .9375rem; }
.v2-comms-menu-member { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 4px; }
.v2-comms-menu-member > span:nth-child(2) { flex: 1; font-weight: 550; }
.v2-comms-menu-note { display: flex; align-items: flex-start; gap: 8px; margin: 10px 4px 0; color: var(--muted); font-size: .8125rem; line-height: 1.4; }
.v2-comms-menu-note svg { flex: none; margin-top: 2px; }
.v2-comms-newchat, .v2-comms-cast { display: flex; flex-direction: column; gap: 4px; }
.v2-comms-newchat-item, .v2-comms-cast-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: none;
  color: var(--foreground);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.v2-comms-newchat-item:hover, .v2-comms-cast-item:hover { background: color-mix(in srgb, var(--foreground) 6%, transparent); }
.v2-comms-newchat-item:focus-visible, .v2-comms-cast-item:focus-visible { outline: none; box-shadow: var(--ring); }
.v2-comms-newchat-item[disabled], .v2-comms-cast-item[disabled] { opacity: .5; cursor: not-allowed; }
.v2-comms-newchat-name, .v2-comms-cast-text { flex: 1; min-width: 0; font-weight: 550; }
.v2-comms-cast-item.is-on { border-color: var(--primary); background: var(--primary-soft); }
.v2-comms-cast-item > svg { color: var(--primary); }
.v2-comms-cast-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); }
.v2-comms-cast-text { display: flex; flex-direction: column; }
.v2-comms-cast-sub { color: var(--muted); font-size: .8125rem; font-weight: 500; }

.v2-comms-field {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  background: var(--surface-glass-strong);
  color: var(--foreground);
  font: inherit;
  box-sizing: border-box;
}
.v2-comms-field:focus { outline: none; box-shadow: var(--ring); }
.v2-comms-field-label { display: flex; flex-direction: column; gap: 6px; margin: 0; font-weight: 600; font-size: .875rem; }
.v2-comms-pick { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow: auto; }
.v2-comms-pick-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: none;
  color: var(--foreground);
  font: inherit;
  font-weight: 550;
  text-align: left;
  cursor: pointer;
}
.v2-comms-pick-item > span:nth-child(2) { flex: 1; }
.v2-comms-pick-item:focus-visible { outline: none; box-shadow: var(--ring); }
.v2-comms-pick-check { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--glass-border); color: transparent; }
.v2-comms-pick-item[aria-pressed="true"] { border-color: color-mix(in srgb, var(--primary) 50%, transparent); background: var(--primary-soft); }
.v2-comms-pick-item[aria-pressed="true"] .v2-comms-pick-check { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

/* ================================================================ CHAT === */

.v2-comms-chat .v2-page-head { margin-bottom: 14px; }
.v2-comms-panes {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 16px;
  height: clamp(520px, calc(100dvh - 200px), 1100px);
}
.v2-comms-list-pane,
.v2-comms-conv {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  background: var(--surface-glass);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(140%);
  backdrop-filter: blur(var(--blur)) saturate(140%);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.v2-comms-list-pane { gap: 12px; padding: 14px 10px 10px; }
.v2-comms-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin: 0 4px;
  padding: 0 14px;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--foreground) 4%, transparent);
  color: var(--muted);
}
.v2-comms-search:focus-within { box-shadow: var(--ring); }
.v2-comms-search-field { flex: 1; min-width: 0; height: 42px; border: 0; background: none; color: var(--foreground); font: inherit; outline: none; }
.v2-comms-search-field::placeholder { color: var(--muted); }
.v2-comms-list-pane .v2-chip-group { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 2px 4px; gap: 6px; }
.v2-comms-list-pane .v2-chip { min-height: 40px; padding: 0 14px; }

.v2-comms-conv-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.v2-comms-conv-item { position: relative; display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 18px; transition: background .15s; }
.v2-comms-conv-item + .v2-comms-conv-item::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 84px;
  right: 12px;
  border-top: 1px solid var(--glass-border);
}
.v2-comms-conv-item:hover { background: color-mix(in srgb, var(--foreground) 5%, transparent); }
.v2-comms-conv-item.is-selected {
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 16%, transparent), color-mix(in srgb, var(--primary) 7%, transparent));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 34%, transparent), 0 0 calc(18px * var(--glow-scale, 1)) color-mix(in srgb, var(--primary) 14%, transparent);
}
.v2-comms-conv-item.is-selected::before, .v2-comms-conv-item.is-selected + .v2-comms-conv-item::before { display: none; }
.v2-comms-conv-hit { position: absolute; inset: 0; z-index: 1; width: 100%; border: 0; border-radius: inherit; background: none; cursor: pointer; }
.v2-comms-conv-hit:focus-visible { outline: none; box-shadow: var(--ring); }
.v2-comms-conv-item > :not(.v2-comms-conv-hit) { position: relative; pointer-events: none; }
.v2-comms-group-pic { flex: none; width: var(--size, 48px); height: var(--size, 48px); border-radius: 50%; }
.v2-comms-conv-text { flex: 1; min-width: 0; }
.v2-comms-conv-top { display: flex; align-items: center; gap: 6px; }
.v2-comms-conv-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1rem; font-weight: 600; letter-spacing: -.01em; }
.v2-comms-conv-flag { display: inline-grid; flex: none; color: var(--muted); }
.v2-comms-conv-time { margin-left: auto; padding-left: 8px; color: var(--muted); font-size: .8125rem; white-space: nowrap; }
.v2-comms-conv-bottom { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.v2-comms-conv-preview { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .875rem; }
.v2-comms-conv-item.is-unread .v2-comms-conv-preview { color: var(--foreground); font-weight: 500; }
.v2-comms-conv-item.is-unread .v2-comms-conv-time { color: var(--primary); font-weight: 600; }

/* ----------------------------------------------------- conversation --- */

.v2-comms-conv-empty { display: grid; place-items: center; flex: 1; padding: 24px; }
.v2-comms-conv-head { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--glass-border); }
.v2-comms-conv-head > .v2-avatar, .v2-comms-conv-head > .v2-comms-group-pic { box-shadow: 0 0 0 2px var(--avatar-ring), 0 0 0 3.5px color-mix(in srgb, var(--primary) 45%, transparent); }
.v2-comms-conv-back { display: none; }
.v2-comms-conv-titles { flex: 1; min-width: 0; }
.v2-comms-conv-title { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.25rem; font-weight: 650; letter-spacing: -.02em; }
.v2-comms-conv-status { margin: 2px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .875rem; }
.v2-comms-conv-actions { display: flex; align-items: center; gap: 8px; }

.v2-comms-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 24px 12px;
}
.v2-comms-log:focus-visible { outline: none; box-shadow: inset var(--ring); }
.v2-comms-day { align-self: center; margin: 8px 0 2px; }
.v2-comms-day > span {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--foreground) 6%, transparent);
  color: var(--muted);
  font-size: .75rem;
  font-weight: 600;
}
.v2-comms-hello { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: auto; padding: 24px; text-align: center; }
.v2-comms-hello p { margin: 0; }

.v2-comms-msg { display: flex; align-items: flex-start; gap: 12px; max-width: min(78%, 560px); }
.v2-comms-msg.is-first { margin-top: 12px; }
.v2-comms-msg > .v2-avatar { margin-top: 2px; }
.v2-comms-msg.is-mine { align-self: flex-end; }
.v2-comms-msg-gap { flex: none; width: 44px; }
/* Cards take a steady width instead of shrinking to their text. */
.v2-comms-msg[data-kind="location"] { width: min(480px, 84%); }
.v2-comms-msg[data-kind="location"] .v2-comms-msg-content,
.v2-comms-msg[data-kind="location"] .v2-comms-msg-line,
.v2-comms-msg[data-kind="location"] .v2-comms-bubble { flex: 1; width: 100%; }
.v2-comms-msg[data-kind="location"] .v2-comms-loc { width: 100%; }
.v2-comms-msg-content { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; min-width: 0; }
.v2-comms-msg.is-mine .v2-comms-msg-content { align-items: flex-end; }
.v2-comms-msg-head { display: flex; align-items: baseline; gap: 8px; padding: 0 2px; font-size: .8125rem; line-height: 1.2; }
.v2-comms-msg-name { font-weight: 600; }
.v2-comms-msg-time { color: var(--muted); font-size: .75rem; font-weight: 500; }
.v2-comms-msg-line { display: flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%; }
.v2-comms-msg.is-mine .v2-comms-msg-line { flex-direction: row-reverse; }
.v2-comms-react-btn { opacity: 0; transition: opacity .12s; }
.v2-comms-msg:hover .v2-comms-react-btn, .v2-comms-react-btn:focus-visible { opacity: 1; }
@media (hover: none) { .v2-comms-react-btn:not(:focus-visible) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } }

.v2-comms-bubble {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-width: 0;
  padding: 10px 15px;
  border: 1px solid var(--comms-bubble-border);
  border-radius: 20px;
  background: var(--comms-bubble);
  color: var(--foreground);
  font-size: .9375rem;
  line-height: 1.45;
}
.v2-comms-msg.is-theirs.is-first .v2-comms-bubble { border-top-left-radius: 6px; }
.v2-comms-msg.is-mine .v2-comms-bubble { border-bottom-right-radius: 6px; }
.v2-comms-text { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
/* Mine: the solid brand bubble in Bright, a lit glass bubble in Dark / Universe (--comms-mine*). */
.v2-comms-msg.is-mine .v2-comms-bubble {
  border-color: var(--comms-mine-border);
  background: var(--comms-mine);
  color: var(--comms-mine-ink);
  box-shadow: var(--comms-mine-shadow);
}
.v2-comms-msg.is-mine .v2-comms-bubble.is-card { background: var(--comms-bubble); border-color: var(--comms-bubble-border); color: var(--foreground); box-shadow: none; }
.v2-comms-ticks { display: inline-grid; flex: none; margin-bottom: 1px; opacity: .8; }
.v2-comms-ticks.is-read { opacity: 1; }
.v2-comms-msg.is-mine .v2-comms-voice-play { background: color-mix(in srgb, currentColor 18%, transparent); color: inherit; box-shadow: none; }
.v2-comms-msg.is-mine .v2-comms-wave-bar { background: color-mix(in srgb, currentColor 45%, transparent); }
.v2-comms-msg.is-mine .v2-comms-wave-bar.is-played { background: currentColor; }
.v2-comms-msg.is-mine .v2-comms-voice-time { color: inherit; opacity: .85; }
.v2-comms-bubble.is-voice { padding: 8px 16px 8px 10px; }
.v2-comms-bubble.is-voice .v2-comms-voice { width: min(250px, 58vw); }

.v2-comms-bubble.is-card { display: block; padding: 0; overflow: hidden; }
.v2-comms-bubble.is-photo { width: 320px; max-width: 100%; }
.v2-comms-photo { margin: 0; }
.v2-comms-photo-open { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.v2-comms-photo-open:focus-visible { outline: none; box-shadow: inset var(--ring); }
.v2-comms-photo-art, .v2-comms-photo-img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.v2-comms-photo-cap { padding: 9px 14px 11px; }
.v2-comms-photo-big { display: block; width: 100%; aspect-ratio: 16 / 10; border-radius: 16px; object-fit: contain; }

.v2-comms-loc {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(80px, 112px);
  align-items: center;
  gap: 12px;
  width: min(420px, 100%);
  min-height: 78px;
  padding: 0 0 0 12px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.v2-comms-loc:focus-visible { outline: none; box-shadow: inset var(--ring); }
.v2-comms-loc-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--primary); color: var(--on-primary); }
.v2-comms-loc-text { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; padding: 10px 0; }
.v2-comms-loc-title { display: -webkit-box; max-width: 100%; overflow: hidden; font-weight: 600; line-height: 1.3; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow-wrap: anywhere; }
.v2-comms-loc-sub { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .8125rem; }
.v2-comms-loc-link { color: var(--primary); font-weight: 550; }
.v2-comms-precision { display: inline-flex; align-items: center; gap: 4px; margin-top: 2px; color: color-mix(in srgb, var(--primary) 80%, var(--foreground)); font-size: .75rem; font-weight: 600; }
.v2-comms-precision.is-approx { color: color-mix(in srgb, var(--amber) 72%, var(--foreground)); }
.v2-comms-loc-map { align-self: stretch; min-height: 78px; -webkit-mask-image: linear-gradient(90deg, transparent, #000 24%); mask-image: linear-gradient(90deg, transparent, #000 24%); }
.v2-comms-loc-chev {
  position: absolute;
  right: 8px;
  top: 50%;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-glass-strong);
  color: var(--primary);
  transform: translateY(-50%);
  box-shadow: var(--shadow);
}
.v2-comms-loc-bigmap { aspect-ratio: 16 / 10; border-radius: 18px; border: 1px solid var(--glass-border); }
.v2-comms-loc-bigmap .v2-comms-map-pin svg { width: 40px; height: 40px; }

.v2-comms-bubble.is-file { align-items: center; gap: 10px; padding: 8px 8px 8px 12px; }
.v2-comms-file-icon { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--sky-soft); color: color-mix(in srgb, var(--sky) 72%, var(--foreground)); }
.v2-comms-file-text { display: flex; flex-direction: column; min-width: 0; }
.v2-comms-file-name { font-weight: 600; overflow-wrap: anywhere; }
.v2-comms-file-size { color: var(--muted); font-size: .8125rem; }

.v2-comms-reactions { display: flex; flex-wrap: wrap; gap: 4px; }
.v2-comms-reaction {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--comms-bubble-border);
  border-radius: 999px;
  background: var(--comms-bubble);
  color: var(--foreground);
  font: inherit;
  font-size: .8125rem;
  font-weight: 600;
  cursor: pointer;
}
.v2-comms-reaction::after { content: ""; position: absolute; inset: -4px; }
.v2-comms-reaction.is-mine { border-color: var(--primary); background: var(--primary-soft); }
.v2-comms-reaction:focus-visible { outline: none; box-shadow: var(--ring); }

.v2-comms-typing { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.v2-comms-typing-dots { display: inline-flex; gap: 4px; padding: 13px 16px; border-radius: 6px 20px 20px 20px; background: var(--comms-bubble); border: 1px solid var(--comms-bubble-border); }
.v2-comms-typing-dots > span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: v2-comms-dot 1.2s ease-in-out infinite; }
.v2-comms-typing-dots > span:nth-child(2) { animation-delay: .15s; }
.v2-comms-typing-dots > span:nth-child(3) { animation-delay: .3s; }
@keyframes v2-comms-dot { 0%, 60%, 100% { transform: none; opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

.v2-comms-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 16px 6px;
  padding: 6px 6px 6px 14px;
  border: 1px solid color-mix(in srgb, var(--amber) 40%, transparent);
  border-radius: 16px;
  background: var(--amber-soft);
  color: var(--foreground);
  font-size: .875rem;
  line-height: 1.35;
}
.v2-comms-notice > svg { flex: none; color: color-mix(in srgb, var(--amber) 72%, var(--foreground)); }
.v2-comms-notice-text { flex: 1; }
.v2-comms-notice[hidden] { display: none; }

/* -------------------------------------------------------- composer --- */

.v2-comms-composer { display: flex; align-items: center; gap: 10px; padding: 12px 16px 14px; border-top: 1px solid var(--glass-border); }
.v2-comms-input {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  min-height: 52px;
  padding: 0 5px 0 20px;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: var(--surface-glass-strong);
  transition: border-color .15s, box-shadow .15s;
}
.v2-comms-input:focus-within { border-color: color-mix(in srgb, var(--primary) 55%, var(--glass-border)); box-shadow: var(--ring); }
.v2-comms-input-field { flex: 1; min-width: 0; height: 48px; border: 0; background: none; color: var(--foreground); font: inherit; font-size: .9375rem; outline: none; }
.v2-comms-input-field::placeholder { color: var(--muted); }
.v2-comms-composer .v2-icon-btn { width: 50px; height: 50px; }
.v2-comms-composer .v2-comms-attach-btn svg, .v2-comms-composer .v2-comms-mic svg { width: 22px; height: 22px; }
.v2-comms-composer .v2-comms-emoji-trigger { width: 42px; height: 42px; color: color-mix(in srgb, var(--foreground) 74%, transparent); }
.v2-comms-composer .v2-comms-emoji-trigger svg { width: 23px; height: 23px; }
.v2-comms-composer .v2-comms-send {
  background: linear-gradient(145deg, color-mix(in srgb, var(--primary) 80%, #ffffff), var(--primary) 60%);
  box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--primary) 80%, transparent), 0 0 calc(18px * var(--glow-scale, 1)) color-mix(in srgb, var(--primary) 32%, transparent);
}
.v2-comms-composer .v2-comms-send svg { margin: 1px 2px 0 0; }
.v2-comms-mic { touch-action: none; user-select: none; -webkit-user-select: none; transition: transform .12s, background .15s; }
.v2-comms-composer.is-recording .v2-comms-mic {
  background: var(--live-solid);
  border-color: var(--live-solid);
  color: var(--on-live);
  transform: scale(1.12);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--live) 22%, transparent);
}
.v2-comms-rec {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-radius: inherit;
  background: var(--surface-glass-strong);
}
.v2-comms-rec[hidden] { display: none; }
.v2-comms-rec-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--live); animation: v2-blink 1.2s ease-in-out infinite; }
.v2-comms-rec-time { flex: none; min-width: 36px; font-weight: 600; font-variant-numeric: tabular-nums; }
.v2-comms-rec-hint { display: inline-flex; align-items: center; gap: 2px; flex: none; color: var(--muted); font-size: .8125rem; white-space: nowrap; }

.v2-comms-attach { display: flex; flex-direction: column; gap: 6px; }
.v2-comms-attach-opt {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 8px 12px;
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  background: color-mix(in srgb, var(--foreground) 3%, transparent);
  color: var(--foreground);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.v2-comms-attach-opt:hover { border-color: color-mix(in srgb, var(--tone) 55%, var(--glass-border)); }
.v2-comms-attach-opt:focus-visible { outline: none; box-shadow: var(--ring); }
.v2-comms-attach-opt[aria-disabled="true"] { opacity: .62; }
.v2-comms-attach-icon { display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 14px; background: var(--tone-soft); color: var(--tone-ink); }
.v2-comms-attach-text { display: flex; flex-direction: column; gap: 2px; }
.v2-comms-attach-title { font-weight: 600; }
.v2-comms-attach-sub { color: var(--muted); font-size: .8125rem; }

/* Narrow conversation panes: the location card's map moves on top. */
@media (max-width: 1023px) {
  .v2-comms-msg[data-kind="location"] { width: 100%; max-width: 100%; }
  .v2-comms-loc { grid-template-columns: auto minmax(0, 1fr) minmax(64px, 28%); gap: 10px; padding-left: 10px; }
  .v2-comms-loc-icon { width: 40px; height: 40px; border-radius: 12px; }
}

/* 600–1023: a narrower list. */
@media (max-width: 1023px) and (min-width: 600px) {
  .v2-comms-panes { grid-template-columns: 280px minmax(0, 1fr); gap: 12px; }
  .v2-comms-conv-actions { gap: 4px; }
  .v2-comms-conv-actions .v2-icon-btn { width: 40px; height: 40px; }
  .v2-comms-conv-head .v2-avatar, .v2-comms-conv-head .v2-comms-group-pic { --size: 40px !important; }
  .v2-comms-log { padding: 10px 14px; }
  .v2-comms-msg { max-width: 88%; }
}

/* Phones: the list; an open conversation takes the whole screen. */
@media (max-width: 599px) {
  .v2-comms-panes { display: block; height: auto; }
  .v2-comms-list-pane { padding: 0; gap: 12px; border: 0; border-radius: 0; background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; overflow: visible; }
  .v2-comms-search { margin: 0; }
  .v2-comms-list-pane .v2-chip-group { margin: 0 calc(-1 * var(--v2-gutter)); padding: 2px var(--v2-gutter); }
  .v2-comms-conv-list { overflow: visible; }
  .v2-comms-conv-item { padding: 10px 4px; }
  .v2-comms-conv-item + .v2-comms-conv-item::before { left: 70px; right: 4px; }
  .v2-comms-chat:not(.is-open) .v2-comms-conv { display: none; }
  .v2-comms-chat.is-open > .v2-page-head,
  .v2-comms-chat.is-open .v2-comms-list-pane { display: none; }
  /* The section itself is the fixed layer (a .screen may carry a transform, which would trap a fixed child). */
  .v2-comms-chat.is-open { position: fixed; inset: 0; z-index: 40; padding: 0; }
  .v2-comms-chat.is-open > .v2-body, .v2-comms-chat.is-open .v2-comms-panes { height: 100%; }
  .v2-comms-chat.is-open .v2-comms-conv {
    position: absolute;
    inset: 0;
    border: 0;
    border-radius: 0;
    background: linear-gradient(180deg, var(--space-top), var(--space-mid) 55%, var(--space-bottom));
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: none;
    padding-top: env(safe-area-inset-top);
  }
  .v2-comms-conv-back { display: inline-grid; margin-left: -6px; }
  .v2-comms-conv-head { gap: 8px; padding: 8px 8px 8px 10px; background: var(--surface-glass-strong); }
  .v2-comms-conv-head .v2-avatar, .v2-comms-conv-head .v2-comms-group-pic { --size: 40px !important; }
  .v2-comms-conv-title { font-size: 1.0625rem; }
  .v2-comms-conv-status { font-size: .8125rem; }
  .v2-comms-conv-actions { gap: 0; margin-right: -4px; }
  .v2-comms-conv-actions .v2-icon-btn { width: 36px; height: 40px; border-color: transparent; background: none; color: var(--primary); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .v2-comms-log { padding: 8px 12px; }
  .v2-comms-msg { max-width: 88%; gap: 10px; }
  .v2-comms-msg .v2-avatar { --size: 40px !important; }
  .v2-comms-msg-gap { width: 40px; }
  .v2-comms-bubble.is-photo { width: 270px; }
  .v2-comms-composer { gap: 8px; padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); background: var(--surface-glass-strong); }
  .v2-comms-composer .v2-icon-btn { width: 46px; height: 46px; }
  .v2-comms-composer .v2-comms-attach-btn { border-color: transparent; background: none; }
  .v2-comms-input { min-height: 48px; padding-left: 16px; }
  .v2-comms-input-field { height: 42px; }
  .v2-comms-rec { padding: 0 12px; gap: 8px; }
  .v2-comms-rec-hint { display: none; }
  .v2-comms-notice { margin: 0 10px 6px; }
}

/* ========================================================== VIDEO CALL === */

.v2-comms-call .v2-page-head { margin-bottom: 14px; }
.v2-comms-call .v2-page-titles { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.v2-comms-call .v2-title { font-size: 1.25rem; font-weight: 600; }
.v2-comms-call-live { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--callable); box-shadow: 0 0 0 4px color-mix(in srgb, var(--callable) 25%, transparent); }
.v2-comms-call-meta { display: inline-flex; align-items: center; gap: 12px; color: var(--muted); font-weight: 600; font-size: .9375rem; }
.v2-comms-call-timer { color: var(--foreground); font-variant-numeric: tabular-nums; }
.v2-comms-call-timer::before { content: "·"; margin-right: 10px; color: var(--muted); }
.v2-comms-call-enc { display: inline-flex; align-items: center; gap: 4px; }
.v2-comms-cast-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 0 0 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: .8125rem;
  font-weight: 600;
}
.v2-comms-cast-chip[hidden] { display: none; }
.v2-comms-signal { display: inline-grid; place-items: center; width: 40px; height: 40px; color: var(--callable); }
.v2-comms-panel-btn { display: none; }

.v2-comms-call-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  height: clamp(540px, calc(100dvh - 190px), 1000px);
}
@media (min-width: 600px) {
  .v2-comms-call:has(.v2-comms-demo:not([hidden])) .v2-comms-call-layout { height: clamp(520px, calc(100dvh - 262px), 940px); }
}
.v2-comms-call-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; min-height: 0; }
.v2-comms-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  grid-auto-rows: minmax(0, 1fr);
  gap: 12px;
}
.v2-comms-stage[data-count="1"] { grid-template-columns: minmax(0, 1fr); }
.v2-comms-stage[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.v2-comms-stage[data-count="3"] .v2-comms-tile.is-main { grid-row: span 2; }
.v2-comms-stage[data-count="4"] .v2-comms-tile.is-main { grid-row: span 3; }

.v2-comms-tile {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
  container-type: size;
  border: 2px solid var(--comms-tile-edge);
  border-radius: 22px;
  background: var(--avatar-base);
  color: var(--media-ink);
  box-shadow: 0 14px 30px -18px color-mix(in srgb, var(--avatar-base) 70%, transparent);
  transition: border-color .25s, box-shadow .25s;
}
/* The scene behind the person: sharp enough to read as a place, softened like a lens's depth of field. */
.v2-comms-tile-art { position: absolute; inset: -3%; z-index: -4; filter: blur(2.5px) saturate(1.15); }
.v2-comms-tile-art > svg { width: 100%; height: 100%; }
.v2-comms-tile-bust {
  position: absolute;
  left: 50%;
  bottom: -4%;
  z-index: -3;
  width: min(82cqh, 88cqw);
  aspect-ratio: 1;
  transform: translateX(-50%);
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, .35));
}
.v2-comms-bust > svg { display: block; width: 100%; height: 100%; stroke: none; fill: none; }
.v2-comms-tile.is-main .v2-comms-tile-bust { width: min(76cqh, 96cqw); }
/* A camera's light: a soft vignette, darker at the bottom for the name. */
.v2-comms-tile-tint {
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(120% 90% at 50% 35%, transparent 55%, rgba(4, 8, 24, .38)),
    linear-gradient(180deg, transparent 62%, rgba(4, 8, 24, .5));
  pointer-events: none;
}
.v2-comms-tile-face { position: absolute; left: 50%; top: 46%; display: none; place-items: center; transform: translate(-50%, -50%); }
/* A voice call: no "camera" — the round avatar over the dimmed scene. */
.v2-comms-stage.is-audio .v2-comms-tile-art { opacity: .35; filter: blur(14px); }
.v2-comms-stage.is-audio .v2-comms-tile-bust { display: none; }
.v2-comms-stage.is-audio .v2-comms-tile-face { display: grid; }
.v2-comms-tile-talk {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 32px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--avatar-base) 55%, transparent);
  color: #5ff3d0;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  pointer-events: none;
}
.v2-comms-tile-talk .v2-comms-livewave { height: 16px; }
.v2-comms-tile-map {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  width: clamp(92px, 26cqmin, 138px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .55);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .35);
  pointer-events: none;
}
.v2-comms-tile-map-art { position: absolute; inset: 0; border-radius: 50%; }
.v2-comms-tile-map-art .v2-comms-map-pin svg { width: 22px; height: 22px; }
.v2-comms-tile-map-art .v2-comms-map-person .v2-avatar { --size: 24px !important; }
.v2-comms-tile-map-n { position: absolute; top: 5px; left: 50%; transform: translateX(-50%); color: var(--foreground); font-size: .6875rem; font-weight: 650; text-shadow: 0 0 4px var(--surface); }
.v2-comms-tile-map-dist {
  position: absolute;
  left: 50%;
  bottom: -11px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(8, 14, 34, .82);
  color: #ffffff;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
  transform: translateX(-50%);
}
.v2-comms-tile-map-dist svg { color: #5ff3d0; }
.v2-comms-tile .v2-comms-tile-avatar {
  --size: clamp(48px, 38cqmin, 176px) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--media-ink) 85%, transparent), 0 12px 30px color-mix(in srgb, var(--avatar-base) 50%, transparent);
}
.v2-comms-tile-ring { position: absolute; inset: -4px; border-radius: 50%; border: 3px solid var(--primary); opacity: 0; }
.v2-comms-tile.is-speaking { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary), 0 0 calc(30px * var(--glow-scale, 1)) color-mix(in srgb, var(--primary) 55%, transparent); }
.v2-comms-tile.is-speaking .v2-comms-tile-ring { animation: v2-comms-ring 1.6s ease-out infinite; }
.v2-comms-tile.is-speaking .v2-comms-tile-ring.is-2 { animation-delay: .8s; }
@keyframes v2-comms-ring { from { opacity: .9; transform: scale(1); } to { opacity: 0; transform: scale(1.45); } }
.v2-comms-tile-hit { position: absolute; inset: 0; z-index: 1; width: 100%; border: 0; border-radius: inherit; background: none; cursor: pointer; }
.v2-comms-tile-hit:focus-visible { outline: none; box-shadow: inset var(--ring); }
.v2-comms-tile-label {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 20px);
  padding: 6px 12px 6px 9px;
  border-radius: 12px;
  background: rgba(8, 12, 30, .58);
  color: #ffffff;
  font-size: .875rem;
  font-weight: 600;
  letter-spacing: -.005em;
  pointer-events: none;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.v2-comms-tile-mic { display: inline-grid; color: #4ade80; }
.v2-comms-tile-mic.is-muted { color: var(--media-ink); background: var(--live-solid); border-radius: 50%; padding: 2px; }
.v2-comms-tile-pin { position: absolute; top: 10px; right: 10px; z-index: 2; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: color-mix(in srgb, var(--avatar-base) 66%, transparent); color: var(--media-ink); pointer-events: none; }
.v2-comms-tile.is-share { background: var(--avatar-base); }
.v2-comms-share-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }

.v2-comms-self {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: clamp(128px, 17%, 200px);
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, .8);
  border-radius: 16px;
  background: linear-gradient(150deg, color-mix(in srgb, var(--primary) 38%, var(--avatar-base)), var(--avatar-base));
  color: var(--media-ink);
  box-shadow: var(--shadow-lg);
}
.v2-comms-self-video { position: absolute; inset: 0; display: none; width: 100%; height: 100%; object-fit: cover; }
.v2-comms-self.has-video:not(.is-simulated) .v2-comms-self-video { display: block; }
.v2-comms-self.is-mirrored .v2-comms-self-video { transform: scaleX(-1); }
/* A simulated camera (mock sensors): you, on camera, in a scene. */
.v2-comms-self-sim { position: absolute; inset: 0; display: none; overflow: hidden; }
.v2-comms-self-sim-art { position: absolute; inset: -4%; filter: blur(2px); }
.v2-comms-self-sim-art > svg { width: 100%; height: 100%; }
.v2-comms-self-bust { position: absolute; left: 50%; bottom: -6%; width: 96%; aspect-ratio: 1; transform: translateX(-50%); animation: v2-comms-sim 6s ease-in-out infinite alternate; }
@keyframes v2-comms-sim { to { transform: translateX(-47%) rotate(1.5deg); } }
.v2-comms-self.is-simulated .v2-comms-self-sim { display: block; }
.v2-comms-self.has-video .v2-comms-self-avatar { display: none; }
.v2-comms-self-label {
  position: absolute;
  left: 6px;
  bottom: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--avatar-base) 66%, transparent);
  color: var(--media-ink);
  font-size: .75rem;
  font-weight: 600;
}
.v2-comms-self-mic { display: inline-grid; }
.v2-comms-self.is-muted .v2-comms-self-mic { color: var(--media-ink); background: var(--live-solid); border-radius: 50%; padding: 1px; }

.v2-comms-burst { position: absolute; inset: 0; z-index: 4; overflow: hidden; pointer-events: none; }
.v2-comms-burst-emoji {
  position: absolute;
  bottom: 6%;
  left: var(--x);
  font-size: calc(2.4rem * var(--s));
  opacity: 0;
  animation: v2-comms-float 2.4s var(--d) ease-out forwards;
}
@keyframes v2-comms-float {
  0% { opacity: 0; transform: translateY(0) rotate(0) scale(.6); }
  12% { opacity: 1; transform: translateY(-20px) rotate(var(--r)) scale(1); }
  100% { opacity: 0; transform: translateY(-340px) rotate(var(--r)) scale(1.1); }
}

.v2-comms-controls {
  align-self: center;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 100%;
  padding: 12px 20px 10px;
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  background: var(--surface-glass-strong);
  -webkit-backdrop-filter: blur(var(--blur));
  backdrop-filter: blur(var(--blur));
  box-shadow: var(--shadow);
}
.v2-comms-ctl {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 68px;
  padding: 2px;
  border: 0;
  border-radius: 14px;
  background: none;
  color: color-mix(in srgb, var(--foreground) 86%, transparent);
  font: inherit;
  font-size: .8125rem;
  font-weight: 500;
  cursor: pointer;
}
.v2-comms-ctl-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  background: linear-gradient(180deg, color-mix(in srgb, var(--foreground) 9%, transparent), color-mix(in srgb, var(--foreground) 4%, transparent));
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 4px 12px -6px color-mix(in srgb, var(--avatar-base) 40%, transparent);
  transition: background .15s, border-color .15s, transform .1s;
}
.v2-comms-ctl:hover .v2-comms-ctl-icon { border-color: color-mix(in srgb, var(--primary) 60%, var(--glass-border)); }
.v2-comms-ctl:active .v2-comms-ctl-icon { transform: scale(.95); }
.v2-comms-ctl:focus-visible { outline: none; }
.v2-comms-ctl:focus-visible .v2-comms-ctl-icon { box-shadow: var(--ring); }
.v2-comms-ctl[aria-pressed="true"] .v2-comms-ctl-icon { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.v2-comms-ctl[data-ctl="mute"][aria-pressed="true"] .v2-comms-ctl-icon { background: var(--live-solid); border-color: var(--live-solid); color: var(--on-live); }
.v2-comms-ctl.is-danger .v2-comms-ctl-icon {
  width: 58px;
  height: 58px;
  margin-top: -2px;
  border-color: transparent;
  border-radius: 50%;
  background: linear-gradient(160deg, #ff6b7d, var(--live-solid) 60%);
  color: var(--on-live);
  box-shadow: 0 8px 20px -6px color-mix(in srgb, var(--live-solid) 80%, transparent), 0 0 calc(22px * var(--glow-scale, 1)) color-mix(in srgb, var(--live) 45%, transparent);
}
.v2-comms-ctl.is-danger { color: color-mix(in srgb, var(--live) 80%, var(--foreground)); }
.v2-comms-ctl.is-phone-only { display: none; }

.v2-comms-side {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 4px 16px 16px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  background: var(--surface-glass);
  -webkit-backdrop-filter: blur(var(--blur));
  backdrop-filter: blur(var(--blur));
  box-shadow: var(--shadow);
}
.v2-comms-side > .v2-seg { flex: none; margin-bottom: 14px; }
.v2-comms-side-pane { display: flex; flex-direction: column; gap: 12px; flex: 1; min-height: 0; }
.v2-scrim .v2-comms-side-pane { min-height: 50vh; }
.v2-comms-side-chat { display: flex; flex-direction: column; gap: 16px; flex: 1; min-height: 0; overflow-y: auto; padding: 4px 2px; }
.v2-comms-side-msg { display: flex; align-items: flex-start; gap: 10px; }
.v2-comms-side-msg.is-mine { justify-content: flex-end; }
.v2-comms-side-msg-body { min-width: 0; }
.v2-comms-side-msg.is-mine .v2-comms-side-msg-body { display: flex; flex-direction: column; align-items: flex-end; }
.v2-comms-side-msg-head { display: flex; align-items: baseline; gap: 8px; color: var(--muted); font-size: .8125rem; }
.v2-comms-side-msg-name { color: var(--foreground); font-weight: 550; }
.v2-comms-side-bubble {
  margin-top: 4px;
  padding: 9px 12px;
  border: 1px solid var(--comms-bubble-border);
  border-radius: 6px 18px 18px 18px;
  background: var(--comms-bubble);
  font-size: .9375rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.v2-comms-side-msg.is-mine .v2-comms-side-bubble { border-radius: 18px 18px 6px 18px; border-color: var(--comms-mine-border); background: var(--comms-mine); color: var(--comms-mine-ink); box-shadow: var(--comms-mine-shadow); }
.v2-comms-side-form { display: flex; flex-direction: column; gap: 6px; flex: none; }
.v2-comms-side-field {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 4px 0 14px;
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  background: color-mix(in srgb, var(--foreground) 4%, transparent);
}
.v2-comms-side-field:focus-within { box-shadow: var(--ring); }
.v2-comms-side-input { flex: 1; min-width: 0; height: 44px; border: 0; background: none; color: var(--foreground); font: inherit; outline: none; }
.v2-comms-side-input::placeholder { color: var(--muted); }
.v2-comms-side-send { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--primary); color: var(--on-primary); cursor: pointer; box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--primary) 70%, transparent); }
.v2-comms-side-send:focus-visible { outline: none; box-shadow: var(--ring); }
.v2-comms-side-tools { display: flex; gap: 4px; color: var(--muted); }

.v2-comms-people { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; flex: 1; min-height: 0; overflow-y: auto; }
.v2-comms-person { display: flex; align-items: center; gap: 12px; min-height: 66px; border-bottom: 1px solid var(--glass-border); }
.v2-comms-person-text { flex: 1; min-width: 0; }
.v2-comms-person-name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v2-comms-person-status { color: var(--muted); font-size: .8125rem; }
.v2-comms-person-status.is-speaking { color: var(--primary); font-weight: 550; }
.v2-comms-person-icon { display: inline-grid; color: var(--muted); }
.v2-comms-person-icon.is-muted { color: color-mix(in srgb, var(--live) 85%, var(--foreground)); }

.v2-comms-call-map { flex: none; aspect-ratio: 4 / 3; border: 1px solid var(--glass-border); border-radius: 18px; }
.v2-comms-map-list { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; overflow-y: auto; }
.v2-comms-map-list li { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: .9375rem; }
.v2-comms-map-list-name { flex: 1; font-weight: 600; }
.v2-comms-map-note { display: flex; align-items: flex-start; gap: 6px; margin: auto 0 0; color: var(--muted); font-size: .8125rem; line-height: 1.4; }
.v2-comms-map-note svg { flex: none; margin-top: 2px; }

/* Rail widths: no side column; People & chat open as a sheet. */
@media (max-width: 1099px) {
  .v2-comms-call-layout { grid-template-columns: minmax(0, 1fr); }
  .v2-comms-side { display: none; }
  .v2-comms-panel-btn { display: inline-grid; }
}
@media (max-width: 899px) and (min-width: 600px) {
  .v2-comms-ctl { min-width: 56px; }
  .v2-comms-ctl-icon { width: 48px; height: 48px; }
  .v2-comms-controls { gap: 2px; padding: 8px 10px 6px; }
}

/* Phones: the call takes the whole screen. */
@media (max-width: 599px) {
  .v2-comms-call {
    position: fixed;
    inset: 0;
    z-index: 40;
    padding: 0;
    background: var(--avatar-base);
    color: var(--media-ink);
  }
  .v2-comms-call > .v2-body { height: 100%; gap: 0; }
  .v2-comms-call .v2-page-head {
    position: absolute;
    top: calc(10px + env(safe-area-inset-top));
    left: 10px;
    right: 10px;
    z-index: 6;
    align-items: flex-start;
    gap: 8px;
    margin: 0;
  }
  .v2-comms-call .v2-page-titles {
    flex: 0 1 auto;
    gap: 2px 8px;
    padding: 8px 14px;
    border-radius: 18px;
    background: color-mix(in srgb, var(--avatar-base) 60%, transparent);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }
  .v2-comms-call .v2-title { font-size: 1rem; color: var(--media-ink); }
  .v2-comms-call-meta { gap: 8px; width: 100%; color: var(--media-muted); font-size: .8125rem; }
  .v2-comms-call-timer { color: var(--media-ink); }
  .v2-comms-call-timer::before { content: none; }
  .v2-comms-call .v2-page-head .v2-icon-btn { background: color-mix(in srgb, var(--avatar-base) 60%, transparent); border-color: color-mix(in srgb, var(--media-ink) 20%, transparent); color: var(--media-ink); }
  .v2-comms-call .v2-page-actions { margin-left: auto; }
  .v2-comms-signal, .v2-comms-fs-btn { display: none; }
  .v2-comms-call-layout { display: block; height: 100%; }
  .v2-comms-call-main { position: relative; height: 100%; gap: 0; }
  .v2-comms-stage {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: none;
    grid-template-rows: minmax(0, 1fr) 120px;
    grid-auto-flow: column;
    grid-auto-columns: 88px;
    gap: 0 8px;
    padding: 0 12px calc(118px + env(safe-area-inset-bottom));
  }
  .v2-comms-stage .v2-comms-tile.is-main { position: absolute; inset: 0; grid-row: auto; border: 0; border-radius: 0; box-shadow: none; }
  .v2-comms-stage .v2-comms-tile:not(.is-main) { grid-row: 2; border-radius: 16px; box-shadow: 0 8px 20px color-mix(in srgb, var(--avatar-base) 50%, transparent); }
  .v2-comms-stage .v2-comms-tile:not(.is-main) .v2-comms-tile-label { left: 6px; bottom: 6px; padding: 3px 7px; font-size: .75rem; }
  .v2-comms-tile.is-main .v2-comms-tile-label { bottom: calc(252px + env(safe-area-inset-bottom)); left: 14px; }
  .v2-comms-tile.is-main .v2-comms-tile-face { top: 42%; }
  .v2-comms-stage .v2-comms-tile.is-main .v2-comms-tile-bust { width: min(100cqw, 60cqh); bottom: calc(150px + env(safe-area-inset-bottom)); }
  .v2-comms-tile.is-main .v2-comms-tile-tint { background: radial-gradient(120% 80% at 50% 35%, transparent 50%, rgba(4, 8, 24, .4)), linear-gradient(180deg, rgba(4, 8, 24, .35), transparent 22%, transparent 55%, rgba(4, 8, 24, .65)); }
  .v2-comms-tile.is-main .v2-comms-tile-map { top: calc(124px + env(safe-area-inset-top)); left: 12px; width: 104px; }
  .v2-comms-tile.is-main .v2-comms-tile-talk { display: none; }
  .v2-comms-stage .v2-comms-tile:not(.is-main) .v2-comms-tile-bust { width: 132%; bottom: -8%; }
  .v2-comms-self { top: calc(118px + env(safe-area-inset-top)); bottom: auto; right: 12px; width: 92px; aspect-ratio: 3 / 4; border-radius: 14px; }
  .v2-comms-self .v2-comms-self-avatar { --size: 44px !important; }
  .v2-comms-controls {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    justify-content: space-around;
    gap: 0;
    padding: 12px 4px calc(10px + env(safe-area-inset-bottom));
    border: 0;
    border-top: 1px solid color-mix(in srgb, var(--media-ink) 12%, transparent);
    border-radius: 24px 24px 0 0;
    background: color-mix(in srgb, var(--avatar-base) 78%, transparent);
    color: var(--media-ink);
  }
  .v2-comms-ctl { min-width: 0; flex: 1; color: #ffffff; font-size: .75rem; }
  .v2-comms-ctl-icon { width: 50px; height: 50px; border-color: rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .14); box-shadow: none; }
  .v2-comms-ctl.is-danger { color: var(--media-ink); }
  .v2-comms-ctl.is-danger .v2-comms-ctl-icon { width: 50px; height: 50px; margin-top: 0; }
  .v2-comms-ctl.is-wide-only { display: none; }
  .v2-comms-ctl.is-phone-only { display: flex; }
  .v2-comms-ctl[aria-pressed="true"] .v2-comms-ctl-icon { background: var(--media-ink); border-color: var(--media-ink); color: var(--avatar-base); }
}

/* ======================================================= WALKIE-TALKIE === */

.v2-comms-wt-mesh {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid color-mix(in srgb, var(--green) 50%, transparent);
  border-radius: 999px;
  background: var(--green-soft);
  color: color-mix(in srgb, var(--green) 72%, var(--foreground));
  font-size: .9375rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 0 calc(14px * var(--glow-scale, 1)) color-mix(in srgb, var(--green) 25%, transparent);
}
.v2-comms-wt-mesh.is-off { border-color: var(--glass-border); background: var(--surface-glass); color: var(--muted); box-shadow: none; }
.v2-comms-wt-settings-btn { display: none; }
.v2-comms-wt-chips { display: none; }

.v2-comms-wt-layout {
  display: grid;
  grid-template-columns: minmax(220px, 250px) minmax(0, 1fr) minmax(260px, 300px);
  gap: 16px;
  align-items: start;
}
.v2-comms-wt-channels { padding: 14px 12px; }
.v2-comms-wt-col-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 12px 6px; }
.v2-comms-wt-col-head h2, .v2-comms-wt-info-title h2, .v2-comms-wt-clips-head h2 { margin: 0; font-size: 1.0625rem; font-weight: 600; }
.v2-comms-wt-channel-list { display: flex; flex-direction: column; gap: 8px; }
.v2-comms-wt-channel {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 68px;
  padding: 11px 12px;
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  background: color-mix(in srgb, var(--foreground) 3%, transparent);
  color: var(--foreground);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.v2-comms-wt-channel:hover { border-color: color-mix(in srgb, var(--primary) 50%, var(--glass-border)); }
.v2-comms-wt-channel:focus-visible { outline: none; box-shadow: var(--ring); }
.v2-comms-wt-channel.is-active {
  border-color: color-mix(in srgb, var(--primary) 70%, transparent);
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 18%, transparent), color-mix(in srgb, var(--primary) 7%, transparent));
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 calc(18px * var(--glow-scale, 1)) var(--glow);
}
.v2-comms-wt-channel-icon, .v2-comms-wt-head-icon { flex: none; }
.v2-comms-wt-channel-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.v2-comms-wt-channel-name { font-weight: 600; letter-spacing: -.005em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v2-comms-wt-channel-sub { color: var(--muted); font-size: .8125rem; }
.v2-comms-wt-channel.is-active .v2-comms-wt-channel-sub { color: color-mix(in srgb, var(--primary) 70%, var(--foreground)); }
.v2-comms-wt-channel.is-new { border-style: dashed; background: none; color: var(--primary); }
.v2-comms-wt-channel-plus { display: inline-grid; place-items: center; width: 44px; }

.v2-comms-wt-active {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  background: var(--surface-glass);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(140%);
  backdrop-filter: blur(var(--blur)) saturate(140%);
  box-shadow: var(--shadow);
}
.v2-comms-wt-card.is-channel { padding: 14px 18px 12px; border-bottom: 1px solid var(--glass-border); }
.v2-comms-wt-head { display: flex; align-items: center; gap: 12px; }
.v2-comms-wt-head-text { flex: 1; min-width: 0; }
.v2-comms-wt-head-title { margin: 0; font-size: 1.1875rem; font-weight: 600; letter-spacing: -.015em; }
.v2-comms-wt-head-sub { margin: 0; color: var(--muted); font-size: .875rem; }
.v2-comms-wt-members { display: flex; gap: 16px; margin: 0; padding: 18px 8px 6px; list-style: none; overflow-x: auto; scrollbar-width: none; }
.v2-comms-wt-member { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 58px; }
.v2-comms-wt-member-face { position: relative; display: grid; place-items: center; }
.v2-comms-wt-member-ring { position: absolute; inset: -6px; border: 2px solid var(--callable); border-radius: 50%; opacity: 0; }
.v2-comms-wt-member.is-speaking .v2-comms-wt-member-ring { opacity: 1; box-shadow: 0 0 calc(18px * var(--glow-scale, 1)) color-mix(in srgb, var(--callable) 60%, transparent), inset 0 0 10px color-mix(in srgb, var(--callable) 35%, transparent); animation: v2-comms-pulse 1.2s ease-in-out infinite; }
/* Sound arcs either side of whoever is talking, like the mockup. */
.v2-comms-wt-member.is-speaking .v2-comms-wt-member-face::before,
.v2-comms-wt-member.is-speaking .v2-comms-wt-member-face::after {
  content: "";
  position: absolute;
  top: 12%;
  bottom: 12%;
  width: 10px;
  border: 2.5px solid color-mix(in srgb, var(--callable) 80%, transparent);
  border-radius: 50%;
  animation: v2-comms-blink-arc 1.2s ease-in-out infinite;
}
.v2-comms-wt-member.is-speaking .v2-comms-wt-member-face::before { left: -18px; border-right-color: transparent; border-top-color: transparent; border-bottom-color: transparent; }
.v2-comms-wt-member.is-speaking .v2-comms-wt-member-face::after { right: -18px; border-left-color: transparent; border-top-color: transparent; border-bottom-color: transparent; }
@keyframes v2-comms-blink-arc { 50% { opacity: .35; } }
.v2-comms-wt-member.is-speaking .v2-avatar { transform: scale(1.06); }
.v2-comms-wt-member.is-offline .v2-avatar { opacity: .55; }
.v2-comms-wt-member-name { font-size: .875rem; font-weight: 500; }
.v2-comms-wt-member.is-speaking .v2-comms-wt-member-name { font-weight: 600; }
@keyframes v2-comms-pulse { 50% { transform: scale(1.1); } }
.v2-comms-wt-talking { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 32px; margin: 10px 0 0; color: var(--muted); font-weight: 500; }
.v2-comms-wt-talking[data-state="other"] { color: color-mix(in srgb, var(--green) 80%, var(--foreground)); font-size: 1.0625rem; font-weight: 600; }
.v2-comms-wt-talking[data-state="me"] { color: var(--primary); }

.v2-comms-wt-card.is-clips { flex: 1; min-height: 0; padding: 4px 18px; }
.v2-comms-wt-clips-head { display: none; }
.v2-comms-wt-clips { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; max-height: 520px; overflow-y: auto; }
.v2-comms-wt-clips.is-sheet { max-height: none; }
.v2-comms-wt-clip { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto; align-items: start; gap: 12px; padding: 14px 0; }
.v2-comms-wt-clip + .v2-comms-wt-clip { border-top: 1px solid var(--glass-border); }
.v2-comms-wt-clip-head { display: flex; align-items: baseline; gap: 8px; }
.v2-comms-wt-clip-name { font-weight: 600; }
.v2-comms-wt-clip-time { color: var(--muted); font-size: .8125rem; }
.v2-comms-wt-clip-time.is-phone { display: none; }
.v2-comms-wt-clip .v2-comms-voice { max-width: 300px; margin-top: 8px; padding: 6px 16px 6px 6px; border: 1px solid var(--comms-bubble-border); border-radius: 6px 20px 20px 20px; background: var(--comms-bubble); }
.v2-comms-wt-clip-text { margin: 8px 2px 0; color: color-mix(in srgb, var(--foreground) 88%, transparent); font-size: .9375rem; line-height: 1.4; }
.v2-comms-wt-empty { display: flex; align-items: center; gap: 10px; padding: 24px 4px; color: var(--muted); }
.v2-comms-wt-quote { margin: 0 4px 8px; color: var(--muted); font-style: italic; }

.v2-comms-wt-ptt-area { display: flex; align-items: center; gap: 14px; padding: 16px 18px 18px; border-top: 1px solid var(--glass-border); }
.v2-comms-wt-ptt-wrap { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }
.v2-comms-wt-ptt {
  --level: 0;
  position: relative;
  display: block;
  width: 100%;
  min-height: 66px;
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: var(--comms-ptt);
  color: var(--comms-ptt-ink);
  font: inherit;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .45),
    inset 0 -6px 14px rgba(0, 0, 0, .12),
    0 10px 26px -10px var(--comms-ptt-glow),
    0 0 calc(26px * var(--glow-scale, 1)) var(--comms-ptt-glow);
  transition: transform .1s, box-shadow .15s, filter .15s;
}
.v2-comms-wt-ptt:hover { filter: brightness(1.05) saturate(1.05); }
.v2-comms-wt-ptt:focus-visible { outline: none; box-shadow: var(--ring), 0 0 calc(26px * var(--glow-scale, 1)) var(--comms-ptt-glow); }
.v2-comms-wt-ptt.is-held { transform: scale(.985); }
.v2-comms-wt-ptt-core { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 66px; font-size: 1.1875rem; font-weight: 700; letter-spacing: -.01em; text-shadow: 0 1px 2px rgba(0, 0, 0, .18); }
.v2-comms-wt-ptt-ring {
  position: absolute;
  inset: -5px;
  border: 3px solid var(--comms-ptt-glow);
  border-radius: 26px;
  opacity: 0;
  transform: scale(calc(1 + var(--level) * .05));
  transition: transform .08s, opacity .15s;
}
.v2-comms-wt-ptt.is-talking { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 0 calc((26px + var(--level) * 34px) * var(--glow-scale, 1)) var(--comms-ptt-glow); }
.v2-comms-wt-ptt.is-talking .v2-comms-wt-ptt-ring { opacity: .9; }
.v2-comms-wt-ptt-narrow { display: none; }
.v2-comms-wt-ptt-label { font-variant-numeric: tabular-nums; }
.v2-comms-wt-ptt-hint { color: var(--muted); font-size: .8125rem; text-align: center; }
.v2-comms-wt-side-btn.is-phone-only { display: none; }
.v2-comms-wt-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 18px 16px;
  padding: 6px 6px 6px 14px;
  border: 1px solid color-mix(in srgb, var(--amber) 40%, transparent);
  border-radius: 16px;
  background: var(--amber-soft);
  font-size: .875rem;
  line-height: 1.35;
}
.v2-comms-wt-notice > span { flex: 1; }
.v2-comms-wt-notice > svg { flex: none; color: color-mix(in srgb, var(--amber) 72%, var(--foreground)); }
.v2-comms-wt-notice[hidden] { display: none; }
.v2-comms-wt-quick { display: none; }

.v2-comms-wt-info { display: flex; flex-direction: column; padding: 14px; }
.v2-comms-wt-info-title { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 10px; }
.v2-comms-wt-info-inner { display: flex; flex-direction: column; }
.v2-comms-wt-banner { overflow: hidden; border-radius: 14px; aspect-ratio: 2.4 / 1; }
.v2-comms-wt-banner-art { width: 100%; height: 100%; }
.v2-comms-wt-info-id { display: flex; align-items: flex-start; gap: 12px; padding: 12px 4px; }
.v2-comms-wt-info-name { margin: 0; font-size: 1.0625rem; font-weight: 600; }
.v2-comms-wt-info-sub, .v2-comms-wt-info-tag { margin: 2px 0 0; color: var(--muted); font-size: .8125rem; }
.v2-comms-wt-info-rows { border-top: 1px solid var(--glass-border); border-bottom: 1px solid var(--glass-border); }
.v2-comms-wt-info-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 54px;
  padding: 6px 4px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--foreground);
  font: inherit;
  font-size: .9375rem;
  text-align: left;
  cursor: pointer;
}
.v2-comms-wt-info-row + .v2-comms-wt-info-row { border-top: 1px solid var(--glass-border); border-radius: 0; }
.v2-comms-wt-info-row:hover { background: color-mix(in srgb, var(--foreground) 4%, transparent); }
.v2-comms-wt-info-row:focus-visible { outline: none; box-shadow: var(--ring); }
.v2-comms-wt-info-row > svg { flex: none; color: var(--muted); }
.v2-comms-wt-info-row-text { display: flex; flex-direction: column; flex: 1; }
.v2-comms-wt-info-row-sub { color: var(--muted); font-size: .75rem; }
.v2-comms-wt-info-members { padding: 10px 0 6px; border-bottom: 1px solid var(--glass-border); }
.v2-comms-wt-info-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }
.v2-comms-wt-info-head h3, .v2-comms-wt-settings h3 { margin: 0; font-size: .9375rem; font-weight: 600; }
.v2-comms-wt-info-list { margin: 0; padding: 0; list-style: none; }
.v2-comms-wt-info-member { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 0 0 4px; }
.v2-comms-wt-info-member-text { display: flex; flex-direction: column; flex: 1; font-size: .875rem; font-weight: 550; line-height: 1.2; }
.v2-comms-wt-presence { color: var(--muted); font-size: .75rem; font-weight: 500; }
.v2-comms-wt-presence.is-online { color: color-mix(in srgb, var(--callable) 75%, var(--foreground)); }
.v2-comms-wt-settings { display: flex; flex-direction: column; padding-top: 12px; }
.v2-comms-wt-settings h3 { padding: 0 4px 4px; }
.v2-comms-wt-setting { display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 0 4px; }
.v2-comms-wt-setting-icon { display: inline-grid; flex: none; color: var(--muted); }
.v2-comms-wt-setting-title { flex: 1; font-size: .9375rem; }

/* Rail widths: Channels | channel, Channel info below. */
@media (max-width: 1199px) and (min-width: 600px) {
  .v2-comms-wt-layout { grid-template-columns: minmax(200px, 240px) minmax(0, 1fr); }
  .v2-comms-wt-info { grid-column: 1 / -1; }
  .v2-comms-wt-info-inner { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
  .v2-comms-wt-banner { grid-column: 1; aspect-ratio: 3 / 1; }
  .v2-comms-wt-info-id { grid-column: 2; grid-row: 1; }
  .v2-comms-wt-info-rows { grid-column: 1; }
  .v2-comms-wt-info-members { grid-column: 2; grid-row: 2 / span 2; border-bottom: 0; }
  .v2-comms-wt-settings { grid-column: 1; }
}

/* Phones: chips, the channel card, recent clips, the big round button. */
@media (max-width: 599px) {
  .v2-comms-walkie .v2-page-head { flex-wrap: wrap; row-gap: 10px; }
  .v2-comms-walkie .v2-page-head::after { content: ""; order: 9; flex-basis: 100%; }
  .v2-comms-walkie .v2-page-actions { display: contents; }
  .v2-comms-wt-mesh { order: 10; margin: 0 auto; min-height: 38px; }
  .v2-comms-wt-settings-btn { display: inline-grid; }
  .v2-comms-wt-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 calc(-1 * var(--v2-gutter));
    padding: 2px var(--v2-gutter);
  }
  .v2-comms-wt-chips::-webkit-scrollbar { display: none; }
  .v2-comms-wt-layout { display: flex; flex-direction: column; gap: 14px; }
  .v2-comms-wt-channels, .v2-comms-wt-info { display: none; }
  .v2-comms-wt-active { gap: 14px; border: 0; border-radius: 0; background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .v2-comms-wt-card {
    border: 1px solid var(--glass-border);
    border-radius: 22px;
    background: var(--surface-glass);
    -webkit-backdrop-filter: blur(var(--blur));
    backdrop-filter: blur(var(--blur));
    box-shadow: var(--shadow);
  }
  .v2-comms-wt-card.is-channel { padding: 12px 14px; border-bottom: 1px solid var(--glass-border); }
  .v2-comms-wt-head-title { font-size: 1.0625rem; }
  .v2-comms-wt-members { justify-content: space-between; gap: 6px; padding-top: 14px; }
  .v2-comms-wt-member { min-width: 0; flex: 1; }
  .v2-comms-wt-member .v2-avatar { --size: 48px !important; }
  .v2-comms-wt-card.is-clips { padding: 12px 14px 4px; }
  .v2-comms-wt-clips-head { display: flex; align-items: center; justify-content: space-between; }
  .v2-comms-wt-clips { max-height: 228px; }
  .v2-comms-wt-clip { grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 0; }
  .v2-comms-wt-clip .v2-avatar { --size: 40px !important; }
  .v2-comms-wt-clip-head, .v2-comms-wt-clip-text, .v2-comms-wt-clip-more { display: none; }
  .v2-comms-wt-clip .v2-comms-voice { margin: 0; padding: 0; border: 0; background: none; }
  .v2-comms-wt-clip-time.is-phone { display: block; }
  .v2-comms-wt-clip + .v2-comms-wt-clip { border-top: 0; }
  .v2-comms-wt-ptt-area { justify-content: space-between; align-items: center; padding: 4px 6px 4px; border: 0; }
  .v2-comms-wt-ptt-wrap { align-items: center; flex: 0 1 auto; gap: 0; }
  .v2-comms-wt-ptt {
    width: 148px;
    height: 148px;
    min-height: 0;
    border-radius: 50%;
    margin: 22px 0 62px;
    box-shadow:
      inset 0 2px 0 rgba(255, 255, 255, .45),
      inset 0 -10px 22px rgba(0, 0, 0, .14),
      0 0 0 12px var(--comms-ptt-halo),
      0 0 0 26px color-mix(in srgb, var(--comms-ptt-halo) 55%, transparent),
      0 0 calc(44px * var(--glow-scale, 1)) var(--comms-ptt-glow);
  }
  .v2-comms-wt-ptt.is-talking { box-shadow: inset 0 2px 0 rgba(255, 255, 255, .45), 0 0 0 calc(12px + var(--level) * 10px) var(--comms-ptt-halo), 0 0 0 calc(26px + var(--level) * 16px) color-mix(in srgb, var(--comms-ptt-halo) 55%, transparent), 0 0 calc(54px * var(--glow-scale, 1)) var(--comms-ptt-glow); }
  .v2-comms-wt-ptt-core { flex-direction: column; min-height: 0; height: 100%; }
  .v2-comms-wt-ptt-core svg { width: 48px; height: 48px; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .2)); }
  .v2-comms-wt-ptt-ring { inset: -10px; border-radius: 50%; transform: scale(calc(1 + var(--level) * .12)); }
  .v2-comms-wt-ptt-label { position: absolute; top: calc(100% + 34px); left: 50%; transform: translateX(-50%); color: var(--foreground); font-size: 1.0625rem; font-weight: 600; text-shadow: none; white-space: nowrap; }
  .v2-comms-wt-ptt-wide { display: none; }
  .v2-comms-wt-ptt-narrow { display: inline; }
  .v2-comms-wt-side-btn.is-phone-only { display: inline-grid; }
  .v2-comms-wt-notice { margin: 0; }
  .v2-comms-wt-quick { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 20px; }
  .v2-comms-wt-quick .v2-comms-wt-setting-icon { color: var(--primary); }
}

/* ----------------------------------------------------- reduced motion --- */

@media (prefers-reduced-motion: reduce) {
  .v2-comms-livewave > span,
  .v2-comms-typing-dots > span,
  .v2-comms-rec-dot,
  .v2-comms-tile-ring,
  .v2-comms-tile.is-speaking .v2-comms-tile-ring,
  .v2-comms-wt-member.is-speaking .v2-comms-wt-member-ring,
  .v2-comms-self-sim,
  .v2-comms-self-bust,
  .v2-comms-wt-member.is-speaking .v2-comms-wt-member-face::before,
  .v2-comms-wt-member.is-speaking .v2-comms-wt-member-face::after { animation: none; }
  .v2-comms-livewave > span { transform: scaleY(.7); }
  .v2-comms-tile.is-speaking .v2-comms-tile-ring { opacity: .8; }
  .v2-comms-burst-emoji { animation-duration: 1.2s; }
  .v2-comms-wt-ptt, .v2-comms-wt-ptt-ring, .v2-comms-wave-bar, .v2-comms-level > span { transition: none; }
}

/* ===================== real mode (orbit-v2-comms-live.ts and friends) ===== */

/* Real/mock swaps hide whole regions (and header actions) with [hidden]. */
.v2-comms-chat [hidden], .v2-comms-call [hidden], .v2-comms-walkie [hidden] { display: none !important; }

/* Banners: "these are examples" / "you're in a call" / load errors. */
.v2-comms-banner { display: flex; flex-direction: column; gap: 6px; }
.v2-comms-banner[hidden] { display: none; }
.v2-comms-banner .v2-comms-notice { margin: 0; }
.v2-comms-notice.is-info { border-color: color-mix(in srgb, var(--sky) 40%, transparent); background: var(--sky-soft); }
.v2-comms-notice.is-info > svg { color: color-mix(in srgb, var(--sky) 72%, var(--foreground)); }
.v2-comms-demo { flex-wrap: wrap; margin: 0 0 12px; }
.v2-comms-demo[hidden] { display: none; }
.v2-comms-ticks.is-failed { opacity: 1; color: var(--danger, var(--coral)); }
.v2-comms-composer.is-text-only .v2-comms-attach-btn { opacity: .55; }

/* Video Call: the real call (mirrored streams) and the lobby. */
.v2-comms-live-call[hidden], .v2-comms-lobby[hidden], .v2-comms-call-layout[hidden] { display: none; }
.v2-comms-call-layout.is-live { grid-template-columns: minmax(0, 1fr); }
.v2-comms-live-video { position: absolute; inset: 0; z-index: -1; display: none; width: 100%; height: 100%; object-fit: cover; background: var(--avatar-base); }
.v2-comms-live-tile.has-video .v2-comms-live-video { display: block; }
.v2-comms-live-tile.has-video .v2-comms-tile-face, .v2-comms-live-tile.has-video .v2-comms-tile-tint { display: none; }
.v2-comms-live-status {
  position: absolute;
  left: 50%;
  top: 16px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 32px);
  padding: 8px 8px 8px 16px;
  border-radius: 18px;
  transform: translateX(-50%);
  background: color-mix(in srgb, var(--avatar-base) 72%, transparent);
  color: var(--media-ink);
  font-size: .9375rem;
  font-weight: 600;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.v2-comms-live-status[hidden] { display: none; }
.v2-comms-controls .v2-comms-ctl[hidden] { display: none; }
.v2-comms-lobby { display: flex; flex-direction: column; gap: 14px; max-width: 720px; }
.v2-comms-lobby-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.v2-comms-lobby-title { margin: 0; font-size: 1.0625rem; }
.v2-comms-lobby-list { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.v2-comms-lobby-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; min-height: 56px; }
.v2-comms-lobby-text { display: flex; flex: 1; flex-direction: column; min-width: 140px; }
@media (max-width: 599px) {
  /* The lobby is a page, not a full-screen call. */
  .v2-comms-call.is-real:not(:has(.is-in-call)) { position: static; background: none; color: inherit; padding: 16px; }
  .v2-comms-call.is-real:not(:has(.is-in-call)) .v2-page-head { position: static; }
  .v2-comms-call.is-real:not(:has(.is-in-call)) .v2-title { color: inherit; }
  .v2-comms-live-status { top: calc(118px + env(safe-area-inset-top)); left: 12px; right: 116px; max-width: none; transform: none; }
  /* The demo banner floats under the call bar; the self view steps below it. */
  .v2-comms-call .v2-comms-demo { position: absolute; top: calc(64px + env(safe-area-inset-top)); left: 10px; right: 10px; z-index: 6; margin: 0; }
  .v2-comms-call:has(.v2-comms-demo:not([hidden])) .v2-comms-self { top: calc(196px + env(safe-area-inset-top)); }
}

/* Walkie-Talkie: the paired peer as the one channel. */
.v2-comms-wt-live {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 760px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  background: var(--surface-glass);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(140%);
  backdrop-filter: blur(var(--blur)) saturate(140%);
  box-shadow: var(--shadow);
}
.v2-comms-wt-live[hidden], .v2-comms-wt-layout[hidden], .v2-comms-wt-chips[hidden], .v2-comms-wt-mesh[hidden] { display: none; }
.v2-comms-wt-live .v2-comms-wt-ptt-area { justify-content: center; border-top: 0; border-bottom: 1px solid var(--glass-border); }
.v2-comms-wt-live .v2-comms-wt-quick { display: flex; align-items: center; gap: 10px; margin: 8px 18px; padding: 8px 14px; border-radius: 20px; }
.v2-comms-wt-live .v2-comms-wt-notice { margin: 10px 18px 0; }
.v2-comms-wt-live > .v2-comms-menu-note { margin: 4px 18px 16px; }
.v2-comms-wt-ptt.is-disabled { opacity: .55; filter: saturate(.4); }
