:root {
  --bg: #0b0f14;
  --panel: #151b23;
  --line: #263040;
  --text: #e8edf3;
  --dim: #8b98a9;
  --brand: #0193ff;
  --danger: #e5484d;
  --ok: #30a46c;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#lobby {
  max-width: 420px;
  margin: 0 auto;
  padding: 18vh 16px 32px;
}
#lobby h1 { font-size: 26px; margin: 0 0 12px; }
#status { color: var(--dim); margin: 0 0 20px; }
#status.error { color: var(--danger); }
.opts { display: flex; gap: 20px; margin-bottom: 20px; }
.opts label { display: flex; gap: 8px; align-items: center; cursor: pointer; }

button {
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--brand); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--brand); border-color: var(--brand); color: #04121f; width: 100%; padding: 13px; font-weight: 600; }
button.danger { background: #c62d33; border-color: #c62d33; color: #fff; }
button[aria-pressed="false"]:not(.danger):not(#btnScreen) { background: #3a1d20; border-color: var(--danger); }
button[aria-pressed="true"]#btnScreen { background: var(--brand); border-color: var(--brand); color: #04121f; }

#call { display: flex; flex-direction: column; height: 100%; }
#call header { display: flex; gap: 8px; padding: 10px 16px; }
.badge { font-size: 13px; padding: 3px 10px; border-radius: 99px; background: #0f2a1d; color: var(--ok); border: 1px solid #1d4a34; }
.badge.muted { background: var(--panel); color: var(--dim); border-color: var(--line); }
.badge.off { background: #3a1d20; color: var(--danger); border-color: var(--danger); }

#grid {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 10px;
  padding: 0 16px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  align-content: center;
}
.tile {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.tile.local:not(.screen) video { transform: scaleX(-1); }
.tile.screen video { object-fit: contain; }
.tile .ph {
  position: absolute; inset: 0; display: none;
  align-items: center; justify-content: center;
  font-size: 44px; font-weight: 600; color: var(--dim); background: var(--panel);
}
.tile.novideo .ph { display: flex; }
.tile .cap {
  position: absolute; left: 8px; bottom: 8px;
  background: rgba(0, 0, 0, .6); border-radius: 6px; padding: 2px 8px; font-size: 13px;
}
.tile.muted .cap::after { content: " · без звука"; color: var(--danger); }

#call footer { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; padding: 14px 16px; }
#warn { margin: 0 16px 12px; padding: 10px 14px; border-radius: 10px; background: #3a1d20; border: 1px solid var(--danger); }

@media (max-width: 600px) {
  #lobby { padding-top: 10vh; }
  .tile .ph { font-size: 32px; }
}
