/* ==========================================================================
   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: 10px;
  --radius-sm: 7px;
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { 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);
  display: grid; grid-template-rows: 46px 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; }
