/* Lobby claro (estilo Google Meet, com a marca Trynux). Sala em tela escura. */
[hidden] { display: none !important; }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Figtree, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #1f1f1f;
  background: #fff;
  min-height: 100vh;
}

button { font: inherit; }
button:focus-visible, select:focus-visible { outline: 2px solid #0b57d0; outline-offset: 2px; }

.inicial {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: #5f6368;
  color: #fff;
  font-size: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}
.cor-0 { background: #1a73e8; }
.cor-1 { background: #d93025; }
.cor-2 { background: #188038; }
.cor-3 { background: #e37400; }
.cor-4 { background: #a142f4; }
.cor-5 { background: #129eaf; }

/* Cabeçalho fixo do lobby */
.topo {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: #fff;
  z-index: 2;
}
.topo img { width: 40px; height: 40px; }
.marca { font-size: 24px; font-weight: 700; color: #1f1f1f; }

/* Telas de carregamento, saída e erro */
#carregando, #saida, #erro {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 64px 16px 16px;
}
.carregando-texto { color: #444746; font-size: 14px; }
#saida h1, #erro h1 { font-size: 28px; font-weight: 400; margin: 0 0 12px; }
#erro p { color: #444746; font-size: 14px; margin: 0; max-width: 440px; }

.btn-contorno {
  height: 40px;
  padding: 0 24px;
  margin-top: 24px;
  border: 1px solid #747775;
  border-radius: 999px;
  background: #fff;
  color: #0b57d0;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.btn-contorno:hover { background: #f0f5fd; }
.btn-tentar { margin-top: 8px; }

/* Lobby */
#lobby { min-height: 100vh; padding: 64px 16px 72px; }
.lobby-corpo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 48px;
  max-width: 1280px;
  min-height: calc(100dvh - 140px); /* centraliza na vertical entre cabeçalho e rodapé, como no Meet */
  margin: 0 auto;
  padding-top: 24px;
}

.previa-area { width: min(740px, 60vw); }
.previa-card {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background: #000;
  overflow: hidden;
}
.previa-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}
.previa-sem {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: #fff;
  font-size: 16px;
  background: #000;
}
.previa-nome {
  position: absolute;
  left: 16px;
  top: 12px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.6);
}
.previa-mais {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  pointer-events: none;
}
.previa-mais svg { width: 20px; height: 20px; fill: currentColor; }
.previa-controles {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: flex;
  gap: 16px;
}

/* Botões redondos (lobby e sala) */
.redondo {
  width: 56px;
  height: 56px;
  padding: 0;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.redondo svg { width: 24px; height: 24px; fill: currentColor; }
.previa-controles .redondo.on { background: #e3e3e3; color: #1f1f1f; }
.previa-controles .redondo.off { background: #ea4335; color: #fff; }

.pilulas {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}
.pilula {
  height: 32px;
  max-width: 240px;
  padding: 0 12px;
  border: 1px solid #747775;
  border-radius: 999px;
  background: #fff;
  color: #1f1f1f;
  font-size: 14px;
  text-overflow: ellipsis;
}

.entrada { width: min(420px, 90vw); display: flex; flex-direction: column; align-items: center; text-align: center; }
.pilula:empty { display: none; } /* sem permissão ainda não há dispositivos para listar */
.entrada h1 { font-size: 36px; font-weight: 400; line-height: 44px; margin: 0 0 16px; color: #1f1f1f; }
.presenca { font-size: 14px; font-weight: 500; margin: 0 0 16px; color: #1f1f1f; }
.reuniao { font-size: 16px; margin: 0 0 4px; color: #1f1f1f; }
.horario { font-size: 14px; color: #444746; margin: 0 0 24px; }

.gravacao {
  display: flex;
  gap: 12px;
  background: #f0f4f9;
  border-radius: 16px;
  padding: 12px 16px;
  margin-bottom: 24px;
}
.ponto {
  flex: none;
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 50%;
  background: #ea4335;
}
.gravacao-titulo { font-size: 14px; font-weight: 500; margin: 0; color: #1f1f1f; }
.gravacao-texto { font-size: 12px; margin: 4px 0 0; color: #444746; }

.btn-participar {
  width: 240px;
  height: 56px;
  border: none;
  border-radius: 999px;
  background: #0b57d0;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.btn-participar:hover { background: #0842a0; }
.btn-participar:disabled { opacity: 0.5; cursor: default; }
.btn-participar:focus-visible { outline: none; box-shadow: 0 0 0 2px #fff, 0 0 0 4px #0b57d0; }

.erro-lobby { color: #b3261e; font-size: 14px; margin: 12px 0 0; }

.rodape {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 12px 16px;
  border-top: 1px solid #e1e3e1;
  background: #fff;
  font-size: 12px;
  color: #444746;
}
.rodape p { margin: 0; }

/* Sala (tela escura) */
body[data-tela="sala"] { background: #202124; color: #fff; }
body[data-tela="sala"] .topo { display: none; }

#sala { position: fixed; inset: 0; }
.grade {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 64px;
  padding: 8px max(8px, env(safe-area-inset-right)) 8px max(8px, env(safe-area-inset-left));
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  grid-auto-rows: minmax(160px, 1fr);
  align-content: stretch;
  overflow: auto;
}
.tile {
  position: relative;
  min-height: 0;
  border-radius: 8px;
  background: #3c4043;
  overflow: hidden;
}
.tile.falando { box-shadow: inset 0 0 0 3px #8ab4f8; }
.tile video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tile video.espelho { transform: scaleX(-1); }
.tile.tela video { object-fit: contain; background: #000; }
.tile .inicial {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
.tile .nome {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(32, 33, 36, 0.7);
  font-size: 14px;
  font-weight: 500;
}
.tile .mudo {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(32, 33, 36, 0.8);
  color: #ea4335;
}
.tile .mudo svg { width: 16px; height: 16px; fill: currentColor; }

.aviso-sala {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 8px 16px;
  border-radius: 8px;
  background: #3c4043;
  font-size: 14px;
  z-index: 3;
}

.barra {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 64px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 0 max(16px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(16px, env(safe-area-inset-left));
  background: #202124;
}
.barra-lado { min-width: 0; }
.barra-direita { justify-self: end; display: flex; align-items: center; gap: 12px; }
.barra-info, .barra-contagem {
  margin: 0;
  font-size: 14px;
  color: #e8eaed;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.barra-acoes { display: flex; align-items: center; gap: 12px; }
.barra .redondo { background: #3c4043; color: #fff; }
.barra .redondo.off { background: #ea4335; }
.barra [aria-pressed="true"] { background: #a8c7fa; color: #062e6f; }
.gravando-sala {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 14px;
  color: #e8eaed;
  white-space: nowrap;
}
.gravando-sala .ponto { margin-top: 0; }
.sair {
  width: 56px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: #ea4335;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.sair svg { width: 24px; height: 24px; fill: currentColor; }

/* Áudio: volume da sala e redução de ruído */
.audio-wrap { position: relative; display: flex; }
.barra [aria-expanded="true"] { background: #a8c7fa; color: #062e6f; }
.painel-audio {
  position: fixed;
  left: 50%;
  bottom: 76px;
  transform: translateX(-50%);
  z-index: 4;
  width: min(320px, calc(100vw - 32px));
  padding: 16px;
  border-radius: 12px;
  background: #2d2f31;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  color: #e8eaed;
}
.painel-rotulo { margin: 0; font-size: 14px; font-weight: 500; }
.volume { display: block; width: 100%; height: 44px; margin: 0; cursor: pointer; accent-color: #8ab4f8; }
.painel-aviso { margin: 0; font-size: 12px; color: #fdd663; }
.painel-linha {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.painel-linha:disabled { opacity: 0.5; cursor: default; }
.trilho {
  flex: none;
  position: relative;
  width: 40px;
  height: 24px;
  border-radius: 999px;
  background: #5f6368;
  transition: background-color 0.15s ease;
}
.trilho::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s ease;
}
.painel-linha[aria-checked="true"] .trilho { background: #8ab4f8; }
.painel-linha[aria-checked="true"] .trilho::after { transform: translateX(16px); background: #062e6f; }
.painel-dica { margin: 0; font-size: 12px; color: #bdc1c6; }

.aviso-ruido {
  position: absolute;
  left: 50%;
  bottom: 76px;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 8px 8px 8px 16px;
  border-radius: 8px;
  background: #3c4043;
  color: #fff;
  font-size: 14px;
}
.aviso-ruido p { margin: 0; }
.aviso-ruido .btn-contorno { height: 44px; margin-top: 0; padding: 0 16px; background: transparent; color: #8ab4f8; border-color: #5f6368; }
.aviso-ruido .btn-contorno:hover { background: #4a4d50; }

.redondo, .btn-participar, .btn-contorno, .sair { transition: background-color 0.15s ease; }
@media (prefers-reduced-motion: reduce) {
  .redondo, .btn-participar, .btn-contorno, .sair { transition: none; }
}

/* Celular */
@media (max-width: 700px) {
  .lobby-corpo { flex-direction: column; gap: 24px; padding: 16px 0 0; }
  .previa-area { width: 100%; }
  .previa-card { width: 100%; }
  .pilulas { display: none; }
  .entrada { width: 100%; }
  .btn-participar { width: 100%; }
  .grade { padding: 4px max(4px, env(safe-area-inset-right)) 4px max(4px, env(safe-area-inset-left)); gap: 4px; }
  .barra-acoes { gap: 8px; }
  .barra .redondo { width: 48px; height: 48px; }
  .barra-direita { gap: 8px; }
}
