/* Call stage and stream viewer (zoom, pan, fullscreen). Loaded after features.css. */

.call-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.stage-focus {
  display: none;
}

.call-stage.has-focus .stage-focus {
  flex: 1;
  min-height: 0;
  display: flex;
  padding: 12px 12px 0;
}

.call-stage .stage-grid {
  flex: 1;
  min-height: 0;
}

/* With a stream in focus, everyone else becomes a strip of small tiles. */
.call-stage .stage-grid.strip {
  flex: none;
  display: flex;
  gap: 10px;
  height: 118px;
  padding: 10px 12px 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.stage-grid.strip > * {
  flex: none;
  width: 190px;
  height: 100%;
}

.stage-grid.strip .tile.person .avatar {
  --avatar-size: 48px !important;
}

.call-stage .calling:empty {
  display: none;
}

/* ---------- viewer ---------- */

.viewer {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  outline: none;
}

.viewer.focus {
  flex: 1;
  min-width: 0;
}

.viewer.thumb {
  cursor: pointer;
  border: 2px solid transparent;
  aspect-ratio: 16 / 9;
}

.stage-grid:not(.strip) .viewer.thumb {
  grid-column: span 2;
}

.viewer.thumb:hover {
  border-color: var(--accent);
}

.viewer-canvas {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
}

.viewer-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: center center;
  transition: transform 0.05s linear;
  user-select: none;
  -webkit-user-drag: none;
}

.viewer.zoomed .viewer-canvas {
  cursor: grab;
}

.viewer.dragging .viewer-canvas {
  cursor: grabbing;
}

.viewer.dragging .viewer-video {
  transition: none;
}

.viewer-name {
  z-index: 2;
  pointer-events: none;
}

.viewer-toolbar {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border-radius: 10px;
  background: rgba(17, 18, 20, 0.86);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 0.15s;
}

.viewer.focus:hover .viewer-toolbar,
.viewer.focus:focus-within .viewer-toolbar,
.viewer:fullscreen .viewer-toolbar {
  opacity: 1;
}

.viewer.thumb .viewer-toolbar {
  display: none;
}

.viewer-btn {
  color: #fff;
}

.viewer-btn.on {
  color: var(--ok);
}

.viewer-sign {
  font-size: 20px;
  line-height: 1;
}

.viewer-zoom {
  min-width: 52px;
  border: 0;
  border-radius: 6px;
  padding: 6px 4px;
  background: none;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.viewer-zoom:hover {
  background: var(--bg-hover);
}

.viewer-divider {
  width: 1px;
  height: 20px;
  margin: 0 4px;
  background: rgba(255, 255, 255, 0.15);
}

.viewer-full {
  padding: 6px 12px;
}

.viewer:fullscreen {
  border-radius: 0;
}

/* ---------- DM call panel ---------- */

.call-panel.live {
  height: 55%;
  min-height: 300px;
}

.call-panel.live:has(.call-stage.has-focus) {
  height: 70%;
}

.call-panel.live.expanded {
  flex: 1;
  height: auto;
  border-bottom: 0;
}

.main.call-expanded > .message-list,
.main.call-expanded > .composer {
  display: none;
}

.call-panel.live .stage-controls {
  padding: 8px 0 12px;
}

/* ---------- connection status in the voice bar ---------- */

.conn-line {
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conn-line:empty {
  display: none;
}

.conn-line.connecting {
  color: var(--warn);
}

/* ---------- notifications: badges, mentions, muted ---------- */

.rail-badge {
  position: absolute;
  right: 8px;
  bottom: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  border: 3px solid var(--bg-rail);
  box-sizing: content-box;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  pointer-events: none;
}

.rail-item.muted .rail-btn {
  opacity: 0.45;
}

.side-item.muted-item {
  opacity: 0.55;
}

.side-item .badge {
  margin-left: 4px;
}

.mention {
  padding: 0 2px;
  border-radius: 3px;
  background: rgba(106, 92, 255, 0.25);
  color: #c9c3ff;
  font-weight: 600;
}

.mention.me {
  background: rgba(240, 178, 50, 0.25);
  color: #ffd98a;
}

.message.mentioned {
  background: rgba(240, 178, 50, 0.08);
  box-shadow: inset 2px 0 0 var(--warn);
}

.message.mentioned:hover {
  background: rgba(240, 178, 50, 0.12);
}
