/* ==========================================================================
   KORD — folha de estilo unica
   Tema escuro, denso, pensado para uma janela de app e nao para um site.
   ========================================================================== */

:root {
  --bg-0: #14161c;
  --bg-1: #1b1d24;
  --bg-2: #22252e;
  --bg-3: #2b2f3a;
  --bg-rail: #101218;
  --line: #343948;

  --txt-0: #e9ecf4;
  --txt-1: #a8b0c2;
  --txt-2: #6e768a;

  --accent: #5b6cff;
  --accent-hi: #7383ff;
  --good: #3fbf7f;
  --warn: #e0a33a;
  --bad: #e2564c;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.3);
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;

  /* Uma curva so para tudo que se move. Movimento com tempos diferentes em
     cada canto da tela parece defeito, e nao acabamento. */
  --ease: cubic-bezier(0.22, 0.68, 0.35, 1);
  --fast: 0.14s var(--ease);
  --slow: 0.26s var(--ease);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body {
  background: var(--bg-1);
  color: var(--txt-0);
  font-family: var(--font);
  font-size: 14px;
  overflow: hidden;
  user-select: none;
}

input, select, button, textarea { font-family: inherit; font-size: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--txt-2); }

/* ==========================================================================
   Botoes
   ========================================================================== */

.btn {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  cursor: pointer;
  color: var(--txt-0);
  background: var(--bg-3);
  transition: background .12s ease, border-color .12s ease, opacity .12s ease;
}
.btn:hover:not(:disabled) { background: #333846; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hi); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-2); }
.btn-block { width: 100%; margin-top: 6px; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn.is-danger { color: #ffb3ad; border-color: rgba(226, 86, 76, .4); }
.btn.is-danger:hover { background: rgba(226, 86, 76, .12); }
.btn.is-on {
  background: rgba(91, 108, 255, .2);
  border-color: rgba(91, 108, 255, .55);
  color: #c3caff;
}

.btn-link {
  background: none; border: none; color: var(--txt-1); cursor: pointer;
  padding: 0; text-decoration: underline; text-underline-offset: 3px;
}
.btn-link:hover { color: var(--txt-0); }

.btn-icon {
  background: none; border: none; color: var(--txt-1); cursor: pointer;
  font-size: 15px; padding: 4px 8px; border-radius: 6px;
}
.btn-icon:hover { background: var(--bg-3); color: var(--txt-0); }

.mini-btn {
  background: none; border: none; color: var(--txt-1); cursor: pointer;
  font-size: 14px; padding: 5px 6px; border-radius: 6px; line-height: 1;
}
.mini-btn:hover { background: var(--bg-3); color: var(--txt-0); }
.mini-btn.is-off { color: var(--bad); }

.ctrl {
  background: var(--bg-3); border: 1px solid transparent;
  border-radius: var(--radius-sm); color: var(--txt-0); cursor: pointer;
  padding: 6px 12px; display: flex; align-items: center; gap: 7px;
}
.ctrl:hover { background: #363b4a; }
.ctrl-sm { padding: 5px 10px; font-size: 12px; }
.ctrl-icon { font-size: 14px; line-height: 1; }
.ctrl-label { font-size: 12px; }
.ctrl.is-on {
  background: rgba(91, 108, 255, .2);
  border-color: rgba(91, 108, 255, .55);
  color: #c3caff;
}

/* ==========================================================================
   Formularios
   ========================================================================== */

.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block; font-size: 12px; color: var(--txt-1); margin-bottom: 6px;
}
.field > span em { color: var(--txt-2); font-style: normal; }

.field input, .field select {
  width: 100%; background: var(--bg-0); border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--txt-0);
  padding: 10px 12px; outline: none; user-select: text;
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.field small {
  display: block; margin-top: 6px; color: var(--txt-2);
  font-size: 11px; line-height: 1.5;
}

.form-error {
  margin: 12px 0 0; padding: 10px 12px; border-radius: var(--radius-sm);
  background: rgba(226, 86, 76, .12); border: 1px solid rgba(226, 86, 76, .4);
  color: #ffb3ad; font-size: 12px; user-select: text; line-height: 1.5;
}

/* ==========================================================================
   Tela de autenticacao
   ========================================================================== */

.auth {
  height: 100%; display: grid; place-items: center;
  background: radial-gradient(1000px 520px at 50% -10%, #262b45 0%, transparent 65%), var(--bg-1);
}

.auth-card {
  width: 420px; max-height: 94vh; overflow-y: auto;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 14px; padding: 26px 28px 20px; box-shadow: var(--shadow);
}

.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 13px;
  background: linear-gradient(140deg, var(--accent), #8f5bff);
  display: grid; place-items: center; font-weight: 700; font-size: 22px; color: #fff;
}
.brand h1 { margin: 0; font-size: 22px; letter-spacing: -.3px; }
.brand-sub { margin: 2px 0 0; color: var(--txt-2); font-size: 12px; }

.auth-tabs {
  display: flex; gap: 4px; background: var(--bg-0);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 4px; margin-bottom: 18px;
}
.auth-tab {
  flex: 1; background: none; border: none; color: var(--txt-2);
  cursor: pointer; padding: 8px; border-radius: 5px; font-size: 13px;
}
.auth-tab:hover { color: var(--txt-1); }
.auth-tab.is-active { background: var(--bg-3); color: var(--txt-0); }

.auth-foot {
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; color: var(--txt-2);
}

.advanced-box {
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line);
}

/* ==========================================================================
   Estrutura do aplicativo
   ========================================================================== */

.app {
  height: 100%;
  display: grid;
  grid-template-columns: 68px 232px 1fr 232px;
}

/* ------------------------------ trilha ---------------------------------- */

.rail {
  background: var(--bg-rail);
  display: flex; flex-direction: column; align-items: center;
  padding: 10px 0; gap: 8px; overflow-y: auto;
}
.rail::-webkit-scrollbar { width: 0; }

.rail-servers { display: flex; flex-direction: column; gap: 8px; }

.rail-btn {
  width: 46px; height: 46px; border-radius: 15px; border: none;
  cursor: pointer; color: #fff; font-weight: 700; font-size: 15px;
  background: var(--bg-3); display: grid; place-items: center;
  transition: border-radius .14s ease, opacity .14s ease;
  flex-shrink: 0;
}
.rail-btn:hover { border-radius: 12px; }
.rail-server.is-active { border-radius: 12px; box-shadow: 0 0 0 3px var(--accent-hi); }

.rail-divider { width: 28px; height: 1px; background: var(--line); margin: 4px 0; }

.rail-add { background: rgba(63, 191, 127, .16); color: var(--good); font-size: 22px; }
.rail-add:hover { background: var(--good); color: #0d1013; }
.rail-join { background: rgba(91, 108, 255, .16); color: var(--accent-hi); font-size: 18px; }
.rail-join:hover { background: var(--accent); color: #fff; }

/* ------------------------------ canais ---------------------------------- */

.channels {
  background: var(--bg-2); border-right: 1px solid var(--line);
  /* Cabecalho, busca, lista, painel de voz, painel do usuario. So a LISTA
     estica: sem a faixa da busca declarada aqui, era ela que ficava com o
     1fr e empurrava a lista de canais para o rodape. */
  display: grid; grid-template-rows: 46px auto 1fr auto auto; min-height: 0;
  position: relative;
}

.channels-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px; border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.channels-head strong {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.server-menu {
  position: absolute; top: 44px; left: 8px; right: 8px; z-index: 20;
  background: var(--bg-3); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 5px; display: flex; flex-direction: column;
}
.server-menu button {
  background: none; border: none; color: var(--txt-1); cursor: pointer;
  text-align: left; padding: 8px 10px; border-radius: 6px; font-size: 12.5px;
}
.server-menu button:hover { background: var(--bg-2); color: var(--txt-0); }
.server-menu button.is-danger { color: #ff9a92; }
.server-menu button.is-danger:hover { background: rgba(226, 86, 76, .14); }

.channels-list { overflow-y: auto; padding: 8px 6px; min-height: 0; }

.channel-group {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--txt-2); padding: 12px 8px 5px;
}

.channel {
  width: 100%; display: flex; align-items: center; gap: 7px;
  background: none; border: none; color: var(--txt-1); cursor: pointer;
  padding: 7px 8px; border-radius: 6px; text-align: left;
}
.channel:hover { background: var(--bg-3); color: var(--txt-0); }
.channel.is-active { background: var(--bg-3); color: var(--txt-0); }
.channel.is-connected .channel-name { color: var(--good); }

.channel .channel-icon { color: var(--txt-2); font-size: 13px; flex-shrink: 0; }
.channel .channel-name {
  flex: 1; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; font-size: 13px;
}

.channel-delete { opacity: 0; color: var(--txt-2); font-size: 11px; padding: 0 3px; }
.channel:hover .channel-delete { opacity: 1; }
.channel-delete:hover { color: var(--bad); }

.channel-peer {
  display: flex; align-items: center; gap: 7px;
  padding: 4px 8px 4px 26px; font-size: 12px; color: var(--txt-1);
}

/* ------------------------- painel de voz + usuario ---------------------- */

.voice-panel {
  border-top: 1px solid var(--line); padding: 10px 12px;
  background: rgba(63, 191, 127, .05);
}
.voice-panel-top {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; margin-bottom: 2px;
}
.voice-status { color: var(--good); font-weight: 600; }
.voice-status.is-bad { color: var(--bad); }
.voice-ping { color: var(--txt-2); font-variant-numeric: tabular-nums; }
.voice-channel-name {
  font-size: 12px; color: var(--txt-2); margin-bottom: 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.user-panel {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; background: var(--bg-0); border-top: 1px solid var(--line);
}
.user-panel-info { flex: 1; min-width: 0; }
.user-panel-info strong {
  display: block; font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-panel-info small { color: var(--txt-2); font-size: 10.5px; }

/* ------------------------------ principal -------------------------------- */

.main {
  display: grid; grid-template-rows: 48px 1fr; min-height: 0;
  background: var(--bg-1);
}

.main-head {
  display: flex; align-items: center; gap: 10px; padding: 0 16px;
  border-bottom: 1px solid var(--line); background: var(--bg-1);
}
.main-head .channel-icon { color: var(--txt-2); font-size: 16px; }
.main-head-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.chip {
  background: var(--bg-3); border-radius: 999px; padding: 3px 10px;
  font-size: 11px; color: var(--txt-1);
}

.empty-state {
  display: grid; place-content: center; text-align: center; gap: 6px; padding: 40px;
}
.empty-icon {
  width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 10px;
  background: linear-gradient(140deg, var(--accent), #8f5bff);
  display: grid; place-items: center; font-size: 30px; font-weight: 700; color: #fff;
}
.empty-state h2 { margin: 0; font-size: 18px; }
.empty-state p { margin: 0; font-size: 13px; }

/* --------------------------------- palco -------------------------------- */

.stage { position: relative; background: var(--bg-0); overflow: auto; padding: 14px; }

.stage-empty {
  position: absolute; inset: 0; display: grid; place-content: center;
  text-align: center; color: var(--txt-1); gap: 4px;
}
.stage-empty-icon { font-size: 40px; color: var(--txt-2); margin-bottom: 6px; }

.stage-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.video-tile {
  background: #000; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; position: relative; aspect-ratio: 16 / 9;
}
.video-tile.is-cam { aspect-ratio: 4 / 3; background: #0c0d11; }
.video-tile video {
  width: 100%; height: 100%; object-fit: contain; display: block; background: #000;
}
.video-tile.is-cam video { object-fit: cover; }

.video-tile-label {
  position: absolute; left: 8px; bottom: 8px;
  background: rgba(0, 0, 0, .66); border-radius: 6px; padding: 4px 9px;
  font-size: 11px; color: #fff; display: flex; align-items: center; gap: 6px;
}
.video-tile-label .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--bad);
}

.video-tile.is-fullscreen {
  grid-column: 1 / -1; aspect-ratio: auto; height: calc(100vh - 110px);
}

.video-tile-expand {
  position: absolute; right: 8px; top: 8px;
  background: rgba(0, 0, 0, .6); border: none; color: #fff;
  border-radius: 6px; padding: 4px 9px; cursor: pointer; font-size: 11px;
  opacity: 0; transition: opacity .12s ease;
}
.video-tile:hover .video-tile-expand { opacity: 1; }

/* --------------------------------- chat --------------------------------- */

.chat { display: grid; grid-template-rows: 1fr auto; min-height: 0; }

.chat-log {
  overflow-y: auto; padding: 14px 18px;
  display: flex; flex-direction: column; gap: 9px; user-select: text;
}
.chat-msg { font-size: 13.5px; line-height: 1.5; word-break: break-word; }
.chat-msg .who { color: var(--accent-hi); font-weight: 600; margin-right: 7px; }
.chat-msg .when { color: var(--txt-2); font-size: 10px; margin-left: 7px; }
.chat-msg.system { color: var(--txt-2); font-style: italic; font-size: 12px; }

.chat-form { display: flex; gap: 8px; padding: 12px 18px 16px; }
.chat-form input {
  flex: 1; min-width: 0; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--txt-0);
  padding: 11px 14px; outline: none; user-select: text;
}
.chat-form input:focus { border-color: var(--accent); }

/* ------------------------------- membros --------------------------------- */

.members {
  background: var(--bg-2); border-left: 1px solid var(--line);
  display: grid; grid-template-rows: 40px 1fr; min-height: 0;
}
.members-title {
  display: flex; align-items: center; padding: 0 14px;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--txt-2); border-bottom: 1px solid var(--line);
}

.peer-list { list-style: none; margin: 0; padding: 8px; overflow-y: auto; }

.peer-row { border-radius: var(--radius-sm); margin-bottom: 2px; }
.peer-row.is-expanded { background: var(--bg-3); }

.peer {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 8px; border-radius: var(--radius-sm); border: 1px solid transparent;
}
.peer:hover { background: var(--bg-3); }
.peer.is-speaking {
  border-color: rgba(63, 191, 127, .55); background: rgba(63, 191, 127, .08);
}

.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--bg-3);
  display: grid; place-items: center; font-weight: 600; font-size: 12px;
  color: #fff; flex-shrink: 0; border: 2px solid transparent;
}
.avatar-xs { width: 20px; height: 20px; font-size: 9px; }
.peer.is-speaking .avatar { border-color: var(--good); }

.peer-name {
  flex: 1; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; font-size: 13px;
}
.peer-name.is-me { color: var(--accent-hi); }

.peer-badges { display: flex; gap: 5px; font-size: 11px; color: var(--txt-2); }
.badge-muted { color: var(--bad); }
.badge-screen { color: var(--good); }
.badge-cam { color: var(--accent-hi); }
.badge-local-mute { color: var(--warn); }

.role-tag {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--txt-2); background: var(--bg-0);
  border-radius: 999px; padding: 2px 7px;
}

.peer-controls {
  display: none; align-items: center; gap: 8px; padding: 2px 10px 10px 50px;
}
.peer-row.is-expanded .peer-controls { display: flex; }
.peer-controls input[type="range"] { flex: 1; min-width: 0; accent-color: var(--accent); }

.peer-volume-value {
  font-size: 10.5px; color: var(--txt-2); width: 34px;
  text-align: right; flex-shrink: 0;
}

.peer-mute {
  background: transparent; border: 1px solid var(--line); border-radius: 6px;
  color: var(--txt-1); cursor: pointer; font-size: 10.5px;
  padding: 3px 8px; flex-shrink: 0;
}
.peer-mute:hover { background: var(--bg-2); color: var(--txt-0); }

/* ==========================================================================
   Modais
   ========================================================================== */

.modal {
  position: fixed; inset: 0; background: rgba(9, 10, 14, .72);
  display: grid; place-items: center; z-index: 60;
}

.modal-card {
  width: min(880px, 92vw); max-height: 86vh;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow);
  display: grid; grid-template-rows: auto 1fr auto; overflow: hidden;
}
.modal-sm { width: min(420px, 92vw); }
.modal-lg { width: min(520px, 92vw); grid-template-rows: auto 1fr; }

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.modal-head h2 { margin: 0; font-size: 16px; }

.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-lead { font-size: 12.5px; line-height: 1.55; margin: 0 0 16px; }

.modal-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-top: 1px solid var(--line);
}
.modal-actions { display: flex; gap: 8px; }

.check {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--txt-1); cursor: pointer;
}
.check input { accent-color: var(--accent); }

.code-input {
  text-transform: uppercase; letter-spacing: 3px;
  font-family: Consolas, "Courier New", monospace; text-align: center;
}

.invite-code {
  background: var(--bg-0); border: 1px dashed var(--line);
  border-radius: var(--radius); padding: 18px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 26px; letter-spacing: 5px; text-align: center;
  color: var(--accent-hi); user-select: text;
}

.join-preview {
  display: flex; align-items: center; gap: 12px; margin-top: 12px;
  background: var(--bg-0); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px;
}
.join-preview small { color: var(--txt-2); font-size: 11px; }

/* -------------------------- seletor de tela ------------------------------ */

.picker-grid {
  overflow-y: auto; padding: 16px 20px; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px;
}
.picker-item {
  background: var(--bg-0); border: 2px solid var(--line);
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  padding: 0; text-align: left; color: var(--txt-0);
  transition: border-color .12s ease;
}
.picker-item:hover { border-color: var(--txt-2); }
.picker-item.is-selected { border-color: var(--accent); }
.picker-item img {
  width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; background: #000;
}
.picker-item-name {
  padding: 8px 10px; font-size: 11.5px; color: var(--txt-1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.picker-empty {
  grid-column: 1 / -1; text-align: center; color: var(--txt-2); padding: 30px 0;
}

/* ==========================================================================
   Ajustes
   ========================================================================== */

.settings-title {
  margin: 22px 0 10px; font-size: 11px; text-transform: uppercase;
  letter-spacing: .7px; color: var(--txt-2);
  border-bottom: 1px solid var(--line); padding-bottom: 6px;
}
.settings-title:first-child { margin-top: 0; }

.settings-actions { display: flex; gap: 8px; margin: 10px 0 6px; }
.settings-actions .btn { flex: 1; padding: 7px 10px; font-size: 12px; }

.hint { font-size: 10.5px; color: var(--txt-2); line-height: 1.55; margin: 0 0 6px; }

.switch {
  display: flex; align-items: center; gap: 9px; padding: 7px 0;
  cursor: pointer; font-size: 12.5px; color: var(--txt-1);
}
.switch input { accent-color: var(--accent); width: 15px; height: 15px; flex-shrink: 0; }
.switch:hover { color: var(--txt-0); }

.range-field { display: block; margin: 6px 0 14px; }
.range-field > span {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--txt-1); margin-bottom: 7px;
}
.range-field > span em {
  font-style: normal; color: var(--accent-hi); font-variant-numeric: tabular-nums;
}
.range-field input[type="range"] { width: 100%; accent-color: var(--accent); }
.range-field small {
  display: block; margin-top: 6px; color: var(--txt-2);
  font-size: 10.5px; line-height: 1.5;
}

/* --------------------------- medidor do microfone ------------------------ */

.meter { margin-bottom: 14px; }
.meter-bar {
  position: relative; height: 12px; background: var(--bg-0);
  border: 1px solid var(--line); border-radius: 999px; overflow: hidden;
}
.meter-fill {
  height: 100%; width: 0%; background: var(--txt-2); border-radius: 999px;
  transition: width .06s linear, background .12s ease;
}
.meter-fill.is-open { background: linear-gradient(90deg, var(--good), #7ee0a8); }
.meter-mark {
  position: absolute; top: -2px; bottom: -2px; width: 2px;
  background: var(--warn); left: 40%; box-shadow: 0 0 4px rgba(224, 163, 58, .8);
}
.meter-foot {
  display: flex; justify-content: space-between; margin-top: 6px;
  font-size: 10.5px; color: var(--txt-2); font-variant-numeric: tabular-nums;
}
.gate-state { color: var(--txt-2); }
.gate-state.is-open { color: var(--good); }

/* ==========================================================================
   Avisos flutuantes
   ========================================================================== */

.toasts {
  position: fixed; right: 18px; bottom: 22px;
  display: flex; flex-direction: column; gap: 8px; z-index: 80;
  pointer-events: none;
}
.toast {
  background: var(--bg-3); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 12.5px; max-width: 340px;
  box-shadow: var(--shadow); animation: toast-in .16s ease-out; line-height: 1.5;
}
.toast.is-error { border-left-color: var(--bad); }
.toast.is-good { border-left-color: var(--good); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.audio-sink { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Barra de rolagem discreta */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--bg-3); border-radius: 6px; border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: #3d4354; background-clip: content-box; }

/* Aviso com acao (atualizacao pronta) */
.toast-action {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toast-action button {
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  padding: 5px 12px;
  font-size: 12px;
  white-space: nowrap;
}

.toast-action button:hover {
  background: var(--accent-hi);
}


/* ==========================================================================
   Botoes do painel de voz (como no Discord)
   ========================================================================== */

.voice-actions { display: flex; gap: 6px; }

.voice-action {
  flex: 1;
  background: var(--bg-3);
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--txt-1);
  cursor: pointer;
  padding: 6px 0;
  font-size: 14px;
  line-height: 1;
}
.voice-action:hover { background: #363b4a; color: var(--txt-0); }
.voice-action.is-on {
  background: rgba(91, 108, 255, 0.22);
  border-color: rgba(91, 108, 255, 0.55);
  color: #c3caff;
}
.voice-action.is-danger { color: #ff9a92; }
.voice-action.is-danger:hover { background: rgba(226, 86, 76, 0.18); }

/* ==========================================================================
   Indicador de fala na lista de canais
   ========================================================================== */

.channel-peer .avatar-xs {
  border: 2px solid transparent;
  transition: border-color 0.1s ease;
}
.channel-peer.is-speaking .avatar-xs { border-color: var(--good); }
.channel-peer.is-speaking { color: var(--txt-0); }

.video-tile.is-cam.is-speaking {
  border-color: var(--good);
  box-shadow: 0 0 0 2px rgba(63, 191, 127, 0.45);
}

/* ==========================================================================
   Volume separado da transmissao
   ========================================================================== */

.peer-controls-stream { padding-top: 0; padding-bottom: 10px; }

.stream-tag {
  font-size: 11px;
  color: var(--good);
  width: 14px;
  flex-shrink: 0;
}

/* ==========================================================================
   Modo cinema
   ========================================================================== */

body.is-theater .video-tile.is-theater {
  position: fixed;
  inset: 0;
  z-index: 70;
  border: none;
  border-radius: 0;
  aspect-ratio: auto;
  background: #000;
}
body.is-theater .video-tile.is-theater video { object-fit: contain; }

body.is-theater .video-tile.is-theater .video-tile-label {
  left: 50%;
  transform: translateX(-50%);
  bottom: 18px;
  font-size: 12px;
  padding: 7px 14px;
  background: rgba(0, 0, 0, 0.72);
}

body.is-theater .video-tile.is-theater .video-tile-expand {
  opacity: 1;
  top: 18px;
  right: 18px;
  padding: 7px 14px;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.72);
}

/* O resto da interface some enquanto a transmissao ocupa a tela. */
body.is-theater .rail,
body.is-theater .channels,
body.is-theater .members,
body.is-theater .main-head { visibility: hidden; }


/* ==========================================================================
   Convite para assistir a transmissao
   ========================================================================== */

.stage-live {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.stage-live:empty {
  display: none;
  margin: 0;
}

.live-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--bad);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.live-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--bg-0);
  display: grid;
  place-items: center;
  font-size: 18px;
  flex-shrink: 0;
}

.live-card-info {
  flex: 1;
  min-width: 0;
}

.live-card-info strong {
  display: block;
  font-size: 13.5px;
}

.live-card-info small {
  color: var(--txt-2);
  font-size: 11px;
}

.live-badge {
  background: var(--bad);
  color: #fff;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.live-card .btn {
  padding: 7px 16px;
  font-size: 12.5px;
  flex-shrink: 0;
}

/* ==========================================================================
   Botoes sobre o video
   ========================================================================== */

.video-tile-btn {
  position: absolute;
  top: 8px;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  color: #fff;
  border-radius: 6px;
  padding: 4px 9px;
  cursor: pointer;
  font-size: 11px;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.video-tile:hover .video-tile-btn {
  opacity: 1;
}

.video-tile-expand { right: 8px; }
.video-tile-fullscreen { right: 74px; font-size: 13px; padding: 3px 9px; }
.video-tile-stop { right: 116px; }

.video-tile-stop:hover {
  background: rgba(226, 86, 76, 0.85);
}

body.is-theater .video-tile.is-theater .video-tile-btn {
  opacity: 1;
  top: 18px;
  padding: 7px 14px;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.72);
}

body.is-theater .video-tile.is-theater .video-tile-expand { right: 18px; }
body.is-theater .video-tile.is-theater .video-tile-fullscreen { right: 108px; }
body.is-theater .video-tile.is-theater .video-tile-stop { right: 158px; }

/* Em tela cheia de verdade o navegador cuida do enquadramento. */
.video-tile:fullscreen { aspect-ratio: auto; border: none; border-radius: 0; }
.video-tile:fullscreen video { object-fit: contain; }
.video-tile:fullscreen .video-tile-btn { opacity: 1; }


/* ==========================================================================
   Menu de contexto do participante
   ========================================================================== */

.peer-menu {
  position: fixed;
  z-index: 90;
  min-width: 240px;
  max-width: 300px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px;
  display: flex;
  flex-direction: column;
}

.peer-menu-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}

.peer-menu-head strong {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.peer-menu-volume {
  padding: 6px 10px 10px;
}

.peer-menu-volume small {
  display: block;
  color: var(--txt-2);
  font-size: 10.5px;
  margin-bottom: 6px;
}

.peer-menu-volume input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.peer-menu button {
  background: none;
  border: none;
  color: var(--txt-1);
  cursor: pointer;
  text-align: left;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12.5px;
}

.peer-menu button:hover {
  background: var(--bg-2);
  color: var(--txt-0);
}

.peer-menu button.is-danger {
  color: #ff9a92;
}

.peer-menu button.is-danger:hover {
  background: rgba(226, 86, 76, 0.14);
}

.peer-menu-sep {
  height: 1px;
  background: var(--line);
  margin: 5px 4px;
}

.badge-server-mute {
  color: var(--warn);
}

/* ==========================================================================
   Aviso de atualizacao na tela de login
   ========================================================================== */

.update-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(91, 108, 255, 0.12);
  border: 1px solid rgba(91, 108, 255, 0.4);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 16px;
}

.update-banner-info {
  flex: 1;
  min-width: 0;
}

.update-banner-info strong {
  display: block;
  font-size: 12.5px;
}

.update-banner-info small {
  color: var(--txt-1);
  font-size: 11px;
}

.update-banner .btn {
  padding: 7px 14px;
  font-size: 12px;
  flex-shrink: 0;
}


/* ==========================================================================
   Volume sobre a transmissao
   ========================================================================== */

.video-tile-label {
  transition: padding 0.12s ease;
}

.tile-volume {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
  padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
}

.tile-volume-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0;
}

.tile-volume-slider {
  width: 0;
  opacity: 0;
  accent-color: #fff;
  transition: width 0.16s ease, opacity 0.16s ease;
}

/* O slider so ocupa espaco quando a pessoa vai mexer nele. */
.video-tile:hover .tile-volume-slider,
.tile-volume:hover .tile-volume-slider,
.tile-volume-slider:focus {
  width: 88px;
  opacity: 1;
}

.video-tile-label.is-muted {
  color: #ffb3ad;
}

body.is-theater .video-tile.is-theater .tile-volume-slider {
  width: 120px;
  opacity: 1;
}


/* ==========================================================================
   Controles sobre o video — canto inferior direito, como no Discord
   ========================================================================== */

.video-tile-controls {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.66);
  opacity: 0;
  transition: opacity 0.14s ease;
}

.video-tile:hover .video-tile-controls,
.video-tile:focus-within .video-tile-controls {
  opacity: 1;
}

.tile-ctrl {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 5px 7px;
  border-radius: 6px;
}

.tile-ctrl:hover {
  background: rgba(255, 255, 255, 0.16);
}

.tile-ctrl-stop {
  background: var(--bad);
}

.tile-ctrl-stop:hover {
  background: #f0685e;
}

.tile-volume {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tile-volume-slider {
  width: 0;
  opacity: 0;
  accent-color: #fff;
  transition: width 0.16s ease, opacity 0.16s ease;
}

.video-tile:hover .tile-volume-slider,
.tile-volume:hover .tile-volume-slider,
.tile-volume-slider:focus {
  width: 84px;
  opacity: 1;
}

/* Os botoes antigos, soltos no topo, deixam de existir. */
.video-tile-btn { display: none !important; }

/* No modo cinema e em tela cheia os controles ficam sempre visiveis. */
body.is-theater .video-tile.is-theater .video-tile-controls,
.video-tile:fullscreen .video-tile-controls {
  opacity: 1;
  right: 24px;
  bottom: 24px;
  padding: 6px;
  gap: 6px;
}

body.is-theater .video-tile.is-theater .tile-ctrl,
.video-tile:fullscreen .tile-ctrl {
  font-size: 16px;
  padding: 7px 10px;
}

body.is-theater .video-tile.is-theater .tile-volume-slider,
.video-tile:fullscreen .tile-volume-slider {
  width: 110px;
  opacity: 1;
}


/* ==========================================================================
   Modo cinema: as outras transmissoes viram miniaturas embaixo
   ==========================================================================
   A transmissao em destaque sai do fluxo (position: fixed), entao o proprio
   grid vira a faixa de miniaturas — sem duplicar nenhum elemento de video.
   ========================================================================== */

/*
 * ATENCAO: nada de `transform` aqui.
 *
 * Um ancestral com transform vira bloco de contencao para descendentes
 * `position: fixed` — e a transmissao em destaque, que e filha deste grid,
 * ficaria presa dentro da faixa em vez de ocupar a janela inteira.
 * Por isso a centralizacao e feita com left/right + justify-content.
 */
body.is-theater .stage-grid {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 18px;
  z-index: 80;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 8px;
  padding: 0 24px;
  overflow-x: auto;
  overflow-y: visible;
  background: none;
  pointer-events: none;
}

/* A faixa ignora o mouse para o clique alcancar a transmissao atras dela,
   mas os tiles precisam receber de volta — inclusive o que esta em destaque,
   senao os controles dele ficam inclicaveis em modo cinema. */
body.is-theater .video-tile {
  pointer-events: auto;
}

body.is-theater .video-tile:not(.is-theater) {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
}

/* Com uma transmissao so, a faixa fica vazia e simplesmente nao aparece,
   porque o unico filho esta fora do fluxo. */

body.is-theater .video-tile:not(.is-theater) {
  flex: 0 0 auto;
  width: 168px;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  cursor: pointer;
  /* Preto sobre preto some: a borda clara e o que faz a miniatura existir. */
  border: 2px solid rgba(255, 255, 255, 0.22);
  /* A transmissao em destaque e IRMA destas miniaturas e tem z-index maior;
     sem isto ela as cobre, porque ocupa a janela inteira. */
  position: relative;
  z-index: 90;
  transition: border-color 0.12s ease, transform 0.12s ease;
}

body.is-theater .video-tile:not(.is-theater):hover {
  border-color: var(--accent-hi);
  transform: translateY(-2px);
}

/* Nas miniaturas os controles atrapalhariam; sobra so o nome. */
body.is-theater .video-tile:not(.is-theater) .video-tile-controls {
  display: none;
}

body.is-theater .video-tile:not(.is-theater) .video-tile-label {
  font-size: 9.5px;
  padding: 2px 6px;
  left: 5px;
  bottom: 5px;
  max-width: calc(100% - 10px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Convites para assistir nao aparecem por cima do cinema. */
body.is-theater .stage-live {
  display: none;
}


/* Aviso sobre o alcance da captura de audio */
.picker-audio-box {
  flex: 1;
  min-width: 0;
  margin-right: 16px;
}

.picker-audio-warning {
  display: block;
  margin-top: 6px;
  color: var(--warn);
  font-size: 10.5px;
  line-height: 1.5;
  max-width: 520px;
}


/* ==========================================================================
   Abas do seletor de tela
   ========================================================================== */

.picker-tabs {
  display: flex;
  gap: 6px;
  padding: 14px 20px 0;
}

.picker-tab {
  flex: 1;
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--txt-2);
  cursor: pointer;
  padding: 10px;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.picker-tab:hover {
  color: var(--txt-1);
  background: var(--bg-2);
}

.picker-tab.is-active {
  background: var(--bg-3);
  border-color: var(--accent);
  color: var(--txt-0);
}

.picker-tab-icon {
  font-size: 14px;
  line-height: 1;
}


/* ==========================================================================
   Acoes na linha do canal
   ========================================================================== */

.channel-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .12s ease; }
.channel:hover .channel-actions,
.channel.is-active .channel-actions { opacity: 1; }

.channel-action {
  color: var(--txt-2); font-size: 11px; padding: 2px 4px;
  border-radius: 4px; line-height: 1;
}
.channel-action:hover { color: var(--txt-0); background: rgba(255, 255, 255, .08); }

/* ==========================================================================
   AO VIVO ao lado do nome, na lista de canais
   ========================================================================== */

.live-tag {
  background: var(--bad); color: #fff; border-radius: 3px;
  padding: 1px 5px; font-size: 8.5px; font-weight: 700;
  letter-spacing: .4px; cursor: pointer; flex-shrink: 0;
}
.live-tag:hover { background: #f0685e; }
.live-tag.is-watching { background: var(--good); }

.channel-peer { cursor: context-menu; }
.channel-peer:hover { background: var(--bg-3); border-radius: 5px; }

/* O convite para assistir vira discreto, e nao uma faixa que toma a tela. */
.live-card { max-width: 480px; margin: 0 auto; }


/* ==========================================================================
   Status da pessoa
   ========================================================================== */

.avatar-wrap {
  position: relative;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 0;
}

.status-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  /* A borda na cor do fundo recorta a bolinha do avatar, como no Discord. */
  border: 2px solid var(--bg-0);
  background: var(--txt-2);
}

.status-dot.is-online { background: var(--good); }
.status-dot.is-idle { background: var(--warn); }
.status-dot.is-offline { background: var(--txt-2); }

/* "Nao perturbe" e um tracinho dentro do circulo, e nao so vermelho: quem
   nao distingue bem cores precisa conseguir ler o estado mesmo assim. */
/* Sem position aqui: a bolinha ja e absoluta e isso a soltava do canto do
   avatar, deixando o tracinho perdido do lado do nome. Um elemento com
   position: absolute ja serve de referencia para o proprio ::after. */
.status-dot.is-dnd {
  background: var(--bad);
}

.status-dot.is-dnd::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 60%;
  height: 2px;
  border-radius: 1px;
  background: var(--bg-0);
}

/* Nas listas o recorte acompanha o fundo do painel. */
.peer .status-dot,
.channel-peer .status-dot {
  border-color: var(--bg-2);
  width: 10px;
  height: 10px;
}

.channel-peer .status-dot {
  width: 8px;
  height: 8px;
  border-width: 1.5px;
}

.status-menu {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 62px;
  z-index: 40;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 5px;
  display: flex;
  flex-direction: column;
}

.status-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  color: var(--txt-1);
  cursor: pointer;
  text-align: left;
  padding: 8px 10px;
  border-radius: 6px;
}

.status-menu button:hover {
  background: var(--bg-2);
  color: var(--txt-0);
}

/* Dentro do menu a bolinha nao se cola em avatar nenhum, mas continua
   precisando ser a referencia do proprio tracinho do "nao perturbe":
   com position: static o tracinho se media pelo menu inteiro e virava uma
   linha atravessando o texto. */
.status-menu .status-dot {
  position: relative;
  right: auto;
  bottom: auto;
  border: none;
  width: 10px;
  height: 10px;
  flex-shrink: 0;
}

/* O status em uso fica marcado: sem isso nao da para saber se o clique
   pegou, e a impressao e a de que o menu nao faz nada. */
.status-menu button.is-current {
  background: var(--bg-2);
}

.status-menu button.is-current .status-text strong::after {
  content: " ✓";
  color: var(--good);
}

.status-text strong {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
}

.status-text small {
  display: block;
  color: var(--txt-2);
  font-size: 10.5px;
  margin-top: 1px;
}

/* Quem esta offline fica apagado na lista, sem sumir. */
.peer-row.is-offline .peer-name,
.peer-row.is-offline .avatar {
  opacity: 0.45;
}


/* ==========================================================================
   Versao na barra de cima
   ========================================================================== */

.app-version {
  font-size: 11px;
  color: var(--txt-2);
  letter-spacing: 0.2px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
}

/* ==========================================================================
   Canal de inatividade (AFK)
   ========================================================================== */

/* O canal AFK precisa se distinguir na lista sem virar um enfeite: um icone
   diferente e o nome mais apagado bastam para nao clicar nele sem querer. */
.channel.is-afk .channel-icon { opacity: 0.6; }
.channel.is-afk .channel-name { color: var(--txt-2); }

.afk-tag {
  margin-left: 6px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--txt-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 4px;
}

/* Aviso dentro do canal AFK, no lugar do palco. */
.afk-note {
  max-width: 460px;
  text-align: center;
  color: var(--txt-2);
  font-size: 13px;
  line-height: 1.6;
}

.check small {
  display: block;
  color: var(--txt-2);
  font-size: 11px;
  margin-top: 2px;
}


/* ==========================================================================
   Barra de controles da conversa
   ========================================================================== */

/* O palco precisa reservar espaco para a barra, senao o ultimo video fica
   escondido atras dela. */
.stage { position: relative; }

.stage-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 20;
}

.stage-bar-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-radius: 12px;
  background: rgba(20, 22, 28, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  pointer-events: auto;
  backdrop-filter: blur(8px);
}

.ctrl-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 13px;
  border-radius: 8px;
  border: none;
  background: var(--bg-3);
  color: var(--txt-1);
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
}

.ctrl-btn:hover:not(:disabled) { background: var(--bg-2); color: var(--txt-0); }
.ctrl-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Ligado = a acao esta acontecendo agora (camera no ar, tela sendo enviada). */
.ctrl-btn.is-on { background: var(--accent); color: #fff; }

/* Cortado = desligado por escolha da pessoa. Vermelho porque e o mesmo
   sinal do Discord para "os outros nao me ouvem". */
.ctrl-btn.is-off { background: rgba(220, 70, 70, 0.18); color: var(--bad); }

.ctrl-btn.is-leave { background: var(--bad); color: #fff; }
.ctrl-btn.is-leave:hover:not(:disabled) { background: #c0392b; color: #fff; }

.ctrl-ico { font-size: 15px; line-height: 1; }

/* Em janela estreita so os icones cabem. */
@media (max-width: 900px) {
  .ctrl-txt { display: none; }
  .ctrl-btn { padding: 9px 11px; }
}

/* ==========================================================================
   Busca de canais e pessoas
   ========================================================================== */

.channels-search { padding: 8px 10px 2px; }

.channels-search input {
  width: 100%;
  padding: 6px 9px;
  font-size: 12px;
  color: var(--txt-1);
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.channels-search input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ==========================================================================
   Arrastar pessoas entre canais
   ========================================================================== */

.channel-peer[draggable="true"] { cursor: grab; }
.channel-peer.is-dragging { opacity: 0.45; }

/* O canal que vai receber a pessoa precisa ficar obvio enquanto se arrasta:
   soltar no lugar errado tira alguem da conversa sem querer. */
.channel.is-drop-target {
  background: var(--bg-3);
  box-shadow: inset 0 0 0 1.5px var(--accent);
}

/* ==========================================================================
   Convite por link
   ========================================================================== */

.invite-link {
  padding: 10px 12px;
  margin-bottom: 10px;
  font-size: 12.5px;
  color: var(--txt-0);
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 8px;
  word-break: break-all;
  user-select: all;
}

.invite-hint { font-size: 11px; margin: 8px 0 12px; line-height: 1.5; }

/* O codigo continua ali para quem preferir ditar seis letras ao telefone. */
.invite-code { opacity: 0.75; font-size: 15px; }


/* ==========================================================================
   Convite: link e botao lado a lado
   ========================================================================== */

.invite-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.invite-input {
  flex: 1;
  min-width: 0;
  padding: 9px 11px;
  font-size: 12.5px;
  color: var(--txt-0);
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.invite-input:focus { outline: none; border-color: var(--accent); }

.invite-row .btn { padding-left: 20px; padding-right: 20px; }

/* As opcoes menos usadas ficam recolhidas: o que importa e o link e o
   botao de copiar, e uma lista de campos ao redor disputava a atencao. */
.invite-more {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.invite-more summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--txt-2);
  list-style: none;
}

.invite-more summary::-webkit-details-marker { display: none; }
.invite-more summary::before { content: "▸ "; }
.invite-more[open] summary::before { content: "▾ "; }
.invite-more summary:hover { color: var(--txt-1); }


/* ==========================================================================
   Quadro grande e miniaturas
   ========================================================================== */

/*
 * Com mais de uma transmissao no ar, uma fica grande e as outras viram
 * miniaturas embaixo. As colunas estreitas dao a linha das miniaturas; o
 * quadro grande atravessa todas elas e fica sozinho na primeira linha.
 */
.stage-grid.is-spotlight {
  grid-template-columns: repeat(auto-fill, 172px);
  grid-auto-rows: max-content;
  align-content: start;
  justify-content: center;
  gap: 10px;
}

.stage-grid.is-spotlight .video-tile.is-main {
  grid-column: 1 / -1;
  /* A proporcao fixa do tile daria a ele a altura de uma faixa estreita;
     aqui a altura e que manda, e o video se ajusta dentro. */
  aspect-ratio: auto;
  height: min(66vh, 620px);
}

.stage-grid.is-spotlight .video-tile.is-thumb {
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.18);
  transition: border-color 0.12s ease;
}

.stage-grid.is-spotlight .video-tile.is-thumb:hover {
  border-color: var(--accent);
}

/* A camera numa miniatura de 16:9 corta melhor do que encolhe. */
.stage-grid.is-spotlight .video-tile.is-thumb.is-cam video {
  object-fit: cover;
}

/* Nas miniaturas os controles nao cabem e nao servem: o clique inteiro ali
   significa "traga isso para o quadro grande". */
.stage-grid.is-spotlight .video-tile.is-thumb .video-tile-controls,
.stage-grid.is-spotlight .video-tile.is-thumb .tile-volume-slider {
  display: none;
}

.stage-grid.is-spotlight .video-tile.is-thumb .video-tile-label {
  font-size: 10px;
  padding: 2px 6px;
  left: 5px;
  bottom: 5px;
}


/* ==========================================================================
   Meu perfil
   ========================================================================== */

/* A faixa do usuario virou botao e precisa parecer com o que era. */
.user-panel-info {
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.user-panel-info:hover strong { text-decoration: underline; }

.profile-top {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.profile-avatar {
  position: relative;
  width: 88px;
  height: 88px;
  flex-shrink: 0;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  overflow: hidden;
  background: var(--accent);
  background-size: cover;
  background-position: center;
  color: #fff;
  font-size: 30px;
  font-weight: 600;
  display: grid;
  place-items: center;
}

/* A dica so aparece com o mouse em cima: um rotulo permanente sobre a foto
   esconderia justamente o que a pessoa quer conferir. */
.profile-avatar-hint {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 500;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.12s ease;
}

.profile-avatar:hover .profile-avatar-hint { opacity: 1; }

.profile-top-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.profile-top-actions small { font-size: 10.5px; line-height: 1.4; }

.color-field {
  width: 100%;
  height: 34px;
  padding: 2px;
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

/* Com foto, as iniciais atras estorvam. */
.avatar.has-photo {
  background-size: cover;
  background-position: center;
  color: transparent;
}

.profile-avatar.has-photo > span:first-child { color: transparent; }


/* ==========================================================================
   Emojis no chat
   ========================================================================== */

/* O chat vira a referencia do painel: ele abre colado no campo, e nao
   solto num canto da tela. */
.chat { position: relative; }

.chat-field {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
}

.chat-field input { flex: 1; min-width: 0; padding-right: 40px; }

.chat-emoji-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: none;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  opacity: 0.65;
}

.chat-emoji-btn:hover { opacity: 1; background: var(--bg-3); }

.emoji-panel {
  position: absolute;
  right: 18px;
  bottom: 66px;
  z-index: 60;
  width: 292px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.emoji-tabs {
  display: flex;
  gap: 2px;
  padding: 6px 6px 0;
  border-bottom: 1px solid var(--line);
}

.emoji-tabs button {
  flex: 1;
  padding: 6px 0 8px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 15px;
  cursor: pointer;
  opacity: 0.55;
}

.emoji-tabs button:hover { opacity: 0.85; }
.emoji-tabs button.is-active { opacity: 1; border-bottom-color: var(--accent); }

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  padding: 8px;
  max-height: 208px;
  overflow-y: auto;
}

.emoji-grid button {
  aspect-ratio: 1;
  background: none;
  border: none;
  border-radius: 6px;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}

.emoji-grid button:hover { background: var(--bg-2); }


/* ==========================================================================
   Cartao da transmissao (ao passar o mouse)
   ========================================================================== */

.stream-peek {
  position: fixed;
  z-index: 90;
  width: 268px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  /* O cartao nao recebe mouse enquanto e so uma previa; quando ha botao
     para clicar, o JS devolve o ponteiro a ele. */
  pointer-events: none;
}

.stream-peek.is-interactive { pointer-events: auto; }

.stream-peek-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  font-size: 11px;
  color: var(--txt-2);
}

.stream-peek-frame {
  position: relative;
  margin: 0 11px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-0);
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
}

.stream-peek-frame video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}

/* Sem estar assistindo nao ha imagem para mostrar: pedir o video so para a
   previa gastaria banda de quem transmite. O desenho ocupa o lugar. */
.stream-peek-art {
  display: grid;
  place-items: center;
  gap: 6px;
  color: var(--txt-2);
  font-size: 11px;
  text-align: center;
  padding: 10px;
}

.stream-peek-art .art-icon { font-size: 30px; opacity: 0.8; }

.stream-peek-foot {
  padding: 10px 11px 11px;
  display: grid;
  gap: 8px;
}

.stream-peek-foot #peek-text {
  font-size: 11.5px;
  color: var(--txt-1);
  line-height: 1.4;
}

.stream-peek-foot .btn:disabled {
  opacity: 0.55;
  cursor: default;
}


/* ==========================================================================
   Acabamento: cantos, movimento e profundidade
   --------------------------------------------------------------------------
   Tudo aqui e visual. As regras vem por ultimo de proposito: sao ajustes
   sobre o que ja existe, e le-las juntas diz como a interface se move.
   ========================================================================== */

/* Quem prefere a tela parada tem essa preferencia respeitada pelo sistema —
   e para muita gente movimento nao e enfeite, e enjoo. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ------------------------------- botoes ---------------------------------- */

.btn,
.btn-icon,
.mini-btn,
.voice-action,
.ctrl-btn,
.channel,
.channel-peer,
.peer,
.rail-btn,
.status-menu button,
.server-menu button,
.peer-menu button {
  transition: background var(--fast), color var(--fast), border-color var(--fast),
    transform var(--fast), box-shadow var(--fast), opacity var(--fast);
}

/* O leve afundar no clique e o que faz um botao parecer um botao. */
.btn:active:not(:disabled),
.btn-icon:active,
.mini-btn:active,
.voice-action:active,
.ctrl-btn:active:not(:disabled) {
  transform: scale(0.96);
}

.btn { border-radius: var(--radius-sm); }
.btn-icon, .mini-btn, .voice-action { border-radius: 10px; }

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 4px 16px rgba(91, 108, 255, 0.35);
}

/* ------------------------------- canais ---------------------------------- */

.channel { border-radius: 10px; }
.channel:hover { transform: translateX(2px); }
.channel-peer { border-radius: 9px; }
.channel-peer:hover { transform: translateX(2px); }

/* A barrinha do canal ativo cresce a partir do nada, em vez de piscar. */
.channel.is-active::before {
  content: "";
  position: absolute;
  /* Dentro do proprio botao: a lista de canais tem rolagem, e uma barra
     em coordenada negativa seria cortada. */
  left: 0;
  top: 50%;
  width: 3px;
  height: 60%;
  transform: translateY(-50%);
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  animation: barra-entra 0.2s var(--ease);
}

.channel { position: relative; }

@keyframes barra-entra {
  from { height: 0; opacity: 0; }
  to { height: 60%; opacity: 1; }
}

/* ------------------------------ avatares --------------------------------- */

.avatar, .avatar-xs {
  transition: transform var(--fast), box-shadow var(--fast);
}

.peer:hover .avatar,
.channel-peer:hover .avatar-xs {
  transform: scale(1.06);
}

/* Falar faz o avatar respirar, em vez de so ganhar uma borda. */
.channel-peer.is-speaking .avatar-xs {
  animation: falando 1.4s ease-in-out infinite;
}

@keyframes falando {
  0%, 100% { box-shadow: 0 0 0 0 rgba(63, 191, 127, 0.55); }
  50% { box-shadow: 0 0 0 4px rgba(63, 191, 127, 0); }
}

/* ------------------------------- modais ---------------------------------- */

.modal-card {
  border-radius: var(--radius-lg);
  animation: modal-entra 0.2s var(--ease);
}

@keyframes modal-entra {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.modal { animation: fundo-entra 0.16s var(--ease); }

@keyframes fundo-entra {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* -------------------------- menus e cartoes ------------------------------ */

.server-menu,
.status-menu,
.peer-menu,
.emoji-panel,
.stream-peek {
  border-radius: var(--radius);
  animation: menu-entra 0.15s var(--ease);
}

@keyframes menu-entra {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.stream-peek { border-radius: var(--radius-lg); }

/* ------------------------------- video ----------------------------------- */

.video-tile {
  border-radius: var(--radius);
  transition: transform var(--fast), box-shadow var(--fast), border-color var(--fast);
}

.stage-grid.is-spotlight .video-tile.is-thumb:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-sm);
}

.stage-grid.is-spotlight .video-tile.is-main { border-radius: var(--radius-lg); }

/* Um tile que aparece de repente no meio da conversa assusta. */
.video-tile { animation: tile-entra 0.22s var(--ease); }

@keyframes tile-entra {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: none; }
}

/* ------------------------------- chat ------------------------------------ */

.chat-form input { border-radius: 12px; }
.chat-msg { animation: msg-entra 0.18s var(--ease); }

@keyframes msg-entra {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* ------------------------------ avisos ----------------------------------- */

.toast { border-radius: 12px; }

/* ------------------------------ diversos --------------------------------- */

.chip, .role-tag, .afk-tag, .live-tag, .badge-muted { border-radius: 999px; }

.invite-input, .invite-link, .invite-code { border-radius: 12px; }
.field input, .field select, .range-field input { border-radius: 10px; }

.live-tag { transition: background var(--fast), transform var(--fast); }
.live-tag:hover { transform: scale(1.05); }

/* O AO VIVO pulsa devagar: e um aviso, nao um alarme. */
.live-tag:not(.is-watching) { animation: ao-vivo 2.4s ease-in-out infinite; }

@keyframes ao-vivo {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.72; }
}

/* Barras de rolagem finas combinam com a densidade do resto. */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--bg-3) transparent;
}

*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }

*::-webkit-scrollbar-thumb {
  background: var(--bg-3);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover { background: var(--line); background-clip: padding-box; }


/* ==========================================================================
   Chat: mensagens, respostas, reacoes
   ========================================================================== */

/* A grade ganhou duas faixas: "esta digitando" e a barra de resposta. */
.chat { grid-template-rows: 1fr auto auto auto; }

.chat-log { gap: 2px; }

.chat-msg {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 10px;
  padding: 3px 10px 3px 4px;
  border-radius: 8px;
  position: relative;
}

.chat-msg:hover { background: rgba(255, 255, 255, 0.025); }

/* Mensagens seguidas da mesma pessoa se juntam: repetir nome e foto a cada
   linha transforma uma conversa rapida numa parede de cabecalhos. */
.chat-msg.is-grouped { margin-top: -2px; }
.chat-msg.is-grouped .chat-msg-head { display: none; }
.chat-msg.is-grouped .chat-msg-avatar { visibility: hidden; }

.chat-msg-avatar { grid-row: span 3; }
.chat-msg-avatar .avatar { width: 38px; height: 38px; font-size: 14px; }

.chat-msg-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.chat-msg-head .who { font-weight: 600; font-size: 13.5px; }
.chat-msg-head .when { color: var(--txt-2); font-size: 10.5px; }
.chat-msg-head .edited { color: var(--txt-2); font-size: 10px; font-style: italic; }

.chat-msg-body {
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}

.chat-msg.is-deleted .chat-msg-body {
  color: var(--txt-2);
  font-style: italic;
}

/* Uma mensagem que cita voce precisa se distinguir de relance. */
.chat-msg.is-mentioning-me {
  background: rgba(91, 108, 255, 0.1);
  box-shadow: inset 3px 0 0 var(--accent);
}

.mention {
  background: rgba(91, 108, 255, 0.22);
  color: var(--accent-hi);
  border-radius: 4px;
  padding: 0 3px;
  font-weight: 500;
}

.mention.is-me { background: rgba(91, 108, 255, 0.42); color: #fff; }

/* ------------------------------ markdown --------------------------------- */

.chat-msg-body code {
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
}

.chat-msg-body pre {
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  margin: 5px 0;
  overflow-x: auto;
  white-space: pre;
}

.chat-msg-body pre code { background: none; border: none; padding: 0; }

.chat-msg-body blockquote {
  margin: 3px 0;
  padding-left: 10px;
  border-left: 3px solid var(--line);
  color: var(--txt-1);
}

.chat-msg-body a { color: var(--accent-hi); }
.chat-msg-body del { color: var(--txt-2); }

/* ------------------------------ resposta --------------------------------- */

.chat-reply {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--txt-2);
  margin-bottom: 2px;
  cursor: pointer;
  max-width: 100%;
}

.chat-reply:hover { color: var(--txt-1); }
.chat-reply strong { color: var(--accent-hi); font-weight: 600; }

.chat-reply-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* A mensagem citada pisca quando se chega nela pelo clique. */
.chat-msg.is-flashing { animation: piscar 1.1s var(--ease); }

@keyframes piscar {
  0%, 60% { background: rgba(91, 108, 255, 0.18); }
  100% { background: transparent; }
}

/* ------------------------------ reacoes ---------------------------------- */

.chat-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 3px;
}

.reaction {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  font-size: 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--fast), border-color var(--fast), transform var(--fast);
}

.reaction:hover { background: var(--bg-3); transform: scale(1.06); }

.reaction.is-mine {
  background: rgba(91, 108, 255, 0.2);
  border-color: var(--accent);
}

.reaction .n { font-size: 10.5px; color: var(--txt-1); }

/* --------------------------- acoes da mensagem --------------------------- */

.chat-msg-actions {
  position: absolute;
  right: 8px;
  top: -10px;
  display: flex;
  gap: 2px;
  padding: 2px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--fast);
}

.chat-msg:hover .chat-msg-actions { opacity: 1; pointer-events: auto; }

.chat-msg-actions button {
  width: 26px;
  height: 24px;
  display: grid;
  place-items: center;
  background: none;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  opacity: 0.75;
}

.chat-msg-actions button:hover { background: var(--bg-2); opacity: 1; }

/* --------------------------- barra de resposta --------------------------- */

.reply-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 18px;
  padding: 7px 10px;
  font-size: 12px;
  color: var(--txt-2);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
}

.reply-bar strong { color: var(--accent-hi); }
.reply-bar em { font-style: normal; opacity: 0.75; }

.reply-bar-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --------------------------- esta digitando ------------------------------ */

.typing-line {
  padding: 2px 18px 0;
  font-size: 11.5px;
  color: var(--txt-2);
  height: 18px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.typing-line .dots { display: inline-flex; gap: 2px; }

.typing-line .dots i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--txt-2);
  animation: digitando 1.2s ease-in-out infinite;
}

.typing-line .dots i:nth-child(2) { animation-delay: 0.15s; }
.typing-line .dots i:nth-child(3) { animation-delay: 0.3s; }

@keyframes digitando {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

/* ---------------------------- nao lidas ---------------------------------- */

/* A bolinha de nao lidas fica no proprio canal, onde a pessoa procura. */
.unread-badge {
  margin-left: auto;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  font-size: 10.5px;
  font-weight: 700;
  color: #fff;
  background: var(--bad);
  border-radius: 999px;
  flex-shrink: 0;
}

.channel.has-unread .channel-name { color: var(--txt-0); font-weight: 600; }

.reply-bar-icon { color: var(--accent-hi); flex-shrink: 0; }


/* ==========================================================================
   Celular e janelas estreitas
   --------------------------------------------------------------------------
   Quatro colunas nao cabem num telefone: espremidas, cada painel virava uma
   fatia inutil. Abaixo de 860px passa a existir uma coluna so — a conversa —
   e os paineis laterais viram gavetas que entram por cima.
   ========================================================================== */

.mobile-only { display: none; }
.nav-scrim { display: none; }

@media (max-width: 860px) {
  .mobile-only { display: grid; place-items: center; }

  .app {
    grid-template-columns: 1fr;
    /* 100% de altura mede a janela inteira, inclusive a parte coberta pela
       barra do navegador do celular. dvh mede o que da para ver de fato. */
    height: 100dvh;
  }

  /* A trilha de servidores entra junto com a lista de canais. */
  .rail,
  .channels,
  .members {
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 70;
    transition: transform var(--slow);
    box-shadow: var(--shadow);
  }

  .rail {
    left: 0;
    width: 68px;
    transform: translateX(-100%);
  }

  .channels {
    left: 68px;
    width: min(268px, calc(100vw - 68px));
    /* Deslocar pela PROPRIA largura, e nao por um numero fixo: em telas bem
       estreitas a largura muda e a conta em pixels deixava uma faixa da
       gaveta aparecendo na beira da tela. */
    transform: translateX(calc(-100% - 68px));
  }

  .members {
    right: 0;
    width: min(252px, 78vw);
    transform: translateX(100%);
  }

  /* Abertas */
  body.nav-channels .rail { transform: none; }
  body.nav-channels .channels { transform: none; }
  body.nav-members .members { transform: none; }

  .nav-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--slow);
  }

  body.nav-channels .nav-scrim,
  body.nav-members .nav-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  /* --------------------------- a conversa ----------------------------- */

  .main { min-width: 0; }

  .main-head {
    gap: 8px;
    padding: 0 10px;
    /* O recorte da camera do telefone come o topo da tela. */
    padding-top: env(safe-area-inset-top);
    height: calc(48px + env(safe-area-inset-top));
  }

  .main-head strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* O botao de membros vai para a ponta direita do cabecalho. */
  #btn-nav-members { margin-left: auto; }

  .stage { padding: 8px; }

  /* Um video de 300px de largura minima nao cabe num telefone: com o
     minmax original a grade estourava para os lados. */
  .stage-grid { grid-template-columns: 1fr; }

  .stage-grid.is-spotlight {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  }

  .stage-grid.is-spotlight .video-tile.is-main {
    height: auto;
    aspect-ratio: 16 / 9;
  }

  /* --------------------------- os controles --------------------------- */

  .stage-bar { bottom: calc(10px + env(safe-area-inset-bottom)); }

  .stage-bar-inner {
    gap: 4px;
    padding: 5px;
    max-width: calc(100vw - 16px);
    overflow-x: auto;
  }

  .ctrl-txt { display: none; }
  .ctrl-btn { padding: 10px 12px; }
  .ctrl-ico { font-size: 17px; }

  /* ----------------------------- o chat ------------------------------- */

  .chat-form { padding: 10px 10px calc(12px + env(safe-area-inset-bottom)); }
  .chat-log { padding: 10px; }
  .reply-bar { margin: 0 10px; }
  .typing-line { padding-left: 10px; }

  .emoji-panel {
    right: 10px;
    left: 10px;
    width: auto;
  }

  /* O cartao da transmissao nao cabe flutuando ao lado de nada. */
  .stream-peek { display: none !important; }

  /* --------------------------- os modais ------------------------------ */

  .modal-card {
    width: calc(100vw - 20px);
    max-width: none;
    max-height: calc(100dvh - 40px);
  }

  .modal-lg, .modal-sm { width: calc(100vw - 20px); }
}

/* A tela de entrada no celular. */
@media (max-width: 860px) {
  .auth-card {
    width: calc(100vw - 24px);
    max-width: none;
    padding: 20px 18px;
  }

  .auth { padding: 12px; }
}

/* Telas bem estreitas: a lista de canais ocupa o que sobra. */
@media (max-width: 420px) {
  .channels { width: calc(100vw - 68px); }
  .members { width: 84vw; }
}


/* ==========================================================================
   Grade: todas as transmissoes do mesmo tamanho
   --------------------------------------------------------------------------
   O numero de colunas vem do numero de transmissoes, e nao de uma largura
   minima: com auto-fit, duas transmissoes numa janela larga viravam duas
   faixas magras, e o que se quer aqui e o oposto — dois quadrados iguais.
   ========================================================================== */

.stage-grid.is-grid {
  align-content: center;
  justify-content: center;
  gap: 10px;
  height: 100%;
}

/* Cada quadro ocupa a celula inteira, e o video se ajusta dentro dela. Com
   proporcao fixa, duas transmissoes numa tela larga ficavam menores do que
   precisavam: a largura mandava na altura e sobrava espaco embaixo. */
.stage-grid.is-grid {
  grid-auto-rows: 1fr;
  align-items: stretch;
}

.stage-grid.is-grid .video-tile {
  aspect-ratio: auto;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.stage-grid.is-grid .video-tile video { object-fit: contain; }

/* Camera em grade tambem vira 16:9: misturar 4:3 com 16:9 faz uma parecer
   maior que a outra, que era justamente a reclamacao. */
.stage-grid.is-grid .video-tile.is-cam { aspect-ratio: auto; }
.stage-grid.is-grid .video-tile.is-cam video { object-fit: cover; }

/* As colunas vem do JavaScript, que mede o espaco e escolhe a divisao que
   deixa o video maior. Uma tabela por quantidade nao daria conta: com duas
   transmissoes, lado a lado ganha numa janela alta e empilhado ganha numa
   janela larga. */
.stage-grid.is-grid { grid-template-columns: repeat(var(--cols, 1), 1fr); }




/* O ping no cabecalho muda de cor conforme a conversa esteja boa ou nao. */
.chip-ping { font-variant-numeric: tabular-nums; }
.chip-ping.is-good { color: var(--good); }
.chip-ping.is-warn { color: var(--warn); }
.chip-ping.is-bad { color: var(--bad); }


/* ==========================================================================
   Controles da transmissao: aparecem com o mouse, somem parados
   ========================================================================== */

.video-tile .video-tile-controls,
.video-tile .video-tile-label {
  opacity: 0;
  transition: opacity 0.22s var(--ease);
}

.video-tile.is-hovering .video-tile-controls,
.video-tile.is-hovering .video-tile-label {
  opacity: 1;
}

/* Escondidos, os controles nao podem roubar o clique do video. */
.video-tile:not(.is-hovering) .video-tile-controls { pointer-events: none; }

/* Em tela cheia e no modo cinema vale a mesma regra: a imagem manda. */
body.is-theater .video-tile.is-theater .video-tile-controls,
body.is-theater .video-tile.is-theater .video-tile-label {
  opacity: 0;
}

body.is-theater .video-tile.is-theater.is-hovering .video-tile-controls,
body.is-theater .video-tile.is-theater.is-hovering .video-tile-label {
  opacity: 1;
}

/* O quadro de quem foi para a janela separada nao fica vazio sem aviso. */
.video-tile.is-popped::after {
  content: "Em janela separada";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: var(--txt-1);
  background: rgba(0, 0, 0, 0.72);
}

.switch-note { font-style: normal; font-size: 10.5px; color: var(--txt-2); margin-left: 6px; }
.switch-note.is-on { color: var(--good); }


/* ==========================================================================
   Esconder a lista de membros
   --------------------------------------------------------------------------
   Assistindo a uma transmissao o que importa e a imagem, e a coluna da
   direita esta tirando 232px dela. O botao no cabecalho recolhe a coluna, e
   a escolha fica guardada.
   ========================================================================== */

@media (min-width: 861px) {
  body.no-members .members { display: none; }
  body.no-members .app { grid-template-columns: 68px 232px 1fr; }
}

/* O botao fica marcado quando a coluna esta a mostra. */
#btn-nav-members.is-on { color: var(--accent-hi); }

/* ==========================================================================
   Grade: as colunas vem do JavaScript
   --------------------------------------------------------------------------
   O numero de colunas nao pode ser fixo por quantidade: com duas
   transmissoes numa janela larga, lado a lado sobra faixa preta em cima e
   embaixo, e empilhado o video fica maior. Qual das duas ganha depende do
   formato do espaco, entao a conta e feita na hora.
   ========================================================================== */


/* ==========================================================================
   A barra de controles some junto com o resto
   --------------------------------------------------------------------------
   Assistindo a duas transmissoes empilhadas, a barra fica bem em cima da
   imagem de baixo. Ela segue a mesma regra dos controles da transmissao:
   aparece ao mexer o mouse, some parada.
   ========================================================================== */

.stage-bar {
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}

.stage.is-hovering .stage-bar { opacity: 1; }

/* Escondida, a barra nao pode receber cliques por engano. */
.stage:not(.is-hovering) .stage-bar-inner { pointer-events: none; }


/* ==========================================================================
   Aba de dispositivos do seletor
   --------------------------------------------------------------------------
   Uma placa de captura entra aqui como qualquer camera. A previa e ao vivo
   porque o nome do dispositivo raramente diz o que ele esta mostrando —
   "USB3 Video" nao ajuda ninguem a escolher.
   ========================================================================== */

.picker-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.picker-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Sem previa — a placa pode nao aceitar duas aberturas ao mesmo tempo. */
.picker-thumb-vazio {
  font-size: 34px;
  opacity: 0.4;
}

#picker-device-audio-row { margin-top: 8px; max-width: 340px; }


/* ==========================================================================
   Painel de conexao
   --------------------------------------------------------------------------
   O numero unico enganava: media a ida e volta pela thread da interface, e
   subia tanto por rede ruim quanto por janela engasgada — duas causas com
   solucoes opostas. Aqui as duas aparecem separadas.
   ========================================================================== */

.chip-ping { border: none; cursor: pointer; font: inherit; }
.chip-ping:hover { filter: brightness(1.25); }

.net-panel {
  position: absolute;
  top: 46px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  width: 290px;
  padding: 12px 14px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.net-title {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--txt-2);
  margin-bottom: 8px;
}

.net-list {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 12px;
  margin: 0 0 10px;
  font-size: 12px;
}

.net-list dt { color: var(--txt-2); }
.net-list dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.net-list dd.is-good { color: var(--good); }
.net-list dd.is-warn { color: var(--warn); }
.net-list dd.is-bad { color: var(--bad); }

.net-hint { display: block; font-size: 10.5px; color: var(--txt-2); line-height: 1.45; }


/* ==========================================================================
   Mensagens diretas
   ========================================================================== */

.rail-dms {
  position: relative;
  font-size: 20px;
  background: var(--bg-2);
}

.rail-dms.is-active { background: var(--accent); color: #fff; }

.rail-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  font-size: 10.5px;
  font-weight: 700;
  color: #fff;
  background: var(--bad);
  border: 2px solid var(--bg-rail);
  border-radius: 999px;
}

/* Cada conversa e uma linha com foto, nome e a ultima mensagem. */
.dm-row {
  width: 100%;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border: none;
  border-radius: 9px;
  background: none;
  color: var(--txt-1);
  cursor: pointer;
  text-align: left;
  transition: background var(--fast), transform var(--fast);
}

.dm-row:hover { background: var(--bg-3); color: var(--txt-0); transform: translateX(2px); }
.dm-row.is-active { background: var(--bg-3); color: var(--txt-0); }

.dm-row .avatar { width: 34px; height: 34px; font-size: 12px; }

.dm-row-text { min-width: 0; }

.dm-row-name {
  display: block;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dm-row.has-unread .dm-row-name { font-weight: 600; color: var(--txt-0); }

.dm-row-last {
  display: block;
  font-size: 11px;
  color: var(--txt-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dm-empty { padding: 22px 14px; text-align: center; color: var(--txt-2); font-size: 12px; line-height: 1.5; }

/* ==========================================================================
   Anexos
   ========================================================================== */

.attach-bar { border-radius: 10px 10px 0 0; }
.chat-attach-btn { right: 36px; }
.chat-field input { padding-right: 70px; }

.chat-file {
  margin-top: 5px;
  max-width: 420px;
}

/* Imagem aparece; o resto vira um cartao para baixar. */
.chat-file img {
  max-width: 100%;
  max-height: 320px;
  border-radius: 10px;
  border: 1px solid var(--line);
  display: block;
  cursor: pointer;
  background: var(--bg-0);
}

.chat-file-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--txt-1);
  text-decoration: none;
  transition: border-color var(--fast), background var(--fast);
}

.chat-file-card:hover { border-color: var(--accent); background: var(--bg-3); }
.chat-file-icon { font-size: 20px; flex-shrink: 0; }
.chat-file-info { min-width: 0; }

.chat-file-name {
  display: block;
  font-size: 12.5px;
  color: var(--txt-0);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-file-size { display: block; font-size: 10.5px; color: var(--txt-2); }

/* Enquanto o arquivo sobe, a barra mostra o progresso. */
.attach-bar.is-uploading .reply-bar-text::after {
  content: " — enviando...";
  color: var(--txt-2);
}

/* A area do chat aceita arquivo largado em cima. */
.chat.is-dropping::after {
  content: "Solte para anexar";
  position: absolute;
  inset: 8px;
  z-index: 30;
  display: grid;
  place-items: center;
  font-size: 14px;
  color: var(--accent-hi);
  background: rgba(91, 108, 255, 0.12);
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  pointer-events: none;
}

/* O painel ganhou linhas de diagnostico e precisa de espaco para rolar. */
.net-panel { max-height: 70vh; overflow-y: auto; width: 310px; }


/* ==========================================================================
   Quem esta assistindo
   ========================================================================== */

/* No canto oposto ao nome, para nao disputar espaco com ele. */
.tile-watchers {
  position: absolute;
  right: 8px;
  top: 8px;
  padding: 3px 9px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: rgba(0, 0, 0, 0.66);
  border-radius: 999px;
  cursor: default;
  opacity: 0;
  transition: opacity 0.22s var(--ease);
}

/* Segue a mesma regra dos outros controles: aparece com o mouse. */
.video-tile.is-hovering .tile-watchers { opacity: 1; }

/* Em destaque e em grade a plateia fica sempre visivel: ali ela e o dado
   que diz se vale a pena continuar transmitindo. */
.stage-grid.is-spotlight .video-tile.is-main .tile-watchers,
.stage-grid.is-grid .tile-watchers {
  opacity: 1;
}


/* ==========================================================================
   Quem eu silenciei
   ========================================================================== */

/* Encostado na direita para nao disputar espaco com o nome nem com o AO
   VIVO, que crescem a esquerda. */
.badge-local-mute {
  margin-left: auto;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  padding: 2px;
  background: transparent;
  border: 0;
  color: var(--warn);
  cursor: pointer;
  line-height: 0;
  opacity: 0.85;
}

.badge-local-mute:hover { opacity: 1; color: var(--bad); }

/* ==========================================================================
   Campo so de leitura (o usuario de entrada)
   ========================================================================== */

.field-readonly {
  display: flex;
  align-items: center;
  gap: 8px;
}

.field-readonly code {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 9px 11px;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 13px;
  color: var(--txt-0);
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.field-readonly .btn { flex-shrink: 0; }

/* ==========================================================================
   Aviso de banda incompativel com a resolucao
   ========================================================================== */

.aviso-banda {
  margin: -6px 0 14px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--warn);
  background: rgba(230, 168, 61, 0.09);
  border-left: 3px solid var(--warn);
  border-radius: 6px;
}

/* ==========================================================================
   Controles do quadro que ficariam debaixo da barra flutuante
   ========================================================================== */

/* Em grade com mais de uma linha, os quadros de baixo encostam na barra de
   Microfone/Audio/Tela. Como a barra e irma do quadro, passar o mouse por
   ela derruba o :hover e os controles somem no meio do caminho. Subi-los
   acima da barra resolve na origem: nao ha mais o que cruzar. */
.video-tile.is-ultima-linha .video-tile-controls {
  bottom: 66px;
}

/* Em tela cheia e no modo cinema a barra nao esta no caminho, entao os
   controles voltam para o lugar natural. */
.video-tile.is-ultima-linha:fullscreen .video-tile-controls,
body.is-theater .video-tile.is-ultima-linha.is-theater .video-tile-controls {
  bottom: 24px;
}

/* ==========================================================================
   Entrar com o Google
   ========================================================================== */

/* Separador entre entrar por senha e entrar pelo Google. */
.auth-ou {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 12px;
  color: var(--txt-2);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.auth-ou::before,
.auth-ou::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* Branco com borda: e o desenho que o Google pede para o proprio botao, e o
   que as pessoas reconhecem sem ler. */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #fff;
  color: #1f1f1f;
  border: 1px solid #dadce0;
  font-weight: 600;
}

.btn-google:hover { background: #f5f6f8; }
.btn-google svg { flex-shrink: 0; }

/* ==========================================================================
   Manter conectado, esqueci a senha e baixar o aplicativo
   ========================================================================== */

.auth-linha {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -2px 0 14px;
}

.check-inline {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--txt-1);
  cursor: pointer;
  user-select: none;
}

.check-inline input { accent-color: var(--accent); cursor: pointer; }

.auth-linha .btn-link { font-size: 12.5px; }

/* O download tem cara de cartao, e nao de botao primario: quem chega no site
   normalmente quer entrar, nao instalar. */
.download-box {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-0);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.download-box:hover {
  border-color: var(--accent);
  background: var(--bg-3);
}

.download-icone {
  font-size: 20px;
  line-height: 1;
  color: var(--accent-hi);
  flex-shrink: 0;
}

.download-texto { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.download-texto strong { font-size: 13px; color: var(--txt-0); }
.download-texto small { font-size: 11.5px; color: var(--txt-2); }

/* ==========================================================================
   Itens de ligar/desligar no menu da pessoa
   ========================================================================== */

/* O rótulo para de mudar entre "Silenciar" e "Reativar": a caixinha mostra o
   estado sem obrigar a ler. */
.peer-menu button.peer-menu-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.peer-menu-caixa {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  border: 1.5px solid var(--line-2, #3a4152);
  border-radius: 4px;
  background: transparent;
  position: relative;
  transition: background 0.12s var(--ease), border-color 0.12s var(--ease);
}

.peer-menu-caixa.is-on {
  background: var(--accent);
  border-color: var(--accent);
}

/* O tique é desenhado, e não uma fonte: assim ele não depende de emoji
   instalado nem muda de forma entre sistemas. */
.peer-menu-caixa.is-on::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(43deg);
}

.peer-menu button.peer-menu-toggle.is-danger .peer-menu-caixa.is-on {
  background: var(--bad);
  border-color: var(--bad);
}

/* ==========================================================================
   Aviso do endereço novo
   ========================================================================== */

.endereco-texto { margin: 0 0 16px; color: var(--txt-1); font-size: 14px; line-height: 1.6; }

.endereco-dominio {
  display: flex;
  justify-content: center;
  padding: 14px;
  margin-bottom: 14px;
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.endereco-dominio code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 17px;
  font-weight: 600;
  color: var(--accent-hi);
  letter-spacing: 0.01em;
}

.endereco-versao { margin: 0; font-size: 12.5px; color: var(--txt-2); text-align: center; }

/* ==========================================================================
   Marcas de áudio e selo VIP
   ========================================================================== */

.peer-marcas { display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; }

.marca-audio {
  display: grid;
  place-items: center;
  line-height: 0;
  color: var(--txt-2);
  cursor: default;
}

/* Vermelho quando foi um administrador que silenciou: é a única forma de a
   pessoa entender que não foi ela quem desligou o próprio microfone, e que
   reativar não está nas mãos dela. */
.marca-audio.is-servidor { color: var(--bad); }

/* A estrela fica do lado OPOSTO ao ponto de status, que mora embaixo à
   direita — assim as duas marcas nunca disputam o mesmo canto. */
/* Dentro do avatar, e nao pela metade fora dele: a estrela solta encostava
   na linha de cima e fazia a lista parecer desalinhada. O anel escuro a
   separa da foto sem precisar de espaco extra. */
.selo-vip {
  position: absolute;
  left: -1px;
  top: -1px;
  width: 11px;
  height: 11px;
  color: #f0c453;
  background: var(--bg-0);
  border-radius: 50%;
  padding: 1.5px;
  box-sizing: content-box;
  pointer-events: none;
}

.peer .selo-vip { width: 12px; height: 12px; }

/* ==========================================================================
   Nível da conta no perfil
   ========================================================================== */

.nivel-caixa {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.nivel-atual { font-size: 14px; font-weight: 600; color: var(--txt-0); }
.nivel-atual.is-vip { color: #f0c453; }

.nivel-caixa small {
  font-size: 11.5px;
  color: var(--txt-2);
  font-variant-numeric: tabular-nums;
}

#perfil-codigo {
  flex: 1;
  min-width: 0;
  padding: 9px 11px;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--txt-0);
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
}

#perfil-codigo:focus { border-color: var(--accent); }

/* ==========================================================================
   Ajuste da foto de perfil
   ========================================================================== */

.recorte-area {
  position: relative;
  width: 100%;
  max-width: 280px;
  aspect-ratio: 1;
  margin: 0 auto 18px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--bg-0);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.recorte-area.is-arrastando { cursor: grabbing; }

.recorte-area img {
  position: absolute;
  transform-origin: 0 0;
  max-width: none;
  pointer-events: none;
}

/* O círculo mostra exatamente o que vai virar avatar: o escuro em volta é o
   que será descartado, e não decoração. */
.recorte-mascara {
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: 0 0 0 999px rgba(9, 10, 14, 0.68);
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
}

.recorte-zoom { margin-bottom: 10px; }
.recorte-zoom input { width: 100%; accent-color: var(--accent); }
.recorte-dica { margin: 0; font-size: 12.5px; color: var(--txt-2); text-align: center; }


/* ==========================================================================
   Painel do usuário: nada pode ser cortado
   ========================================================================== */

/* Sem flex-shrink os três botões encolhiam quando o nome era comprido, e a
   engrenagem acabava saindo pela borda da coluna. */
.user-panel { overflow: hidden; }
.user-panel .mini-btn { flex-shrink: 0; }
.user-panel .avatar-wrap { flex-shrink: 0; }

/* Nota explicando por que uma ação não está disponível: não é um botão, é
   uma resposta. Sem ela, o menu parecia quebrado. */
.peer-menu button.is-nota {
  color: var(--txt-2);
  font-size: 11.5px;
  cursor: default;
  pointer-events: none;
}

/* ==========================================================================
   O que mudou na versão
   ========================================================================== */

.novidades-titulo {
  margin: 18px 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--txt-2);
}

.novidades-lista {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.novidades-lista li { font-size: 13.5px; line-height: 1.5; color: var(--txt-1); }

/* ==========================================================================
   Sala privada e empilhamento dos modais
   ========================================================================== */

.cadeado-canal { font-size: 10.5px; opacity: 0.75; flex-shrink: 0; }

/* O editor de recorte abre POR CIMA do perfil. Com o mesmo z-index, quem
   vinha depois no HTML ganhava — e o perfil, que abriu antes, tapava o
   editor que ele mesmo chamou. */
#modal-recorte { z-index: 70; }

/* ==========================================================================
   Arrastar canais para reordenar
   ========================================================================== */

.channel.is-dragging { opacity: 0.45; }

/* A linha mostra ONDE o canal vai cair. Sem ela, arrastar é adivinhação. */
.channel.is-drop-antes { box-shadow: inset 0 2px 0 0 var(--accent); }
.channel.is-drop-depois { box-shadow: inset 0 -2px 0 0 var(--accent); }

/* ==========================================================================
   Qualidade da transmissão recebida
   ========================================================================== */

/* Canto superior ESQUERDO: o nome fica embaixo à esquerda e o contador de
   plateia em cima à direita, então este é o único canto livre. */
.tile-qualidade {
  position: absolute;
  left: 8px;
  top: 8px;
  padding: 3px 9px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: rgba(0, 0, 0, 0.66);
  border-radius: 999px;
  cursor: default;
  opacity: 0;
  transition: opacity 0.22s var(--ease);
}

/* Segue a mesma regra dos outros controles: aparece com o mouse, some
   parado. É informação para conferir, não um número disputando com a
   imagem o tempo todo. */
.video-tile:hover .tile-qualidade,
.video-tile.is-hovering .tile-qualidade { opacity: 1; }

body.is-theater .video-tile.is-theater .tile-qualidade,
.video-tile:fullscreen .tile-qualidade { left: 24px; top: 24px; }

/* ==========================================================================
   Campo de sugestão
   ========================================================================== */

#sugestao-texto {
  width: 100%;
  resize: vertical;
  min-height: 62px;
  padding: 10px 12px;
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  color: var(--txt-0);
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
}

#sugestao-texto:focus { border-color: var(--accent); }

/* ==========================================================================
   Tela de atualização — só o K e a barra
   ========================================================================== */

.atualizando {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: rgba(10, 12, 17, 0.92);
  backdrop-filter: blur(8px);
}

.atualizando-caixa {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  padding: 46px 54px;
  width: min(400px, 88vw);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

/* O K grande é o único elemento visual: nada mais disputa a atenção de quem
   está só esperando. */
.atualizando-marca {
  width: 132px;
  height: 132px;
  border-radius: 30px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #7c8bff 0%, #5b6cff 100%);
  box-shadow: 0 0 44px rgba(107, 124, 255, 0.42);
}

.atualizando-marca span {
  font-size: 82px;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  letter-spacing: -0.04em;
}

.atualizando-titulo {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--txt-0);
}

.atualizando-barra {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--bg-0);
  overflow: hidden;
}

.atualizando-preenche {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #7c8bff, #a3adff);
  transition: width 0.3s var(--ease);
}

.atualizando-passo {
  margin: 0;
  font-size: 12.5px;
  color: var(--txt-2);
  font-variant-numeric: tabular-nums;
}
