/* ===========================================================
   Bad News — sistema visual.

   Três decisões sustentam o resto:

   1. PROFUNDIDADE POR CAMADAS, não por sombras. A barra lateral é a
      superfície mais funda, o conteúdo é a mais alta. Cada camada sobe um
      degrau de luminosidade e ganha um fio de 1px. Sombra fica reservada para
      o que realmente flutua sobre a interface — menus, modais, avisos.

   2. O ACENTO É RARO. Roxo só aparece no que está ativo agora ou no que a
      pessoa deve tocar em seguida. Interface de chamada de voz passa horas na
      tela; cor demais cansa e some o significado.

   3. TUDO NUMA GRADE DE 4px. Espaços, raios e tamanhos de ícone saem da mesma
      escala — é o que faz o conjunto parecer desenhado e não montado.
   =========================================================== */

:root {
  /* ---- superfícies, da mais funda à mais alta ---- */
  --surface-0: #0d0e12;   /* fundo absoluto, atrás de tudo */
  --surface-1: #131419;   /* barra lateral */
  --surface-2: #191b21;   /* conteúdo principal */
  --surface-3: #20222a;   /* cartões, campos elevados */
  --surface-4: #272a33;   /* menus e modais */

  --overlay-soft: rgba(255, 255, 255, .04);
  --overlay-mid: rgba(255, 255, 255, .07);
  --overlay-strong: rgba(255, 255, 255, .11);

  /* ---- texto ---- */
  --text-1: #eceef3;      /* títulos e o que precisa ser lido */
  --text-2: #a8adbb;      /* apoio */
  --text-3: #6f7484;      /* rótulos, metadados */
  --text-max: #ffffff;

  /* ---- fios ---- */
  --line: rgba(255, 255, 255, .06);
  --line-2: rgba(255, 255, 255, .10);
  --line-3: rgba(255, 255, 255, .16);

  /* ---- cor ---- */
  --accent: #6366f1;
  --accent-hi: #818cf8;
  --accent-lo: #4f46e5;
  --accent-ghost: rgba(99, 102, 241, .14);
  --accent-text: #ffffff;

  --live: #f43f5e;        /* transmitindo, gravando, perigo */
  --live-ghost: rgba(244, 63, 94, .13);
  --ok: #34d399;          /* conectado, falando */
  --ok-ghost: rgba(52, 211, 153, .13);
  --warn: #fbbf24;
  --warn-ghost: rgba(251, 191, 36, .12);

  /* ---- forma ---- */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-full: 999px;

  /* ---- elevação: só para o que flutua ---- */
  --lift-1: 0 1px 2px rgba(0, 0, 0, .3);
  --lift-2: 0 4px 16px -2px rgba(0, 0, 0, .45);
  --lift-3: 0 18px 48px -12px rgba(0, 0, 0, .7), 0 0 0 1px var(--line-2);

  /* ---- medidas ---- */
  --sidebar-w: 256px;
  --members-w: 240px;
  --bar-h: 52px;

  /* ---- tipografia ---- */
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", ui-monospace, Consolas, monospace;

  /* ---- tempo ---- */
  --fast: 110ms cubic-bezier(.2, 0, 0, 1);
  --med: 180ms cubic-bezier(.2, 0, 0, 1);
}

:root[data-theme="light"] {
  --surface-0: #e7e9ee;
  --surface-1: #eef0f4;
  --surface-2: #ffffff;
  --surface-3: #f5f6f9;
  --surface-4: #ffffff;

  --overlay-soft: rgba(0, 0, 0, .035);
  --overlay-mid: rgba(0, 0, 0, .06);
  --overlay-strong: rgba(0, 0, 0, .10);

  --text-1: #14161c;
  --text-2: #4e5464;
  --text-3: #7b8194;
  --text-max: #000000;

  --line: rgba(0, 0, 0, .07);
  --line-2: rgba(0, 0, 0, .11);
  --line-3: rgba(0, 0, 0, .18);

  --accent-ghost: rgba(99, 102, 241, .11);
  --lift-1: 0 1px 2px rgba(16, 20, 40, .08);
  --lift-2: 0 4px 16px -2px rgba(16, 20, 40, .12);
  --lift-3: 0 18px 48px -12px rgba(16, 20, 40, .22), 0 0 0 1px var(--line-2);
}

/* ===================== base ===================== */

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; margin: 0; overflow: hidden; }

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-1);
  background: var(--surface-0);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";
  overscroll-behavior: none;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; color: inherit; }
a { color: var(--accent-hi); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

h1, h2, h3, h4 { letter-spacing: -.015em; }

/* Anel de foco único, visível nos dois temas e nunca cortado. */
:focus-visible {
  outline: 2px solid var(--accent-hi);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--overlay-mid);
  border-radius: var(--r-full);
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--overlay-strong); background-clip: content-box; }
::selection { background: var(--accent); color: #fff; }

/* ===================== ícones ===================== */

/*
 * Um só traço para todo o conjunto. Sem isto, ícones de origens diferentes
 * brigam: um parece mais gordo que o outro no mesmo tamanho, e o olho percebe
 * a inconsistência antes de saber nomeá-la.
 */
.icone {
  display: block;
  flex: none;
  stroke-width: 1.75;
  vector-effect: non-scaling-stroke;
}
.icone-inline {
  display: inline-block;
  vertical-align: -.18em;
  margin-right: .35em;
}

/* ===================== botões ===================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  color: var(--text-1);
  font-size: 14px;
  font-weight: 550;
  letter-spacing: -.005em;
  border: 1px solid var(--line);
  transition: background var(--fast), border-color var(--fast), transform var(--fast), opacity var(--fast);
  white-space: nowrap;
}
.btn:hover { background: var(--surface-4); border-color: var(--line-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn .icone { width: 16px; height: 16px; }

.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-text);
  box-shadow: var(--lift-1);
}
.btn-primary:hover { background: var(--accent-lo); border-color: transparent; }

.btn-danger { background: var(--live); border-color: transparent; color: #fff; }
.btn-danger:hover { filter: brightness(1.1); }

.btn-ghost { background: transparent; border-color: var(--line-2); }
.btn-ghost:hover { background: var(--overlay-soft); }

.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: var(--r-xs); }

/* botão que é só ícone */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  flex: none;
  transition: color var(--fast), background var(--fast);
}
.icon-btn .icone { width: 19px; height: 19px; }
.icon-btn:hover { color: var(--text-1); background: var(--overlay-soft); }
.icon-btn.is-active { color: var(--text-1); background: var(--overlay-mid); }
.icon-btn.accent { color: var(--accent-hi); }
.icon-btn.accent:hover { color: var(--accent-hi); background: var(--accent-ghost); }
.icon-btn.danger:hover { color: var(--live); background: var(--live-ghost); }
.icon-btn-tiny { width: 24px; height: 24px; }
.icon-btn-tiny .icone { width: 15px; height: 15px; }

/* Alterna o par ligado/desligado pelo estado do próprio botão. */
.icon-btn .i-off { display: none; }
.icon-btn[aria-pressed="true"] .i-on { display: none; }
.icon-btn[aria-pressed="true"] .i-off { display: block; }
.icon-btn[aria-pressed="true"] { color: var(--live); }
.icon-btn[aria-pressed="true"]:hover { background: var(--live-ghost); }

.select-sm {
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xs);
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text-1);
  transition: border-color var(--fast);
}
.select-sm:hover { border-color: var(--line-3); }

/* ===================== entrada ===================== */

.auth-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: auto;
  background: var(--surface-0);
}
/*
 * Dois halos largos e de baixa opacidade em vez de um degradê chapado: dão
 * profundidade sem competir com o cartão, que é onde a atenção deve ir.
 */
.auth-screen::before {
  content: '';
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(46% 38% at 18% 8%, rgba(99, 102, 241, .26), transparent 70%),
    radial-gradient(42% 36% at 86% 96%, rgba(244, 63, 94, .16), transparent 70%);
  filter: blur(20px);
  pointer-events: none;
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 36px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  box-shadow: var(--lift-3);
}
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.auth-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  flex: none;
  background: linear-gradient(145deg, var(--accent-hi), var(--accent-lo) 55%, #a855f7);
  box-shadow: 0 6px 20px -4px rgba(99, 102, 241, .6);
}
.auth-brand h1 { margin: 0; font-size: 23px; font-weight: 680; letter-spacing: -.025em; }

.auth-tabs {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: var(--surface-0);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  margin-bottom: 22px;
}
.auth-tab {
  flex: 1;
  padding: 8px;
  border-radius: var(--r-xs);
  font-size: 14px;
  font-weight: 550;
  color: var(--text-3);
  transition: color var(--fast), background var(--fast);
}
.auth-tab:hover { color: var(--text-2); }
.auth-tab.is-active { background: var(--surface-3); color: var(--text-1); box-shadow: var(--lift-1); }

.field { display: block; margin-bottom: 16px; }
.field > span {
  display: block;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 7px;
}
.field input, .field textarea, .field select {
  width: 100%;
  padding: 11px 13px;
  background: var(--surface-0);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  color: var(--text-1);
  transition: border-color var(--fast), background var(--fast);
}
.field input::placeholder { color: var(--text-3); }
.field input:hover, .field textarea:hover { border-color: var(--line-3); }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-1);
}
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

.auth-note {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-2);
  background: var(--accent-ghost);
  border: 1px solid rgba(99, 102, 241, .22);
  padding: 12px 14px;
  border-radius: var(--r-sm);
  margin: 0 0 16px;
}
.auth-error { font-size: 13px; color: #fb7185; margin: 0 0 16px; }

/* ===================== estrutura ===================== */

.app { display: flex; height: 100dvh; background: var(--surface-0); }

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--surface-1);
  min-height: 0;
  position: relative;
  z-index: 2;
}

.server-header {
  height: var(--bar-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px 0 18px;
  border-bottom: 1px solid var(--line);
}
.server-header h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -.015em;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#btn-server-menu .icone { width: 16px; height: 16px; }

.channel-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 10px 18px;
  min-height: 0;
}

/* ---- categorias ---- */

.category { margin-top: 16px; }
.category:first-child { margin-top: 0; }
.category-head {
  display: flex;
  align-items: center;
  gap: 3px;
  width: 100%;
  padding: 5px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  color: var(--text-3);
  text-transform: uppercase;
  transition: color var(--fast);
}
.category-head:hover { color: var(--text-2); }
.category-head .chev { width: 13px; height: 13px; transition: transform var(--med); }
.category-head .chev .icone { width: 13px; height: 13px; }
.category.is-collapsed .chev { transform: rotate(-90deg); }
.category.is-collapsed .category-body > .channel-row:not(.has-people):not(.is-active),
.category.is-collapsed .category-body > div > .channel-row:not(.is-active) { display: none; }
.category-add {
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: var(--r-xs);
  color: var(--text-3);
  transition: color var(--fast), background var(--fast);
}
.category-add .icone { width: 14px; height: 14px; }
.category-add:hover { color: var(--text-1); background: var(--overlay-mid); }

/* ---- canais ---- */

.channel-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 9px;
  margin: 1px 0;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: 14.5px;
  text-align: left;
  transition: background var(--fast), color var(--fast);
}
.channel-row:hover { background: var(--overlay-soft); color: var(--text-1); }
.channel-row.is-active { background: var(--overlay-mid); color: var(--text-max); }

/*
 * Marca de canal ativo à esquerda. Um bloco de cor cheia diria "selecionado"
 * com mais força do que o necessário — a barra fina orienta sem gritar.
 */
.channel-row.is-active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 var(--r-full) var(--r-full) 0;
  background: var(--accent-hi);
}
.channel-row.has-unread { color: var(--text-max); font-weight: 600; }

.channel-row .glyph { flex: none; display: grid; place-items: center; color: var(--text-3); }
.channel-row .glyph .icone { width: 17px; height: 17px; }
.channel-row.is-active .glyph, .channel-row.has-unread .glyph { color: var(--text-2); }
.channel-row .label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.channel-row .badge {
  flex: none;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--live);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  border-radius: var(--r-full);
  display: grid;
  place-items: center;
}
.channel-row .count {
  flex: none;
  display: flex;
  align-items: center;
  font-size: 11.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.channel-row .count .icone { width: 14px; height: 14px; }

/* ---- pessoas na sala de voz ---- */

.voice-members { padding: 2px 0 6px 14px; display: flex; flex-direction: column; gap: 1px; }
.voice-member {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 4px 8px;
  border-radius: var(--r-xs);
  font-size: 13.5px;
  color: var(--text-2);
  transition: background var(--fast), color var(--fast);
}
.voice-member:hover { background: var(--overlay-soft); color: var(--text-1); }
.voice-member .avatar {
  width: 22px;
  height: 22px;
  font-size: 9px;
  box-shadow: 0 0 0 0 transparent;
  transition: box-shadow var(--fast);
}
.voice-member .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Anel de quem está falando: a informação mais consultada da tela. */
.voice-member.is-speaking .avatar { box-shadow: 0 0 0 2px var(--ok), 0 0 12px -2px var(--ok); }
.voice-member.is-speaking .name { color: var(--text-1); }

.voice-member .flags { display: flex; align-items: center; gap: 5px; flex: none; color: var(--text-3); }
.voice-member .flags .icone { width: 14px; height: 14px; }
.voice-member .flags .off { color: var(--live); }
.voice-member .flags .live {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 5px 1px 4px;
  border-radius: var(--r-xs);
  background: var(--live-ghost);
  color: var(--live);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .05em;
}
.voice-member .flags .live .icone { width: 10px; height: 10px; }

/* ---- painel de voz ---- */

.voice-panel {
  flex: none;
  margin: 0 10px 8px;
  padding: 10px 11px;
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  box-shadow: var(--lift-1);
}
.voice-panel-top { display: flex; align-items: center; gap: 9px; }
.voice-panel-status { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; }
.voice-panel-status strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ok);
  letter-spacing: -.01em;
}
.voice-panel-status small {
  display: block;
  font-size: 11.5px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.voice-panel.is-bad .voice-panel-status strong { color: var(--warn); }
.voice-panel.is-failed .voice-panel-status strong { color: var(--live); }

.quality-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-ghost);
  animation: pulso 2.4s ease-in-out infinite;
}
.voice-panel.is-bad .quality-dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-ghost); }
.voice-panel.is-failed .quality-dot { background: var(--live); box-shadow: 0 0 0 3px var(--live-ghost); animation: none; }
@keyframes pulso { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

.voice-panel-actions { display: flex; gap: 5px; margin-top: 9px; }
.voice-panel-actions .btn { flex: 1; padding: 6px; font-size: 12px; gap: 5px; }
.voice-panel-actions .btn .icone { width: 14px; height: 14px; }
.voice-panel-actions .btn.is-on { background: var(--accent); border-color: transparent; color: #fff; }
.voice-panel-actions .btn.is-live { background: var(--live); border-color: transparent; color: #fff; }

/* ---- painel do usuário ---- */

.user-panel {
  flex: none;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 8px 10px 10px;
  background: var(--surface-0);
  border-top: 1px solid var(--line);
}
.me-card {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  min-width: 0;
  padding: 5px;
  border-radius: var(--r-sm);
  text-align: left;
  transition: background var(--fast);
}
.me-card:hover { background: var(--overlay-soft); }
.me-text { min-width: 0; }
.me-text strong {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.me-text small {
  display: block;
  font-size: 11.5px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-panel-actions { display: flex; gap: 1px; }
.user-panel-actions .icon-btn { width: 32px; height: 32px; }
.user-panel-actions .icon-btn .icone { width: 18px; height: 18px; }

/* ===================== avatares ===================== */

.avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--r-full);
  flex: none;
  display: grid;
  place-items: center;
  position: relative;
  font-size: 12.5px;
  font-weight: 650;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: .02em;
  background-size: cover;
  background-position: center;
  overflow: hidden;
  user-select: none;
}
.avatar-sm { width: 26px; height: 26px; font-size: 10px; }
.avatar-lg { width: 76px; height: 76px; font-size: 27px; border-radius: var(--r-lg); }

/* Ponto de presença com recorte no avatar, em vez de sobreposto. */
.avatar[data-presence] { overflow: visible; }
.avatar[data-presence]::after {
  content: '';
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 36%;
  height: 36%;
  min-width: 10px;
  min-height: 10px;
  border-radius: 50%;
  background: var(--text-3);
  box-shadow: 0 0 0 2.5px var(--surface-1);
}
.avatar[data-presence="online"]::after { background: var(--ok); }
.avatar[data-presence="idle"]::after { background: var(--warn); }
.avatar[data-presence="dnd"]::after { background: var(--live); }
.avatar[data-presence="offline"]::after { background: #565c6b; }
.user-panel .avatar[data-presence]::after { box-shadow: 0 0 0 2.5px var(--surface-0); }
.messages .avatar::after { display: none; }

/* ===================== principal ===================== */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface-2);
  border-left: 1px solid var(--line);
}

.main-header {
  height: var(--bar-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px 0 18px;
  border-bottom: 1px solid var(--line);
}
.channel-icon { display: grid; place-items: center; color: var(--text-3); flex: none; }
.channel-icon .icone { width: 20px; height: 20px; }
.main-header h2 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: -.015em;
  flex: none;
  max-width: 36%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.channel-topic {
  font-size: 13px;
  color: var(--text-3);
  padding-left: 12px;
  border-left: 1px solid var(--line-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.spacer { flex: 1; }

.search-wrap { flex: none; position: relative; }
.search-wrap input {
  width: 152px;
  padding: 7px 11px;
  background: var(--surface-0);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--text-1);
  transition: width var(--med), border-color var(--fast), background var(--fast);
}
.search-wrap input::placeholder { color: var(--text-3); }
.search-wrap input:focus { outline: none; width: 240px; border-color: var(--accent); background: var(--surface-1); }

.main-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* ===================== palco de vídeo ===================== */

.stage {
  flex: 1 1 62%;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  background: var(--surface-0);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.stage.is-solo { flex: 1 1 100%; }

/*
 * Tela cheia sem a API de tela cheia do HTML.
 *
 * No aplicativo desktop a janela é que vai para tela cheia, e o palco é
 * promovido a cobrir tudo por cima do resto da interface. O motivo está em
 * `goFullscreen`: `requestFullscreen()` num elemento leva o Chromium a
 * promover a janela a superfície de vídeo, e em parte das placas a janela
 * inteira fica verde.
 */
.stage.is-cheia {
  position: fixed;
  inset: 0;
  z-index: 400;
  border-bottom: none;
  background: #000;
}
.stage.is-cheia .stage-grid { padding: 0; }
.stage.is-cheia .tile { border-radius: 0; border: none; }
/* A barra de controles continua acessível, sobreposta e discreta. */
.stage.is-cheia .stage-bar {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  border-top: none;
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--surface-1) 88%, transparent);
  border: 1px solid var(--line-2);
  box-shadow: var(--lift-3);
  opacity: 0;
  transition: opacity var(--fast);
}
.stage.is-cheia:hover .stage-bar,
.stage.is-cheia .stage-bar:focus-within { opacity: 1; }

/*
 * A grade divide o espaço disponível e cada tile ocupa a célula inteira; o
 * vídeo se encaixa dentro com `contain`.
 *
 * A alternativa óbvia — fixar 16:9 no tile — quebra: com um participante só, a
 * altura calculada passa da área do palco, a grade rola, e as etiquetas
 * chegam a aparecer sobre o chat. Deixar a célula mandar na altura resolve
 * isso de uma vez e mantém o enquadramento correto em qualquer proporção.
 */
.stage-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 10px;
  padding: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  overflow: hidden;
}
.stage-grid.is-focused { display: flex; flex-direction: column; }

.tile {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  background: #07080b;
  border-radius: var(--r-md);
  overflow: hidden;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1px var(--line-2);
  transition: box-shadow var(--med);
}
/* O anel de fala é sombra, não borda: não muda o tamanho da caixa ao acender. */
.tile.is-speaking { box-shadow: inset 0 0 0 2px var(--ok), 0 0 24px -8px var(--ok); }
.tile.is-focused { flex: 1; }
.stage-grid.is-focused .tile:not(.is-focused) { display: none; }

/*
 * Uma trilha só, de mínimo zero, com vídeo e placeholder na mesma célula.
 *
 * Com a trilha automática, a grade calculava a altura da linha pela proporção
 * do vídeo, e não pela altura do cartão. Num cartão mais largo que 16:9 — o
 * modo ampliado numa janela larga — a caixa do vídeo ficava mais alta que o
 * cartão e a base da tela era cortada: medido, 718 px de vídeo num cartão de
 * 275. Em tela cheia a proporção bate e o defeito sumia, o que o escondia.
 * `object-fit: contain` não resolvia porque ele ajusta a imagem dentro da
 * caixa do vídeo, e era a caixa que estava grande demais.
 */
.tile { grid-template: minmax(0, 1fr) / minmax(0, 1fr); }
.tile > video, .tile > .tile-placeholder { grid-area: 1 / 1; min-width: 0; min-height: 0; }

.tile video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.tile.is-cam video { object-fit: cover; }
.tile-placeholder { display: grid; place-items: center; gap: 12px; color: var(--text-3); }
.tile-placeholder .avatar { width: 72px; height: 72px; font-size: 25px; border-radius: var(--r-lg); }

.tile-label {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: var(--r-full);
  background: rgba(8, 9, 12, .72);
  backdrop-filter: blur(10px);
  font-size: 12.5px;
  font-weight: 550;
  color: #fff;
  max-width: calc(100% - 20px);
}
.tile-label .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-label .icone { width: 14px; height: 14px; color: rgba(255, 255, 255, .75); }
.tile-label .icone.off { color: var(--live); }
.tile-label .tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .06em;
  padding: 2px 6px;
  border-radius: var(--r-xs);
  background: var(--live);
  color: #fff;
}
.tile-label .tag .icone { width: 10px; height: 10px; color: currentColor; }
.tile-label .tag.cam { background: var(--accent); }

.tile-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 5px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity var(--med), transform var(--med);
}
.tile:hover .tile-actions, .tile:focus-within .tile-actions { opacity: 1; transform: none; }
.tile-actions button {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: rgba(8, 9, 12, .7);
  backdrop-filter: blur(10px);
  color: #fff;
  display: grid;
  place-items: center;
  transition: background var(--fast);
}
.tile-actions button:hover { background: rgba(8, 9, 12, .92); }
.tile-actions .icone { width: 16px; height: 16px; }

.tile-stats {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 6px 9px;
  border-radius: var(--r-sm);
  background: rgba(8, 9, 12, .72);
  backdrop-filter: blur(10px);
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.65;
  color: #7dd3a8;
  white-space: pre;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

.stage-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface-1);
  border-top: 1px solid var(--line);
}
.stage-info {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stage-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }

.round-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  font-size: 13px;
  font-weight: 550;
  color: var(--text-1);
  transition: background var(--fast), color var(--fast), border-color var(--fast);
}
.round-btn .icone { width: 16px; height: 16px; }
.round-btn:hover { background: var(--surface-4); border-color: var(--line-3); }
.round-btn.is-on { background: var(--accent); border-color: transparent; color: #fff; }
.round-btn.is-live { background: var(--live); border-color: transparent; color: #fff; }
.round-btn.is-off { background: var(--live-ghost); border-color: rgba(244, 63, 94, .3); color: #fb7185; }
.round-btn.danger { color: #fb7185; border-color: rgba(244, 63, 94, .25); }
.round-btn.danger:hover { background: var(--live); border-color: transparent; color: #fff; }

/* ===================== chat ===================== */

.chat { flex: 1 1 38%; display: flex; flex-direction: column; min-height: 0; position: relative; }

.messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 8px 10px 0;
  min-height: 0;
  overflow-anchor: none;
}

.msg-day {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 20px 12px;
  font-size: 11px;
  font-weight: 650;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .07em;
}
.msg-day::before, .msg-day::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.new-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 20px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--live);
  text-transform: uppercase;
  letter-spacing: .07em;
}
.new-divider::before { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--live)); }

/*
 * Mensagens seguidas do mesmo autor formam um bloco. O respiro entre elas é
 * menor que entre blocos, mas não zero — sem ele, cinco frases viram um
 * parágrafo só e some a noção de onde uma mensagem termina.
 */
.msg { display: flex; gap: 14px; padding: 4px 20px; position: relative; }
.msg:hover { background: var(--overlay-soft); }
.msg.is-grouped { padding-top: 2px; padding-bottom: 2px; }
.msg.is-first { margin-top: 16px; }
.msg.is-mention { background: var(--warn-ghost); box-shadow: inset 2px 0 0 var(--warn); }
.msg.is-mention:hover { background: rgba(251, 191, 36, .17); }
.msg.is-pending { opacity: .5; }
.msg.is-failed { box-shadow: inset 2px 0 0 var(--live); }
.msg.is-highlight { animation: destaque 1.8s ease-out; }
@keyframes destaque {
  0%, 35% { background: var(--accent-ghost); box-shadow: inset 2px 0 0 var(--accent); }
  100% { background: transparent; box-shadow: none; }
}

.msg-gutter { width: 40px; flex: none; display: flex; justify-content: center; padding-top: 2px; }
.msg-gutter .avatar { width: 40px; height: 40px; font-size: 14px; border-radius: var(--r-md); }
.msg-time-hover {
  font-size: 10.5px;
  color: var(--text-3);
  opacity: 0;
  padding-top: 5px;
  font-variant-numeric: tabular-nums;
  transition: opacity var(--fast);
}
.msg:hover .msg-time-hover { opacity: 1; }

.msg-body { flex: 1; min-width: 0; }
.msg-head { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; margin-bottom: 1px; }
.msg-author {
  font-size: 15px;
  font-weight: 620;
  letter-spacing: -.01em;
  color: var(--text-1);
  cursor: pointer;
}
.msg-author:hover { text-decoration: underline; text-underline-offset: 2px; }
.msg-role {
  display: inline-flex;
  align-items: center;
  font-size: 9.5px;
  font-weight: 750;
  padding: 2px 6px;
  border-radius: var(--r-xs);
  background: var(--accent);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.msg-role.owner { background: linear-gradient(135deg, var(--warn), #f59e0b); color: #3d2c00; }
.msg-stamp { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.msg-edited { font-size: 10.5px; color: var(--text-3); display: inline-flex; align-items: center; gap: 3px; }
.msg-edited .icone { width: 11px; height: 11px; }

.msg-reply {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 4px;
  cursor: pointer;
  max-width: 100%;
}
.msg-reply::before {
  content: '';
  width: 24px;
  height: 9px;
  flex: none;
  margin-left: -30px;
  border-left: 2px solid var(--line-3);
  border-top: 2px solid var(--line-3);
  border-top-left-radius: var(--r-xs);
  align-self: flex-end;
}
.msg-reply .avatar { width: 16px; height: 16px; font-size: 7.5px; border-radius: var(--r-xs); }
.msg-reply .snippet { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-reply:hover .snippet, .msg-reply:hover strong { color: var(--text-2); }

.msg-text { font-size: 15px; line-height: 1.55; word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; }
.msg-text p { margin: 0; }
.msg-text code {
  font-family: var(--mono);
  font-size: 13px;
  padding: 2px 5px;
  background: var(--surface-0);
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
}
.msg-text pre {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  margin: 8px 0;
  padding: 12px 14px;
  background: var(--surface-0);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  overflow-x: auto;
  white-space: pre;
}
.msg-text pre code { background: none; border: 0; padding: 0; }
.msg-text blockquote {
  margin: 5px 0;
  padding-left: 12px;
  border-left: 3px solid var(--line-3);
  color: var(--text-2);
}
.msg-text .spoiler {
  background: var(--surface-4);
  color: transparent;
  border-radius: var(--r-xs);
  padding: 0 4px;
  cursor: pointer;
  transition: color var(--fast), background var(--fast);
}
.msg-text .spoiler.is-open { background: var(--surface-0); color: inherit; }
.msg-text .mention {
  background: var(--accent-ghost);
  color: var(--accent-hi);
  padding: 1px 4px;
  border-radius: var(--r-xs);
  font-weight: 550;
  cursor: pointer;
  transition: background var(--fast), color var(--fast);
}
.msg-text .mention:hover { background: var(--accent); color: #fff; }
.msg-text .mention.is-me { background: var(--warn-ghost); color: #fcd34d; }
.msg-text .big-emoji { font-size: 42px; line-height: 1.25; }
.msg-system { color: var(--text-3); font-style: italic; font-size: 14px; }

.msg-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.msg-files img, .msg-files video {
  max-width: min(520px, 100%);
  max-height: 380px;
  border-radius: var(--r-sm);
  display: block;
  cursor: zoom-in;
  background: #000;
  box-shadow: 0 0 0 1px var(--line-2);
}
.msg-files video { cursor: default; }
.msg-files audio { width: min(420px, 100%); }
.file-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  max-width: 340px;
  transition: border-color var(--fast), background var(--fast);
}
.file-card:hover { border-color: var(--line-3); background: var(--surface-4); text-decoration: none; }
.file-card .file-icon {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  background: var(--accent-ghost);
  color: var(--accent-hi);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .03em;
}
.file-card .file-meta { min-width: 0; }
.file-card .file-meta strong {
  display: block;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--text-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-card .file-meta small { color: var(--text-3); font-size: 11.5px; }

.msg-reactions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.reaction {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-xs);
  background: var(--surface-3);
  border: 1px solid var(--line);
  font-size: 13.5px;
  line-height: 1.45;
  transition: background var(--fast), border-color var(--fast);
}
.reaction:hover { border-color: var(--line-3); background: var(--surface-4); }
.reaction.is-mine { background: var(--accent-ghost); border-color: rgba(99, 102, 241, .45); }
.reaction .n { font-size: 12px; font-weight: 650; color: var(--text-3); font-variant-numeric: tabular-nums; }
.reaction.is-mine .n { color: var(--accent-hi); }
.reaction .icone { width: 15px; height: 15px; color: var(--text-3); }

.msg-tools {
  position: absolute;
  top: -16px;
  right: 20px;
  display: none;
  gap: 1px;
  background: var(--surface-4);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  box-shadow: var(--lift-2);
  padding: 3px;
  z-index: 3;
}
.msg:hover .msg-tools, .msg:focus-within .msg-tools { display: flex; }
.msg-tools button {
  width: 30px;
  height: 30px;
  border-radius: var(--r-xs);
  display: grid;
  place-items: center;
  color: var(--text-2);
  transition: background var(--fast), color var(--fast);
}
.msg-tools button:hover { background: var(--overlay-mid); color: var(--text-1); }
.msg-tools button.danger:hover { background: var(--live-ghost); color: var(--live); }
.msg-tools .icone { width: 17px; height: 17px; }

.msg-edit textarea {
  width: 100%;
  background: var(--surface-0);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  resize: none;
  font-size: 15px;
  color: var(--text-1);
}
.msg-edit textarea:focus { outline: none; border-color: var(--accent); }
.msg-edit-hint { font-size: 11.5px; color: var(--text-3); margin-top: 5px; }

/*
 * Abertura do canal. Um canal recém-criado é a primeira coisa que alguém vê
 * ao entrar no servidor, e uma linha de texto solta no vazio não diz nada.
 * O emblema dá peso e repete o ícone que a pessoa acabou de clicar na lista.
 */
.msg-empty { padding: 52px 24px 32px; }
.msg-empty .marca {
  width: 60px;
  height: 60px;
  border-radius: var(--r-lg);
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  color: var(--text-2);
}
.msg-empty .marca .icone { width: 28px; height: 28px; }
.msg-empty h3 {
  color: var(--text-1);
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.035em;
}
.msg-empty p { color: var(--text-3); margin: 0; font-size: 15px; line-height: 1.6; max-width: 58ch; }
.load-more { display: grid; place-items: center; padding: 16px; }

.jump-latest { position: absolute; left: 0; right: 0; bottom: 96px; display: grid; place-items: center; pointer-events: none; z-index: 4; }
.jump-latest .btn {
  pointer-events: auto;
  background: var(--accent);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--lift-2);
}

/* ===================== composer ===================== */

.composer-wrap { flex: none; padding: 0 20px 20px; position: relative; }
.typing-bar {
  height: 20px;
  font-size: 12px;
  color: var(--text-3);
  padding: 0 4px 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 12.5px;
  color: var(--text-3);
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  border-bottom: 0;
  border-radius: var(--r-md) var(--r-md) 0 0;
}
.reply-bar strong { color: var(--text-1); font-weight: 600; }
.reply-bar .icon-btn { margin-left: auto; }

.attachment-tray {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px;
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  border-bottom: 0;
  border-radius: var(--r-md) var(--r-md) 0 0;
}
.attachment-chip { position: relative; width: 96px; }
.attachment-chip .thumb {
  width: 96px;
  height: 70px;
  border-radius: var(--r-sm);
  background: var(--surface-0);
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--text-3);
  box-shadow: inset 0 0 0 1px var(--line-2);
}
.attachment-chip .thumb img { width: 100%; height: 100%; object-fit: cover; }
.attachment-chip .name {
  font-size: 10.5px;
  color: var(--text-3);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-chip .kill {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--live);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: var(--lift-1);
}
.attachment-chip .kill .icone { width: 13px; height: 13px; }
.attachment-chip .bar { height: 3px; border-radius: var(--r-full); background: var(--accent); transition: width var(--med); }

.composer {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 6px 8px;
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  transition: border-color var(--fast);
}
.composer:focus-within { border-color: var(--line-3); }
.reply-bar:not([hidden]) ~ .composer,
.attachment-tray:not([hidden]) ~ .composer { border-radius: 0 0 var(--r-md) var(--r-md); }
.composer textarea {
  flex: 1;
  background: none;
  border: 0;
  resize: none;
  padding: 9px 6px;
  max-height: 45vh;
  min-height: 22px;
  line-height: 1.5;
  color: var(--text-1);
}
.composer textarea:focus { outline: none; }
.composer textarea::placeholder { color: var(--text-3); }
.composer-hint { font-size: 11px; color: var(--text-3); padding: 6px 4px 0; min-height: 17px; }

/* ===================== membros ===================== */

.members {
  width: var(--members-w);
  flex: none;
  background: var(--surface-1);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  padding: 14px 10px 24px;
}
.members.is-hidden { display: none; }
.member-group {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 16px 8px 6px;
}
.member-row {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  text-align: left;
  transition: background var(--fast);
}
.member-row:hover { background: var(--overlay-soft); }
.member-row.is-offline { opacity: .45; }
.member-row.is-offline:hover { opacity: .7; }
.member-row .who { min-width: 0; flex: 1; }
.member-row .who strong {
  display: block;
  font-size: 14px;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.member-row .who small {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.member-row .who small .icone { width: 12px; height: 12px; flex: none; }

/* ===================== sobreposições ===================== */

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(6, 7, 10, .6);
  backdrop-filter: blur(6px);
  animation: surgir var(--med);
}
@keyframes surgir { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 100%;
  max-width: 560px;
  max-height: 86vh;
  overflow: auto;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  box-shadow: var(--lift-3);
  padding: 28px;
  animation: subir var(--med) cubic-bezier(.2, .9, .3, 1);
}
.modal.is-wide { max-width: 780px; }
@keyframes subir { from { transform: translateY(12px) scale(.985); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h2 { margin: 0 0 6px; font-size: 21px; font-weight: 680; letter-spacing: -.025em; }
.modal h4 { color: var(--text-1); }
.modal .sub { color: var(--text-3); font-size: 13.5px; line-height: 1.6; margin: 0 0 22px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 24px; }

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
  overflow-x: auto;
}
.tabs button {
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 550;
  color: var(--text-3);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color var(--fast), border-color var(--fast);
}
.tabs button:hover { color: var(--text-2); }
.tabs button.is-active { color: var(--text-1); border-bottom-color: var(--accent); }

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.setting-row:last-child { border-bottom: 0; }
.setting-row .info { min-width: 0; }
.setting-row .info strong { display: block; font-size: 14.5px; font-weight: 570; margin-bottom: 2px; }
.setting-row .info small { color: var(--text-3); font-size: 12.5px; line-height: 1.5; display: block; }
.setting-row select,
.setting-row input[type="text"],
.setting-row input[type="password"] {
  min-width: 190px;
  max-width: 280px;
  padding: 8px 11px;
  background: var(--surface-0);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  color: var(--text-1);
}
.setting-row select:focus, .setting-row input:focus { outline: none; border-color: var(--accent); }
.setting-row input[type="range"] { accent-color: var(--accent); }

.switch {
  position: relative;
  width: 44px;
  height: 25px;
  flex: none;
  border-radius: var(--r-full);
  background: var(--overlay-strong);
  transition: background var(--med);
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--lift-1);
  transition: transform var(--med);
}
.switch[aria-pressed="true"] { background: var(--accent); }
.switch[aria-pressed="true"]::after { transform: translateX(19px); }

.level-meter {
  height: 8px;
  border-radius: var(--r-full);
  background: var(--surface-0);
  overflow: hidden;
  margin-top: 10px;
  box-shadow: inset 0 0 0 1px var(--line);
}
.level-meter i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--ok), var(--warn) 78%, var(--live));
  transition: width 70ms linear;
}

.keycap {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--r-xs);
  background: var(--surface-0);
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-2);
}

.invite-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.invite-row code {
  font-family: var(--mono);
  background: var(--surface-0);
  border: 1px solid var(--line);
  padding: 5px 10px;
  border-radius: var(--r-xs);
  font-size: 13px;
  color: var(--text-1);
}
.invite-row .muted { color: var(--text-3); font-size: 12px; }

.context-root { position: fixed; inset: 0; z-index: 300; }
.context-menu {
  position: absolute;
  min-width: 200px;
  padding: 5px;
  background: var(--surface-4);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  box-shadow: var(--lift-3);
  animation: subir 120ms cubic-bezier(.2, .9, .3, 1);
}
.context-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--r-xs);
  font-size: 13.5px;
  text-align: left;
  color: var(--text-2);
  transition: background var(--fast), color var(--fast);
}
.context-menu button:hover { background: var(--accent); color: #fff; }
.context-menu button.danger { color: #fb7185; }
.context-menu button.danger:hover { background: var(--live); color: #fff; }
.context-menu .icone { width: 16px; height: 16px; }
.context-menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 2px; }
.context-menu .head {
  padding: 8px 10px 6px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-3);
  letter-spacing: .06em;
}

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface-4);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  box-shadow: var(--lift-3);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-1);
  max-width: 400px;
  pointer-events: auto;
  animation: entrar var(--med) cubic-bezier(.2, .9, .3, 1);
}
.toast .icone { width: 17px; height: 17px; flex: none; margin-top: 1px; color: var(--accent-hi); }
.toast.is-error { border-color: rgba(244, 63, 94, .35); }
.toast.is-error .icone { color: var(--live); }
.toast.is-success { border-color: rgba(52, 211, 153, .35); }
.toast.is-success .icone { color: var(--ok); }
@keyframes entrar { from { transform: translateX(28px); opacity: 0; } to { transform: none; opacity: 1; } }

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  background: rgba(99, 102, 241, .16);
  backdrop-filter: blur(3px);
}
.drop-overlay div {
  padding: 36px 60px;
  border: 2px dashed var(--accent-hi);
  border-radius: var(--r-xl);
  background: var(--surface-2);
  font-size: 17px;
  font-weight: 600;
  box-shadow: var(--lift-3);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: grid;
  place-items: center;
  background: rgba(4, 5, 7, .93);
  padding: 32px;
}
.lightbox img, .lightbox video { max-width: 100%; max-height: 88vh; border-radius: var(--r-md); }
.lightbox .close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  color: rgba(255, 255, 255, .75);
  background: rgba(255, 255, 255, .08);
  transition: background var(--fast), color var(--fast);
}
.lightbox .close:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.lightbox .close .icone { width: 22px; height: 22px; }

/* emoji */
.emoji-panel {
  position: absolute;
  bottom: 80px;
  right: 20px;
  width: 330px;
  max-height: 330px;
  overflow-y: auto;
  background: var(--surface-4);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  box-shadow: var(--lift-3);
  padding: 10px;
  z-index: 50;
  animation: subir 120ms cubic-bezier(.2, .9, .3, 1);
}
.emoji-panel h4 {
  margin: 10px 4px 6px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-3);
  letter-spacing: .06em;
}
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.emoji-grid button {
  font-size: 21px;
  height: 36px;
  border-radius: var(--r-xs);
  line-height: 1;
  transition: background var(--fast), transform var(--fast);
}
.emoji-grid button:hover { background: var(--overlay-mid); transform: scale(1.15); }

.only-mobile { display: none; }

/* ===================== responsivo ===================== */

@media (max-width: 1180px) {
  .members { display: none; }
  .members.is-forced {
    display: block;
    position: absolute;
    right: 0;
    top: var(--bar-h);
    bottom: 0;
    z-index: 30;
    box-shadow: var(--lift-3);
  }
  .app { position: relative; }
}

@media (max-width: 780px) {
  :root { --sidebar-w: 84vw; }
  .only-mobile { display: inline-flex; }
  .sidebar {
    position: absolute;
    inset: 0 auto 0 0;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform var(--med);
    box-shadow: var(--lift-3);
    max-width: 330px;
  }
  .sidebar.is-open { transform: none; }
  .channel-topic, .search-wrap { display: none; }
  .main-header h2 { max-width: none; }
  .msg { padding-left: 14px; padding-right: 14px; }
  .composer-wrap { padding: 0 12px 14px; }
  .stage-grid { grid-template-columns: 1fr; }
  .modal { padding: 22px; border-radius: var(--r-lg); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ===================== recepção ===================== */

/*
 * Aparece uma vez, logo depois de a conta ser criada, e sai com qualquer
 * clique ou tecla. Cobre tudo de propósito: é para ser a única coisa na tela
 * no segundo em que aparece.
 */
.recepcao {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 40%, #2a1035, #0b0b10 70%);
  opacity: 0;
  transition: opacity var(--med);
  cursor: pointer;
}
.recepcao.is-open { opacity: 1; }

.recepcao-card {
  text-align: center;
  max-width: 1180px;
  transform: scale(.94);
  transition: transform var(--med);
}
.recepcao.is-open .recepcao-card { transform: scale(1); }

.recepcao-oi {
  margin: 0 0 14px;
  font-size: 15px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--text-3);
}

.recepcao-frase {
  margin: 0;
  /*
   * O tamanho leva em conta que a arte ocupa a esquerda: a medida é da largura
   * que sobra, não da tela inteira. Com 8vw a frase empurrava o desenho para
   * cima e a composição virava duas coisas empilhadas.
   */
  font-size: clamp(32px, 5.4vw, 74px);
  font-weight: 800;
  line-height: .95;
  letter-spacing: -.04em;
  /* O degradê evita que o tamanho vire só grito: fica grande e intencional. */
  background: linear-gradient(100deg, #f43f5e, #a855f7 55%, #6366f1);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  overflow-wrap: anywhere;
}

.recepcao-pe {
  margin: 28px 0 0;
  font-size: 13px;
  color: var(--text-3);
  animation: recepcao-pisca 2.4s ease-in-out infinite;
}

@keyframes recepcao-pisca {
  0%, 100% { opacity: .45; }
  50% { opacity: 1; }
}

/*
 * O desenho ao lado do texto. Em tela estreita eles empilham: lado a lado com
 * pouca largura, a frase quebraria em pedaços de duas palavras.
 */
.recepcao-linha {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  flex-wrap: nowrap;
}

/* Só empilha quando de fato não cabe lado a lado. */
@media (max-width: 720px) {
  .recepcao-linha { flex-wrap: wrap; }
}
.recepcao-arte {
  flex: none;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, .45));
  animation: recepcao-balanca 2.6s ease-in-out infinite;
}
.recepcao-arte img { display: block; width: clamp(130px, 20vw, 290px); height: auto; }
.recepcao-texto { text-align: left; }

@media (max-width: 720px) {
  .recepcao-texto { text-align: center; }
}

@keyframes recepcao-balanca {
  0%, 100% { transform: rotate(-5deg) translateY(0); }
  50% { transform: rotate(5deg) translateY(-8px); }
}

/* Quem pediu menos movimento no sistema não deve levar um desenho balançando. */
@media (prefers-reduced-motion: reduce) {
  .recepcao-arte { animation: none; }
  .recepcao-pe { animation: none; }
}

/*
 * Botão dentro do aviso. Só aparece nos avisos que têm conserto conhecido —
 * descrever o problema e deixar a pessoa procurar o ajuste é como garantir que
 * o problema continue.
 */
.toast-acao {
  flex: none;
  margin-left: 4px;
  padding: 5px 12px;
  border-radius: var(--r-sm, 8px);
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  opacity: .9;
}
.toast-acao:hover { opacity: 1; background: rgba(255, 255, 255, .12); }

/* Nota sob o seletor de saída: alerta enquanto a saída padrão estiver em uso. */
.nota-eco { display: block; max-width: 320px; text-align: right; line-height: 1.45; }
.nota-eco.is-alerta { color: var(--warn, #f0883e); }

/*
 * Aviso do eco dentro do seletor de tela. Fica onde a escolha acontece: quem
 * liga o áudio do sistema precisa saber, no mesmo instante, que a voz da
 * chamada vai junto.
 */
.aviso-eco {
  margin-top: 4px;
  padding: 12px 14px;
  border-radius: var(--r-md, 10px);
  background: rgba(240, 136, 62, .1);
  border: 1px solid rgba(240, 136, 62, .35);
}
.aviso-eco strong { display: block; color: var(--warn, #f0883e); font-size: 13.5px; margin-bottom: 5px; }
.aviso-eco p { margin: 0 0 4px; font-size: 12.5px; line-height: 1.5; color: var(--text-3); }
.aviso-eco p:last-child { margin-bottom: 0; }

/* ===================== roleta da entrada ===================== */

.roleta-modos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 20px 0 0; }

.roleta-modo {
  padding: 22px 16px;
  border-radius: var(--r-lg, 14px);
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--text-1);
  font: inherit;
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
  transition: border-color var(--fast), background var(--fast), transform var(--fast);
}
.roleta-modo:hover { border-color: var(--accent); transform: translateY(-2px); }
.roleta-modo.is-escolhido { border-color: var(--accent); background: var(--surface-3); }

.roleta-detalhe {
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--r-md, 10px);
  background: var(--surface-1);
  border: 1px solid var(--line);
}
.roleta-detalhe strong { display: block; margin-bottom: 6px; }
.roleta-detalhe p { margin: 0 0 10px; color: var(--text-3); font-size: 13.5px; line-height: 1.55; }
.roleta-chance { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); margin-bottom: 12px; }

/*
 * A saída para quem não quer apostar. Discreta, e não escondida: obrigar
 * alguém a arriscar a conta para entrar numa conversa seria hostil.
 */
.roleta-covarde {
  display: block;
  width: 100%;
  margin-top: 18px;
  padding: 8px;
  border: none;
  background: none;
  color: var(--text-3);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  opacity: .65;
  transition: opacity var(--fast);
}
.roleta-covarde:hover { opacity: 1; text-decoration: underline; }

.roleta-palco { display: grid; place-items: center; padding: 20px 0 6px; }
.roleta-caixa { position: relative; width: 190px; height: 190px; }

.roleta-roda {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 4px solid var(--surface-3);
  box-shadow: var(--lift-2);
}
/* A seta marca onde a roda para: sem ela não há como ler o resultado. */
.roleta-seta {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
  border-top: 18px solid var(--text-1);
}

.roleta-texto { margin: 16px 0 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.roleta-texto.is-ok { color: var(--ok, #34d399); }
.roleta-texto.is-ruim { color: var(--live, #f43f5e); }

@media (prefers-reduced-motion: reduce) {
  .roleta-roda { transition: none !important; }
}

/*
 * A frase seca embaixo do deboche. O deboche é a piada; esta linha é o fato,
 * e separar as duas deixa claro que a conta foi mesmo.
 */
.roleta-lapide {
  margin: 10px 0 0;
  font-size: 13px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--live, #f43f5e);
  opacity: .85;
}
