/* =============================================================
   Callnexa — Estilos globais
   ============================================================= */

:root {
  --bg-0: #0b1020;
  --bg-1: #121833;
  --bg-2: #1a2247;
  --bg-3: #232c5c;
  --card: rgba(255, 255, 255, 0.05);
  --card-strong: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.08);
  --text: #e7eaf6;
  --text-dim: #aab0c8;
  --text-faint: #7a82a0;
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 22px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  height: 100%;
  background: radial-gradient(1200px 800px at 20% 0%, #1c2350 0%, var(--bg-0) 55%) fixed;
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji";
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
input[type="text"], input[type="number"], input[type="email"] {
  font: inherit; color: inherit;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  outline: none;
  transition: border-color .15s, background .15s;
  width: 100%;
}
input[type="text"]:focus { border-color: var(--accent); background: var(--card-strong); }

select.select-native {
  font: inherit; color: inherit;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  outline: none;
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'><path d='M1 1l5 5 5-5' stroke='%23aab0c8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}
select.select-native:focus { border-color: var(--accent); background-color: var(--card-strong); }
select.select-native option { background: var(--bg-1); color: var(--text); }

.warning {
  margin: 10px 0;
  padding: 10px 12px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #ffe5b3;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  line-height: 1.5;
}
.warning code {
  background: rgba(0,0,0,0.3);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.82rem;
}

.hidden { display: none !important; }

/* =============================================================
   Landing page
   ============================================================= */
body.landing {
  display: block;
  padding: 0;
  overflow: auto;
  min-height: 100%;
}
.landing-container {
  width: 100%; max-width: 1100px;
  margin: 0 auto;
  padding: 80px 24px 40px;
  display: grid; gap: 40px;
}
.brand {
  text-align: center;
  display: grid; gap: 8px; justify-items: center;
  color: var(--text);
}
.brand-logo {
  width: 64px; height: 64px;
  border-radius: 18px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: var(--shadow-md);
  color: white;
}
.brand h1 {
  margin: 4px 0 0;
  font-size: 1.9rem;
  letter-spacing: -0.02em;
  font-weight: 700;
}
.tagline { color: var(--text-dim); margin: 0; font-size: 0.96rem; max-width: 380px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.card h2 { margin: 0 0 18px; font-size: 1.1rem; font-weight: 600; }

.field {
  display: grid; gap: 8px;
  margin-bottom: 18px;
}
.field > span { font-size: 0.85rem; color: var(--text-dim); }
.field > span .muted { color: var(--text-faint); font-weight: 400; }
.hint-inline {
  display: block;
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--text-faint);
  line-height: 1.4;
}

.lang-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}
.lang-option {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: 12px;
  background: var(--card-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .15s;
  user-select: none;
  font-size: 0.95rem;
}
.lang-option input { position: absolute; opacity: 0; }
.lang-option:has(input:checked) {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.18);
}

.actions { display: grid; gap: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform .08s, background .15s, opacity .15s;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  box-shadow: 0 6px 16px rgba(99,102,241,0.35);
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-secondary {
  background: var(--card-strong);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: rgba(255,255,255,0.12); }

.separator {
  position: relative; text-align: center; color: var(--text-faint);
  font-size: 0.8rem; padding: 4px 0;
}
.separator::before, .separator::after {
  content: ""; position: absolute; top: 50%;
  width: calc(50% - 60px); height: 1px; background: var(--border);
}
.separator::before { left: 0; }
.separator::after { right: 0; }

.join-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }

.hint {
  margin: 14px 0 0;
  color: var(--text-faint);
  font-size: 0.82rem;
  line-height: 1.5;
  text-align: center;
}

.footer { text-align: center; color: var(--text-faint); }

/* =============================================================
   Sala de videochamada
   ============================================================= */
body.room {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;        /* fallback Safari mais antigo */
  height: 100dvh;
  /* iOS: respeita áreas seguras (notch, home bar) */
  padding-top: env(safe-area-inset-top);
}

/* Wrapper: vídeo (stage) + chat lateral */
.room-body {
  display: grid;
  grid-template-columns: 1fr 340px;
  grid-template-rows: 1fr;
  min-height: 0;
  overflow: hidden;
}
@media (max-width: 900px) {
  .room-body {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }
}

/* Header */
.room-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(0,0,0,0.25);
  border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  transition: background .15s;
}
.icon-btn:hover { background: var(--card-strong); }
.room-info {
  display: flex; flex-direction: column;
  min-width: 0;
}
.room-info strong { font-size: 0.95rem; }
.room-meta { font-size: 0.78rem; color: var(--text-dim); }

/* ============== Grid de vídeos ==============
 * 3 modos de layout (controlados pelo atributo data-layout):
 *   - grid     : todos do mesmo tamanho
 *   - spotlight: principal grande + miniaturas na rail
 *   - pip      : remoto cobre tudo + self num PiP no canto (2 pessoas)
 */
.video-grid {
  position: relative;
  min-height: 0;
  overflow: hidden;
  padding: 8px;
  gap: 8px;
}

/* --- Layout: GRADE --- */
.video-grid[data-layout="grid"] { display: grid; }
.video-grid[data-layout="grid"][data-count="1"] { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.video-grid[data-layout="grid"][data-count="2"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
.video-grid[data-layout="grid"][data-count="3"],
.video-grid[data-layout="grid"][data-count="4"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.video-grid[data-layout="grid"][data-count="5"],
.video-grid[data-layout="grid"][data-count="6"] { grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr 1fr; }
.video-grid[data-layout="grid"][data-count="7"],
.video-grid[data-layout="grid"][data-count="8"],
.video-grid[data-layout="grid"][data-count="9"] { grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr 1fr 1fr; }
.video-grid[data-layout="grid"][data-count="10"],
.video-grid[data-layout="grid"][data-count="11"],
.video-grid[data-layout="grid"][data-count="12"] { grid-template-columns: 1fr 1fr 1fr 1fr; grid-template-rows: 1fr 1fr 1fr; }

@media (max-width: 700px) {
  .video-grid[data-layout="grid"][data-count="2"] { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .video-grid[data-layout="grid"][data-count="3"],
  .video-grid[data-layout="grid"][data-count="4"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
}

/* --- Layout: SPOTLIGHT (foco grande + rail) --- */
.video-grid[data-layout="spotlight"] {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr auto;
}
.video-grid[data-layout="spotlight"] .video-tile.tile-main {
  grid-row: 1; grid-column: 1;
  min-height: 0; min-width: 0;
}
.video-grid[data-layout="spotlight"] .video-tile.tile-rail {
  grid-row: 2; grid-column: 1;
  width: 160px;
  aspect-ratio: 16/9;
  min-height: 0;
  flex-shrink: 0;
}
.video-grid[data-layout="spotlight"] .rail-container {
  grid-row: 2; grid-column: 1;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 2px 2px;
  scrollbar-width: thin;
}
@media (max-width: 700px) {
  .video-grid[data-layout="spotlight"] .video-tile.tile-rail { width: 110px; }
}

/* --- Layout: PIP (2 pessoas, "estilo Meet" 1x1) --- */
.video-grid[data-layout="pip"] {
  display: block;
}
.video-grid[data-layout="pip"] .video-tile.tile-main {
  position: absolute; inset: 8px;
  width: auto; height: auto;
}
.video-grid[data-layout="pip"] .video-tile.tile-pip {
  position: absolute;
  bottom: 20px; right: 20px;
  width: 28%; max-width: 220px; min-width: 130px;
  aspect-ratio: 16/9;
  height: auto;
  z-index: 10;
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
  cursor: pointer;
  transition: transform .15s;
}
.video-grid[data-layout="pip"] .video-tile.tile-pip:hover { transform: scale(1.04); }
@media (max-width: 700px) {
  .video-grid[data-layout="pip"] .video-tile.tile-pip {
    width: 35%; max-width: 160px; min-width: 110px;
    bottom: 12px; right: 12px;
  }
}

/* --- Indicador de quem está falando --- */
.video-tile.speaking {
  outline: 3px solid #10b981;
  outline-offset: -3px;
  box-shadow: 0 0 24px rgba(16, 185, 129, 0.5);
}
.video-tile.speaking .tile-overlay {
  background: rgba(16, 185, 129, 0.75);
}

/* Indicador de foco manual */
.video-tile.manual-focus::before {
  content: "📌";
  position: absolute;
  top: 10px; right: 10px;
  background: rgba(0,0,0,0.6);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  z-index: 2;
}

/* Tile clicável (para fixar foco) */
.video-tile.clickable { cursor: pointer; }
.video-tile.clickable:hover .tile-overlay {
  background: rgba(0,0,0,0.7);
}

.video-tile {
  position: relative;
  background: linear-gradient(135deg, var(--bg-2), var(--bg-1));
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  min-height: 120px;
}
.video-tile video {
  width: 100%; height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}
/* Modo "preencher tile" (corta bordas — estilo Google Meet) ativado pela
   classe .fit-cover no grid. Padrão é contain (mostra vídeo inteiro). */
.video-grid.fit-cover .video-tile video {
  object-fit: cover;
}
.video-tile.self video { transform: scaleX(-1); }
.video-tile .avatar {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  font-size: clamp(40px, 8vw, 80px);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.tile-overlay {
  position: absolute;
  top: 10px; left: 10px;
  display: flex; gap: 8px; align-items: center;
  background: rgba(0,0,0,0.45);
  border-radius: 999px;
  padding: 4px 10px 4px 6px;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-size: 0.8rem;
  max-width: calc(100% - 20px);
}
.tile-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  max-width: 180px;
}
.tile-lang {
  background: rgba(255,255,255,0.18);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.caption {
  position: absolute;
  /* Centralizada no rodapé (mais perto do estilo "legenda de filme") */
  left: 50%;
  bottom: 14px;
  transform: translate(-50%, 8px);
  max-width: calc(100% - 28px);
  width: max-content;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.78);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  /* Amarelo de legenda clássico, com sombra preta forte para legibilidade
     mesmo se o fundo passar pelos cantos do balão */
  color: #ffd54a;
  font-weight: 600;
  border-radius: 8px;
  font-size: clamp(0.95rem, 1.9vw, 1.2rem);
  line-height: 1.35;
  max-height: 40%;
  overflow: hidden;
  text-align: center;
  text-shadow:
    0 1px 0 rgba(0, 0, 0, 0.95),
    0 0 4px rgba(0, 0, 0, 0.85),
    0 2px 6px rgba(0, 0, 0, 0.6);
  letter-spacing: 0.01em;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  /* Quebra de palavras longas para não estourar a largura */
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.caption.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Em telas pequenas, reduz padding lateral para caber mais texto */
@media (max-width: 700px) {
  .caption {
    bottom: 10px;
    padding: 6px 12px;
    font-size: clamp(0.85rem, 3.5vw, 1.05rem);
    max-width: calc(100% - 16px);
  }
}

/* =============================================================
   Painel de chat (conversa traduzida)
   ============================================================= */
.chat-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: rgba(0,0,0,0.25);
  border-left: 1px solid var(--border);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.chat-panel.collapsed .chat-list,
.chat-panel.collapsed .chat-foot { display: none; }
.chat-panel.collapsed { border-left: none; }

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.18);
}
.chat-header h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}
.chat-header .icon-btn {
  width: 30px; height: 30px;
}
.chat-header .icon-btn svg { transition: transform .2s; }
.chat-panel.collapsed .chat-header .icon-btn svg { transform: rotate(-90deg); }

.chat-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
  overscroll-behavior: contain;
}
.chat-list::-webkit-scrollbar { width: 6px; }
.chat-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 999px; }

.chat-empty {
  display: grid; place-items: center;
  gap: 6px;
  padding: 30px 16px;
  text-align: center;
  color: var(--text-faint);
  font-size: 0.85rem;
  margin: auto;
}
.chat-empty small { font-size: 0.75rem; }

.chat-msg {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  animation: msgEnter .25s ease;
}
@keyframes msgEnter {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-msg.self { flex-direction: row-reverse; }
.chat-msg.self .chat-bubble { background: rgba(99, 102, 241, 0.18); }

.chat-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.chat-bubble {
  background: var(--card-strong);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 10px;
  max-width: 78%;
  min-width: 0;
  word-wrap: break-word;
}
.chat-meta {
  display: flex;
  gap: 6px;
  align-items: baseline;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.chat-meta strong { font-size: 0.82rem; font-weight: 600; }
.chat-time { font-size: 0.7rem; color: var(--text-faint); }
.chat-lang {
  font-size: 0.65rem;
  background: rgba(255,255,255,0.12);
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.05em;
}
.chat-msg.partial .chat-lang::after {
  content: " …";
  color: var(--accent);
}
.chat-body { display: flex; flex-direction: column; gap: 5px; }

.msg-mono {
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--text);
}

/* Original em BRANCO */
.msg-original {
  font-size: 0.88rem;
  line-height: 1.4;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
  border-left: 3px solid rgba(255, 255, 255, 0.55);
  border-radius: 0 8px 8px 0;
  padding: 6px 10px;
}
/* Tradução em VERDE */
.msg-translated {
  font-size: 0.92rem;
  line-height: 1.4;
  color: #86efac;
  background: rgba(16, 185, 129, 0.10);
  border-left: 3px solid #10b981;
  border-radius: 0 8px 8px 0;
  padding: 6px 10px;
  font-weight: 500;
}
.msg-translated.pending {
  color: var(--text-faint);
  background: rgba(255,255,255,0.04);
  border-left-color: rgba(255,255,255,0.18);
  font-style: italic;
  animation: pulseFade 1.4s ease-in-out infinite;
}
.msg-translated.error {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.12);
  border-left-color: #ef4444;
  font-size: 0.78rem;
}
@keyframes pulseFade {
  0%, 100% { opacity: 0.6; }
  50%      { opacity: 1; }
}

.msg-original[data-lang]::before,
.msg-translated[data-lang]::before {
  content: attr(data-lang);
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 800;
  margin-right: 8px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.10);
  letter-spacing: 0.06em;
  vertical-align: middle;
  opacity: 0.85;
}

.chat-foot {
  padding: 10px 12px 8px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chat-foot small { color: var(--text-faint); font-size: 0.7rem; text-align: center; }

/* Input para digitar mensagem */
.chat-input {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.chat-input input {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color .15s, background .15s;
  min-width: 0;
}
.chat-input input:focus {
  border-color: var(--accent);
  background: var(--card-strong);
}
.chat-input input::placeholder { color: var(--text-faint); }

.btn-send {
  flex: 0 0 auto;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  transition: background .15s, transform .1s;
}
.btn-send:hover { background: var(--accent-2); }
.btn-send:active { transform: scale(0.94); }
.btn-send:disabled { opacity: 0.4; cursor: not-allowed; background: var(--text-faint); }

/* Em mobile, chat ocupa metade da tela quando aberto, escondível */
@media (max-width: 900px) {
  .chat-panel {
    border-left: none;
    border-top: 1px solid var(--border);
    max-height: 55vh;
    min-height: 160px;
    transition: max-height .3s ease, min-height .3s ease;
  }
  .chat-panel.collapsed {
    max-height: 0;
    min-height: 0;
    border-top: none;
  }
  /* Header também esconde quando colapsado (controlado pelo botão da toolbar) */
  .chat-panel.collapsed .chat-header { display: none; }
}

/* Header mais moderno do chat (desktop) */
@media (min-width: 901px) {
  .chat-panel.collapsed { max-width: 44px; }
  .chat-panel.collapsed .chat-header h3 { display: none; }
}

/* Barra de controles */
.controls {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  background: rgba(0,0,0,0.55);
  border-top: 1px solid var(--border);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  flex-wrap: wrap;
  position: relative;
  /* iOS: respeita home indicator */
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  transition: max-height .3s ease, padding .3s ease, opacity .3s ease;
  max-height: 200px;
  overflow: hidden;
  z-index: 30;
}

/* Auto-hide em mobile: a barra colapsa de verdade (libera espaço)
   e mostra apenas uma "alça" tocável que volta a expandir. */
@media (max-width: 900px) {
  .controls.auto-hidden {
    max-height: 18px;
    padding: 0;
    opacity: 0.9;
    cursor: pointer;
  }
  .controls.auto-hidden > * { display: none; }
  .controls.auto-hidden::after {
    content: "";
    position: absolute;
    top: 7px; left: 50%;
    width: 56px; height: 4px;
    background: rgba(255,255,255,0.55);
    border-radius: 999px;
    transform: translateX(-50%);
  }
}
.ctrl {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px;
  padding: 8px 12px;
  min-width: 64px;
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  transition: background .15s, color .15s;
}
.ctrl:hover { background: var(--card-strong); }
.ctrl.off {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.45);
  color: #ffd9d9;
}
/* Microfone com problema de reconhecimento (ex.: Safari iOS, sem rede) */
.ctrl.rec-error {
  position: relative;
  border-color: rgba(251, 191, 36, 0.6);
}
.ctrl.rec-error::after {
  content: "!";
  position: absolute; top: 2px; right: 4px;
  width: 14px; height: 14px;
  background: #f59e0b; color: #1a1a1a;
  border-radius: 50%; font-size: 10px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
}
/* Microfone capturando voz — pulsa em verde */
.ctrl#btnMic.listening {
  background: rgba(16, 185, 129, 0.22);
  border-color: rgba(16, 185, 129, 0.6);
  color: #c9ffe7;
  animation: micPulse 1.1s infinite;
}
@keyframes micPulse {
  0%   { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55); }
  60%  { box-shadow: 0 0 0 12px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
.ctrl.on {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.45);
  color: #c9ffe7;
}
.ctrl-danger {
  background: rgba(239, 68, 68, 0.85);
  color: white;
  border-color: rgba(239, 68, 68, 0.9);
}
.ctrl-danger:hover { background: rgba(239, 68, 68, 1); }
.ctrl-label { font-size: 0.7rem; }

/* Badge de mensagens novas */
.ctrl { position: relative; }
.ctrl-badge {
  position: absolute;
  top: 2px; right: 6px;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 999px;
  display: grid;
  place-items: center;
  border: 2px solid var(--bg-0);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.3);
  animation: badgePop .25s ease;
}
@keyframes badgePop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}
.ctrl#btnChat.has-unread {
  background: rgba(99, 102, 241, 0.22);
  border-color: rgba(99, 102, 241, 0.5);
  color: #d3d6ff;
}

@media (max-width: 480px) {
  .ctrl { min-width: 56px; padding: 6px 8px; }
  .ctrl-label { font-size: 0.65rem; }
  .room-info strong { font-size: 0.85rem; }
}

/* =============================================================
   Overlay (status / erro)
   ============================================================= */
.overlay {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: rgba(0,0,0,0.7);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 50;
  padding: 24px;
}
.overlay-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.overlay-card h2 { margin: 0 0 8px; font-size: 1.15rem; }
.overlay-card p { color: var(--text-dim); margin: 0 0 16px; font-size: 0.92rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }

/* =============================================================
   Modal de configurações — com scroll interno + botão fixo
   ============================================================= */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 40;
  padding: 16px;
  /* Centraliza o card via flex (mais confiável que grid em iOS) */
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  /* Limita à altura visível — usa scroll interno em vez de cortar */
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-card h2 {
  margin: 0;
  padding: 18px 22px 12px;
  font-size: 1.1rem;
  flex: 0 0 auto;
  border-bottom: 1px solid var(--border);
}
/* Área rolável central */
.modal-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 22px;
  -webkit-overflow-scrolling: touch;
}
.modal-scroll .field { margin-bottom: 14px; }
.modal-scroll .field:last-child { margin-bottom: 0; }

/* Footer com botão Salvar — FIXO no rodapé do card */
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 22px;
  background: var(--bg-1);
  border-top: 1px solid var(--border);
  flex: 0 0 auto;
}
.modal-actions .btn { min-width: 140px; }

/* Em telas pequenas, o card ocupa quase toda a tela */
@media (max-width: 600px) {
  .modal { padding: 0; }
  .modal-card {
    max-height: 100vh;
    max-height: 100dvh;
    height: 100vh;
    height: 100dvh;
    max-width: 100%;
    border-radius: 0;
  }
  .modal-actions { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
}

.toggle {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
  font-size: 0.95rem;
  padding: 6px 0;
}
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); }

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

/* =============================================================
   Popover (menu de layout) — fica ACIMA de tudo via z-index alto
   ============================================================= */
.popover {
  position: fixed;
  bottom: calc(90px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  min-width: 260px;
  max-width: calc(100vw - 24px);
  z-index: 60; /* acima da barra de controles (30) e dos vídeos */
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Em mobile, popover vira "bottom sheet" — colado ao rodapé,
   ocupando toda a largura, mais fácil de tocar. */
@media (max-width: 600px) {
  .popover {
    left: 12px;
    right: 12px;
    bottom: calc(100px + env(safe-area-inset-bottom));
    transform: none;
    min-width: 0;
    max-width: none;
  }
  .popover-item { padding: 14px 12px; }
}
.popover-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  text-align: left;
  transition: background .15s;
  color: var(--text);
  width: 100%;
}
.popover-item:hover { background: var(--card-strong); }
.popover-item.active { background: rgba(99, 102, 241, 0.2); }
.popover-icon {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: var(--card-strong);
  border-radius: 8px;
  font-size: 18px;
  flex-shrink: 0;
}
.popover-item strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
}
.popover-item small {
  display: block;
  font-size: 0.75rem;
  color: var(--text-faint);
}

/* =============================================================
   Toast
   ============================================================= */
.toast {
  position: fixed;
  left: 50%;
  bottom: 120px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0,0,0,0.85);
  color: white;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  z-index: 60;
}
.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* =============================================================
   Acessibilidade
   ============================================================= */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* =============================================================
   ETAPA 2 — Login, Dashboard, Topbar, Toasts, Modais
   ============================================================= */

/* ---- Topbar ---- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  background: rgba(11, 16, 32, 0.72);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--border);
}
.topbar-brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--text); text-decoration: none;
  font-weight: 700; letter-spacing: -0.01em;
}
.topbar-brand svg {
  color: var(--accent);
  filter: drop-shadow(0 0 10px rgba(99,102,241,0.45));
}
.topbar-nav {
  display: flex; align-items: center; gap: 16px;
  color: var(--text-dim);
}
.topbar-link {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 8px 14px;
  border-radius: 999px;
  transition: background .15s, color .15s;
}
.topbar-link:hover { background: var(--card-strong); color: var(--text); }
.topbar-user {
  display: flex; align-items: center; gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px 4px 4px;
}
.topbar-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  display: grid; place-items: center;
  font-size: 0.78rem; font-weight: 700;
  overflow: hidden;
}
.topbar-avatar img { width: 100%; height: 100%; object-fit: cover; }
.topbar-name { font-size: 0.88rem; color: var(--text); }
.topbar-btn-ghost {
  font-size: 0.82rem;
  color: var(--text-faint);
  padding: 4px 12px;
  border-radius: 999px;
  transition: background .15s, color .15s;
}
.topbar-btn-ghost:hover { background: var(--card-strong); color: var(--text); }

@media (max-width: 640px) {
  .topbar { padding: 12px 16px; }
  .topbar-name { display: none; }
}

/* ---- Hero ---- */
.hero {
  text-align: center;
  display: grid; gap: 14px; justify-items: center;
  max-width: 720px; margin: 0 auto;
}
.hero-tight { gap: 8px; }
.hero-title {
  margin: 0;
  font-size: clamp(1.8rem, 3.8vw, 2.7rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, #ffffff 0%, #c8cbe6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-sub {
  margin: 0;
  color: var(--text-dim);
  font-size: 1.02rem;
  line-height: 1.55;
  max-width: 580px;
}

/* ---- Cards grid (landing) ---- */
.cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 820px) {
  .cards-grid { grid-template-columns: 1fr; }
}

.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.025));
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(600px 200px at 50% -10%, rgba(99,102,241,0.18), transparent 70%);
  pointer-events: none;
}
.card > * { position: relative; }
.card-head { margin-bottom: 18px; }
.card-head h2 { margin: 0 0 4px; font-size: 1.15rem; }
.card-head .muted { margin: 0; font-size: 0.85rem; color: var(--text-dim); }
.muted { color: var(--text-dim); }
.small { font-size: 0.82rem; }

/* ---- Auth area no card 1 ---- */
.auth-prompt { display: grid; gap: 16px; }
.gbtn-host { display: flex; justify-content: center; }
.dev-login { margin-top: 6px; }
.dev-details summary {
  cursor: pointer;
  color: var(--text-faint);
  font-size: 0.85rem;
  list-style: none;
  padding: 8px 0;
  user-select: none;
}
.dev-details summary::-webkit-details-marker { display: none; }
.dev-details summary::before { content: '▸ '; transition: transform .2s; display: inline-block; }
.dev-details[open] summary::before { transform: rotate(90deg); }
.dev-details > * + * { margin-top: 8px; }

/* Separador "ou" entre o login Google e o login local */
.auth-sep {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-faint);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 2px 0;
}
.auth-sep::before,
.auth-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border), transparent);
}

/* Form de login local (usuário + senha) */
.local-login {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: var(--card-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.local-login .field { gap: 4px; }
.local-login .field span {
  font-size: 0.78rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.local-login input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color .15s, box-shadow .15s;
}
.local-login input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.local-hint {
  margin: 0;
  padding-top: 4px;
  text-align: center;
  line-height: 1.5;
}
.local-hint code {
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  font-size: 0.85em;
}

.auth-area { display: grid; gap: 18px; }
.me-card {
  display: flex; align-items: center; gap: 12px;
  padding: 14px;
  background: var(--card-strong);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.me-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center;
  color: white; font-weight: 700;
  overflow: hidden;
}
.me-avatar img { width: 100%; height: 100%; object-fit: cover; }
.me-info { display: grid; gap: 2px; }
.me-info strong { font-size: 0.95rem; }
.me-info small { color: var(--text-dim); font-size: 0.82rem; }

.host-actions { display: grid; gap: 10px; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 12px; font-size: 0.86rem; }
.btn-danger {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: white;
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.35);
}
.btn-danger:hover { filter: brightness(1.1); }

/* ---- Idiomas avançado ---- */
.lang-extras {
  background: var(--card-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 14px;
}
.lang-extras > summary {
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text-dim);
  list-style: none;
  user-select: none;
  padding: 4px 0;
}
.lang-extras > summary::-webkit-details-marker { display: none; }
.lang-extras > summary::before { content: '▸ '; transition: transform .2s; display: inline-block; }
.lang-extras[open] > summary::before { transform: rotate(90deg); }
.lang-extras[open] { padding-bottom: 16px; }
.lang-extras .field:last-of-type { margin-bottom: 0; }

/* ---- Card guest ---- */
.card-guest .field { margin-bottom: 14px; }

/* =============================================================
   Dashboard
   ============================================================= */
.dashboard {
  max-width: 1180px;
}
.dashboard-toolbar {
  display: flex; gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.rooms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}
.room-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.025));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: grid; gap: 12px;
  position: relative;
  transition: transform .15s, box-shadow .15s, border-color .15s;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.room-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  opacity: 0.6;
}
.room-card:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 12px 30px rgba(99,102,241,0.15);
}
.room-card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 8px;
}
.room-id-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.18);
  color: #c7c9ff;
  border: 1px solid rgba(99,102,241,0.35);
  letter-spacing: 0.04em;
}
.room-actions {
  display: flex; gap: 4px;
}
.room-actions .icon-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--card);
  font-size: 0.95rem;
  transition: background .15s, color .15s;
}
.room-actions .icon-btn:hover { background: var(--card-strong); }
.room-actions .icon-btn.danger:hover { background: rgba(239,68,68,0.18); color: #ffb3b3; }
.room-name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
}
.room-meta {
  display: grid; gap: 4px;
  font-size: 0.82rem;
  color: var(--text-dim);
}
.room-meta .muted { color: var(--text-faint); }
.room-card-foot { margin-top: 4px; }

.empty-state {
  text-align: center;
  padding: 60px 24px;
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  display: grid; gap: 12px; justify-items: center;
}
.empty-state h3 { margin: 0; font-size: 1.2rem; }
.empty-state p { margin: 0; max-width: 380px; }
.empty-icon { font-size: 3rem; }

/* =============================================================
   Modais (compartilhar, deletar)
   ============================================================= */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  padding: 20px;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(2, 6, 23, 0.65);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: fadeIn .15s ease-out;
}
.modal-content {
  position: relative; z-index: 1;
  width: 100%; max-width: 480px;
  background: linear-gradient(180deg, #1a2143, #141a35);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: slideUp .18s ease-out;
  overflow: hidden;
}
.modal-share { max-width: 560px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 1.05rem; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  font-size: 1.4rem;
  color: var(--text-dim);
}
.modal-close:hover { background: var(--card-strong); color: var(--text); }
.modal-body {
  padding: 20px 22px;
  display: grid; gap: 16px;
}
.modal-foot {
  padding: 16px 22px;
  display: flex; justify-content: flex-end; gap: 10px;
  border-top: 1px solid var(--border);
}
.copy-row { display: flex; gap: 8px; }
.copy-row input {
  flex: 1;
  font-family: ui-monospace, monospace;
  font-size: 0.86rem;
}
.share-tip {
  font-size: 0.82rem;
  color: var(--text-dim);
  background: rgba(99,102,241,0.08);
  border: 1px solid rgba(99,102,241,0.2);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  line-height: 1.55;
}
.share-tip strong { color: var(--text); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* =============================================================
   Toast
   ============================================================= */
.toast-host {
  position: fixed; top: 80px; right: 20px; z-index: 200;
  display: grid; gap: 10px; pointer-events: none;
}
.toast {
  min-width: 240px; max-width: 360px;
  padding: 12px 18px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #1a2245, #141a35);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  font-size: 0.9rem;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity .2s, transform .2s;
  pointer-events: auto;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast-success { border-left: 4px solid var(--success); }
.toast-error   { border-left: 4px solid var(--danger);  }
.toast-warn    { border-left: 4px solid var(--warning); }
.toast-info    { border-left: 4px solid var(--accent);  }

@media (max-width: 640px) {
  .toast-host { top: 72px; left: 16px; right: 16px; }
  .toast { min-width: 0; max-width: none; }
}

/* =============================================================
   Painel de Participantes (room.html)
   ============================================================= */
.people-panel {
  position: fixed; z-index: 80;
  top: 0; right: 0; bottom: 0;
  width: 360px; max-width: calc(100vw - 24px);
  background: linear-gradient(180deg, #141a35, #0e1330);
  border-left: 1px solid var(--border);
  box-shadow: -16px 0 36px rgba(0,0,0,0.45);
  display: flex; flex-direction: column;
  animation: slideInRight .18s ease-out;
}
.people-panel[hidden] { display: none; }
.people-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--border);
}
.people-panel-head h3 { margin: 0; font-size: 1.05rem; font-weight: 600; }
.people-count {
  display: inline-block;
  min-width: 22px;
  padding: 0 8px;
  font-size: 0.78rem;
  background: var(--card-strong);
  border: 1px solid var(--border);
  border-radius: 999px;
  text-align: center;
  color: var(--text-dim);
  margin-left: 6px;
}

.admin-bar {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(99,102,241,0.06);
  display: grid; gap: 10px;
}
.admin-badge {
  font-size: 0.78rem; font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.04em;
}
.admin-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.people-list {
  margin: 0; padding: 8px 12px;
  list-style: none;
  flex: 1; overflow-y: auto;
}
.person-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 12px; align-items: center;
  padding: 10px 8px;
  border-radius: 10px;
  transition: background .15s;
}
.person-row:hover { background: var(--card); }
.person-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center;
  font-size: 0.84rem; font-weight: 700;
  color: white;
}
.person-info { display: grid; gap: 2px; min-width: 0; }
.person-info strong {
  font-size: 0.92rem; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.person-info small {
  font-size: 0.76rem; color: var(--text-dim);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.tag-admin {
  font-size: 0.7rem;
  background: rgba(245, 158, 11, 0.18);
  color: #ffd994;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  font-weight: 600;
}
.person-actions { display: flex; gap: 4px; }
.person-actions .icon-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--card);
  font-size: 0.9rem;
  border: 1px solid var(--border);
  transition: background .15s, border-color .15s;
}
.person-actions .icon-btn:hover { background: var(--card-strong); border-color: rgba(99,102,241,0.4); }
.person-actions .icon-btn.danger:hover { background: rgba(239,68,68,0.18); color: #ffb3b3; border-color: rgba(239,68,68,0.4); }

.people-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  min-height: 14px;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@media (max-width: 640px) {
  .people-panel { width: 100vw; }
}

/* =============================================================
   Lobby overlay (sala de espera para pendentes)
   ============================================================= */
.lobby-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(11, 16, 32, 0.92);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  display: grid; place-items: center;
  padding: 20px;
  animation: lobby-fade .25s ease-out;
}
.lobby-overlay.fading { opacity: 0; transition: opacity .22s ease-out; }

.lobby-card {
  width: 100%; max-width: 460px;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 30px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  position: relative;
}
.lobby-icon { font-size: 3rem; line-height: 1; margin-bottom: 12px; }
.lobby-title {
  margin: 0 0 8px;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.lobby-sub {
  margin: 0 0 24px;
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.55;
}
.lobby-status {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 18px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #c8caff;
  border-radius: 999px;
  font-size: 0.86rem;
  margin-bottom: 22px;
}
.lobby-spinner {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.18);
  border-top-color: var(--accent);
  animation: lobby-spin 0.8s linear infinite;
}
@keyframes lobby-spin { to { transform: rotate(360deg); } }
@keyframes lobby-fade {
  from { opacity: 0; transform: scale(0.98); }
  to   { opacity: 1; transform: scale(1); }
}

.lobby-shortcut {
  margin: 8px 0 18px;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
}
.lobby-shortcut summary {
  cursor: pointer;
  list-style: none;
  font-size: 0.88rem;
  color: var(--text);
  padding: 4px 0;
  user-select: none;
}
.lobby-shortcut summary::-webkit-details-marker { display: none; }
.lobby-shortcut summary::before {
  content: '🔑 '; margin-right: 6px;
}
.lobby-shortcut summary::after {
  content: ' ▸'; color: var(--text-faint);
  display: inline-block; transition: transform .2s;
  margin-left: 4px;
}
.lobby-shortcut[open] summary::after { transform: rotate(90deg); }
.lobby-pw {
  display: grid; gap: 10px;
  padding: 10px 0 4px;
}
.lobby-pw input {
  font: inherit; color: inherit;
  width: 100%;
  padding: 11px 14px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  text-align: center;
  letter-spacing: 0.04em;
  font-family: ui-monospace, monospace;
}
.lobby-pw input:focus { border-color: var(--accent); }
.lobby-btn-primary {
  padding: 11px 16px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  font: inherit; font-weight: 600;
  cursor: pointer;
  transition: filter .15s, transform .08s;
}
.lobby-btn-primary:hover { filter: brightness(1.1); }
.lobby-btn-primary:active { transform: scale(0.98); }
.lobby-btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.lobby-pw-error {
  font-size: 0.82rem;
  color: #ffb3b3;
  min-height: 1.2em;
  text-align: center;
}
.lobby-btn-ghost {
  background: transparent;
  border: none;
  color: var(--text-faint);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  padding: 8px;
  transition: color .15s;
}
.lobby-btn-ghost:hover { color: var(--text); }

/* Badge na barra de controles (botão Pessoas) */
.ctrl-badge {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  background: var(--accent);
  color: white;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
  line-height: 1;
}
.ctrl-badge.alert {
  background: var(--warning);
  animation: badge-pulse 1s ease-in-out infinite;
}
@keyframes badge-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.18); box-shadow: 0 0 0 6px rgba(245,158,11,0.25); }
}

/* =============================================================
   Painel — área de compartilhar (anfitrião)
   ============================================================= */
.share-box {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(99,102,241,0.06);
  display: grid; gap: 10px;
}
.share-box[hidden] { display: none; }
.share-row { display: grid; gap: 4px; }
.share-label {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-weight: 600;
}
.share-box .copy-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}
.share-box input {
  font-family: ui-monospace, monospace;
  font-size: 0.82rem;
  padding: 8px 10px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
}
.btn-copy {
  width: 38px;
  background: var(--card-strong);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  transition: background .15s, border-color .15s;
  font-size: 1rem;
}
.btn-copy:hover { background: rgba(99,102,241,0.25); border-color: rgba(99,102,241,0.5); }
.btn-copy:disabled { opacity: 0.5; cursor: not-allowed; }

.share-details summary {
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--text-faint);
  list-style: none;
  padding: 4px 0;
  user-select: none;
}
.share-details summary::-webkit-details-marker { display: none; }
.share-details summary::before { content: '▸ '; transition: transform .2s; display: inline-block; }
.share-details[open] summary::before { transform: rotate(90deg); }
.share-details[open] { padding-top: 4px; }

/* =============================================================
   Seções do painel (pendentes / na sala)
   ============================================================= */
.people-section { display: flex; flex-direction: column; }
.people-section + .people-section { border-top: 1px solid var(--border); margin-top: 6px; }
.section-head {
  padding: 12px 18px 6px;
}
.section-head h4 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  display: flex; align-items: center; gap: 8px;
}
.badge-pill {
  display: inline-block;
  min-width: 20px;
  padding: 1px 8px;
  font-size: 0.72rem;
  background: rgba(245,158,11,0.18);
  border: 1px solid rgba(245,158,11,0.35);
  color: #ffd994;
  border-radius: 999px;
  text-align: center;
}
.pending-section {
  background: rgba(245,158,11,0.04);
}

.tag-pending {
  font-size: 0.7rem;
  background: rgba(245,158,11,0.18);
  color: #ffd994;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid rgba(245,158,11,0.35);
  font-weight: 600;
}
.tag-banned {
  font-size: 0.7rem;
  background: rgba(239,68,68,0.18);
  color: #ffb3b3;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid rgba(239,68,68,0.4);
  font-weight: 600;
}

.person-avatar.pending {
  background: linear-gradient(135deg, #d97706, #f59e0b);
}
.person-avatar.banned {
  background: linear-gradient(135deg, #991b1b, #ef4444);
  font-size: 1.1rem;
}
.person-avatar.me {
  background: linear-gradient(135deg, #059669, #10b981);
}

/* =============================================================
   Mute toggle (botão verde/cinza)
   ============================================================= */
.mic-toggle {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 10px;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all .15s;
  background: var(--card);
  color: var(--text);
}
.mic-toggle.live {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.45);
}
.mic-toggle.live:hover {
  background: rgba(16, 185, 129, 0.28);
  border-color: rgba(16, 185, 129, 0.7);
  transform: scale(1.05);
}
.mic-toggle.muted {
  background: rgba(255,255,255,0.05);
  color: var(--text-faint);
  border-color: var(--border);
  position: relative;
}
.mic-toggle.muted:hover {
  background: rgba(99, 102, 241, 0.2);
  color: var(--text);
  border-color: rgba(99, 102, 241, 0.4);
  transform: scale(1.05);
}
.mic-toggle.disabled {
  cursor: default;
  opacity: 0.85;
}

.icon-btn-success {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
  border: 1.5px solid rgba(16, 185, 129, 0.45);
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
}
.icon-btn-success:hover {
  background: rgba(16, 185, 129, 0.32);
  transform: scale(1.05);
}

/* =============================================================
   Botão Mic forçado (mutado pelo admin) — destaque vermelho
   ============================================================= */
.ctrl.forced {
  background: rgba(239,68,68,0.22) !important;
  border-color: rgba(239,68,68,0.45) !important;
  color: #ffb3b3;
}
.ctrl.forced .ctrl-label {
  font-size: 0.65rem;
}

/* =============================================================
   Botão ghost (variante discreta usada em "Alterar senha")
   ============================================================= */
.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--card-strong);
  color: var(--text);
  border-color: rgba(125, 211, 252, 0.35);
}

/* =============================================================
   Modal de troca de senha (.change-pw-card)
   - Usa o .modal/.modal-card já existentes; adiciona ações e
     mensagem de erro com estilo próprio.
   ============================================================= */
.change-pw-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 460px;
  background: linear-gradient(180deg, #1a2143, #141a35);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: slideUp .18s ease-out;
}
.change-pw-card .modal-body {
  display: grid;
  gap: 14px;
}
.change-pw-card .field input {
  width: 100%;
}
.change-pw-card .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}
.change-pw-card .modal-actions .btn { min-width: 140px; }
.change-pw-card .error-msg {
  background: rgba(239, 68, 68, 0.10);
  border: 1px solid rgba(239, 68, 68, 0.30);
  color: #fca5a5;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.86rem;
  margin: 0;
}
.change-pw-card .warning {
  margin: 0;
}

@media (max-width: 560px) {
  .change-pw-card { max-width: 100%; }
  .change-pw-card .modal-actions { flex-direction: column-reverse; }
  .change-pw-card .modal-actions .btn { width: 100%; }
}
