/* Huddle (P2P call) — header chip + floating call bar.
   Components: messenger_huddle.js. Tokens come from design-tokens.css. */

/* ---- header chip ------------------------------------------------------ */
.ws-huddle-btn.is-live {
  border-color: var(--green);
  color: var(--green);
}
.ws-huddle-btn.is-joined {
  border-color: var(--green);
  background: color-mix(in srgb, var(--green) 18%, transparent);
  color: var(--ink-1);
}
.ws-huddle-btn:disabled { opacity: 0.6; cursor: progress; }
.ws-dm-hero-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ws-dm-hero-actions:empty { display: none; }

/* ---- floating bar ----------------------------------------------------- */
.ws-huddle-bar {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 1950;
  width: min(340px, calc(100vw - 32px));
  max-height: min(70vh, 640px);
  display: flex;
  flex-direction: column;
  background: var(--bg-1);
  color: var(--ink-1);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  font-size: 13px;
  overflow: hidden;
}
.ws-huddle-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-1);
  background: color-mix(in srgb, var(--green) 10%, var(--bg-1));
}
.ws-huddle-head .ttl {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ws-huddle-head .meta {
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 11px;
}
.ws-huddle-ghost {
  background: transparent;
  border: 0;
  color: var(--ink-3);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
}
.ws-huddle-autoplay {
  margin: 8px 12px 0;
  padding: 6px 8px;
  border: 1px solid var(--amber);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--amber);
  cursor: pointer;
}

.ws-huddle-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px;
  padding: 8px 12px 0;
  overflow-y: auto;
  max-height: 300px;
}
.ws-huddle-tile {
  position: relative;
  margin: 0;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--r-sm);
  overflow: hidden;
}
.ws-huddle-tile video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.ws-huddle-tile video.is-mirror { transform: scaleX(-1); }
.ws-huddle-tile figcaption {
  position: absolute;
  left: 4px;
  bottom: 4px;
  padding: 1px 6px;
  border-radius: var(--r-sm);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 11px;
}

.ws-huddle-people {
  list-style: none;
  margin: 0;
  padding: 6px 4px;
  overflow-y: auto;
}
.ws-huddle-person {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: var(--r-sm);
}
.ws-huddle-person .av {
  width: 26px;
  height: 26px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-2);
  color: var(--ink-2);
  font-size: 10px;
  font-weight: 600;
  object-fit: cover;
  box-shadow: 0 0 0 2px transparent;
  transition: box-shadow 120ms ease;
}
.ws-huddle-person.is-speaking .av { box-shadow: 0 0 0 2px var(--green); }
.ws-huddle-person .nm {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ws-huddle-person .st { color: var(--ink-4); font-size: 11px; }
.ws-huddle-person .ic { font-size: 12px; }

.ws-huddle-controls {
  display: flex;
  gap: 6px;
  padding: 8px 12px 10px;
  border-top: 1px solid var(--line-1);
}
.ws-huddle-ctl {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 2px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--bg-2);
  color: var(--ink-1);
  cursor: pointer;
  font-size: 15px;
}
.ws-huddle-ctl span { font-size: 10px; color: var(--ink-3); }
.ws-huddle-ctl.is-off { border-color: var(--red); }
.ws-huddle-ctl.is-on { border-color: var(--green); }
.ws-huddle-ctl:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.ws-huddle-leave { background: var(--red); border-color: var(--red); }
.ws-huddle-leave span { color: #fff; }
.ws-huddle-bar.is-collapsed .ws-huddle-controls { border-top: 0; }

@media (max-width: 560px) {
  .ws-huddle-bar { left: 8px; right: 8px; bottom: 8px; width: auto; }
}
