:root {
  --bg: #0d0f14;
  --surface: #171a22;
  --surface-2: #222632;
  --text: #f3f4f7;
  --muted: #9aa1b1;
  /* Ping blue (brand/README.md). */
  --accent: #3866ff;
  --danger: #e03131;
  --speaking: #74c0fc;
  --radius: 20px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.screen { min-height: 100%; }
[hidden] { display: none !important; }

.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: -0.01em; color: var(--muted); }
/* Ping's mark (brand/logo/ping-mark.svg), cropped to its ink. */
.brand .mark { width: 24px; height: 22.5px; color: var(--accent); }

h1 { font-size: 28px; line-height: 1.15; letter-spacing: -0.02em; margin: 18px 0 6px; }
.lede { color: var(--muted); margin: 0 0 20px; }

.lobby, .ended {
  max-width: 440px;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
}

.preview {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
}
.preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.preview-off { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.preview-controls { position: absolute; left: 0; right: 0; bottom: 12px; display: flex; justify-content: center; gap: 12px; }

.name { display: block; margin: 18px 0; }
.name span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.name input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--surface-2);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.name input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

button { font: inherit; cursor: pointer; border: 0; }
button:focus-visible { outline: 2px solid var(--speaking); outline-offset: 3px; }

.primary {
  width: 100%;
  padding: 15px;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-weight: 650;
  font-size: 17px;
}
.primary:disabled { opacity: 0.6; cursor: default; }

.round {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.14);
  color: var(--text);
  backdrop-filter: blur(12px);
}
.round { position: relative; }
.round svg { width: 26px; height: 26px; fill: currentColor; }
.round[aria-pressed="true"] { background: var(--text); color: var(--bg); }
/* Off: a slash through the icon. */
.round[aria-pressed="true"]::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 30px;
  height: 3px;
  border-radius: 2px;
  background: currentColor;
  box-shadow: 0 0 0 2px var(--text);
  transform: translate(-50%, -50%) rotate(-45deg);
}
.round.leave { background: var(--danger); color: white; }
.round.leave svg { transform: rotate(135deg); }

.error { color: #ff8787; margin-top: 14px; }

#call { position: fixed; inset: 0; display: flex; flex-direction: column; }

.grid {
  flex: 1;
  display: grid;
  gap: 8px;
  padding: max(8px, env(safe-area-inset-top)) 8px 8px;
  grid-template-columns: repeat(var(--cols, 1), 1fr);
  grid-auto-rows: 1fr;
  min-height: 0;
}

.tile {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  min-height: 0;
  transition: box-shadow 0.2s ease;
}
.tile.speaking { box-shadow: inset 0 0 0 3px var(--speaking); }
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile.me video { transform: scaleX(-1); }
.tile .avatar {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}
.tile .avatar span {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  font-size: 34px;
  font-weight: 650;
}
.tile .label {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tile .label .muted { width: 14px; height: 14px; fill: #ff8787; }
.tile .status {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 13px;
  color: var(--muted);
}

.waiting { position: absolute; top: calc(50% + 70px); left: 0; right: 0; text-align: center; color: var(--muted); pointer-events: none; }

.controls {
  display: flex;
  justify-content: center;
  gap: 18px;
  padding: 14px 0 max(10px, env(safe-area-inset-bottom));
}
.secure { text-align: center; font-size: 12px; color: var(--muted); padding-bottom: max(10px, env(safe-area-inset-bottom)); }

@media (prefers-reduced-motion: reduce) {
  .tile { transition: none; }
}
