#grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 560px));
  justify-content: center;
  align-content: start;
  gap: 16px;
  padding: 14px 20px 120px;
}

.tile {
  position: relative;
  margin: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #000;
  box-shadow: var(--shadow);
  animation: pop .35s ease both;
}

.tile video,
.tile canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tile.local {
  border-color: color-mix(in srgb, var(--accent) 65%, transparent);
}

#local {
  transform: scaleX(-1);
}

body.has-peers .tile.local {
  grid-column: 1 / -1;
  justify-self: center;
  width: 240px;
  position: sticky;
  top: 8px;
  z-index: 5;
}

.tag {
  position: absolute;
  max-width: calc(100% - 20px);
  padding: 4px 11px;
  font-size: 12px;
  line-height: 1.5;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 999px;
  background: var(--chip);
  backdrop-filter: blur(10px);
}

.name {
  left: 10px;
  bottom: 10px;
  font-weight: 500;
}

.stat {
  right: 10px;
  top: 10px;
  font-variant-numeric: tabular-nums;
  opacity: .85;
}

.stat.warn {
  opacity: 1;
  color: #fecaca;
  background: rgba(127, 29, 29, .72);
}

.stat:empty {
  display: none;
}

.nocam {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  background:
    radial-gradient(circle at 50% 40%, rgba(109, 106, 247, .22), transparent 60%),
    #0e1018;
}

.nocam.show {
  display: grid;
}

.avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  font-size: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 12px 34px rgba(109, 106, 247, .45);
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(.96);
  }
}

@media (max-width: 520px) {
  body.has-peers .tile.local {
    width: 168px;
  }

  #grid {
    padding: 4px 12px 110px;
    gap: 12px;
  }
}
