* { box-sizing: border-box; margin: 0; }

:root {
  --bg: #0e0e14;
  --panel: #1a1a24;
  --text: #e8e8f0;
  --muted: #8a8a9c;
  --accent: #e5484d;
}

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
  overflow: hidden;
}

/* ---------- lobby ---------- */

#lobby {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

#lobby h1 { font-size: 3rem; }
.tagline { color: var(--muted); margin-bottom: 16px; }

button.primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px 36px;
  font-size: 1.1rem;
  cursor: pointer;
}
button.primary:hover { filter: brightness(1.1); }
button.primary:disabled { opacity: .5; cursor: wait; }

.error { color: var(--accent); }

/* ---------- call ---------- */

#call { height: 100%; position: relative; }

#stage {
  position: absolute;
  inset: 0;
  background: #000;
}

#stage video { position: absolute; background: #000; }

/* padrão: câmera remota grande, minha câmera em PiP */
#remoteCam {
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#localCam {
  right: 16px;
  bottom: 88px;
  width: clamp(120px, 18vw, 240px);
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #ffffff22;
  transform: scaleX(-1); /* espelho local */
  z-index: 2;
}

#screenVideo { display: none; }

/* com tela compartilhada: tela grande, câmeras viram PiP */
.screen-active #screenVideo {
  display: block;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.screen-active #remoteCam {
  inset: auto;
  right: 16px;
  bottom: 88px;
  width: clamp(120px, 18vw, 240px);
  height: auto;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #ffffff22;
  z-index: 2;
}

.screen-active #localCam { bottom: calc(88px + 20px + clamp(68px, 10vw, 135px)); }

#status {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #000000aa;
  color: var(--text);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: .95rem;
  z-index: 3;
}
#status:empty { display: none; }

/* ---------- controles ---------- */

#controls {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  padding: 10px 14px;
  border-radius: 16px;
  border: 1px solid #ffffff14;
  z-index: 4;
  transition: opacity .3s, transform .3s;
}

.idle #controls {
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
  pointer-events: none;
}
.idle { cursor: none; }

#controls button {
  background: #ffffff10;
  border: none;
  border-radius: 10px;
  width: 46px;
  height: 46px;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--text);
}
#controls button:hover { background: #ffffff22; }
#controls button.off { background: var(--accent); }
#controls button.danger { background: var(--accent); }

#volume { width: 110px; accent-color: var(--accent); }

#toast {
  position: absolute;
  bottom: 92px;
  left: 50%;
  transform: translateX(-50%);
  background: #000000d0;
  border: 1px solid #ffffff20;
  padding: 10px 18px;
  border-radius: 12px;
  max-width: min(480px, 90vw);
  text-align: center;
  font-size: .95rem;
  z-index: 5;
}
