*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #000;
  color: #e7e9ea;
}

.header {
  flex-shrink: 0;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #2f3336;
  background: #0f1419;
}

.header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.header h1 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.hint {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  color: #8b98a5;
  line-height: 1.4;
  max-width: 48rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.btn {
  cursor: pointer;
  border: none;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 600;
  background: #1d9bf0;
  color: #fff;
}

.btn:hover {
  background: #1a8cd8;
}

.btn-secondary {
  background: #38444d;
  color: #e7e9ea;
}

.btn-secondary:hover {
  background: #536471;
}

.status {
  font-size: 0.75rem;
  color: #8b98a5;
}

.video-wall {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 2px;
  width: 100%;
  background: #000;
}

.tile {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #16181c;
}

.tile--hidden {
  display: none;
}

.tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tile .label {
  position: absolute;
  left: 0.35rem;
  bottom: 0.35rem;
  font-size: 0.6875rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.65);
  pointer-events: none;
}

.tile--local {
  outline: 1px solid rgba(29, 155, 240, 0.5);
  outline-offset: -1px;
}

/* Убираем «зеркальность» превью своей камеры (горизонтальный разворот). */
.tile--local video {
  transform: scaleX(-1);
}
