:root {
  /* Matiz do aplicativo. Só o matiz e a saturação variam: cada tom neutro abaixo define sua própria
     luminosidade. Assim, o tema recolore os cinzas sem clareá-los nem escurecê-los, e todas as
     relações de contraste permanecem iguais. Com --tint-s em 0%, volta-se ao cinza neutro original.
   */
  --tint-h: 0;
  --tint-s: 0%;
  /* Os valores claros recebem um terço do matiz: o texto continua quase neutro, enquanto as
     superfícies
     carregam a cor.
   */
  --tint-s-text: calc(var(--tint-s) / 3);
  /* Trilha do seletor de matiz: um valor para dois pseudo-elementos específicos de cada navegador. */
  --hue-track: linear-gradient(to right,
      hsl(0 65% 55%), hsl(60 65% 55%), hsl(120 65% 55%),
      hsl(180 65% 55%), hsl(240 65% 55%), hsl(300 65% 55%), hsl(360 65% 55%));

  /* Cor de origem para hovers, divisórias e linhas finas da interface; são canais separados para
     aplicar alfa em cada uso. Ela acompanha o tema, não o matiz: sobreposições em vídeo, banners ou
     avatares permanecem brancas, pois o conteúdo abaixo delas não muda.
   */
  --ink: 255 255 255;

  /* A luminosidade parte do preto. Cada tom neutro ocupa uma posição em um de dois eixos: superfícies
     em --l0/--ls e textos em --lt0/--lts. Separá-los permite mover um sem o outro: o tema claro
     inverte ambos; o OLED leva somente as superfícies ao preto.
   */
  --l0: 0%;
  --ls: 1;
  --lt0: 0%;
  --lts: 1;

  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);

  --bg: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 5.49%));
  --bg-soft: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 9.02%));
  --panel: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 11.76%));
  --line: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 18.04%));
  --text: hsl(var(--tint-h) var(--tint-s-text) calc(var(--lt0) + var(--lts) * 93.33%));
  --muted: hsl(var(--tint-h) var(--tint-s-text) calc(var(--lt0) + var(--lts) * 61.96%));
  /* Cor neutra de primeiro plano: preenchimento cinza-claro com texto escuro, usado nos botões
     principais e em elementos ativos.
   */
  --accent: hsl(var(--tint-h) var(--tint-s-text) calc(var(--lt0) + var(--lts) * 83.92%));
  --accent-ink: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 7.84%));
  --ok: hsl(var(--tint-h) var(--tint-s-text) calc(var(--lt0) + var(--lts) * 83.92%));
  --danger: #ff6b6b;
  /* Legível em fundos escuros: texto de erro e bordas de aviso. */
  --danger-hover: #ff8e8e;
  --toast-bad: hsl(0 48% 24%);
  /* Fundo vermelho-escuro para notificações de problema, sob o texto comum. */
  --toast-bad-edge: hsl(0 55% 40% / 0.6);
  --speaking: #23a55a;
  /* Anel e ponto que indicam que alguém está falando. */
  --wife: #ff3da6;
  /* Selo “Esposa do desenvolvedor”. */
  --live: #7abaff;
  /* Indica compartilhamento de tela ou câmera em andamento. */
  --danger-strong: #c62828;
  /* Botão circular para encerrar a chamada. */
  --danger-strong-hover: #d93636;
  --radius: 14px;
  --shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  /* Janelas e caixas de diálogo. */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  /* Elementos menores em primeiro plano, como imagens e notificações. */
  color-scheme: dark;
}

/* A marca da Lua usa o lilás da Luna em superfícies escuras. No tema claro, vira uma silhueta preta
   para manter o contraste.
 */
:root[data-theme="light"] .logo,
:root[data-theme="light"] .brand-mark {
  filter: grayscale(1) brightness(0);
}

/* As duas alternativas ao tema escuro padrão. Nenhuma altera matiz ou saturação — controlados pelas
   variáveis de cor —, então tema e cor personalizada são escolhidos independentemente.
 */

/* Tema claro. Inverter o eixo transforma de uma vez todos os neutros do aplicativo — os tokens acima e
   os valores de superfície definidos pontualmente nesta folha — sem precisar declarar uma versão clara
   para cada um. --ink também se inverte, fazendo as mesmas regras de hover e divisória escurecerem as
   superfícies em vez de clareá-las.
 */
:root[data-theme="light"] {
  --l0: 100%;
  --ls: -1;
  --lt0: 100%;
  --lts: -1;
  --ink: 0 0 0;
  --danger: #c62828;
  /* O vermelho do tema escuro não tem contraste suficiente no branco. */
  --danger-hover: #b71c1c;
  --toast-bad: hsl(0 72% 91%);
  --toast-bad-edge: hsl(0 60% 70% / 0.7);
  --shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
  color-scheme: light;
}

/* Tema OLED. É o tema padrão com o eixo das superfícies deslocado até o fundo da página chegar ao
   preto puro, permitindo desligar esses pixels em uma tela OLED. As demais superfícies também
   escurecem na mesma proporção; o eixo do texto não muda, preservando o contraste.
 */
:root[data-theme="oled"] {
  --l0: -5.49%;
  --shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

/* Barras de rolagem. O Chromium ignora as regras ::-webkit-scrollbar em elementos que definem
   scrollbar-width/scrollbar-color e desenha setas na barra fina. Por isso, as propriedades padrão
   ficam restritas aos navegadores sem ::-webkit-scrollbar (Firefox); as regras detalhadas abaixo
   estilizam Chromium e Safari, inclusive as setas.
 */
@supports not selector(::-webkit-scrollbar) {
  * {
    scrollbar-width: thin;
    scrollbar-color: rgb(var(--ink) / 0.18) transparent;
  }
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgb(var(--ink) / 0.18);
  border-radius: 999px;
  transition: background 0.15s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: rgb(var(--ink) / 0.32);
}

::-webkit-scrollbar-thumb:active {
  background: rgb(var(--ink) / 0.45);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

/* Os painéis abaixo definem seu próprio display, o que poderia prevalecer sobre a regra do navegador
   para o atributo hidden e manter as sobreposições na tela.
 */
[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  /* O efeito de elástico da rolagem no Android deixa arrastar e soltar a página mesmo sem conteúdo
     para rolar, dando a impressão de que ela está frouxa. Esta regra preserva a rolagem real e remove
     só o quique.
   */
  overscroll-behavior: none;
  /* O realce ao tocar pinta uma caixa azul-clara sob o dedo, quadrada sobre botões arredondados e
     visível por tempo suficiente para parecer uma seleção. Cada controle já indica o toque à sua
     maneira. A propriedade é herdada, então defini-la aqui vale para o aplicativo todo.
   */
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Imagens e vídeos fazem parte do aplicativo: não devem ser selecionáveis, arrastados para fora nem
   salvos com toque prolongado. O Firefox ignora -webkit-user-drag; theme.js cobre esse caso.
 */
img,
video,
canvas {
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}

/* Visível para leitores de tela e oculto para todo o restante. As dimensões usam !important para
   prevalecer sobre o estilo original do elemento. Uma classe isolada perde para quase qualquer regra:
   o seletor genérico input:not(...) abaixo tem quatro seletores e estava deixando o campo de arquivo
   oculto com 345 px. Posicionado de forma absoluta, ele ultrapassava a borda do celular e criava uma
   barra horizontal, reduzindo a área útil e causando também rolagem vertical.
 */
.sr-only {
  position: absolute;
  width: 1px !important;
  height: 1px !important;
  min-width: 0 !important;
  margin: -1px;
  padding: 0 !important;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------------- elementos compartilhados */

.btn {
  appearance: none;
  border: 0;
  outline: none;
  background: var(--bg-soft);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  /* O texto do DOM mantém a capitalização normal para leitores de tela; só a apresentação visual fica
     em
     minúsculas.
   */
  text-transform: lowercase;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}

.btn:hover:not(:disabled) {
  background: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 14.12%));
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  border: 0;
  color: var(--accent-ink);
}

.btn-primary:hover:not(:disabled) {
  background: var(--text);
}

/* A única ação destrutiva do menu: encerrar um compartilhamento em andamento. */
.btn-danger {
  background: var(--danger-strong);
  border: 0;
  color: #ffffff;
}

.btn-danger:hover:not(:disabled) {
  background: #d93636;
}


.btn-discord {
  background: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 13.33%));
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-transform: none;
  font-weight: 500;
  border: 0;
  transition: background 0.15s, transform 0.05s;
}

.btn-discord:hover:not(:disabled) {
  background: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 17.65%));
  color: var(--text);
}

.btn-discord .discord-icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex-shrink: 0;
}

.btn-block {
  width: 100%;
}

.btn-small {
  padding: 8px 12px;
}

/* Somente campos de texto. Caixas de seleção, botões de opção e controles deslizantes de faixa ficam
   de fora, pois o bloco abaixo dá forma e tamanho a uma caixa de texto. Além disso, :not() herda a
   especificidade do argumento; sem a exclusão, este seletor prevaleceria sobre as classes desses
   controles.
 */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
select {
  appearance: none;
  background: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 7.84%));
  border: 0;
  outline: none;
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  width: 100%;
}

input:focus,
select:focus {
  outline: none;
  border: 0;
}

.btn:focus,
.btn:focus-visible {
  outline: none;
}

.chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.field {
  display: grid;
  gap: 6px;
}

.field>span {
  font-size: 13px;
  color: var(--muted);
}

.error {
  margin: 0;
  color: var(--danger);
  font-size: 14px;
}

.muted {
  color: var(--muted);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 4px;
}

.brand h1 {
  font-size: 20px;
  margin: 0;
  letter-spacing: -0.01em;
}

.brand-mark {
  width: 26px;
  height: 26px;
  display: block;
  object-fit: contain;
}

.brand-mark.small {
  width: 26px;
  height: 26px;
  margin-left: 6px;
}

/* ------------------------------------------------------------------- página inicial */

body.lobby {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
  min-height: 100dvh;
  /* Quanto da borda direita a barra de amigos ocupa: sua largura inteira quando aberta, a largura do
     botão que a abre quando recolhida e nada para visitantes, que não têm lista para exibir.
   */
  /* Quanto da parte inferior é ocupado pela barra do celular — nada nas demais telas. */
  --tabbar-h: 78px;
  /* O aplicativo se estende sob a barra de status e a barra de gestos, então o preenchimento precisa
     respeitar ambas. No navegador, os recuos são zero e o valor fica em 24 px.
   */
  padding: calc(24px + var(--sat)) 24px calc(24px + var(--sab)) 24px;
  /* Helvetica World é uma fonte licenciada; se não estiver instalada, a pilha usa as famílias
     grotescas
     mais próximas.
   */
  font-family: "Helvetica World", "Helvetica Neue", Helvetica, Arial, sans-serif;
  position: relative;
  /* Use clip, não hidden: ocultar um eixo transforma o outro em auto, tornando a página inicial um
     contêiner rolável que podia ser arrastado sem haver conteúdo para rolar. clip mantém o eixo
     vertical visível, permitindo que uma tela baixa transborde para a página, como deve ocorrer.
   */
  overflow-x: clip;
}

@keyframes glowFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Esfera luminosa de fundo, minimalista. Seu tamanho usa a dimensão mais disponível: a largura no
   computador, como antes, e a altura no celular. Assim, o brilho continua até a borda inferior em vez
   de terminar no meio da tela.
 */
.bg-glow-sphere {
  position: fixed;
  top: calc(-1 * min(1280px, 120vw) + 52vh);
  left: 50%;
  transform: translateX(-50%);
  width: min(1280px, 120vw);
  height: min(1280px, 120vw);
  border-radius: 50%;
  pointer-events: none;
  user-select: none;
  z-index: 0;
  background: radial-gradient(circle at 50% 32%,
      rgba(255, 255, 255, 0.12) 0%,
      rgba(255, 255, 255, 0.06) 36%,
      rgba(255, 255, 255, 0.018) 65%,
      transparent 88%);
  box-shadow: 0 0 100px 25px rgba(255, 255, 255, 0.025);
}

.bg-glow-sphere.glow-entering {
  animation: glowFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

body.lobby .code-input::placeholder {
  letter-spacing: 0.12em;
  text-align: center;
}

/* Destaque: logotipo e nome lado a lado, centralizados, com o título logo abaixo. */
body.lobby .brand {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
}

body.lobby .brand h1 {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.01em;
  /* A caixa da linha tem exatamente a altura do texto; centralizar o título em relação à marca também
     centraliza a palavra. Antes, o texto era deslocado seis pixels para cima, um ajuste visual baseado
     em uma fonte e incorreto quando o celular usava sua própria fonte.
   */
  line-height: 1;
  margin: 0;
  display: inline-flex;
  align-items: center;
}

/* ------------------------------------------------------------- página inicial A página se organiza em
   faixas: barra, sala e base. O destaque fica no centro, e o perfil, ao lado, acessível sem se colocar
   entre a pessoa e as duas ações que a trouxeram até aqui.
 */

.lobby-bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 2px 4px 0;
}

.lobby-bar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  font-weight: 600;
  line-height: 1;
}

.lobby-bar-brand span {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  transform: translateY(-3px);
}

.lobby-bar-brand .brand-mark {
  width: 26px;
  height: 26px;
  display: block;
  object-fit: contain;
}

.lobby-bar-side {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Tema claro ou escuro como um par, não como um ciclo: são dois botões e o tema atual fica aceso. Os
   demais temas estão nas configurações.
 */

.icon-btn {
  appearance: none;
  border: 0;
  background: none;
  color: var(--muted);
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn svg {
  width: 19px;
  height: 19px;
}

.icon-btn:hover {
  color: var(--text);
}

.icon-btn.is-on {
  background: var(--bg-soft);
  color: var(--text);
}

.bar-profile {
  appearance: none;
  border: 0;
  padding: 0;
  background: none;
  border-radius: 50%;
  cursor: pointer;
  line-height: 0;
  transition: box-shadow 0.15s ease;
}

.bar-profile .avatar {
  width: 40px;
  height: 40px;
  font-size: 15px;
}

.bar-profile:hover {
  box-shadow: 0 0 0 3px rgb(var(--ink) / 0.14);
}

/* O destaque ocupa o centro do espaço que sobra abaixo da barra. */
.lobby-main {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  padding: 24px 0;
}

.lobby-stage {
  display: flex;
  align-items: stretch;
  justify-content: center;
  position: relative;
  max-width: 100%;
  background: var(--panel);
  border-radius: 18px;
  box-shadow: none;
  border: 0;
  overflow: hidden;
}

.lobby-hero {
  position: relative;
  z-index: 1;
  width: min(480px, calc(100vw - 48px));
  text-align: center;
  background: var(--panel);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 38px 32px 30px !important;
  box-sizing: border-box;
}


body.lobby .tagline {
  text-align: center;
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.55;
}

.btn-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 54px;
  border-radius: 14px;
  font-size: 15.5px;
  font-weight: 600;
  text-transform: none;
}

.btn-hero svg {
  width: 18px;
  height: 18px;
}

/* Código e entrada em uma única cápsula: o botão faz parte do campo, em vez de ficar ao lado dele. */
.join-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 14px;
  background: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 7.84%));
  border: 1px solid rgb(var(--ink) / 0.05);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.join-row:focus-within {
  border-color: rgb(var(--ink) / 0.18);
  box-shadow: 0 0 0 2px rgb(var(--ink) / 0.08);
}

.join-row .code-input {
  flex: 1;
  min-width: 0;
  height: 42px;
  border: 0;
  background: none;
  text-align: center;
  letter-spacing: 0.14em;
  font-weight: 600;
}

.join-row .code-input::placeholder {
  text-align: center;
  letter-spacing: 0.12em;
}

.join-row .code-input:focus {
  outline: none;
}

.join-go {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  border-radius: 10px;
  text-transform: none;
  font-size: 14px;
}

.join-go svg {
  width: 16px;
  height: 16px;
}

body.lobby .error {
  margin-top: 14px;
  text-align: center;
}

/* Barra lateral de amigos, encaixada imediatamente à direita do cartão central. */
.friends-rail {
  position: relative;
  z-index: 2;
  width: 270px;
  background: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 9.5%));
  border-left: 1px solid rgb(var(--ink) / 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
  transition: width 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Antes de qualquer dado estar disponível, o script do head já sabe se há uma lista de amigos. Assim,
   visitantes não veem a barra aparecer e desaparecer. Consulte index.html.
 */
:root:not(.has-friends) .friends-rail {
  display: none;
}

.friends-rail:has(#friends[hidden]),
.friends-rail[hidden] {
  display: none !important;
}

.friends-rail .friends {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 20px 14px 16px;
  border: 0;
  background: transparent;
  box-sizing: border-box;
  height: 100%;
  transition: padding 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.friends-rail .friends-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 10px;
  padding: 0 2px;
}

.friends-rail .friends-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
  color: var(--muted);
  white-space: nowrap;
}

.friends-rail .friend-avatar.is-online::after,
.friends-rail .friend-avatar.is-in-room::after {
  border-color: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 9.5%));
}

/* Quantidade de amigos disponíveis, na mesma linha do título. Sem ninguém na lista, fica vazia, não
   ocupa espaço nem desenha separador.
 */
.friends-count {
  font-weight: 500;
  color: rgb(var(--ink) / 0.45);
}

.friends-count:not(:empty)::before {
  content: "·";
  margin: 0 6px;
}

/* A barra permanece no lugar, qualquer que seja o tamanho da lista. */
.friends-rail .friends-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0;
  margin: 0;
  list-style: none;
}

.friends-toggle {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  flex: none;
}

.friends-toggle svg {
  width: 17px;
  height: 17px;
}

/* Recolhida, a barra vira uma coluna de fotos com 64 px de largura. Só se aplica aqui: mais estreita
   que isso, a lista vira uma aba própria e não há barra para recolher.
 */
@media (min-width: 981px) {
  :root[data-friends="closed"] .friends-rail {
    width: 64px;
  }

  :root[data-friends="closed"] .friends-rail .friends {
    padding: 16px 0;
    align-items: center;
  }

  :root[data-friends="closed"] .friends-rail .friends-head {
    justify-content: center;
    margin: 0 0 10px;
    padding: 0;
    width: 100%;
  }

  :root[data-friends="closed"] .friends-rail .friends-title {
    display: none;
  }

  :root[data-friends="closed"] .friends-rail .friends-toggle {
    margin: 0 auto;
  }

  :root[data-friends="closed"] .friends-rail .friends-list {
    width: 100%;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }

  /* Recolhida, cada linha contém apenas a foto e assume o formato dela: um círculo largo o bastante
     para
     contornar o avatar, não uma faixa atravessando a barra.
   */
  :root[data-friends="closed"] .friends-rail .friend {
    width: 44px;
    padding: 2px;
    justify-content: center;
    border-radius: 50%;
    gap: 0;
    background: transparent;
    cursor: pointer;
  }

  :root[data-friends="closed"] .friends-rail .friend:hover {
    background: rgb(var(--ink) / 0.08);
  }

  :root[data-friends="closed"] .friends-rail .friend> :not(.friend-avatar) {
    display: none;
  }

  :root[data-friends="closed"] .friends-rail .friend-avatar {
    width: 40px;
    height: 40px;
    margin: 0 auto;
    flex: none;
    border-radius: 50%;
  }

  :root[data-friends="closed"] .friends-rail .friend-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
  }

  /* Em fotos maiores, o ponto fica na borda, não para fora dela. */
  :root[data-friends="closed"] .friends-rail .friend-avatar.is-online::after,
  :root[data-friends="closed"] .friends-rail .friend-avatar.is-in-room::after {
    right: 0;
    bottom: 0;
  }

  :root[data-friends="closed"] .friends-rail .friends-empty {
    display: none;
  }
}

/* No celular, abas inferiores alternam entre Início e Amigos. */
@media (max-width: 980px) {
  body.lobby {
    padding-bottom: calc(18px + var(--sab) + var(--tabbar-h));
  }

  body.lobby .mobile-tabs {
    display: flex;
  }

  .bg-glow-sphere,
  .empty .bg-glow-sphere {
    --glow-size: min(960px, 110vh);
    top: calc(-1 * var(--glow-size) + 46vh);
    width: var(--glow-size);
    height: var(--glow-size);
    border-radius: 50%;
    background: radial-gradient(circle at 50% 50%,
        rgba(255, 255, 255, 0.12) 0%,
        rgba(255, 255, 255, 0.06) 36%,
        rgba(255, 255, 255, 0.018) 65%,
        transparent 88%);
    box-shadow: 0 0 80px 20px rgba(255, 255, 255, 0.025);
  }

  .lobby-stage {
    flex-direction: column;
    width: 100%;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
  }

  .lobby-hero {
    width: min(480px, calc(100vw - 32px));
    margin: 0 auto;
    border-radius: 18px;
    box-shadow: none;
    border: 0;
  }

  body.lobby[data-tab="friends"] .lobby-main {
    place-items: start center;
    padding-top: 16px;
  }

  /* Em vez de uma barra lateral, a lista ocupa sua própria aba: largura e fundo da página, sem uma
     barra
     para recolher.
   */
  .friends-rail {
    position: static;
    width: min(480px, calc(100vw - 32px));
    margin: 0 auto;
    background: transparent;
    border: 0;
    overflow: visible;
    display: none;
  }

  .friends-rail .friends {
    width: 100%;
    padding: 0;
  }

  .friends-rail .friends-head {
    padding: 0;
  }

  /* As linhas mantêm o tamanho da barra — a aba tem mais espaço para as fotos, não menos. Só muda o
     anel
     que separa o indicador de status do fundo: aqui, ele acompanha a página, não a superfície da
     barra.
   */
  .friends-rail .friend-avatar.is-online::after,
  .friends-rail .friend-avatar.is-in-room::after {
    border-color: var(--bg);
  }

  /* Uma aba vazia não é uma página com uma linha de lista; é uma página sem conteúdo. */
  .friends-rail .friends-empty {
    text-align: center;
    padding: 32px 16px;
  }

  .friends-toggle {
    display: none;
  }

  /* A aba inferior já diz “Amigos”; a linha acima da lista informa o que a aba não consegue dizer. */
  .friends-word {
    display: none;
  }

  .friends-count:not(:empty)::before {
    content: none;
  }

  body.lobby[data-tab="friends"] .lobby-hero {
    display: none;
  }

  body.lobby[data-tab="friends"] .friends-rail {
    display: flex;
  }
}

/* As duas telas ficam no controle flutuante junto à borda inferior da sala: uma cápsula desfocada e
   afastada da borda, em vez de uma faixa separada por linha, para deixar claro que a página inicial e
   a sala são o mesmo aplicativo. Consulte .dock; as dimensões acompanham esse componente.
 */
.mobile-tabs {
  position: fixed;
  left: 50%;
  bottom: calc(18px + var(--sab));
  transform: translateX(-50%);
  z-index: 4;
  display: none;
  align-items: center;
  gap: 4px;
  padding: 5px;
  border-radius: 14px;
  background: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 11.76%) / 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* As mesmas duas verificações da barra: o que o script do head já sabia e o que a página descobre após
   a resposta de js/friends.js.
 */
:root:not(.has-friends) .mobile-tabs,
body.lobby:has(#friends[hidden]) .mobile-tabs {
  display: none;
}

/* Nome ao lado da foto, não abaixo: duas palavras em uma linha são lidas de relance e mantêm a cápsula
   baixa.
 */
.mobile-tab {
  appearance: none;
  border: 0;
  background: none;
  font: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  /* A mesma caixa para qualquer rótulo, para que o botão ativo não tenha tamanho diferente do vizinho. */
  min-width: 106px;
  padding: 0 16px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.mobile-tab svg {
  width: 18px;
  height: 18px;
  flex: none;
  /* Ícones um pouco mais espessos que os da página: nesse tamanho, o traço fino desaparecia sobre a
     cápsula.
   */
  stroke-width: 2.1;
}

.mobile-tab.is-on {
  color: var(--text);
  background: rgb(var(--ink) / 0.1);
}

/* No celular, a barra mantém a marca, o tema e sua foto. */
@media (max-width: 620px) {
  body.lobby {
    padding-left: 16px;
    padding-right: 16px;
  }



  body.lobby .brand h1 {
    font-size: 32px;
  }

  .logo {
    width: 40px;
    height: 40px;
  }

  .lobby-headline {
    font-size: 25px;
  }

}

/* O perfil aparece como uma janela sobre a página, não como um painel dentro dela. */
.editor-card {
  position: relative;
  display: grid;
  gap: 16px;
  width: min(420px, 100%);
  padding: 22px;
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.logo {
  width: 48px;
  height: 48px;
  display: block;
  object-fit: contain;
}

.card:not(.lobby-hero) {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  background: var(--panel);
  border: 0;
  border-radius: var(--radius);
  box-shadow: none;
  padding: 28px;
}

.tagline {
  color: var(--muted);
  margin: 0 0 20px;
}

.stack {
  display: grid;
  gap: 14px;
}

.row {
  display: flex;
  gap: 10px;
}

.code-input {
  /* O valor é convertido para minúsculas em JS porque é o código da sala; esta regra muda apenas a
     aparência.
   */
  text-transform: lowercase;
  letter-spacing: 0.22em;
  font-weight: 700;
  text-align: center;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 16px;
  color: var(--muted);
  font-size: 13px;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.foot {
  position: relative;
  z-index: 1;
  max-width: 480px;
  text-align: center;
  font-size: 13px;
  padding: 0;
  margin-top: -10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.foot p {
  margin: 0;
}



/* -------------------------------------------------------------------- sala */

body.room {
  display: grid;
  --sidebar-w: 320px;
  grid-template-columns: 1fr var(--sidebar-w);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    "top    top"
    "stage  side";
  height: 100dvh;
  padding: 0;
}

/* Ao fechar os dois painéis, o espaço deve voltar ao palco, não ficar como coluna vazia. Abaixo do
   ponto de quebra não há coluna a devolver — os painéis são uma folha — e esta regra prevaleceria
   sobre o layout de uma coluna.
 */
@media (min-width: 861px) {
  body.room.sidebar-hidden {
    grid-template-columns: 1fr 0;
  }
}

body.resizing {
  user-select: none;
  cursor: var(--resize-cursor, col-resize);
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
  overflow: hidden;
  transition: opacity 0.2s ease;
  font-family: "Helvetica World", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.gate #gate-form {
  width: min(480px, calc(100vw - 48px));
  border-radius: 18px;
  padding: 38px 32px 30px;
  box-sizing: border-box;
}

.gate.gate-fade-out {
  opacity: 0;
  pointer-events: none;
}

/**
 * Tela de reconexão. Fica sobre a sala para impedir cliques no conteúdo quando não há conexão para
 * atendê-los e abaixo de .gate-leaving, para que uma saída intencional nunca seja encoberta por uma
 * tela que anuncia o retorno à sala. A marca pulsa em vez de girar. Um indicador giratório sugere
 * trabalho em andamento a uma velocidade constante; aqui, a espera tem duração incerta — em geral, um
 * ou dois segundos, às vezes um minuto. O pulso lento diz “continuo aqui” sem sugerir um progresso que
 * ninguém está medindo.
 */
.gate-reconnecting {
  z-index: 45;
  animation: gateFadeIn 0.18s ease;
}

.reconnect-card {
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
}

.reconnect-mark {
  width: 68px;
  height: 68px;
  animation: reconnectPulse 1.8s ease-in-out infinite;
}

@keyframes reconnectPulse {

  0%,
  100% {
    opacity: 0.45;
    transform: scale(0.94);
  }

  50% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Quem prefere menos movimento ainda precisa saber que o processo continua. Por isso, removemos o
   movimento e mantemos o efeito de transparência.
 */
@media (prefers-reduced-motion: reduce) {
  .reconnect-mark {
    animation: reconnectFade 2s ease-in-out infinite;
  }

  @keyframes reconnectFade {

    0%,
    100% {
      opacity: 0.5;
    }

    50% {
      opacity: 1;
    }
  }
}

.reconnect-text {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.reconnect-sub {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

/* A sobreposição de saída fica acima de tudo, inclusive do cartão de sala encerrada. */
.gate-leaving {
  z-index: 50;
  /* Sem fill mode de propósito: se as animações forem limitadas (aba em segundo plano) ou desativadas,
     a
     sobreposição mantém sua opacidade normal em vez de ficar presa em 0.
   */
  animation: gateFadeIn 0.18s ease;
}

@keyframes gateFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

#gate-submit {
  margin-top: 8px;
}

/* -------------------------------------------------- interface de confirmação de entrada -- */

.gate-bar {
  position: absolute;
  top: calc(24px + var(--sat));
  left: 24px;
  right: 24px;
  z-index: 2;
  pointer-events: auto;
}

@media (max-width: 640px) {
  .gate-bar {
    top: calc(16px + var(--sat));
    left: 16px;
    right: 16px;
  }
}

.gate-brand {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 0 14px;
}

.gate-brand .logo {
  width: 48px;
  height: 48px;
  display: block;
  object-fit: contain;
}

.gate-heading {
  font-size: 22px;
  font-weight: 600;
  margin: 0;
  text-align: center;
  letter-spacing: -0.01em;
}

.gate-code-chip {
  justify-self: center;
  margin: 4px 0 2px;
  height: 40px;
  padding: 8px 16px;
  font-size: 15px;
  border-radius: 12px;
  gap: 8px;
}

.gate-code-chip .chip-icon {
  width: 17px;
  height: 17px;
}

.gate-code-chip strong {
  font-size: 15px;
  letter-spacing: 0.16em;
}

.gate-desc {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.55;
  text-align: center;
  margin: 0;
}

/* Cartão do anfitrião e das pessoas na sala. */
.gate-room-card {
  background: var(--bg-soft);
  border: 1px solid rgb(var(--ink) / 0.08);
  border-radius: 12px;
  overflow: hidden;
  margin: 2px 0;
}

.gate-host-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  gap: 12px;
}

.gate-host-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.gate-host-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 15px;
  font-weight: 600;
}

.gate-host-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.gate-host-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.gate-host-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gate-host-crown {
  display: inline-flex;
  align-items: center;
  color: #f59e0b;
  /* Dourado do Discord/Luna. */
  flex-shrink: 0;
}


.gate-host-media {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.gate-media-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  width: 22px;
  height: 22px;
  transition: color 0.15s ease, opacity 0.15s ease;
}

.gate-media-icon.is-active {
  color: var(--text);
  opacity: 1;
}

.gate-media-icon.is-dimmed {
  color: var(--muted);
  opacity: 0.35;
}

.gate-media-icon.is-muted,
.gate-media-icon.is-deafened {
  color: #ed4245;
  /* Vermelho do Discord. */
  opacity: 1;
}

.gate-members-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-top: 1px solid rgb(var(--ink) / 0.08);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: default;
  transition: background var(--trans-fast);
}

.gate-members-row.has-members {
  cursor: pointer;
  user-select: none;
}

.gate-members-row.has-members:hover {
  background: rgb(var(--ink) / 0.04);
}

.gate-members-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.gate-members-icon {
  color: var(--muted);
  flex-shrink: 0;
}

.gate-members-text {
  color: var(--text);
  text-transform: lowercase;
}

.gate-members-chevron {
  color: var(--muted);
  flex-shrink: 0;
  transition: transform 0.18s ease;
}

.gate-members-chevron.is-expanded {
  transform: rotate(90deg);
}

.gate-members-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid rgb(var(--ink) / 0.06);
  background: rgb(var(--ink) / 0.02);
  padding: 4px 0;
  max-height: 180px;
  overflow-y: auto;
}

.gate-member-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
}

.gate-member-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
}

.gate-member-name {
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


.topbar {
  grid-area: top;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: calc(10px + var(--sat)) 12px 10px;
  background: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 5.49%) / 0.85);
  backdrop-filter: blur(8px);
  min-height: calc(54px + var(--sat));
  box-sizing: border-box;
}

.topbar-side {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.topbar-left {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.topbar-left .chip-icon-btn {
  flex: none;
}

.topbar-right {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  /* Tem exatamente a mesma largura e posição do painel de pessoas/bate-papo abaixo. */
  width: calc(var(--sidebar-w) - var(--sidebar-pad, 12px));
  flex-shrink: 0;
  box-sizing: border-box;
}

body.sidebar-hidden .topbar-right {
  width: auto;
  justify-content: flex-end;
}

.chip {
  appearance: none;
  border: 1px solid transparent;
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 10px;
  padding: 6px 12px;
  height: 34px;
  box-sizing: border-box;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  transition: background 0.15s, color 0.15s;
}

.chip:hover {
  background: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 14.12%));
}

.chip strong {
  letter-spacing: 0.14em;
  text-transform: lowercase;
  overflow: hidden;
  text-overflow: ellipsis;
}

/**
 * Painel de amigos na página inicial. Fica abaixo do formulário de entrada porque é outra forma de
 * entrar em uma sala, não a primeira: depois do código recebido e da sala que a pessoa está criando,
 * vêm as pessoas que talvez já estejam em uma.
 */
.friends {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.friends-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.friends-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.friends-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.friend {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  overflow: hidden;
}

/* Banner da amizade sob uma camada de gradiente, como na lista de participantes da sala. */
.friend-plate {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-size: 100% 100%, cover;
  background-position: 0 0, center;
  background-repeat: no-repeat, no-repeat;
  transition: filter 0.2s ease;
}

.friend> :not(.friend-plate) {
  position: relative;
  z-index: 1;
}

.friend.has-banner:hover {
  background: transparent;
}

.friend.has-banner:hover .friend-plate {
  filter: brightness(1.1);
}

.friend.has-banner .friend-name {
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

.friend.has-banner .friend-sub {
  color: rgba(255, 255, 255, 0.78);
}

.friend.has-banner .friend-dismiss {
  color: rgba(255, 255, 255, 0.8);
}

.friend.has-banner .friend-dismiss:hover {
  background: rgba(0, 0, 0, 0.35);
  color: #ffffff;
}

.friend:hover {
  background: rgb(var(--ink) / 0.05);
}

/* O convite é a única linha que leva a algum lugar; por isso, parece uma ação, não apenas um item de
   lista.
 */
.friend-invited {
  background: rgb(var(--ink) / 0.06);
}


.friend-avatar {
  position: relative;
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

/* A foto é recortada, não a moldura: o indicador de status fica na borda e seria cortado ao meio se a
   própria moldura tivesse overflow.
 */
.friend-avatar img {
  border-radius: 50%;
}

/* Indicador de status no canto da foto. Um anel na cor do cartão o destaca do conteúdo atrás dele,
   mantendo a leitura sobre uma imagem.
 */
.friend-avatar.is-online::after,
.friend-avatar.is-in-room::after {
  content: "";
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--panel);
  background: var(--speaking);
}

/* Estar em uma chamada é diferente de apenas estar disponível e merece distinção imediata: interromper
   essa pessoa é uma decisão.
 */
.friend-avatar.is-in-room::after {
  background: var(--accent);
}

.friend-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.friend-name {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  font-size: 14px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-sub {
  font-size: 12px;
  color: var(--muted);
}

.friend-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Cápsula pequena e sólida, dimensionada para a linha, não para um formulário. */
.friend-join {
  appearance: none;
  flex: none;
  height: 24px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  /* Texto em minúsculas, como os demais rótulos de botão desta página. */
  text-transform: lowercase;
  cursor: pointer;
  transition: opacity 0.12s ease;
}

.friend-join:hover {
  opacity: 0.88;
}

.friend-join:focus-visible {
  outline: 2px solid rgb(var(--ink) / 0.5);
  outline-offset: 2px;
}

.friend.has-banner .friend-join {
  background: #ffffff;
  color: #121212;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.friend-dismiss {
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.friend-dismiss:hover {
  background: rgb(var(--ink) / 0.1);
  color: var(--text);
}

.friends-empty {
  padding: 6px 8px;
  font-size: 12px;
  color: var(--muted);
}

.chip-accent {
  color: var(--accent-ink);
  background: var(--accent);
  font-weight: 600;
}

.chip[aria-pressed="true"] {
  background: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 18.04%));
}

/* As configurações ficam tão destacadas quanto os botões de painel. */
#toggle-settings {
  background: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 18.04%));
}

#toggle-settings:hover,
#toggle-settings[aria-pressed="true"] {
  background: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 21.96%));
}

.chip-icon {
  width: 15px;
  height: 15px;
  display: block;
  flex-shrink: 0;
}

.chip-icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 10px;
}

.chip-icon-btn svg {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
}

/* ------------------------------------------------------------------- palco */

.stage {
  grid-area: stage;
  position: relative;
  overflow: auto;
  /* Arrastar sobre os compartilhamentos move a página ao redor deles, sem selecioná-los. */
  -webkit-user-select: none;
  user-select: none;
  /* Espaço para o dock flutuante. */
  padding: 16px 16px 120px;
  container-type: size;
}

/* Os quadros permanecem modestos para que a sala pareça uma chamada, não uma parede de vídeos. O modo
   de foco permite ler o conteúdo compartilhado.
 */
/* Os quadros dividem o palco em vez de terem tamanho fixo: um ocupa tudo; dois ficam empilhados; três
   formam um par com outro centralizado abaixo; quatro formam uma grade 2×2, e assim por diante.
   room.js informa a quantidade em data-count. Cada quadro fica em um .slot, que recebe sua parte do
   palco. O quadro é sempre a maior área 16:9 que cabe no espaço. Manter o slot em tamanho total
   permite a quebra correta das linhas; um palco baixo e largo poderia colocar três quadros estreitos
   na mesma linha.
 */
.grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  height: 100%;
  max-width: calc(var(--cols) * ((100cqh - (var(--rows) - 1) * 12px) / var(--rows) * 16 / 9) + (var(--cols) - 1) * 12px);
  width: 100%;
  margin-inline: auto;
  justify-content: center;
  align-content: center;
  /* Contenção de tamanho para que o slot meça o palco em unidades cq. */
  container-type: size;
  --cols: 1;
  --rows: 1;
}

.grid[data-count="2"] {
  --cols: 2;
  --rows: 1;
}

@container (aspect-ratio < 1.2) {
  .grid[data-count="2"] {
    --cols: 1;
    --rows: 2;
  }
}

.grid[data-count="3"],
.grid[data-count="4"] {
  --cols: 2;
  --rows: 2;
}

.grid[data-count="5"],
.grid[data-count="6"] {
  --cols: 3;
  --rows: 2;
}

.grid[data-count="7"],
.grid[data-count="8"],
.grid[data-count="9"] {
  --cols: 3;
  --rows: 3;
}

.grid[data-count="10"],
.grid[data-count="11"],
.grid[data-count="12"] {
  --cols: 4;
  --rows: 3;
}

.grid[data-count="13"],
.grid[data-count="14"],
.grid[data-count="15"],
.grid[data-count="16"] {
  --cols: 4;
  --rows: 4;
}

.grid.has-focus {
  max-width: none;
  width: 100%;
  height: 100%;
}

.grid.has-focus .slot {
  display: none;
}

.grid.has-focus .slot.focused {
  display: grid;
  width: 100%;
  height: 100%;
}

.grid.has-focus .slot.focused .tile {
  width: min(100%, calc(100cqh * 16 / 9));
}

/* Cada slot ocupa toda a sua parte da largura do palco para manter a quebra correta das linhas, mas
   usa somente a altura necessária ao quadro.
 */
.slot {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: calc((100% - (var(--cols) - 1) * 12px) / var(--cols));
  height: auto;
}

.tile {
  position: relative;
  /* Maior área 16:9 que cabe no slot. */
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 0;
  cursor: pointer;
  background: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 3.14%));
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color 0.15s;
}

.grid[data-count="1"] .tile {
  cursor: default;
}

.tile:hover {
  border-color: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 23.92%));
}

.tile.self {
  border-color: rgba(255, 255, 255, 0.28);
}

.tile.self.is-camera video {
  transform: scaleX(-1);
}

.tile video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 3.14%));
  display: block;
}

.tile figcaption {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-size: 13px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 5;
}

.tile:hover figcaption,
.tile:focus-within figcaption,
.tile.self.screen-tile figcaption,
.tile figcaption.has-open-popover {
  opacity: 1;
}

.tile-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.tile-name-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Indicador de espectadores, à direita do nome da transmissão, somente no quadro de quem transmite. */
.tile-viewers-badge {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 7px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.15);
  border: 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  pointer-events: auto;
  transition: background 0.15s ease, color 0.15s ease, transform 0.05s ease;
  user-select: none;
  flex: 0 0 auto;
  line-height: 1;
  outline: none;
  font-family: inherit;
  margin-left: 4px;
  vertical-align: middle;
}

.tile-viewers-badge:hover,
.tile-viewers-badge.is-active {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.tile-viewers-badge.has-viewers {
  background: #23a55a;
  color: #ffffff;
}

.tile-viewers-badge.has-viewers:hover,
.tile-viewers-badge.has-viewers.is-active {
  background: #1f9450;
  color: #ffffff;
}

.tile-viewers-badge svg {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  stroke: currentColor;
}

.tile-viewers-count {
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

/* Lista flutuante de espectadores da transmissão. */
.tile-viewers-popover {
  position: absolute;
  bottom: 50px;
  left: 10px;
  width: 220px;
  max-width: calc(100% - 20px);
  background: hsl(var(--tint-h) var(--tint-s) 9%);
  border: none;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 10px 10px 8px;
  z-index: 10;
  pointer-events: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
  cursor: default;
}

.tile-viewers-popover.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.tile-viewers-header {
  display: flex;
  align-items: center;
  padding-bottom: 4px;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: rgba(255, 255, 255, 0.7);
}

.tile-viewers-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 160px;
  overflow-y: auto;
}

.tile-viewers-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 12px;
  color: #fff;
  transition: background 0.1s ease;
}

.tile-viewers-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.tile-viewers-avatar {
  width: 22px;
  height: 22px;
  font-size: 10px;
  flex: 0 0 auto;
}

.tile-viewers-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.tile-viewers-empty {
  padding: 8px 4px 4px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
  font-style: italic;
}

.tile-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tile-btn {
  appearance: none;
  border: 0;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  border-radius: 9px;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

.tile-btn svg {
  width: 16px;
  height: 16px;
}

.tile-btn:hover {
  background: rgba(0, 0, 0, 0.7);
}

/* No celular, dois controles próprios: o X encerra seu compartilhamento e as setas colocam um quadro
   em foco. No computador, há o menu de contexto; veja o bloco compacto.
 */
.tile-stop-share-btn,
.tile-focus-btn {
  display: none;
}

/* Controle de volume da transmissão com controle deslizante expansível. */
.tile-volume-control {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 9px;
  backdrop-filter: blur(4px);
  height: 30px;
  padding: 0;
  transition: background 0.15s;
}

.tile-volume-control:hover {
  background: rgba(0, 0, 0, 0.75);
}

/* O foco fica no controle deslizante, não no botão de silenciar: um clique deixa o foco no botão,
   mantendo o controle aberto mesmo depois que o ponteiro sai. A regra separada de :hover permite que
   navegadores sem :has() percam apenas este estado.
 */
.tile-volume-control:has(.tile-volume-slider:focus) {
  background: rgba(0, 0, 0, 0.75);
}

.tile-volume-btn {
  background: transparent !important;
  backdrop-filter: none !important;
}

.tile-volume-slider-wrap {
  display: flex;
  align-items: center;
  /* Altura total da cápsula: o contêiner recorta horizontalmente ao recolher, então precisa ser alto o
     bastante para não cortar o cursor, que ultrapassa a trilha de 5 px.
   */
  align-self: stretch;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-width 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.15s ease;
  pointer-events: none;
}

.tile-volume-control:hover .tile-volume-slider-wrap,
.tile-volume-slider-wrap:focus-within {
  max-width: 90px;
  opacity: 1;
  pointer-events: auto;
}

/* ------------------------------------------------ quadrados de usuário no estilo Discord */

.tile.user-tile,
.tile.user-tile.self {
  background-color: var(--tile-user-color, hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 11%)));
  background-image: none;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: box-shadow 0.15s ease, background-color 0.2s ease;
}

.tile.user-tile.is-speaking,
.tile.is-speaking {
  box-shadow: 0 0 0 2px var(--speaking) !important;
}

.tile-avatar-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  container-type: size;
}

.tile .tile-avatar,
.tile-avatar.avatar,
.tile .tile-avatar.is-speaking,
.tile-avatar.avatar.is-speaking {
  width: clamp(72px, 35cqh, 150px);
  height: clamp(72px, 35cqh, 150px);
  font-size: clamp(28px, 14cqh, 56px);
  border-radius: 50%;
  box-shadow: none !important;
  pointer-events: auto;
  cursor: pointer;
  transition: transform 0.15s ease-out;
}

.tile .tile-avatar:hover,
.tile-avatar.avatar:hover {
  transform: scale(1.04);
}

.tile.user-tile video {
  display: none;
  object-fit: contain;
  background: #000;
}

.tile.user-tile.has-camera video {
  display: block;
}

.tile.user-tile.has-camera .tile-avatar-wrap {
  display: none;
}

.tile.user-tile.self.has-camera video {
  transform: scaleX(-1);
}

/* Cápsula do selo do usuário (inferior esquerdo). */
.tile-user-badge {
  position: absolute;
  bottom: 10px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 20px);
  padding: 4px 9px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  z-index: 5;
  pointer-events: auto;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.tile-user-badge:hover {
  background: rgba(0, 0, 0, 0.85);
}

.tile-user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-user-prefix-icons,
.tile-user-icons {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.tile-user-prefix-icons:empty,
.tile-user-icons:empty {
  display: none;
}

.tile-user-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tile-user-icon svg {
  width: 14px;
  height: 14px;
  display: block;
}

.tile-user-icon.is-muted,
.tile-user-icon.is-deafened {
  color: #ed4245;
  /* Vermelho do Discord. */
}

.tile-user-icon.is-host {
  color: #f59e0b;
  /* Dourado do Discord. */
}

/* Detalhes específicos do quadro de tela. */
.tile.screen-tile,
.tile.screen-tile:hover,
.tile.screen-tile.self {
  border: none;
  outline: none;
}

.tile.screen-tile video {
  object-fit: contain;
  /* O zoom parte do canto superior esquerdo; room.js faz os cálculos. */
  transform-origin: 0 0;
}

.tile.screen-tile.is-zoomed {
  cursor: grab;
  /* Todo toque pertence ao zoom, não à página. */
  touch-action: none;
}

.tile.screen-tile.is-panning {
  cursor: grabbing;
}

/* Os controles deslizantes de faixa compartilham a aparência escura: o controle de volume e o editor
   de imagem. Um seletor por tipo tem mais especificidade que uma classe simples; esta regra não define
   largura, deixando cada classe dimensionar seu controle.
 */
input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  --slider-pct: 0%;
  --slider-fill-color: var(--text);
  --slider-track-color: rgb(var(--ink) / 0.16);
  /* Altura de 18 px oferece uma área confortável para clicar ou tocar, mantendo a trilha visível fina
     e
     centralizada na vertical.
   */
  height: 18px;
  background: transparent;
  border: 0;
  outline: none;
  cursor: pointer;
  margin: 0;
  padding: 0;
  vertical-align: middle;
}

input[type="range"]:not(.theme-hue):hover,
input[type="range"]:not(.theme-hue):active,
input[type="range"]:not(.theme-hue).is-adjusting {
  --slider-track-color: rgb(var(--ink) / 0.24);
}

input[type="range"]:active,
input[type="range"].is-adjusting {
  cursor: grabbing;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  background: linear-gradient(to right,
      var(--slider-fill-color) 0%,
      var(--slider-fill-color) var(--slider-pct, 0%),
      var(--slider-track-color) var(--slider-pct, 0%),
      var(--slider-track-color) 100%);
  border-radius: 999px;
  transition: background 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.2);
  /* Centraliza o cursor na trilha: (altura da trilha - altura do cursor) / 2 = (6 - 16) / 2. */
  margin-top: -5px;
  transition: transform 0.14s cubic-bezier(0.2, 0.8, 0.4, 1), box-shadow 0.14s ease;
}

input[type="range"]:hover::-webkit-slider-thumb {
  transform: scale(1.15);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45), 0 0 0 4px rgb(var(--ink) / 0.12);
}

input[type="range"]:active::-webkit-slider-thumb,
input[type="range"].is-adjusting::-webkit-slider-thumb {
  cursor: grabbing;
  transform: scale(1.22);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55), 0 0 0 6px rgb(var(--ink) / 0.18);
}

input[type="range"]:focus-visible {
  outline: none;
}

input[type="range"]:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent);
}

input[type="range"]::-moz-range-track {
  height: 6px;
  background: var(--slider-track-color);
  border-radius: 999px;
  border: none;
  transition: background 0.15s ease;
}

input[type="range"]:not(.theme-hue)::-moz-range-progress {
  height: 6px;
  background: var(--slider-fill-color);
  border-radius: 999px;
  transition: background 0.15s ease;
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text);
  cursor: pointer;
  border: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: transform 0.14s cubic-bezier(0.2, 0.8, 0.4, 1), box-shadow 0.14s ease;
}

input[type="range"]:hover::-moz-range-thumb {
  transform: scale(1.15);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45), 0 0 0 4px rgb(var(--ink) / 0.12);
}

input[type="range"]:active::-moz-range-thumb,
input[type="range"].is-adjusting::-moz-range-thumb {
  cursor: grabbing;
  transform: scale(1.22);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55), 0 0 0 6px rgb(var(--ink) / 0.18);
}

input[type="range"]:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent);
}

input[type="range"]:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

input[type="range"]:disabled::-webkit-slider-thumb {
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

input[type="range"]:disabled::-moz-range-thumb {
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.tile-volume-slider {
  width: 74px;
}

/* Seletor de cor do aplicativo no editor de perfil. */
.theme-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-hue {
  flex: 1;
  min-width: 0;
}

/* Um seletor por tipo prevalece sobre uma classe simples; por isso, a trilha cinza compartilhada
   precisa ser sobrescrita com input. — veja a observação sobre as regras dos controles de faixa acima.
 */
input.theme-hue::-webkit-slider-runnable-track {
  background: var(--hue-track) !important;
}

input.theme-hue::-moz-range-track {
  background: var(--hue-track) !important;
}

/* A extremidade sem matiz da mesma opção oferecida pelo controle deslizante. O preenchimento é cinza
   literal, não um token, para continuar mostrando a cor neutra de retorno enquanto o aplicativo está
   colorido.
 */
.theme-swatch {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: hsl(0 0% 61.96%);
  cursor: pointer;
  box-shadow: 0 0 0 2px transparent;
  transition: box-shadow 0.15s ease, transform 0.1s ease;
}

.theme-swatch:hover {
  transform: scale(1.12);
}

/* Recebe um contorno quando o aplicativo está em tons de cinza, mostrando que é uma opção e não um
   botão sempre igual.
 */
.theme-swatch.is-active {
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--text);
}

/* O preenchimento ao redor do controle fica aqui, não na cápsula, para que o contêiner o recorte ao
   recolher sem deslocar o botão de silenciar.
 */
.tile-volume-slider-wrap .tile-volume-slider {
  margin: 0 7px 0 9px;
}


/* Cartão de transmissão pausada ou não assistida. */
.tile-paused-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 7%));
  z-index: 7;
  user-select: none;
  cursor: pointer;
}

.tile.screen-tile.is-paused video,
.tile.screen-tile.is-paused .tile-name {
  display: none;
}

.tile-paused-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 16px;
  max-width: 90%;
}

.tile-paused-avatar {
  width: 58px;
  height: 58px;
  font-size: 24px;
}

.tile-paused-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tile-paused-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.tile-paused-status {
  font-size: 12px;
  color: var(--muted);
}

.tile-resume-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 9px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
  backdrop-filter: blur(4px);
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}

.tile-resume-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
}

.tile-resume-btn:active {
  transform: translateY(1px);
}

.tile-resume-btn svg {
  width: 12px;
  height: 12px;
}

.empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--muted);
  pointer-events: none;
  margin: 0;
  padding: 24px 24px 120px;
  line-height: 1.7;
  overflow: hidden;
}

.empty-text {
  position: relative;
  z-index: 1;
  margin: 0;
}

.empty .bg-glow-sphere {
  position: absolute;
  top: calc(-1 * var(--glow-size) + 50%);
  left: 50%;
  transform: translateX(-50%);
}

/* ----------------------------------------------------------------- barra lateral */

.sidebar {
  grid-area: side;
  --sidebar-pad: 12px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px var(--sidebar-pad) var(--sidebar-pad) 0;
  overflow: hidden;
}

/* Arraste a borda esquerda da barra lateral para aumentar ou diminuir sua largura. */
.resizer-x {
  position: absolute;
  left: -6px;
  top: 0;
  bottom: 0;
  width: 12px;
  cursor: col-resize;
  z-index: 22;
  touch-action: none;
}

.resizer-x::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: transparent;
  transition: background 0.15s;
}

.resizer-x:hover::after,
.resizer-x.dragging::after {
  background: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 28.24%));
}

/* Divide Pessoas e Bate-papo quando os dois painéis estão abertos. */
.resizer-y {
  flex: 0 0 auto;
  height: 12px;
  display: grid;
  place-items: center;
  cursor: row-resize;
  touch-action: none;
}

.resizer-y::after {
  content: "";
  width: 40px;
  height: 3px;
  border-radius: 2px;
  background: var(--line);
  transition: background 0.15s;
}

.resizer-y:hover::after,
.resizer-y.dragging::after {
  background: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 28.24%));
}

.panel {
  background: var(--bg-soft);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#people-panel,
#chat-panel {
  flex: 1 1 0;
}

/* A divisão salva só se aplica quando os dois painéis estão visíveis e existe uma alça — no celular,
   ambos apenas compartilham a folha. Um painel sozinho precisa crescer pelo fator total 1; um fator
   salvo abaixo de 1 o deixaria aquém do fim.
 */
@media (min-width: 861px) {
  .sidebar.split #people-panel {
    flex-grow: var(--people-flex, 1);
  }

  .sidebar.split #chat-panel {
    flex-grow: var(--chat-flex, 1);
  }
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: hsl(var(--tint-h) var(--tint-s-text) calc(var(--lt0) + var(--lts) * 87.06%));
}

.people {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  overflow-y: auto;
  overflow-x: hidden;
  align-content: start;
}

.person {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  border-radius: 10px;
  padding: 6px 8px;
  cursor: pointer;
  user-select: none;
  overflow: hidden;
  transition: background 0.12s ease;
}

.person:hover {
  background: rgb(var(--ink) / 0.07);
}

.person.has-banner {
  background: transparent;
}

.person.has-banner:hover {
  background: transparent;
}

.person-nameplate {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  border: 0;
  background-size: 100% 100%, cover;
  background-position: 0 0, center;
  background-repeat: no-repeat, no-repeat;
  transition: filter 0.2s ease;
}

.person.has-banner:hover .person-nameplate {
  filter: brightness(1.1);
}

.person .avatar,
.person .person-name,
.person .person-tags {
  position: relative;
  z-index: 1;
}

.person.has-banner .person-name {
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

.person.has-banner .tag {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: hsl(var(--tint-h) var(--tint-s-text) calc(var(--lt0) + var(--lts) * 87.06%));
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.person.has-banner .tag-host {
  background: #ffffff;
  color: #121212;
}

.person.has-banner .tag-dev {
  background: var(--speaking);
  color: #ffffff;
}

.person.has-banner .tag-wife {
  background: var(--wife);
  color: #ffffff;
}

.person.has-banner button.tag-danger {
  background: rgba(255, 107, 107, 0.25);
  color: #ff8585;
}

.person.has-banner button.tag-danger:hover {
  background: var(--danger-strong);
  color: #ffffff;
}

.avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  transition: box-shadow 0.15s ease-out;
  background-image: none;
}

/* Sem imagem: a marca da Luna, branca sobre a cor da própria pessoa, definida inline por
   LunaProfile.paint. Uma camada de fundo, não um elemento filho, centraliza a marca no círculo em
   qualquer tamanho ou display; um filho só ficava centralizado quando o pai era uma grade e podia
   deslocar um pixel por arredondamento de porcentagens. A classe duplicada prevalece sobre
   background-image: none dos avatares.
 */
.avatar-mark.avatar-mark {
  background-image: url("/moon.svg");
  background-position: 50% 50%;
  background-size: 56% 56%;
  background-repeat: no-repeat;
}

.avatar.is-speaking,
.person.is-speaking .avatar {
  box-shadow: 0 0 0 2.5px var(--speaking);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}

/* Sua foto é o botão que permite trocá-la. */
button.avatar {
  appearance: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button.avatar:hover {
  filter: brightness(1.2);
}

.avatar-lg {
  width: 84px;
  height: 84px;
  font-size: 32px;
}

.profile-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar-picker {
  position: relative;
  width: 84px;
  height: 84px;
  flex: 0 0 auto;
}

/* As ações ficam sobre a foto, não ao lado: formam uma camada, não um contêiner, porque aplicar a
   imagem substitui o conteúdo do avatar.
 */
.avatar-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.58);
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}

.avatar-picker:hover .avatar-overlay,
.avatar-picker:focus-within .avatar-overlay {
  opacity: 1;
  pointer-events: auto;
}

.avatar-action {
  appearance: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  outline: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.avatar-action svg {
  width: 17px;
  height: 17px;
}

.avatar-action:hover {
  background: rgba(255, 255, 255, 0.3);
}

.avatar-action:last-child:hover {
  background: var(--danger-strong);
}

.profile-row .field {
  flex: 1;
  min-width: 0;
}

button.tag {
  appearance: none;
  border: 0;
  font: inherit;
  font-size: 10px;
  cursor: pointer;
}

button.tag:hover {
  color: var(--text);
  background: rgb(var(--ink) / 0.16);
}

button.tag-danger {
  color: var(--danger);
  background: rgba(255, 107, 107, 0.14);
  transition: background 0.15s ease, color 0.15s ease;
}

button.tag-danger:hover {
  color: #ffffff;
  background: var(--danger-strong);
}

/* ------------------------------------------------------ editor de imagem ---- */

/* A tela de entrada aparece como abertura enquanto a sala é carregada diretamente da página inicial. */
.gate.working .card {
  display: none;
}

/* Indicador de cinco pontos para entrada automática. */
.gate-loader {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 8px;
  align-items: center;
}

.gate-loader .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  animation: dotFill 1.2s ease-in-out infinite;
}

.gate-loader .dot:nth-child(1) {
  animation-delay: 0s;
}

.gate-loader .dot:nth-child(2) {
  animation-delay: 0.12s;
}

.gate-loader .dot:nth-child(3) {
  animation-delay: 0.24s;
}

.gate-loader .dot:nth-child(4) {
  animation-delay: 0.36s;
}

.gate-loader .dot:nth-child(5) {
  animation-delay: 0.48s;
}

@keyframes dotFill {

  0%,
  100% {
    background: rgba(255, 255, 255, 0.15);
  }

  40% {
    background: rgba(255, 255, 255, 0.85);
  }
}

/* Transmissão conectada que ainda não exibiu um quadro. */
.tile-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 5.49%));
  z-index: 3;
  pointer-events: none;
}

.tile-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.16);
  border-top-color: rgba(255, 255, 255, 0.75);
  animation: tileSpin 0.8s linear infinite;
}

@keyframes tileSpin {
  to {
    transform: rotate(1turn);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tile-spinner {
    animation-duration: 2.4s;
  }
}

/* ------------------------------------------------------------- autenticação Discord */

.discord-auth {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.discord-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-soft);
  border-radius: 10px;
}

.discord-badge .discord-icon {
  width: 22px;
  height: 22px;
  color: #ffffff;
  fill: #ffffff;
  flex-shrink: 0;
}

.discord-badge-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.discord-badge-label {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.2;
}

.discord-badge-user {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.discord-disconnect-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}

.discord-disconnect-btn:hover {
  color: var(--danger);
  background: rgba(255, 107, 107, 0.1);
}

.editor {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 8, 8, 0.82);
  backdrop-filter: blur(6px);
}

.editor-card {
  /* Largura suficiente para manter a linha de ações inteira, que precisa de cerca de 302 px. */
  width: min(380px, 100%);
  background: var(--panel);
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: grid;
  gap: 12px;
  justify-items: center;
}

.editor-card h2 {
  margin: 0;
  font-size: 16px;
  justify-self: start;
}

.editor-stage {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 5.49%));
}

.editor-stage canvas {
  display: block;
  cursor: grab;
  touch-action: none;
}

.editor-stage canvas:active {
  cursor: grabbing;
}

/* Furo circular: o grande espalhamento é recortado pelo overflow do palco. O recuo vem de MASK_INSET
   em js/profile.js, que também dimensiona o recorte.
 */
.editor-mask {
  position: absolute;
  border-radius: 50%;
  box-shadow: 0 0 0 999px rgba(12, 12, 12, 0.66);
  pointer-events: none;
}

.editor-card .menu-row {
  width: 100%;
  grid-template-columns: 62px 1fr;
  align-items: center;
  gap: 10px;
}

.editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  flex-wrap: wrap;
}

.editor-spacer {
  flex: 1;
}

.person-name {
  font-weight: 500;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  /* min-width: 0 permite truncar nomes longos em vez de empurrar os selos para fora. */
  flex: 1 1 0;
  min-width: 0;
}

.person-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.tag {
  font-size: 10px;
  letter-spacing: 0.04em;
  border-radius: 999px;
  padding: 2px 6px;
  color: var(--muted);
  background: rgb(var(--ink) / 0.06);
}


/**
 * Cápsulas de texto deslocadas meio pixel para cima. Elas não têm descendentes — ANFITRIÃO e REMOVER
 * são maiúsculas —, então as letras ocupam só a parte superior da caixa de linha, que ainda reserva
 * espaço abaixo da linha de base para descendentes como g e y. A caixa está centralizada, mas o
 * desenho das letras não: fica meio pixel baixo. Tirar esse meio pixel do topo e somá-lo à parte
 * inferior desloca as letras, não a cápsula, preservando sua altura e alinhamento com os selos de
 * ícone.
 */
.tag-host,
button.tag-danger {
  padding-top: 1.5px;
  padding-bottom: 2.5px;
  /* E devolve o espaçamento entre letras à esquerda. Ele é somado após cada caractere, inclusive o
     último; assim, a linha centralizada tem um espaço final que os glifos não preenchem e a palavra
     fica deslocada para a esquerda pela metade desse espaço. O recuo usa o espaço inteiro porque as
     cápsulas se ajustam ao conteúdo: aumentá-lo também aumenta a largura e desloca o centro pela
     metade, então meio espaço corrigiria apenas metade do desvio.
   */
  text-indent: 0.08em;
}

.tag-host {
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Em destaque, como ANFITRIÃO ao lado, pelo mesmo motivo: é a ação da linha que não pode ser desfeita. */
button.tag-danger {
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/**
 * Selos de ícone. Têm 19 px de altura, igual às cápsulas de texto ao lado. Com 2 px de preenchimento
 * em cima e embaixo, sobra uma área de conteúdo de exatamente 15 px, o tamanho do ícone. Um ícone
 * menor precisaria ser centralizado; meio pixel de cada lado não pode ser representado sem
 * arredondamento, e o ícone subiria um pixel. Com as dimensões iguais, não há arredondamento.
 */
.tag-dev,
.tag-wife {
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 19px;
  cursor: default;
}

.tag-dev {
  background: var(--speaking);
}

.tag-wife {
  background: var(--wife);
}

.tag-badge-icon {
  display: block;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.tag-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: none;
  border-radius: 0;
  line-height: 1;
}

.tag-icon svg {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
}

.tag-mic-muted,
.tag-deafened {
  color: var(--danger);
  background: none;
}

.tag-sharing,
.tag-camera {
  color: var(--live);
  background: none;
}

/* Texto de espaço reservado quando o bate-papo está vazio. */
.chat-empty {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 16px;
  user-select: none;
  pointer-events: none;
}

.chat-empty-icon {
  width: 38px;
  height: 38px;
  color: var(--muted);
  opacity: 0.65;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.chat-empty-title {
  margin: 0 0 5px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.chat-empty-sub {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
  max-width: 190px;
}

.messages:empty {
  display: none;
}

.messages:not(:empty)+.chat-empty,
.chat-empty[hidden] {
  display: none !important;
}

.messages {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  flex: 1;
  align-content: start;
}

/* A barra de rolagem do bate-papo só aparece quando o ponteiro está sobre ele. A barra é um controle
   e, quando ninguém a usa, parece apenas uma linha ao lado da conversa. Esta regra a esconde até que o
   bate-papo esteja em uso. Só muda a cor do cursor, nunca a largura da trilha: removê-la reorganizaria
   todas as mensagens quando o ponteiro chegasse, o que distrai mais que a própria barra. O
   esmaecimento vem da transição definida globalmente para o cursor. O teste considera somente o
   ponteiro, não a digitação: estar no campo de mensagem com o mouse em outro lugar significa escrever,
   não reler. Manter a barra visível durante toda a composição criaria justamente a distração que
   queremos evitar.
 */
.messages::-webkit-scrollbar-thumb {
  background: transparent;
}

#chat-panel:hover .messages::-webkit-scrollbar-thumb {
  background: rgb(var(--ink) / 0.18);
}

#chat-panel:hover .messages::-webkit-scrollbar-thumb:hover {
  background: rgb(var(--ink) / 0.32);
}

#chat-panel:hover .messages::-webkit-scrollbar-thumb:active {
  background: rgb(var(--ink) / 0.45);
}

/* Firefox não tem ::-webkit-scrollbar e usa as propriedades padrão. Esta regra permanece sob a mesma
   condição das regras no início do arquivo, pois definir scrollbar-color no Chromium desativa todas as
   regras ::-webkit-scrollbar acima.
 */
@supports not selector(::-webkit-scrollbar) {
  .messages {
    scrollbar-color: transparent transparent;
  }

  #chat-panel:hover .messages {
    scrollbar-color: rgb(var(--ink) / 0.18) transparent;
  }
}

.message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
}

.message-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  font-size: 12.5px;
}

.message-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.message-header {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.message-who {
  font-size: 13.5px;
  font-weight: 600;
  color: hsl(var(--tint-h) var(--tint-s-text) calc(var(--lt0) + var(--lts) * 85%));
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message.mine .message-who {
  color: var(--text);
}

.message-time {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
  opacity: 0.75;
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
}

.message-body {
  font-size: 14px;
  line-height: 1.42;
  color: hsl(var(--tint-h) var(--tint-s-text) calc(var(--lt0) + var(--lts) * 88%));
  overflow-wrap: anywhere;
}

.message-link {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  word-break: break-all;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.message-link:hover {
  color: var(--text);
  text-decoration-color: var(--text);
}

.message-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.chat-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

#chat-input {
  flex: 1;
  min-width: 0;
  width: auto;
  height: 40px;
  border-radius: 12px;
  background: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 6.5%));
  border: 1px solid rgb(var(--ink) / 0.09);
  padding: 0 13px;
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  outline: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

#chat-input:hover {
  border-color: rgb(var(--ink) / 0.16);
}

#chat-input:focus {
  border-color: rgb(var(--ink) / 0.24);
  box-shadow: 0 0 0 2px rgb(var(--ink) / 0.08);
  background: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 7.5%));
}

#chat-input::placeholder {
  color: var(--muted);
  opacity: 0.7;
  font-size: 13.5px;
  text-transform: lowercase;
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  flex: 0 0 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid rgb(var(--ink) / 0.09);
  outline: none;
  background: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 6.5%));
  color: var(--muted);
  opacity: 0.6;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.chat-send-btn svg {
  width: 17px;
  height: 17px;
}

.chat-send-btn:hover {
  opacity: 0.9;
  background: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 11%));
  border-color: rgb(var(--ink) / 0.16);
  color: var(--text);
}

.chat-send-btn:active {
  transform: none;
}

#chat-input:not(:placeholder-shown)~.chat-send-btn {
  opacity: 1;
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}

#chat-input:not(:placeholder-shown)~.chat-send-btn:hover {
  background: var(--text);
  color: var(--bg);
}

@media (pointer: coarse) {
  #chat-input {
    height: 44px;
  }

  .chat-send-btn {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
  }
}

/* Centralizado no palco, entre a borda esquerda e a barra lateral. */
.dock {
  position: fixed;
  left: calc((100% - var(--sidebar-w)) / 2);
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  background: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 7.06%) / 0.95);
  backdrop-filter: blur(12px);
  padding: 6px;
  border-radius: 20px;
}

.dock-group {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgb(var(--ink) / 0.06);
  border-radius: 14px;
  padding: 3px;
}

.dock-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  transition: background 0.15s, color 0.15s, transform 0.08s;
}

.dock-btn svg {
  width: 24px;
  height: 24px;
}

/* Elementos SVG não têm a propriedade IDL hidden; a troca de ícone usa uma classe no botão, não um
   atributo no ícone.
 */
.dock-btn .icon-live {
  display: none;
}

.dock-btn.is-live .icon-live {
  display: block;
}

.dock-btn.is-live .icon-idle {
  display: none;
}

.dock-btn:active:not(:disabled) {
  transform: scale(0.94);
}

.dock-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.dock-caret {
  width: 42px;
  height: 46px;
  border-radius: 11px;
  color: var(--muted);
}

.dock-caret svg {
  width: 17px;
  height: 17px;
  transition: transform 0.18s;
}

.dock-caret[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.dock-wide {
  width: 58px;
  height: 46px;
  border-radius: 11px;
  background: transparent;
}

.dock-voice-group,
#voice-group {
  position: relative;
  display: flex;
  align-items: center;
  padding: 3px;
  gap: 2px;
  background: rgb(var(--ink) / 0.06);
  border-radius: 14px;
}

.dock-square,
#voice-group .dock-btn,
#voice-group .dock-round,
#voice-group .dock-square {
  width: 58px;
  height: 46px;
  border-radius: 11px;
  background: transparent;
}

#voice-group .dock-btn:hover:not(:disabled),
#voice-group .dock-round:hover:not(:disabled),
#voice-group .dock-square:hover:not(:disabled) {
  background: rgb(var(--ink) / 0.12);
  color: var(--text);
}

.dock-caret:hover,
.dock-wide:hover {
  background: rgb(var(--ink) / 0.12);
  color: var(--text);
}

.dock-caret[aria-expanded="true"] {
  background: rgb(var(--ink) / 0.12);
  color: var(--text);
}

.dock-round {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgb(var(--ink) / 0.06);
}

.dock-round:hover:not(:disabled) {
  background: rgb(var(--ink) / 0.14);
}

/* Os estados ativos são reconhecidos de relance: o compartilhamento fica azul-claro. */
.dock-wide.is-live {
  background: rgba(122, 186, 255, 0.12);
  color: var(--live);
}

.dock-wide.is-live:hover {
  background: rgba(122, 186, 255, 0.22);
  color: var(--live);
}

/* Estado de microfone silenciado: invertido para que “silenciado” seja o estado ativo. */
#mic.is-muted {
  background: rgba(198, 40, 40, 0.16);
  color: var(--danger);
}

#voice-group #mic.is-muted:hover:not(:disabled),
#mic.is-muted:hover:not(:disabled) {
  background: rgba(198, 40, 40, 0.26);
  color: var(--danger-hover, #ff8e8e);
}

#mic.is-live {
  background: transparent;
  color: var(--text);
}

#mic.is-live:hover:not(:disabled) {
  background: rgb(var(--ink) / 0.12);
  color: var(--text);
}

/* Estado de áudio desativado: usa o mesmo efeito vermelho do microfone silenciado. */
.dock-round.is-live#deafen,
.dock-square.is-live#deafen,
#deafen.is-live {
  background: rgba(198, 40, 40, 0.16);
  color: var(--danger);
}

#voice-group #deafen.is-live:hover:not(:disabled),
.dock-round.is-live#deafen:hover:not(:disabled),
.dock-square.is-live#deafen:hover:not(:disabled),
#deafen.is-live:hover:not(:disabled) {
  background: rgba(198, 40, 40, 0.26);
  color: var(--danger-hover, #ff8e8e);
}

.dock-danger,
.dock-danger.dock-round {
  background: var(--danger-strong);
  color: #ffffff;
}

.dock-danger:hover:not(:disabled),
.dock-danger.dock-round:hover:not(:disabled) {
  background: var(--danger-strong-hover);
}

.dock-danger svg {
  width: 26px;
  height: 26px;
}

.dock-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 12px);
  width: 240px;
  background: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 7.06%));
  border: none;
  border-radius: 12px;
  padding: 6px;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 35;
}

/* Mais largo que os demais: a linha de qualidade traz a resposta ao lado do nome. */
#share-menu {
  width: 264px;
}

.dock-menu-header {
  padding: 6px 10px 4px;
}

.dock-menu-label-header {
  font-size: 12px;
  font-weight: 600;
  color: hsl(var(--tint-h) var(--tint-s-text) calc(var(--lt0) + var(--lts) * 55%));
}

.dock-menu-empty {
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
}

.dock-menu-item {
  position: relative;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.dock-menu-item.is-selected {
  background: rgb(var(--ink) / 0.08);
  color: var(--text);
}

.dock-menu-item.is-selected .dock-dropdown-check {
  opacity: 1;
  transform: scale(1);
}

.dock-menu-item:hover {
  background: rgb(var(--ink) / 0.08);
}

.dock-menu-item:has(input:disabled),
.dock-menu-item:has(select:disabled) {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.dock-menu-select {
  justify-content: space-between;
}

.dock-menu-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.dock-menu-title {
  font-size: 13.5px;
  font-weight: 600;
  color: hsl(var(--tint-h) var(--tint-s-text) calc(var(--lt0) + var(--lts) * 94.9%));
  line-height: 1.2;
}

.dock-menu-sub {
  font-size: 12px;
  color: hsl(var(--tint-h) var(--tint-s-text) calc(var(--lt0) + var(--lts) * 60%));
  line-height: 1.2;
}

.dock-menu-chevron {
  width: 16px;
  height: 16px;
  color: hsl(var(--tint-h) var(--tint-s-text) calc(var(--lt0) + var(--lts) * 60%));
  flex-shrink: 0;
  transition: transform 0.2s ease, color 0.15s ease;
}

.dock-menu-item:hover .dock-menu-chevron {
  color: hsl(var(--tint-h) var(--tint-s-text) calc(var(--lt0) + var(--lts) * 94.9%));
}

.dock-menu-select-wrap {
  position: relative;
}

.dock-menu-select-wrap:hover .dock-menu-item,
.dock-menu-select[aria-expanded="true"] {
  background: rgb(var(--ink) / 0.08);
}

.dock-menu-select-wrap:hover .dock-menu-chevron,
.dock-menu-select[aria-expanded="true"] .dock-menu-chevron {
  color: hsl(var(--tint-h) var(--tint-s-text) calc(var(--lt0) + var(--lts) * 94.9%));
  transform: translateX(2px);
}

.dock-dropdown {
  position: absolute;
  left: calc(100% + 8px);
  top: 0;
  min-width: 175px;
  background: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 7.06%));
  border: none;
  border-radius: 12px;
  padding: 6px;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 40;
  max-height: none;
  overflow: visible;
}

@supports not selector(::-webkit-scrollbar) {
  .dock-dropdown {
    scrollbar-width: thin;
    scrollbar-color: rgb(var(--ink) / 0.22) transparent;
  }
}

/* Ponte invisível sobre o espaço de 8 px entre o acionador e o menu suspenso flutuante. */
.dock-dropdown::before {
  content: '';
  position: absolute;
  top: -6px;
  bottom: -6px;
  left: -12px;
  width: 14px;
}

.dock-dropdown[hidden] {
  display: none;
}

.dock-dropdown::-webkit-scrollbar {
  width: 4px;
}

.dock-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

.dock-dropdown::-webkit-scrollbar-thumb {
  background: rgb(var(--ink) / 0.22);
  border-radius: 999px;
}

.dock-dropdown::-webkit-scrollbar-thumb:hover {
  background: rgb(var(--ink) / 0.4);
}

.dock-dropdown::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

.dock-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: hsl(var(--tint-h) var(--tint-s-text) calc(var(--lt0) + var(--lts) * 87.06%));
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease;
}

.dock-dropdown-item:hover,
.dock-dropdown-item:focus-visible {
  background: rgb(var(--ink) / 0.08);
  color: var(--text);
  outline: none;
}

.dock-dropdown-item.is-selected {
  background: rgb(var(--ink) / 0.06);
  color: var(--text);
  font-weight: 600;
}

.dock-dropdown-item.is-selected .dock-dropdown-check {
  opacity: 1;
  transform: scale(1);
}

/* Ícone e rótulo ficam juntos para que a marca de seleção permaneça na extremidade: a linha usa
   space-between e três filhos soltos se afastariam.
 */
.dock-dropdown-lead {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.dock-dropdown-icon {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--muted);
}

/* O ícone da opção escolhida ganha destaque junto com o texto, em vez de continuar cinza. */
.dock-dropdown-item.is-selected .dock-dropdown-icon {
  color: var(--text);
}

.dock-dropdown-check {
  width: 16px;
  height: 16px;
  color: var(--accent);
  margin-left: 12px;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.15s ease, transform 0.15s ease;
  flex-shrink: 0;
}

.dock-menu-divider {
  height: 1px;
  background: rgb(var(--ink) / 0.08);
  margin: 4px 4px;
}

/* ------------------------------------------------------- configuração do compartilhamento */

/* Janela de pré-compartilhamento do navegador: aparência e rodapé do seletor de computador, com opções
   para as telas disponíveis.
 */
.share-setup .profile-modal-dialog {
  width: min(520px, 100%);
}

.share-setup-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.share-setup-body {
  display: flex;
  flex-direction: column;
  padding: 24px 26px;
}

/* O preenchimento próprio da janela já separa o primeiro rótulo. */
.share-setup-body>.share-setup-label:first-child {
  margin-top: 0;
}

.share-setup-label {
  margin: 16px 0 8px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Cápsula segmentada, como as opções “Tela inteira” e “Aplicativos” do seletor. */
.share-segments {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: rgb(var(--ink) / 0.05);
}

.share-segment {
  appearance: none;
  border: 0;
  border-radius: 9px;
  padding: 12px 10px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  background: none;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}

.share-segment:hover {
  color: var(--text);
}

.share-segment:focus-visible {
  outline: 2px solid rgb(var(--ink) / 0.4);
  outline-offset: -2px;
}

.share-segment.is-selected {
  background: rgb(var(--ink) / 0.1);
  color: var(--text);
}

.share-setup-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgb(var(--ink) / 0.05);
  cursor: pointer;
}

.share-setup-toggle-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.share-setup-summary {
  min-width: 0;
  font-size: 13.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Rodapé do seletor: à esquerda, o conteúdo compartilhado; à direita, a forma de sair. */
.share-setup-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 26px 20px;
  border-top: 1px solid rgb(var(--ink) / 0.06);
}

/* ------------------------------------------------------ qualidade do compartilhamento */

/* No computador, resolução e taxa de quadros ficam em um submenu de uma linha; no celular, há dois
   modos de transmissão (veja o bloco compacto abaixo).
 */
.share-modes {
  display: none;
}

/* O título e a linha acima da opção de áudio são próprios da folha no celular, que explicita todas as
   opções. No computador, as linhas ficam independentes, como no menu de contexto.
 */
.share-audio-title,
.share-audio-divider {
  display: none;
}

.share-group-title {
  margin: 0;
  padding: 8px 10px 4px;
  font-size: 12px;
  font-weight: 600;
  color: hsl(var(--tint-h) var(--tint-s-text) calc(var(--lt0) + var(--lts) * 55%));
}

/* Círculo de opção preenchido quando escolhido. É desenhado, não um input, para atender tanto aos
   cartões de modo do celular quanto às opções do menu de contexto. Quando selecionado, usa um único
   gradiente radial: ponto e preenchimento são pintados de uma vez a partir do centro exato. Assim, o
   ponto não fica desalinhado e não há borda ou sombra entre eles. --dot define o raio do ponto.
 */
.share-radio {
  --dot: 3px;
  flex: none;
  box-sizing: border-box;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px rgb(var(--ink) / 0.35);
  transition: box-shadow 0.15s ease;
}

.is-selected>.share-radio {
  box-shadow: none;
  background: radial-gradient(circle, var(--bg) 0 var(--dot), var(--text) calc(var(--dot) + 0.75px));
}

.dock-menu-action {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Uma linha que executa uma ação, em vez de conter um controle, é um botão; o botão usa a aparência da
   própria linha.
 */
button.dock-menu-item {
  width: 100%;
  appearance: none;
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
}

/* Linha que resume opções definidas em outro lugar: primeiro o resultado em peso visual mais suave,
   depois a seta para acessá-las.
 */
#share-quality-row .dock-menu-label {
  white-space: nowrap;
}

.dock-menu-value {
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  color: hsl(var(--tint-h) var(--tint-s-text) calc(var(--lt0) + var(--lts) * 60%));
}

.dock-menu-item:hover .dock-menu-value,
.dock-menu-item.is-open .dock-menu-value {
  color: hsl(var(--tint-h) var(--tint-s-text) calc(var(--lt0) + var(--lts) * 87.06%));
}

#share-quality-row:hover .dock-menu-chevron,
#share-quality-row.is-open .dock-menu-chevron {
  color: hsl(var(--tint-h) var(--tint-s-text) calc(var(--lt0) + var(--lts) * 94.9%));
  transform: translateX(2px);
}

/* Permanece aberta junto com o submenu, para que linha e menu pareçam uma coisa só. */
.dock-menu-item.is-open {
  background: rgb(var(--ink) / 0.08);
}

.dock-menu-icon {
  width: 18px;
  height: 18px;
  color: hsl(var(--tint-h) var(--tint-s-text) calc(var(--lt0) + var(--lts) * 60%));
  flex-shrink: 0;
  transition: color 0.15s ease;
}

.dock-menu-item:hover .dock-menu-icon {
  color: hsl(var(--tint-h) var(--tint-s-text) calc(var(--lt0) + var(--lts) * 94.9%));
}

.dock-menu-label {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: hsl(var(--tint-h) var(--tint-s-text) calc(var(--lt0) + var(--lts) * 87.06%));
}

/* Encerra o compartilhamento usando o vermelho definido para essa ação. Nome e foto assumem a cor da
   linha para que ela, sozinha, comunique o estado: vermelho com texto branco.
 */
.dock-menu-item.is-danger {
  color: var(--danger);
}

.dock-menu-item.is-danger .dock-menu-label,
.dock-menu-item.is-danger .dock-menu-icon {
  color: inherit;
}

.dock-menu-item.is-danger:hover,
.dock-menu-item.is-danger:focus-visible {
  background: var(--danger);
  color: #ffffff;
}

.dock-menu-check {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  padding: 0;
  margin: 0;
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  max-width: 18px;
  max-height: 18px;
  aspect-ratio: 1 / 1;
  border: 1.5px solid rgb(var(--ink) / 0.32);
  border-radius: 3.5px;
  background-color: rgb(var(--ink) / 0.05);
  background-position: center;
  background-repeat: no-repeat;
  cursor: pointer;
  flex: 0 0 18px;
  align-self: center;
  outline: none;
  box-shadow: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.dock-menu-check:hover {
  border-color: rgb(var(--ink) / 0.55);
  background-color: rgb(var(--ink) / 0.1);
}

.dock-menu-check:checked {
  background-color: var(--text);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23141414' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8l3 3 6-6'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 12px 12px;
  border-color: var(--text);
}

/* A marca de seleção está embutida no URI acima e não pode usar uma propriedade personalizada; no tema
   claro, o mesmo glifo é redesenhado com tinta clara.
 */
:root[data-theme="light"] .dock-menu-check:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23f5f5f5' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8l3 3 6-6'/%3E%3C/svg%3E");
}

.dock-menu-check::before,
.dock-menu-check:checked::before {
  content: none;
  display: none;
}

.dock-menu-check:focus,
.dock-menu-check:focus-visible {
  outline: none;
  box-shadow: none;
}

.menu-row {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}


/* ------------------------------------------------------------- clique com o botão direito */

/* Menu aberto com clique direito ou toque longo sobre uma pessoa ou transmissão; veja showContextMenu
   em room.js. Segue a estrutura dos menus do dock.
 */
.context-menu {
  position: fixed;
  z-index: 80;
  min-width: 200px;
  max-width: 280px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 7.06%));
  border-radius: 12px;
  box-shadow: var(--shadow);
  font-size: 13px;
  -webkit-user-select: none;
  user-select: none;
  animation: context-in 0.1s ease-out;
}

@keyframes context-in {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
}

.context-menu-item {
  appearance: none;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 500;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  color: hsl(var(--tint-h) var(--tint-s-text) calc(var(--lt0) + var(--lts) * 87.06%));
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.context-menu-item:hover,
.context-menu-item:focus-visible {
  background: rgb(var(--ink) / 0.08);
  color: var(--text);
  outline: none;
}

.context-menu-item.is-danger {
  color: var(--danger);
}

.context-menu-item.is-danger:hover,
.context-menu-item.is-danger:focus-visible {
  background: var(--danger);
  color: #ffffff;
}

.context-menu-item.is-open {
  background: rgb(var(--ink) / 0.08);
  color: var(--text);
}

.context-icon {
  flex: none;
  width: 18px;
  height: 18px;
}

.context-chevron {
  flex: none;
  width: 14px;
  height: 14px;
  color: hsl(var(--tint-h) var(--tint-s-text) calc(var(--lt0) + var(--lts) * 60%));
}

.context-menu.is-submenu {
  min-width: 170px;
}

/* Ponte invisível sobre o espaço entre o menu principal e o submenu. */
.context-menu.is-submenu::before {
  content: '';
  position: absolute;
  top: -6px;
  bottom: -6px;
  left: -10px;
  width: 14px;
}

.context-menu.is-submenu.is-left::before {
  left: auto;
  right: -10px;
}

.context-menu-heading {
  padding: 8px 10px 4px;
  font-size: 12px;
  font-weight: 600;
  color: hsl(var(--tint-h) var(--tint-s-text) calc(var(--lt0) + var(--lts) * 55%));
}

.context-menu-sep {
  height: 1px;
  margin: 4px;
  background: rgb(var(--ink) / 0.08);
}

.context-menu-slider {
  display: grid;
  gap: 6px;
  padding: 6px 10px 8px;
}

.context-menu-slider-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: hsl(var(--tint-h) var(--tint-s-text) calc(var(--lt0) + var(--lts) * 60%));
}

.context-menu-slider input {
  width: 100%;
}

/* Caixa de seleção de uma linha alternável, desenhada pelo aplicativo em vez de usar input, para que a
   linha inteira funcione como botão.
 */
.context-check {
  flex: none;
  box-sizing: border-box;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border: 1.5px solid rgb(var(--ink) / 0.32);
  border-radius: 3.5px;
  color: transparent;
}

.context-check svg {
  width: 11px;
  height: 11px;
}

.context-check.is-checked {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

@media (prefers-reduced-motion: reduce) {
  .context-menu {
    animation: none;
  }
}

/* ------------------------------------------------------------------ notificações */

/* Centralizadas no topo do palco, logo abaixo da barra superior. */
.toasts {
  position: fixed;
  left: calc((100% - var(--sidebar-w)) / 2);
  top: calc(var(--sat) + 64px);
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  z-index: 28;
  pointer-events: none;
  width: min(420px, calc(100vw - 32px));
  justify-items: center;
}

.toast {
  background: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 7.06%));
  color: hsl(var(--tint-h) var(--tint-s-text) calc(var(--lt0) + var(--lts) * 94.9%));
  border: 1px solid rgb(var(--ink) / 0.12);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  box-shadow: var(--shadow-sm);
  animation: toast-in 0.25s ease-out;
  transition: opacity 0.35s, transform 0.35s;
  overflow-wrap: anywhere;
  text-align: center;
}

/* Em caso de erro, a cápsula fica vermelha e o texto mantém a mesma legibilidade dos demais. */
.toast-bad {
  background: var(--toast-bad);
  border-color: var(--toast-bad-edge);
}

.toast.out {
  opacity: 0;
  transform: translateY(-8px);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .toast {
    animation: none;
  }
}

body.sidebar-hidden .dock,
body.sidebar-hidden .toasts {
  left: 50%;
}

.mobile-only {
  display: none !important;
}

.mobile-sidebar,
.mobile-sidebar-backdrop {
  display: none;
}

/* ------------------------------------------------------------- visualização estreita */

@media (max-width: 860px) {
  body.room {
    /* Use minmax, não apenas 1fr: uma coluna 1fr nunca fica mais estreita que seu conteúdo. Uma barra
       superior um botão larga demais alargava a página inteira. O celular responde a uma página maior
       que a tela reduzindo-a, o que deslocava o dock para baixo e para a direita ao ligar a câmera e
       exibir o botão de inversão.
     */
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "top"
      "stage";
    --dock-h: 88px;
  }

  .topbar {
    gap: 8px;
    padding: calc(8px + var(--sat)) 10px 8px;
    min-height: calc(54px + var(--sat));
  }

  .topbar-side {
    gap: 6px;
  }

  .topbar-left .brand-mark.small {
    width: 26px;
    height: 26px;
    margin-left: 2px;
  }

  .topbar-left .chip {
    padding: 4px 10px;
    height: 36px;
    font-size: 14px;
  }

  .topbar-left .chip .chip-icon {
    width: 17px;
    height: 17px;
  }

  .topbar-left .chip-icon-btn {
    width: 36px;
    padding: 0;
  }

  .topbar-left .chip-icon-btn svg {
    width: 19px;
    height: 19px;
  }

  .topbar-right {
    width: auto;
    gap: 5px;
  }

  .topbar-right .chip-icon-btn {
    width: 36px;
    height: 36px;
  }

  .topbar-right .chip-icon-btn svg {
    width: 19px;
    height: 19px;
  }

  /* No celular, Pessoas e Configurações passam para a barra lateral móvel. */
  #toggle-people,
  #toggle-settings {
    display: none !important;
  }

  .mobile-only {
    display: inline-flex !important;
  }

  .topbar-menu {
    top: calc(58px + var(--sat));
    right: 8px;
  }

  /* Pessoas e Bate-papo viram uma folha que sobe da parte inferior e cobre a maior parte da tela,
     mostrando um painel de cada vez. Como é uma sobreposição, o palco atrás mantém toda a altura e só
     precisa liberar espaço para o dock.
   */
  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    /* Use svh, não dvh: o viewport dinâmico muda quando a barra de endereço recolhe, o que
       reorganizaria a
       folha — e a lista dentro dela — durante a rolagem.
     */
    height: 88svh;
    gap: 0;
    padding: 0;
    background: var(--panel);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.35);
    animation: sheetIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  }

  @keyframes sheetIn {
    from {
      transform: translateY(100%);
    }
  }

  /* Alça para puxar no topo da folha. */
  .sidebar::before {
    content: "";
    flex: 0 0 auto;
    width: 44px;
    height: 4px;
    margin: 10px auto 2px;
    border-radius: 999px;
    background: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 28.24%));
  }

  body.room.sheet-open .sheet-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(0, 0, 0, 0.6);
    animation: sheetBackdropIn 0.2s ease;
  }

  @keyframes sheetBackdropIn {
    from {
      opacity: 0;
    }
  }

  /* Dentro da folha, o painel já é a própria folha; não precisa de um cartão separado. */
  .panel {
    background: none;
    border-radius: 0;
    padding: 0 14px 14px;
  }

  /* Título centralizado, como cabe a uma folha. */
  .panel h2 {
    margin: 6px 0 12px;
    text-align: center;
    font-size: 16px;
    color: var(--text);
  }

  /* No celular, o palco centraliza os quadrados na vertical e libera espaço para o dock com margens
     compactas e equilibradas.
   */
  .stage {
    padding: 10px 8px calc(var(--dock-h) + 14px + var(--sab));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    overflow-x: hidden;
  }

  /* O dock cobriria o campo de mensagem; por isso, fica recolhido enquanto a folha está aberta. */
  body.room.sheet-open .dock {
    display: none;
  }

  /* A folha alcança a barra superior, então as notificações ficam sobre a barra, não escondidas atrás
     da borda da folha. Ocultá-las impediria ver as notificações do bate-papo que a própria folha
     existe para mostrar.
   */
  body.room.sheet-open .toasts {
    top: calc(var(--sat) + 8px);
    z-index: 61;
    /* Sobre a folha e o fundo escurecido. */
  }

  /* ---------------------------------------------------- barra lateral móvel */
  .mobile-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(320px, 86vw);
    height: 100%;
    z-index: 70;
    background: var(--panel);
    border-radius: 20px 0 0 20px;
    box-shadow: -10px 0 32px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    padding: calc(14px + var(--sat)) calc(16px + var(--sar, 0px)) calc(14px + var(--sab)) calc(16px + var(--sal, 0px));
    transform: translateX(100%);
    will-change: transform;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
    pointer-events: none;
    visibility: hidden;
    overscroll-behavior: contain;
  }

  .mobile-sidebar.is-open {
    transform: translateX(0);
    pointer-events: auto;
    visibility: visible;
  }

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

  .mobile-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 68;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    display: block;
  }

  body.mobile-sidebar-open .mobile-sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
  }

  body.mobile-sidebar-open .dock {
    pointer-events: none;
  }

  .mobile-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    flex-shrink: 0;
  }

  .mobile-sidebar-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .mobile-sidebar-title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
  }

  .mobile-sidebar-header .mobile-sidebar-close {
    position: static !important;
    top: auto;
    right: auto;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
  }

  .mobile-sidebar-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    margin-bottom: 12px;
  }

  .mobile-sidebar-content #people-panel {
    padding: 0;
    background: none;
  }

  .mobile-sidebar-content #people-panel>h2 {
    display: none;
  }

  .mobile-sidebar-content .people {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .mobile-sidebar-footer {
    flex-shrink: 0;
    padding-top: 12px;
    border-top: 1px solid rgb(var(--ink) / 0.08);
  }

  .mobile-settings-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 14px;
    border-radius: 12px;
    border: 0;
    background: rgb(var(--ink) / 0.08);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
  }

  .mobile-settings-btn:hover {
    background: rgb(var(--ink) / 0.14);
  }

  .mobile-settings-btn:active {
    transform: scale(0.98);
  }

  .mobile-settings-icon {
    width: 20px;
    height: 20px;
    color: var(--muted);
    flex-shrink: 0;
  }

  .mobile-settings-label {
    flex: 1;
    text-align: left;
  }

  .mobile-settings-arrow {
    width: 16px;
    height: 16px;
    color: var(--muted);
    flex-shrink: 0;
  }

  /* O celular é alto e estreito, então a sala se organiza de cima para baixo: uma pessoa abaixo da
     outra, ocupando toda a largura do palco. Ao lado de um compartilhamento, as pessoas ficam lado a
     lado e a transmissão ocupa toda a largura acima delas. Cada linha tem exatamente a altura do
     quadro, sem espaço sobrando; e, como não pode ser mais alta que larga, nenhum quadro fica em
     formato retrato — a maioria é quadrada. A transmissão é a única que se estica para ocupar a altura
     que as pessoas deixarem. A imagem preenche o espaço, sem letterboxing; o modo de foco restaura o
     formato original da captura.
   */
  .grid {
    display: grid;
    /* O palco é a referência de tamanho dos quadros; por isso, é o contêiner usado pelos cálculos
       abaixo.
     */
    container-type: size;
    --gap: 8px;
    --tile-cols: 1;
    --tile-rows: 1;
    /* Altura máxima da metade quadrada do layout: todo o palco ou o espaço que sobrar após a
       transmissão
       esticada.
     */
    --squares-height: 100cqh;
    /* Um quadrado com o maior tamanho que as colunas e linhas permitem. As linhas usam exatamente essa
       altura, sem sobra para abrir espaços entre elas.
     */
    --cell: min((100cqw - (var(--tile-cols) - 1) * var(--gap)) / var(--tile-cols),
        (var(--squares-height) - (var(--tile-rows) - 1) * var(--gap)) / var(--tile-rows));
    grid-template-columns: repeat(var(--tile-cols), minmax(0, 1fr));
    grid-auto-rows: var(--cell);
    justify-content: center;
    align-content: center;
    gap: var(--gap);
    height: 100%;
    min-height: 0;
    width: 100%;
    max-width: none;
    margin: 0;
  }

  .grid .slot {
    width: auto;
    min-width: 0;
    min-height: 0;
  }

  .grid .tile {
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    border-radius: 18px;
  }

  .grid[data-count="1"] .tile-user-name {
    max-width: 140px;
  }

  /* O quadro que sobra em uma linha de dois ocupa a linha inteira e fica centralizado, em vez de
     encostado à esquerda com um espaço vazio ao lado. Veja describePhoneGrid em js/room.js.
   */
  .grid .slot.takes-the-row {
    grid-column: 1 / -1;
  }

  .grid .slot.takes-the-row .tile {
    width: var(--cell);
  }

  /* Uma transmissão fica acima das pessoas; duas dividem esse espaço. Acima de duas, não vale a pena
     dividir: elas entram na grade como os demais quadros. Esta altura limita o espaço das pessoas, não
     o divide igualmente. Quando as colunas são estreitas, as linhas continuam quadradas e a
     transmissão fica com o restante. Isso impede que a multidão elimine todo o espaço da transmissão.
   */
  .grid[data-shares="1"],
  .grid[data-shares="2"] {
    --squares-height: 70cqh;
    /* Altura ocupada pelas pessoas, que determina o espaço restante para as transmissões, até um
       quadrado por pessoa. Uma transmissão fica melhor mais larga que alta; ultrapassar essa proporção
       desperdiça largura.
     */
    --people-height: calc(var(--tile-rows) * var(--cell) + (var(--tile-rows) - 1) * var(--gap));
  }

  .grid[data-shares="1"] {
    grid-template-rows: min(100cqw, calc(100cqh - var(--people-height) - var(--gap)));
  }

  .grid[data-shares="2"] {
    --share-height: min(100cqw,
        calc((100cqh - var(--people-height) - 2 * var(--gap)) / 2));
    grid-template-rows: var(--share-height) var(--share-height);
  }

  .grid[data-shares="1"] .slot:has(.screen-tile),
  .grid[data-shares="2"] .slot:has(.screen-tile) {
    order: -1;
    grid-column: 1 / -1;
  }

  .grid[data-shares="1"] .slot:has(.screen-tile) .tile,
  .grid[data-shares="2"] .slot:has(.screen-tile) .tile {
    width: 100%;
    height: 100%;
  }

  .grid:not(.has-focus) .tile.screen-tile video {
    object-fit: cover;
  }

  /* O formato usa duas vezes o lado menor do quadro. Dividir a largura para um eixo e a altura para o
     outro criaria um oval assim que o quadro ficasse mais largo que alto.
   */
  .tile .tile-avatar,
  .tile-avatar.avatar,
  .tile .tile-avatar.is-speaking,
  .tile-avatar.avatar.is-speaking {
    width: clamp(48px, min(46cqw, 46cqh), 88px);
    height: clamp(48px, min(46cqw, 46cqh), 88px);
    font-size: clamp(20px, min(20cqw, 20cqh), 36px);
  }

  /* Selo em forma de cápsula centralizado na base do quadrado de usuário. */
  .tile-user-badge {
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 9999px;
    padding: 3px 10px;
    font-size: 12px;
    max-width: calc(100% - 14px);
    justify-content: center;
    gap: 5px;
  }

  .tile-user-name {
    max-width: 75px;
  }

  .tile-user-icon svg {
    width: 13px;
    height: 13px;
  }

  .tile-user-prefix-icons {
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }

  /* No celular, o vídeo compartilhado preenche todo o quadrado no modo de grade. */
  .tile.screen-tile video {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* Sobreposição e botões do quadro de compartilhamento no celular. */
  .tile.screen-tile figcaption {
    position: absolute;
    inset: 0;
    display: block;
    opacity: 1;
    background: transparent;
    padding: 0;
    pointer-events: none;
    z-index: 6;
  }

  .tile.screen-tile .tile-name {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 9999px;
    padding: 3px 8px 3px 10px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    max-width: calc(100% - 16px);
    pointer-events: auto;
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .tile-viewers-popover {
    left: 50%;
    transform: translate(-50%, 6px);
    bottom: 40px;
  }

  .tile-viewers-popover.is-open {
    transform: translate(-50%, 0);
  }

  .tile.screen-tile .tile-actions {
    position: absolute;
    inset: 0;
    display: block;
    pointer-events: none;
  }

  .tile.screen-tile .tile-full-btn {
    display: none;
  }

  /* Controles nos cantos da transmissão no celular: X para encerrar a sua, setas para focar qualquer
     transmissão — no computador, ambos ficam no menu de contexto — e volume. Os três usam o mesmo
     fundo escuro desfocado. Os controles são posicionados, não deixados no fluxo: .tile-actions cobre
     o quadro inteiro com pointer-events: none. Um filho estático herdaria isso, ficaria no canto
     superior esquerdo e não responderia ao toque.
   */
  .tile.screen-tile .tile-stop-share-btn,
  .tile.screen-tile .tile-focus-btn,
  .tile.user-tile .tile-focus-btn,
  .tile.screen-tile .tile-volume-control {
    position: absolute;
    top: 8px;
    height: 32px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    pointer-events: auto;
    z-index: 8;
  }

  .tile.screen-tile .tile-stop-share-btn,
  .tile.screen-tile .tile-focus-btn,
  .tile.user-tile .tile-focus-btn {
    width: 32px;
    border: none;
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background 0.15s ease;
  }

  .tile.screen-tile .tile-stop-share-btn svg,
  .tile.screen-tile .tile-focus-btn svg,
  .tile.user-tile .tile-focus-btn svg {
    width: 16px;
    height: 16px;
  }

  .tile.screen-tile .tile-stop-share-btn:active,
  .tile.screen-tile .tile-focus-btn:active,
  .tile.user-tile .tile-focus-btn:active {
    background: rgba(0, 0, 0, 0.85);
  }

  /* X à esquerda, foco à direita e volume entre eles, começando onde termina o X. Só transmissões de
     outras pessoas têm controle de volume.
   */
  .tile.screen-tile .tile-stop-share-btn {
    left: 8px;
  }

  .tile.screen-tile .tile-volume-control {
    left: 48px;
    max-width: calc(100% - 96px);
  }

  .tile.screen-tile .tile-focus-btn,
  .tile.user-tile .tile-focus-btn {
    right: 8px;
  }

  .tile.user-tile .tile-focus-btn {
    display: none;
  }

  .tile.user-tile.has-camera .tile-focus-btn,
  .slot.focused .tile.user-tile .tile-focus-btn {
    display: grid;
  }

  .slot.is-floating .tile-focus-btn {
    display: none !important;
  }

  /* Formato de cápsula, não círculo, afastado do botão de foco oposto. */
  .tile.screen-tile .tile-volume-control {
    max-width: calc(100% - 56px);
    border-radius: 16px;
  }

  .tile.screen-tile .tile-volume-btn {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    flex: none;
  }

  .tile.screen-tile .tile-volume-btn svg {
    width: 16px;
    height: 16px;
  }

  /* No celular, o controle deslizante fica sempre visível: não há hover para reabri-lo. Além disso,
     sua largura fixa de 74 px, que cabe exatamente na cápsula do computador, excede o contêiner móvel;
     como ele recorta ao recolher, a trilha e o cursor ficavam cortados. O espaço à direita do controle
     também não precisa ser reservado: sem recolhimento, vira apenas uma lacuna antes do botão de
     silenciar.
   */
  .tile.screen-tile .tile-volume-slider-wrap {
    max-width: 96px;
    opacity: 1;
    pointer-events: auto;
    transition: none;
    padding-left: 12px;
  }

  .tile.screen-tile .tile-volume-slider {
    width: 100%;
    margin-right: 0;
  }

  /* Cartão de tela pausada no celular. */
  .tile.screen-tile .tile-paused-card {
    padding: 6px;
    gap: 6px;
    max-width: 95%;
  }

  .tile.screen-tile .tile-paused-avatar {
    width: clamp(40px, 30%, 54px);
    height: clamp(40px, 30%, 54px);
    font-size: 18px;
  }

  .tile.screen-tile .tile-paused-name {
    font-size: 12px;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .tile.screen-tile .tile-paused-status {
    display: none;
  }

  .tile.screen-tile .tile-resume-btn {
    padding: 5px 12px;
    font-size: 11.5px;
    border-radius: 9999px;
  }

  /* No celular, o modo de foco se expande para preencher toda a área útil do palco. */
  .grid.has-focus {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    position: relative !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 0 !important;
  }

  .grid.has-focus .slot.focused {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    flex: 1 1 100% !important;
    grid-column: 1 / -1 !important;
    grid-row: 1 / -1 !important;
  }

  .grid.has-focus .slot.focused .tile {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    aspect-ratio: auto !important;
    border-radius: 14px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #000 !important;
    overflow: hidden !important;
  }

  .grid.has-focus .slot.focused .tile video {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    display: block !important;
  }

  /* Janela(s) flutuante(s) da câmera no celular durante o modo de foco. */
  .grid.has-focus .slot.is-floating {
    display: block !important;
    position: fixed !important;
    z-index: 40 !important;
    width: clamp(100px, 28vw, 130px);
    height: auto;
    aspect-ratio: 16 / 9;
    border-radius: 12px !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.65), 0 0 0 1.5px rgba(255, 255, 255, 0.25) !important;
    overflow: hidden !important;
    cursor: grab !important;
    background: #111 !important;
    pointer-events: auto !important;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
  }

  .grid.has-focus .slot.is-floating:not(.has-custom-pos) {
    right: 12px !important;
    bottom: calc(var(--dock-h, 88px) + 14px + var(--sab, 0px) + var(--floating-index, 0) * (clamp(72px, 19vw, 92px) + 10px)) !important;
  }

  .grid.has-focus .slot.is-floating.has-custom-pos {
    right: auto !important;
    bottom: auto !important;
  }

  .grid.has-focus .slot.is-floating.is-dragging {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.8), 0 0 0 2px var(--live, #7abbff) !important;
    cursor: grabbing !important;
    transition: none !important;
  }

  .grid.has-focus .slot.is-floating .tile {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    border-radius: 12px !important;
    border: none !important;
    aspect-ratio: auto !important;
    position: relative !important;
    background: #111 !important;
    cursor: inherit !important;
    display: block !important;
  }

  .grid.has-focus .slot.is-floating .tile video {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 11px !important;
    pointer-events: none;
  }

  .grid.has-focus .slot.is-floating .tile-avatar-wrap {
    display: none !important;
  }

  .grid.has-focus .slot.is-floating .tile-user-badge {
    position: absolute !important;
    bottom: 4px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    padding: 1px 6px !important;
    font-size: 10px !important;
    background: rgba(0, 0, 0, 0.75) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
    max-width: calc(100% - 8px) !important;
    pointer-events: none !important;
    white-space: nowrap !important;
    gap: 3px !important;
    border-radius: 9999px !important;
    z-index: 5 !important;
  }

  .grid.has-focus .slot.is-floating .tile-user-name {
    max-width: 55px !important;
    font-size: 10px !important;
  }

  .grid.has-focus .slot.is-floating .tile-user-icon svg {
    width: 10px !important;
    height: 10px !important;
  }

  .grid.has-focus .slot.is-floating .tile-focus-btn {
    display: none !important;
  }

  /* Alça de redimensionamento no canto superior esquerdo da janela flutuante da câmera. */
  .slot.is-floating .tile-resize-handle {
    position: absolute !important;
    top: 4px !important;
    left: 4px !important;
    width: 24px !important;
    height: 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(0, 0, 0, 0.65) !important;
    backdrop-filter: blur(6px) !important;
    -webkit-backdrop-filter: blur(6px) !important;
    color: rgba(255, 255, 255, 0.85) !important;
    border-radius: 6px !important;
    z-index: 10 !important;
    cursor: nwse-resize !important;
    touch-action: none !important;
    pointer-events: auto !important;
    opacity: 0.85;
    transition: opacity 0.15s, background 0.15s;
  }

  .slot.is-floating .tile-resize-handle:active {
    background: rgba(0, 0, 0, 0.9) !important;
    opacity: 1;
  }

  .slot.is-floating .tile-resize-handle svg {
    width: 12px !important;
    height: 12px !important;
    pointer-events: none;
  }

  .slot:not(.is-floating) .tile-resize-handle {
    display: none !important;
  }

  /* A folha ocupa toda a largura e seus painéis já são dimensionados automaticamente; nenhuma das
     alças
     tem função aqui.
   */
  .resizer-x,
  .resizer-y {
    display: none;
  }

  /* No celular, o painel é uma sobreposição; o dock fica centralizado sobre a janela, acima da
     navegação
     do sistema, respeitando a área segura do navegador.
   */
  .dock {
    left: 50%;
    bottom: calc(16px + var(--sab));
    gap: 10px;
  }

  /* No computador, o menu da câmera ficava centralizado sobre o dock. No celular, não há seta e a
     câmera é invertida pela barra superior. O menu de compartilhamento continua disponível e vira uma
     folha de largura total, posicionada por conta própria.
   */

  .toasts {
    left: 50%;
  }
}

.sheet-backdrop {
  display: none;
}

/* ------------------------------------------------------------- configurações */

/* Usa o mesmo fundo escurecido e centralização da janela de perfil; só o cartão é diferente. */
/* O contêiner de diálogo compartilhado é dimensionado para o cartão de perfil; o cartão de
   configurações define o próprio tamanho, então o contêiner não deve limitá-lo.
 */
#settings-modal .profile-modal-dialog {
  width: auto;
  max-width: 100%;
}

/* Tamanho fixo, qualquer que seja o conteúdo: o cartão não deve saltar quando seções de comprimentos
   diferentes passam pela tela. O conteúdo rola dentro destes limites, em vez de fazer o cartão
   crescer.
 */
.settings-card {
  width: 860px;
  height: 640px;
  max-width: 100%;
  max-height: 92dvh;
  display: grid;
  grid-template-columns: 232px 1fr;
  position: relative;
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 20px 12px;
  background: var(--bg-soft);
  overflow-y: auto;
}

/**
 * Linha de identificação da compilação abaixo das categorias. margin-top: auto na coluna flex da barra
 * lateral a mantém no fim, independentemente da quantidade de categorias, sem uma distância fixa que
 * uma nova categoria invalidaria. Ao contrário do restante da interface, o texto pode ser selecionado:
 * sua única função é ser copiado para uma mensagem.
 */
.settings-build {
  margin: auto 0 0;
  padding: 16px 10px 2px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
  opacity: 0.7;
  white-space: pre-line;
  -webkit-user-select: text;
  user-select: text;
  cursor: text;
}

.settings-title,
.settings-heading {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.settings-title {
  margin: 0 0 8px;
  padding: 0 10px;
}

/* Identidade da pessoa e busca acima das categorias. */
.settings-nav-head {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

.settings-profile {
  appearance: none;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 6px 8px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.12s ease;
}

.settings-profile:hover {
  background: rgb(var(--ink) / 0.05);
}

.settings-profile:focus-visible {
  outline: 2px solid rgb(var(--ink) / 0.5);
  outline-offset: 1px;
}

.settings-profile-avatar {
  width: 44px;
  height: 44px;
  font-size: 16px;
}

.settings-profile-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.settings-profile-name {
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-profile-sub {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--muted);
}

.settings-profile-sub svg {
  width: 12px;
  height: 12px;
  flex: none;
}

.settings-profile:hover .settings-profile-sub {
  color: var(--text);
}

.settings-search {
  position: relative;
  display: block;
}

.settings-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

/* #id: a regra global de campos de texto usa input:not():not():not() e prevaleceria no preenchimento,
   colocando o espaço reservado sob o ícone.
 */
.settings-search #settings-search {
  height: 40px;
  padding: 0 12px 0 36px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 14px;
}

.settings-search #settings-search:focus {
  box-shadow: inset 0 0 0 1px rgb(var(--ink) / 0.3);
}

.settings-search #settings-search::-webkit-search-cancel-button {
  cursor: pointer;
}

.settings-search-empty {
  margin: 0;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--muted);
}

.is-search-hidden {
  display: none !important;
}

.settings-tab {
  appearance: none;
  border: 0;
  outline: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.settings-tab svg {
  width: 18px;
  height: 18px;
  flex: none;
  opacity: 0.8;
}

.settings-tab:hover {
  background: rgb(var(--ink) / 0.05);
  color: var(--text);
}

.settings-tab.is-active {
  background: rgb(var(--ink) / 0.09);
  color: var(--text);
}

.settings-tab.is-active svg {
  opacity: 1;
}

/* Exibe uma categoria por vez. O conteúdo só rola quando a categoria é mais alta que o cartão, para
   que uma categoria longa não arraste uma curta para fora.
 */
.settings-body {
  padding: 26px 28px;
  overflow-x: hidden;
  overflow-y: auto;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.settings-heading {
  margin: 0;
}

/* Um título que abre um grupo no meio da seção precisa de espaço acima. */
.settings-heading:not(:first-child) {
  margin-top: 10px;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
}

.settings-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

/* Seletores de dispositivo e controles deslizantes organizados em pares. */
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px 20px;
}

/* Os seletores reaproveitam o menu suspenso do dock: mesmo acionador, painel e linhas marcadas. Só
   muda a posição: abaixo do acionador, com a mesma largura, em vez de ao lado.
 */
.settings-picker {
  min-width: 0;
}

.settings-picker-icon {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--muted);
}

.settings-picker .dock-menu-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-soft);
  padding: 10px 12px;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

/* O nome do dispositivo aparece em uma linha acima do campo, não dentro dele. Se for longo, é truncado
   sem alargar o campo; o texto completo continua no menu, onde pode quebrar linhas.
 */
.settings-picker .dock-menu-title {
  flex: 1;
  font-weight: 400;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-picker-sub {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.9em;
  margin-left: 4px;
}

.dock-menu-select:hover .settings-picker-sub,
.dock-menu-select:focus-visible .settings-picker-sub {
  color: inherit;
  opacity: 0.82;
}


.settings-picker .dock-menu-select[aria-expanded="true"] .dock-menu-chevron {
  transform: rotate(180deg);
}

.settings-dropdown {
  left: 0;
  top: calc(100% + 6px);
  right: 0;
  min-width: 0;
  max-height: 280px;
  overflow-y: auto;
  z-index: 20;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 12px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-dropdown::before {
  content: none;
}

/* Itens do menu de dispositivos com ícone, nome e subtítulo opcional. */
.settings-dropdown .dock-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  gap: 10px;
  border-radius: 8px;
  white-space: normal;
  min-width: 0;
  cursor: pointer;
  transition: background 0.12s ease;
}

.settings-dropdown .dock-dropdown-item.is-default-item {
  padding: 9px 10px;
}

.settings-device-lead {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  flex: 1;
}

.settings-device-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--muted);
  transition: color 0.12s ease;
}

.dock-dropdown-item:hover .settings-device-icon,
.dock-dropdown-item:focus-visible .settings-device-icon,
.dock-dropdown-item.is-selected .settings-device-icon {
  color: var(--text);
}

.settings-device-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  gap: 2px;
}

.settings-device-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.settings-device-desc {
  font-size: 11.5px;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.dock-dropdown-item:hover .settings-device-desc,
.dock-dropdown-item:focus-visible .settings-device-desc {
  color: inherit;
  opacity: 0.85;
}

.dock-dropdown-item.is-selected .settings-device-desc {
  color: var(--text);
  opacity: 0.75;
}

.settings-device-divider {
  margin: 5px 4px;
  height: 1px;
  background: rgb(var(--ink) / 0.1);
  flex-shrink: 0;
}


/* Amostras de tema. Cada uma mostra o fundo para o qual muda, com uma cor literal, não um token;
   assim, mantém sua própria aparência mesmo quando outro tema está ativo.
 */
.theme-presets {
  display: flex;
  gap: 10px;
}

.theme-preset {
  position: relative;
  width: 54px;
  height: 54px;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.theme-preset:hover {
  transform: translateY(-1px);
}

.theme-preset-swatch {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 2px transparent;
  transition: box-shadow 0.15s ease;
}

.theme-preset-swatch[data-preview="white"] {
  background: #ffffff;
}

.theme-preset-swatch[data-preview="grey"] {
  background: hsl(0 0% 11.76%);
}

.theme-preset-swatch[data-preview="oled"] {
  background: #000000;
}

/* Não é uma paleta, mas uma opção de adiamento: mostra a superfície atual do aplicativo com o símbolo
   de sincronização, sem fingir ser uma quarta cor.
 */
.theme-preset-swatch[data-preview="system"] {
  display: grid;
  place-items: center;
  background: var(--bg-soft);
  color: var(--muted);
}

.theme-preset-swatch[data-preview="system"] svg {
  width: 22px;
  height: 22px;
}

.theme-preset[aria-checked="true"] .theme-preset-swatch[data-preview="system"] {
  color: var(--text);
}

.theme-preset[aria-checked="true"] .theme-preset-swatch {
  border-color: transparent;
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--text);
}

/* A marca de seleção aparece apenas na amostra escolhida, em um dos cantos. */
.theme-preset-check {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 18px;
  height: 18px;
  padding: 3px;
  border-radius: 50%;
  background: var(--text);
  color: var(--panel);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.theme-preset[aria-checked="true"] .theme-preset-check {
  opacity: 1;
  transform: scale(1);
}

/* Valor ao lado do rótulo do controle deslizante. */
.settings-value {
  float: right;
  font-style: normal;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.settings-range {
  width: 100%;
}

.settings-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

/* Linha de caixa de seleção com a mesma aparência dos campos acima. */
.settings-check-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
}

.settings-check-text {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* Elementos exclusivos do celular. No computador há espaço para a barra lateral, as setas de opções e
   os seletores de dispositivo; estes componentes não são exibidos lá.
 */
.settings-bar,
.settings-tab-chevron,
.phone-only,
.dock-sheet-title,
.dock-sheet-confirm,
.dock-sheet-backdrop {
  display: none;
}

/* Ancorado sob a barra superior, não em um grupo do dock, pois o botão que o abre fica ali. */
.topbar-menu {
  position: fixed;
  top: 58px;
  right: 12px;
  left: auto;
  bottom: auto;
  z-index: 65;
  min-width: 200px;
  max-width: calc(100vw - 24px);
  box-shadow: var(--shadow);
}

.topbar-menu::before {
  content: none;
}

/* ---------------------------------------------------- janela de convite a amigos */

/* Uma versão compacta de Pessoas: mesmo painel e linhas sobre os banners, flutuando sob a barra
   superior, ao lado do botão que a abriu.
 */
.friends-window {
  position: fixed;
  top: 58px;
  /* Fica abaixo do botão ao lado do código da sala; js/room.js define a borda esquerda. */
  left: 12px;
  z-index: 65;
  width: 290px;
  max-width: calc(100vw - 24px);
  max-height: min(420px, calc(100vh - 140px));
  background: var(--bg-soft);
  box-shadow: var(--shadow);
  animation: friendsWindowIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes friendsWindowIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .friends-window {
    animation: none;
  }
}

.friends-window-list {
  min-height: 0;
}

/* As linhas contêm apenas um botão e, por isso, não recebem cliques diretamente. */
.friends-window-row {
  cursor: default;
}

.friends-window-row.is-sent .avatar,
.friends-window-row.is-sent .person-name {
  opacity: 0.6;
}

/* Linhas de espaço reservado enquanto a lista é carregada. */
.friends-window-skeleton .avatar,
.friends-skeleton-bar {
  background: rgb(var(--ink) / 0.08);
  animation: friendsSkeletonPulse 1.2s ease-in-out infinite;
}

.friends-skeleton-bar {
  height: 10px;
  border-radius: 999px;
}

.friends-window-skeleton:hover {
  background: transparent;
}

@keyframes friendsSkeletonPulse {

  0%,
  100% {
    opacity: 0.55;
  }

  50% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {

  .friends-window-skeleton .avatar,
  .friends-skeleton-bar {
    animation: none;
  }
}

.friends-window-empty {
  padding: 18px 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
}

/* Em destaque como ANFITRIÃO e REMOVER em Pessoas. Sem hover: as regras :hover abaixo impedem que
   button.tag:hover altere a cor compartilhada.
 */
button.tag-invite,
button.tag-invite:hover {
  position: relative;
  z-index: 1;
  border: 0;
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 1.5px 7px 2.5px;
  /* Ocupa menos espaço que ANFITRIÃO e REMOVER. Medido no botão renderizado: CONVIDAR com recuo à
     esquerda de 0,08em ficava meio pixel à direita do centro; 0,03em equilibra o texto em escalas de
     100%, 125% e 150%.
   */
  text-indent: 0.03em;
  background: var(--text);
  color: var(--bg);
  cursor: pointer;
}

button.tag-invite:focus-visible {
  outline: 2px solid rgb(var(--ink) / 0.5);
  outline-offset: 2px;
}

button.tag-invite:disabled,
button.tag-invite:disabled:hover {
  background: rgb(var(--ink) / 0.12);
  color: var(--muted);
  cursor: default;
}

.person.has-banner button.tag-invite:not(:disabled),
.person.has-banner button.tag-invite:not(:disabled):hover {
  background: #ffffff;
  color: #121212;
}

.person.has-banner button.tag-invite:disabled,
.person.has-banner button.tag-invite:disabled:hover {
  background: rgba(0, 0, 0, 0.45);
  color: rgba(255, 255, 255, 0.7);
}

/* No celular, sobe da parte inferior como Pessoas, Bate-papo e Saída de áudio. */
@media (max-width: 860px) {
  .friends-window {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-width: none;
    max-height: 70svh;
    z-index: 60;
    padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
    border-radius: 18px 18px 0 0;
    background: var(--panel);
    animation: sheetIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .friends-window::before {
    content: "";
    align-self: center;
    flex: none;
    width: 44px;
    height: 4px;
    margin: 2px 0 8px;
    border-radius: 999px;
    background: rgb(var(--ink) / 0.22);
  }

  .friends-window h2 {
    text-align: center;
    font-size: 16px;
    margin: 0 0 10px;
  }

  .friends-window-row {
    padding: 10px;
  }
}

/* Botão próprio, diferente do botão da janela de perfil: este fica sobre um painel simples, não sobre
   um banner com foto. Ancorado ao cartão, não à página, para manter o canto enquanto as seções rolam.
 */
.settings-close {
  position: absolute;
  top: 18px;
  right: 24px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgb(var(--ink) / 0.06);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.settings-close svg {
  width: 16px;
  height: 16px;
}

.settings-close:hover {
  background: rgb(var(--ink) / 0.12);
  color: var(--text);
}

@media (max-width: 860px) {

  /* Sem espaço para uma barra lateral: as abas viram uma faixa no topo. */
  /* No celular, a janela de configurações ocupa a tela inteira, em vez de flutuar como cartão; o
     preenchimento do modal e a largura limitada do diálogo deixam de se aplicar.
   */
  #settings-modal {
    padding: 0;
  }

  #settings-modal .profile-modal-dialog {
    width: 100%;
  }

  /* O celular mostra uma tela por vez: a lista de categorias e, depois, a categoria escolhida, com a
     barra superior para voltar. Ambas ocupam a mesma linha da grade, mas só uma fica visível.
   */
  .settings-card {
    width: 100%;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    /* Cor da página, para que as linhas da lista pareçam elevadas sobre ela. A relação se mantém nos
       dois
       temas, pois eles deslocam as cores em sentidos opostos.
     */
    background: var(--bg);
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .settings-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    /* Tela com altura total: sem esta regra, o título começaria sob a barra de status. */
    padding: calc(10px + var(--sat)) 12px 10px;
  }

  .settings-bar-btn {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--text);
    cursor: pointer;
  }

  .settings-bar-btn svg {
    width: 22px;
    height: 22px;
  }

  /* Um botão com duas funções: na raiz, fecha a janela; dentro de uma categoria, volta à lista. */
  .settings-bar-icon-back,
  .settings-card.is-detail .settings-bar-icon-close {
    display: none;
  }

  .settings-card.is-detail .settings-bar-icon-back {
    display: block;
  }

  .settings-bar-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
  }

  /* A barra lateral vira a lista de categorias: um cartão arredondado com linhas de ícone, nome e seta
     para indicar que cada uma abre uma tela.
   */
  .settings-nav {
    padding: 8px 14px calc(24px + var(--sab));
    background: none;
    gap: 0;
    overflow-y: auto;
  }

  /* A barra acima já nomeia esta tela; um título para o único grupo repetiria essa informação. */
  .settings-title {
    display: none;
  }

  .settings-nav-head {
    margin-bottom: 16px;
  }

  .settings-profile {
    padding: 8px 4px;
  }

  .settings-search #settings-search {
    height: 44px;
    font-size: 16px;
    background: var(--bg-soft);
  }

  .settings-tab {
    gap: 14px;
    padding: 16px 14px;
    border-radius: 0;
    font-size: 16px;
    color: var(--text);
    background: var(--bg-soft);
  }

  .settings-tab:first-of-type {
    border-radius: 12px 12px 0 0;
  }

  .settings-tab:last-of-type {
    border-radius: 0 0 12px 12px;
  }

  /* Linha fina entre itens, recuada depois dos ícones, como em uma lista de celular. */
  .settings-tab+.settings-tab {
    box-shadow: inset 0 1px 0 var(--line);
  }

  .settings-tab svg {
    width: 22px;
    height: 22px;
    opacity: 1;
  }

  /* A lista é curta e a tela é alta; a linha acompanha o último item em vez de ficar no fim da tela,
     separada por um espaço vazio.
   */
  .settings-build {
    margin-top: 0;
    padding: 18px 4px 2px;
    text-align: center;
  }

  /* Em uma lista de opções, nada está “atual” antes da escolha. */
  .settings-tab.is-active {
    background: var(--bg-soft);
  }

  .settings-tab:active {
    background: var(--line);
  }

  .settings-tab span {
    flex: 1;
  }

  .settings-tab-chevron {
    display: block;
    color: var(--muted);
  }

  /* Somente uma das duas telas ocupa a linha abaixo da barra. */
  .settings-card.is-detail .settings-nav,
  .settings-card:not(.is-detail) .settings-body {
    display: none;
  }

  /* No celular, a barra contém o botão de fechar. */
  .settings-close {
    display: none;
  }

  .settings-body {
    padding: 8px 18px calc(32px + var(--sab));
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  /* No celular, a barra superior oferece o que o dock não comporta: inverter a câmera e selecionar a
     saída de áudio da sala.
   */
  .phone-only {
    display: inline-flex;
  }

  /* As setas das opções desaparecem: o compartilhamento pergunta o que precisa em uma folha antes de
     começar, e a câmera é invertida pela barra superior, não por uma lista.
   */
  #share-options,
  #camera-options {
    display: none !important;
  }

  #voice-group,
  #media-group {
    gap: 2px;
  }

  /* As opções de compartilhamento viram uma folha como Pessoas e Bate-papo: sobem da parte inferior,
     apresentam duas escolhas e só então abrem o seletor.
   */
  .dock-sheet-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(0, 0, 0, 0.55);
  }

  #share-menu {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: auto;
    z-index: 60;
    gap: 6px;
    padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
    border-radius: 18px 18px 0 0;
    animation: sheetIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  }

  /* Alça para puxar, igual à das folhas Pessoas e Bate-papo. */
  #share-menu::before {
    content: "";
    width: 44px;
    height: 4px;
    margin: 2px auto 6px;
    border-radius: 999px;
    background: rgb(var(--ink) / 0.22);
  }

  .dock-sheet-title {
    display: block;
    margin: 0 0 6px;
    padding: 0 4px;
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
  }

  .dock-sheet-confirm {
    display: block;
    margin-top: 10px;
  }

  /* O botão da própria folha já encerra o compartilhamento e o celular captura a tela inteira; não há
     mais nada para alterar aqui.
   */
  #share-live {
    display: none;
  }

  /* No celular, a qualidade oferece dois modos em um cartão: menos escolhas, cada uma identificada por
     seu uso.
   */
  #share-menu .dock-sheet-title {
    text-align: center;
    margin-bottom: 4px;
  }

  #share-quality-row {
    display: none;
  }

  .share-modes {
    display: flex;
    flex-direction: column;
  }

  #share-menu .share-group-title {
    display: block;
    padding: 12px 4px 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
  }

  .share-card {
    border-radius: 14px;
    background: rgb(var(--ink) / 0.06);
    overflow: hidden;
  }

  .share-mode {
    appearance: none;
    border: 0;
    background: none;
    font: inherit;
    text-align: left;
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    color: var(--text);
    cursor: pointer;
  }

  .share-mode:active {
    background: rgb(var(--ink) / 0.05);
  }

  /* Linha fina entre os modos, recuada depois dos ícones. */
  .share-mode+.share-mode::before {
    content: "";
    position: absolute;
    top: 0;
    left: 54px;
    right: 0;
    height: 1px;
    background: rgb(var(--ink) / 0.08);
  }

  .share-mode-icon {
    flex: none;
    width: 24px;
    height: 24px;
    color: hsl(var(--tint-h) var(--tint-s-text) calc(var(--lt0) + var(--lts) * 70%));
  }

  .share-mode-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
  }

  .share-mode-name {
    font-size: 16px;
    font-weight: 600;
  }

  .share-mode-sub {
    font-size: 13px;
    line-height: 1.35;
    color: var(--muted);
  }

  .share-mode .share-radio {
    --dot: 4px;
    width: 24px;
    height: 24px;
  }

  .share-mode:not(.is-selected) .share-radio {
    box-shadow: inset 0 0 0 2px rgb(var(--ink) / 0.35);
  }

  /* O controle de áudio fica em seu próprio cartão, como os modos acima. */
  #share-menu #system-audio-row {
    padding: 14px 16px;
    border-radius: 14px;
    background: rgb(var(--ink) / 0.06);
  }

  #share-menu #system-audio-row .dock-menu-label {
    font-size: 15px;
  }

  /* No celular, as opções de ligar/desligar usam controles de alternância, como nas configurações do
     sistema. :root dá prioridade a estas regras sobre a marca de seleção do tema claro, que teria
     maior especificidade.
   */
  :root .dock-menu-check.is-switch {
    width: 46px;
    min-width: 46px;
    max-width: 46px;
    height: 28px;
    min-height: 28px;
    max-height: 28px;
    flex: 0 0 46px;
    aspect-ratio: auto;
    border: 0;
    border-radius: 999px;
    background: rgb(var(--ink) / 0.2);
    background-image: none;
    position: relative;
    transition: background-color 0.18s ease;
  }

  :root .dock-menu-check.is-switch::before {
    content: "";
    display: block;
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: transform 0.18s ease;
  }

  :root .dock-menu-check.is-switch:checked {
    background: var(--text);
    background-image: none;
  }

  :root .dock-menu-check.is-switch:checked::before {
    transform: translateX(18px);
    background: var(--bg);
  }

  /* O menu de saída de áudio também vira uma folha. Ele é aberto pela barra superior, mas um pequeno
     menu suspenso preso a um canto não cabe no celular; por isso, sobe da parte inferior como Pessoas,
     Bate-papo e opções de compartilhamento, parecendo uma janela do aplicativo, não um menu que
     simplesmente apareceu.
   */
  #output-menu {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: auto;
    max-width: none;
    z-index: 60;
    padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
    border-radius: 18px 18px 0 0;
    animation: sheetIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  }

  /* Alça para puxar, igual à das outras folhas. */
  #output-menu::before {
    content: "";
    /* Este pseudo-elemento já é usado por .dock-dropdown::before: cria a ponte invisível para o
       ponteiro cruzar o espaço entre o acionador e o menu sem fechá-lo. Posicionado absolutamente fora
       da borda esquerda, fazia a alça aparecer ali até estas três linhas recolocá-la no fluxo. Como a
       folha abre por toque, não há espaço a cruzar nem função a perder. No fluxo, ele é o primeiro
       item de um contêiner flex em coluna; align-self o centraliza, e as margens automáticas resultam
       em zero.
     */
    position: static;
    inset: auto;
    width: auto;
    display: block;
    align-self: center;
    flex: none;
    inline-size: 44px;
    block-size: 4px;
    margin: 2px 0 8px;
    border-radius: 999px;
    background: rgb(var(--ink) / 0.22);
  }

  /* Centralizado, como o título da folha Pessoas e Bate-papo. A folha de compartilhamento mantém o
     título alinhado à esquerda, acima de um formulário, não de uma lista.
   */
  #output-menu .dock-sheet-title {
    text-align: center;
    margin: 0 0 10px;
    font-size: 16px;
  }

  /* Linhas de largura total, com espaço para serem acionadas pelo polegar, em vez de compactas para o
     ponteiro.
   */
  #output-menu .dock-dropdown-item {
    padding: 14px 12px;
    font-size: 15px;
  }

  #output-menu .dock-dropdown-lead {
    gap: 14px;
  }

  #output-menu .dock-dropdown-icon {
    width: 20px;
    height: 20px;
  }

  /* A opção é escolhida pela barra superior; a janela de configurações não precisa perguntar
     novamente.
   */
  .settings-device-field {
    display: none;
  }
}

/* ------------------------------------------------ Modal de perfil na sala (estilo Discord) */

.profile-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 20px;
}

.profile-modal[hidden] {
  display: none !important;
}

.profile-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.profile-modal-dialog {
  position: relative;
  width: min(380px, 100%);
  z-index: 1;
  animation: profileModalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  justify-content: center;
}

@keyframes profileModalPop {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.profile-card {
  position: relative;
  width: min(380px, 100%);
  background: var(--panel);
  border-radius: 16px;
  box-shadow: none;
  border: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.profile-close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #fff;
  border: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  transition: background 0.15s, transform 0.15s;
}

.profile-close-btn:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.05);
}

.profile-close-btn svg {
  width: 16px;
  height: 16px;
}

/* Contêiner do banner e sobreposição. */
.profile-banner-container {
  position: relative;
  width: 100%;
  height: 124px;
  background: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 10.78%));
  overflow: hidden;
  z-index: 1;
}

.profile-banner {
  width: 100%;
  height: 100%;
  background-image: none;
  background-size: cover;
  background-position: center;
  transition: background-image 0.2s ease, filter 0.2s ease;
}

.profile-banner-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.profile-banner-container:hover .profile-banner-overlay,
.profile-banner-container:focus-within .profile-banner-overlay {
  opacity: 1;
}

/* Avatar sobreposto ao banner. */
.profile-header-content {
  position: relative;
  z-index: 6;
  padding: 0 16px;
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.profile-avatar-wrapper {
  position: relative;
  z-index: 2;
  margin-top: -44px;
  width: 88px;
  height: 88px;
  display: inline-block;
  flex-shrink: 0;
}

.avatar-xl {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 0;
  box-shadow: var(--shadow-sm);
  font-size: 32px;
  display: grid;
  place-items: center;
  box-sizing: border-box;
}

.profile-avatar-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.profile-avatar-wrapper:hover .profile-avatar-overlay,
.profile-avatar-wrapper:focus-within .profile-avatar-overlay {
  opacity: 1;
}

/* A foto, o banner e o nome do pop-up abrem o cartão completo. */
.opens-full-profile {
  cursor: pointer;
}

.profile-popup-name.opens-full-profile:hover {
  text-decoration: underline;
}

.avatar.opens-full-profile {
  transition: filter 0.15s ease;
}

.avatar.opens-full-profile:hover {
  filter: brightness(0.75);
}

/* Perfil completo de outra pessoa, somente para leitura: o nome aparece onde o editor mostra o campo e
   os selos de status ficam abaixo.
 */
.profile-view-identity {
  display: grid;
  gap: 8px;
}

.profile-view-name {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
  word-break: break-word;
}

/* Corpo do cartão. */
.profile-card-body {
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.profile-modal-discord {
  margin: 0;
}

.profile-modal-actions {
  margin-top: 4px;
}

/* Área do editor de banner. */
.banner-stage {
  border-radius: 8px;
}

.banner-editor-mask {
  position: absolute;
  inset: 0;
  border: 2px dashed rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  pointer-events: none;
}

/* ----------------------------------------------- Pop-up de perfil (estilo Discord) */

.profile-popup {
  position: fixed;
  inset: 0;
  z-index: 65;
  pointer-events: none;
}

.profile-popup[hidden] {
  display: none !important;
}

.profile-popup-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: transparent;
  pointer-events: auto;
}

.profile-popup-card {
  position: fixed;
  z-index: 2;
  width: 290px;
  background: var(--panel);
  border-radius: 16px;
  box-shadow: none;
  border: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  animation: profilePopupIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (max-width: 860px) {

  .profile-popup,
  .profile-popup-backdrop {
    display: none !important;
  }

  .profile-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: stretch;
    overflow: hidden;
  }

  .profile-modal-dialog {
    width: 100%;
    max-width: 100%;
    height: 100%;
    height: 100dvh;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: stretch;
  }

  /* No celular, o editor/visualizador de perfil principal preenche a tela inteira. */
  .profile-card:not(.profile-invite) {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
    border-radius: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    animation: profileModalMobileIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .profile-banner-container {
    height: calc(140px + var(--sat, 0px));
    padding-top: var(--sat, 0px);
    flex-shrink: 0;
    box-sizing: border-box;
  }

  .profile-close-btn {
    top: calc(12px + var(--sat, 0px));
    right: calc(12px + var(--sar, 0px));
    width: 32px;
    height: 32px;
  }

  .profile-close-btn svg {
    width: 18px;
    height: 18px;
  }

  .profile-header-content {
    flex-shrink: 0;
  }

  .profile-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px 20px calc(24px + var(--sab, 0px));
    box-sizing: border-box;
  }

  /* O botão de aplicar fica encostado à parte inferior. */
  .profile-modal-actions {
    margin-top: auto;
    padding-top: 20px;
    width: 100%;
  }

  .profile-modal-actions .btn {
    height: 50px;
    font-size: 15.5px;
    font-weight: 600;
    border-radius: var(--radius, 14px);
  }

  /* Somente o cartão QR “Ver cartão” não deve preencher a tela: continua flutuando. */
  .profile-invite {
    width: min(340px, calc(100vw - 32px)) !important;
    max-width: 340px !important;
    height: auto !important;
    min-height: 395px !important;
    max-height: calc(100dvh - 32px) !important;
    border-radius: 20px !important;
    border: 0 !important;
    box-shadow: none !important;
    margin: auto !important;
    flex: none !important;
    animation: inviteCardZoomIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .profile-invite-header {
    padding-top: 14px;
    padding-left: 16px;
    padding-right: 16px;
  }

  .profile-invite-body {
    padding-bottom: 24px;
    justify-content: center;
  }
}

@keyframes profileModalMobileIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes profilePopupIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.profile-popup-banner-wrap {
  position: relative;
  width: 100%;
  height: 96px;
  background: hsl(var(--tint-h) var(--tint-s) calc(var(--l0) + var(--ls) * 10.78%));
  overflow: hidden;
}

.profile-popup-banner {
  width: 100%;
  height: 100%;
  background-image: none;
  background-size: cover;
  background-position: center;
}

.profile-popup-header {
  position: relative;
  padding: 0 14px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.profile-popup-avatar-wrap {
  position: relative;
  margin-top: -34px;
  width: 68px;
  height: 68px;
  display: inline-block;
  flex-shrink: 0;
}

.avatar-popup {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 0;
  box-shadow: var(--shadow-sm);
  font-size: 26px;
  display: grid;
  place-items: center;
  box-sizing: border-box;
}

.avatar-popup.is-speaking {
  box-shadow: 0 0 0 3px var(--speaking), var(--shadow-sm);
}

.profile-popup-body {
  padding: 10px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-popup-identity {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-popup-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-popup-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  word-break: break-word;
}

.profile-popup-badges {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.profile-popup-discord {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.profile-popup-discord .discord-icon {
  width: 14px;
  height: 14px;
  fill: currentColor;
  flex-shrink: 0;
}

.profile-popup-volume {
  background: rgb(var(--ink) / 0.04);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-popup-volume-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.profile-popup-volume-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-popup-volume-row .tile-volume-slider {
  opacity: 1;
  pointer-events: auto;
  width: 100%;
}

.profile-popup-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-popup-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 8px;
}

/* Contêiner dos selos de perfil, à direita da foto. */
.profile-user-badges,
.profile-popup-user-badges {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  padding: 0;
  margin-bottom: 4px;
  flex-shrink: 0;
}

.profile-user-badges[hidden],
.profile-popup-user-badges[hidden] {
  display: none !important;
}

/* Selo de desenvolvedor. */
.badge-account,
.badge-dev {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  flex-shrink: 0;
  line-height: 1;
  transition: transform 0.15s ease;
  cursor: pointer;
}

.badge-account:hover,
.badge-dev:hover {
  transform: scale(1.12);
}

.badge-account .badge-dev-icon,
.badge-dev-icon {
  display: block;
  width: 26px;
  height: 26px;
  filter: none;
  box-shadow: none;
}

/* O botão para inverter a câmera só aparece com a câmera ligada e fazia a barra superior ultrapassar a
   largura de celulares de 390 a 430 px. Enquanto ele estiver visível, cada botão cede dois pixels para
   não cortar o código da sala. Celulares mais estreitos já usam botões menores; veja abaixo.
 */
@media (min-width: 391px) and (max-width: 860px) {
  .topbar:has(#flip-camera:not([hidden])) .chip-icon-btn {
    width: 34px;
    height: 34px;
  }

  .topbar:has(#flip-camera:not([hidden])) .topbar-right {
    gap: 4px;
  }
}

/* Celulares muito estreitos (iPhone SE, Galaxy S8 etc.): ocultam a marca e reduzem ainda mais a barra
   superior para manter o código da sala em uma linha.
 */
@media (max-width: 390px) {
  .topbar-left .brand-mark.small {
    display: none;
  }

  .topbar {
    gap: 6px;
    padding: calc(6px + var(--sat)) 8px 6px;
  }

  .topbar-right {
    gap: 3px;
  }

  .topbar-right .chip-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 9px;
  }

  .topbar-right .chip-icon-btn svg {
    width: 17px;
    height: 17px;
  }

  .topbar-left .chip {
    padding: 4px 8px;
    height: 32px;
    gap: 5px;
    font-size: 13px;
  }

  .topbar-left .chip-icon-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 9px;
  }

  .topbar-left .chip-icon-btn svg {
    width: 17px;
    height: 17px;
  }

  .topbar-left .chip .chip-icon {
    width: 15px;
    height: 15px;
  }
}

/* ------------------------------------------------------ pedido de amizade ---- */

/**
 * Página aberta pelo link de convite. Há um único elemento, centralizado sobre o banner da pessoa,
 * escurecido e desfocado a ponto de virar atmosfera, não imagem. A página parece pertencer a ela sem
 * pedir que ninguém analise uma foto enquanto decide se aceita.
 */
body.invite {
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  padding: calc(24px + var(--sat)) 24px calc(24px + var(--sab));
  font-family: "Helvetica World", "Helvetica Neue", Helvetica, Arial, sans-serif;
  position: relative;
  overflow: hidden;
}

.invite-wash {
  position: fixed;
  inset: -10%;
  z-index: 0;
  /* Antes da chegada do banner, um perfil sem imagem mostra a página escura normal, não um retângulo
     cinza.
   */
  background: none;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.invite-wash.has-banner {
  opacity: 0.28;
  filter: blur(56px) saturate(1.3) brightness(0.42);
}

.invite-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  width: min(460px, 100%);
  text-align: center;
  background: var(--panel);
  border: 0;
  border-radius: 18px;
  box-shadow: none;
  padding: 48px 40px 42px;
  overflow: hidden;
}

.invite-loader {
  grid-row: 1;
}

/* O brilho pertence à foto; por isso, é um elemento irmão colocado atrás dela, não uma sombra. Uma
   sombra seguiria exatamente o círculo do avatar e pareceria um anel, não luz ao redor da pessoa.
 */
.invite-figure {
  position: relative;
  display: grid;
  place-items: center;
}

.invite-card:not([hidden]) {
  animation: inviteFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes inviteFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* A luz vem da foto e usa sua cor. js/add.js extrai o matiz predominante do avatar e define
   --glow-color. Branco puro é o padrão até o avatar carregar ou quando ele contém somente letras ou é
   monocromático.
 */
.invite-glow {
  --glow-color: rgba(255, 255, 255, 0.28);
  --glow-color-fade: rgba(255, 255, 255, 0.08);
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle,
      var(--glow-color) 0%,
      var(--glow-color-fade) 42%,
      transparent 70%);
  filter: blur(18px);
  animation: inviteBreathe 5s ease-in-out infinite;
  transition: background 0.5s ease;
}

@keyframes inviteBreathe {

  0%,
  100% {
    transform: scale(0.94);
    opacity: 0.75;
  }

  50% {
    transform: scale(1.04);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .invite-glow {
    animation: none;
  }
}

.invite-avatar {
  position: relative;
  width: 136px;
  height: 136px;
  font-size: 48px;
  font-weight: 600;
  border: 0;
  box-shadow: var(--shadow);
}

.invite-identity {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.invite-eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.invite-name {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.invite-sub {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--muted);
}

.invite-sub.is-bad {
  color: var(--danger);
}

.invite-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.invite-decline {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
}

.invite-decline:hover {
  color: var(--text);
  text-decoration: underline;
}

.invite-note {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.invite-foot {
  position: relative;
  z-index: 1;
}

@media (max-width: 480px) {
  .invite-card {
    padding: 36px 24px 30px;
    gap: 22px;
    border-radius: var(--radius);
  }

  .invite-avatar {
    width: 120px;
    height: 120px;
    font-size: 42px;
  }

  .invite-glow {
    width: 230px;
    height: 230px;
  }
}

/* ------------------------------------------------- meu cartão de convite, no perfil --- */

/**
 * Seu cartão pessoal de convite, aberto ao clicar em “Ver cartão” no editor de perfil. Exibe
 * discretamente o banner desfocado como fundo, um QR code com alta correção de erros e o avatar
 * centralizado, além de um ícone simples para copiar para a área de transferência.
 */
/* Abaixo do banner, à direita da linha do avatar. Botão somente com ícone. */
.profile-view-card-btn {
  margin-left: auto;
  margin-bottom: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: rgb(var(--ink) / 0.08);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.profile-view-card-btn:hover {
  background: rgb(var(--ink) / 0.14);
}

.profile-view-card-btn:active {
  transform: scale(0.95);
}

.profile-view-card-btn:focus-visible {
  outline: 2px solid rgb(var(--ink) / 0.5);
  outline-offset: 2px;
}

.profile-view-card-btn svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.profile-invite {
  position: relative;
  width: min(340px, 100%);
  min-height: 395px;
  border-radius: 20px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: none;
  border: 0;
  display: flex;
  flex-direction: column;
  animation: inviteCardZoomIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes inviteCardZoomIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(6px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .profile-invite {
    animation: none;
  }
}

.profile-invite-banner-wash {
  position: absolute;
  inset: -4px;
  z-index: 0;
  background-size: cover;
  background-position: center 30%;
  background-repeat: no-repeat;
  filter: blur(4px) saturate(1.1);
  opacity: 0.95;
  transform: scale(1.02);
  pointer-events: none;
  image-rendering: -webkit-optimize-contrast;
}

.profile-invite-surface-overlay {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(14, 14, 18, 0.18);
  pointer-events: none;
}

.profile-invite-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px 0;
  width: 100%;
  pointer-events: none;
}

.profile-invite-header .profile-close-btn {
  position: static;
  pointer-events: auto;
}

.profile-invite-body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  padding: 0 24px;
  text-align: center;
}

.profile-invite-title-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: auto 0;
}

.profile-invite-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

.profile-invite-code {
  display: grid;
  place-items: center;
  width: 220px;
  height: 220px;
  padding: 10px;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.profile-invite-code canvas {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  display: block;
}

.profile-invite-code.is-empty {
  font-size: 12px;
  color: #555555;
  text-align: center;
  padding: 18px;
}

.profile-invite-spinner {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2.5px solid rgba(0, 0, 0, 0.12);
  border-top-color: #111111;
  animation: profileInviteSpin 0.75s linear infinite;
}

@keyframes profileInviteSpin {
  to {
    transform: rotate(1turn);
  }
}

@media (prefers-reduced-motion: reduce) {
  .profile-invite-spinner {
    animation-duration: 2s;
  }
}

.profile-invite-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0.92;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
  pointer-events: none;
  user-select: none;
  margin: auto 0;
}

.profile-invite-brand .profile-invite-logo {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
}

.profile-invite-brand-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1;
  display: inline-block;
  transform: translateY(-2px);
}

:root[data-theme="light"] .profile-invite-brand .profile-invite-logo {
  filter: grayscale(1) brightness(0);
}

.profile-invite-copy-btn {
  background: none;
  border: 0;
  padding: 4px;
  cursor: pointer;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.profile-invite-copy-btn:hover {
  color: var(--text);
  background: rgb(var(--ink) / 0.15);
  transform: scale(1.1);
}

.profile-invite-copy-btn:active {
  transform: scale(0.94);
}

.profile-invite-copy-btn.is-copied {
  color: var(--speaking);
}

.profile-invite-copy-btn svg {
  width: 17px;
  height: 17px;
}

.profile-invite[hidden] {
  display: none !important;
}
