:root {
  --bg-servers: #1e1f22;
  --bg-channels: #2b2d31;
  --bg-main: #313338;
  --bg-input: #383a40;
  --bg-hover: #35373c;
  --bg-active: #404249;
  --text: #dbdee1;
  --text-muted: #949ba4;
  --accent: #5865f2;
  --green: #23a55a;
  --red: #da373c;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "gg sans", "Segoe UI", system-ui, sans-serif;
  background: var(--bg-main);
  color: var(--text);
  overflow: hidden;
}
button { font: inherit; cursor: pointer; }
ul { list-style: none; margin: 0; padding: 0; }
.hidden { display: none !important; }

/* Login */
.overlay {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: linear-gradient(135deg, #404eed, #2b2d31);
  z-index: 10;
}
#login {
  place-content: center; justify-items: center; gap: 20px; overflow-y: auto; padding: 24px 16px;
  background:
    radial-gradient(60% 50% at 20% 15%, rgba(88,101,242,.55), transparent 70%),
    radial-gradient(50% 45% at 85% 85%, rgba(168,85,247,.45), transparent 70%),
    linear-gradient(160deg, #1d1b4b, #141327 60%, #0f0e1f);
}
#login .login-box {
  background: rgba(43,45,49,.82); backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.08); border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
}
#login .login-box input { border: 1px solid transparent; transition: border-color .15s; }
#login .login-box input:focus { border-color: var(--accent); }
#login-submit {
  border-radius: 8px; background: linear-gradient(135deg, #5865f2, #8b5cf6);
  transition: filter .15s, transform .15s;
}
#login-submit:hover { filter: brightness(1.1); }
#login-submit:active { transform: translateY(1px); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 56px; height: 56px; filter: drop-shadow(0 6px 18px rgba(139,92,246,.55)); }
.brand span { font-size: 34px; font-weight: 800; letter-spacing: -.5px; color: #fff; }
.download-pc {
  display: flex; align-items: center; gap: 14px; width: min(400px, 90vw);
  color: #fff; text-decoration: none; text-align: left;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
  padding: 14px 18px; border-radius: 14px;
  transition: background .15s, border-color .15s, transform .15s;
}
.download-pc span { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.download-pc b { font-size: 15px; }
.download-pc small { font-size: 12px; color: #b5bac1; }
.download-pc svg { color: #8ea1ff; flex-shrink: 0; }
.download-pc .download-arrow { color: #fff; opacity: .7; transition: transform .15s, opacity .15s; }
.download-pc:hover { background: rgba(88,101,242,.22); border-color: rgba(142,161,255,.5); transform: translateY(-1px); }
.download-pc:hover .download-arrow { opacity: 1; transform: translateY(2px); }
.login-box {
  background: var(--bg-main); padding: 32px; border-radius: 8px; width: min(400px, 90vw);
  display: flex; flex-direction: column; gap: 12px; text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.login-box h1 { margin: 0; font-size: 22px; }
.login-box p { margin: 0 0 8px; color: var(--text-muted); }
.login-box input, .composer input {
  background: var(--bg-input); border: 0; border-radius: 6px; color: var(--text);
  padding: 12px; font-size: 15px; outline: none;
}
.login-box button {
  background: var(--accent); color: #fff; border: 0; border-radius: 4px; padding: 12px; font-weight: 600;
}
.login-box button:disabled { opacity: .6; cursor: default; }
.login-box label {
  display: flex; flex-direction: column; gap: 6px; text-align: left;
  font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--text-muted);
}
.password-field { position: relative; display: flex; }
.password-field input { flex: 1; min-width: 0; padding-right: 44px; }
.login-box .toggle-pass {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; padding: 0; background: transparent; border-radius: 4px;
  font-size: 18px; color: var(--text-muted); opacity: .6;
}
.login-box .toggle-pass:hover, .login-box .toggle-pass.on { opacity: 1; background: var(--bg-hover); }
.login-error { color: #fa777c; font-size: 14px; min-height: 18px; }
.login-switch { font-size: 14px; color: var(--text-muted); text-align: left; }
.login-switch a { color: #00a8fc; text-decoration: none; }
.login-switch a:hover { text-decoration: underline; }

/* Editar perfil */
.modal { background: rgba(0,0,0,.7); z-index: 20; }
.profile-avatar { display: flex; align-items: center; gap: 16px; margin: 8px 0; }
.profile-avatar .avatar { width: 80px; height: 80px; font-size: 32px; }
.profile-avatar-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.login-box button.secondary { background: var(--bg-active); padding: 8px 14px; }
.login-box button.secondary:hover { background: #4e5058; }
.login-box button.link { background: transparent; color: var(--text); font-weight: 500; padding: 8px; }
.login-box button.link:hover { text-decoration: underline; }
.profile-avatar-actions button.link { color: #fa777c; padding: 0; font-size: 13px; }
.profile-buttons { display: flex; justify-content: flex-end; gap: 8px; }
.profile-buttons button[type=submit] { padding: 10px 24px; }

/* Layout */
#app { display: flex; height: 100vh; }

.servers {
  width: 72px; background: var(--bg-servers); padding: 12px 0;
  display: flex; flex-direction: column; align-items: center; gap: 8px; flex-shrink: 0;
}
.server-icon {
  width: 48px; height: 48px; border-radius: 16px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 700; overflow: hidden;
}
.server-icon img { width: 100%; height: 100%; object-fit: cover; background: #fff; }

.channels {
  width: 240px; background: var(--bg-channels); display: flex; flex-direction: column; flex-shrink: 0;
}
.server-name {
  height: 48px; padding: 0 16px; display: flex; align-items: center; font-weight: 600;
  border-bottom: 1px solid #1f2023;
}
.channel-list { flex: 1; overflow-y: auto; padding: 8px; }
.category {
  font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--text-muted);
  padding: 16px 8px 4px; display: flex; align-items: center; justify-content: space-between;
}
.add-channel {
  background: transparent; border: 0; color: var(--text-muted); font-size: 18px; line-height: 1;
  padding: 0 2px; display: none;
}
.add-channel:hover { color: var(--text); }
.can-manage .manage-only { display: block; }
.channel {
  padding: 6px 8px; border-radius: 4px; color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; gap: 6px;
}
.channel:hover { background: var(--bg-hover); color: var(--text); }
.channel.active { background: var(--bg-active); color: #fff; }
.channel .icon { width: 20px; text-align: center; opacity: .8; }
.voice-users { padding-left: 32px; }
.voice-user {
  display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 14px; color: var(--text-muted);
}
.voice-user .avatar { width: 22px; height: 22px; font-size: 11px; }
.badge-live {
  background: var(--red); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 5px;
  border-radius: 4px; margin-left: auto;
}

.voice-panel { background: #232428; padding: 8px 8px 10px; border-bottom: 1px solid #1f2023; }
.voice-status { display: flex; align-items: center; gap: 8px; padding: 0 2px; }
.vs-signal { color: var(--green); flex-shrink: 0; }
.vs-text { flex: 1; min-width: 0; }
.vs-title { color: var(--green); font-weight: 600; font-size: 14px; }
.vs-sub {
  color: var(--text-muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vp-icon {
  width: 32px; height: 32px; border: 0; border-radius: 4px; background: transparent; color: var(--text);
  display: grid; place-items: center; flex-shrink: 0;
}
.vp-icon:hover { background: var(--bg-active); color: #fa777c; }
.voice-actions { display: flex; gap: 8px; margin-top: 8px; }
.voice-actions button {
  flex: 1; height: 32px; background: #2b2d31; color: var(--text); border: 0; border-radius: 8px;
  display: grid; place-items: center;
}
.voice-actions button:hover { background: var(--bg-active); }
.voice-actions button.on { background: var(--green); color: #fff; }

.user-panel {
  height: 52px; background: #232428; display: flex; align-items: center; gap: 2px; padding: 0 8px;
}
.user-panel .me { margin-right: 4px; }
.me {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 4px; margin-left: -4px;
  border-radius: 4px; cursor: pointer;
}
.me:hover { background: var(--bg-active); }
.me-name { flex: 1; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn {
  background: transparent; border: 0; border-radius: 4px; width: 30px; height: 32px; font-size: 16px;
  padding: 0; flex-shrink: 0;
}
.icon-btn:hover { background: var(--bg-active); }
.icon-btn.muted { background: rgba(218,55,60,.3); }
.power-btn { color: var(--text-muted); display: grid; place-items: center; }
.power-btn:hover { color: #fa777c; }

.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; color: #fff; flex-shrink: 0; font-size: 14px;
}
.avatar.speaking { box-shadow: 0 0 0 2px var(--green); }

/* Principal */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.main-header {
  height: 48px; padding: 0 16px; display: flex; align-items: center; gap: 6px; font-weight: 600;
  border-bottom: 1px solid #26272b; flex-shrink: 0;
}
.hash { color: var(--text-muted); font-size: 22px; }

.stage {
  background: #000; flex: 0 0 55%; display: grid; gap: 8px; padding: 8px; min-height: 0;
  grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows, 1), minmax(0, 1fr)); overflow: hidden;
}
/* uma tela em destaque em cima e as outras pequenas numa fileira embaixo */
.stage.has-focus {
  grid-template-columns: repeat(var(--others, 1), minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr) clamp(90px, 22%, 180px);
}
.stage.has-focus .tile.focused { grid-column: 1 / -1; order: -1; }
.main.chat-hidden .stage { flex: 1 1 auto; }
.main.chat-hidden .messages, .main.chat-hidden .composer { display: none; }
.tile {
  position: relative; background: #111; border-radius: 8px; overflow: hidden; min-height: 0; cursor: pointer;
}
.header-btn {
  margin-left: auto; background: var(--bg-input); color: var(--text); border: 0; border-radius: 4px;
  padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.header-btn:hover { background: var(--bg-active); }
.tile video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.tile .label {
  position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.65); padding: 3px 8px;
  border-radius: 4px; font-size: 13px;
}
.tile .fs {
  position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.65); color: #fff;
  border: 0; border-radius: 4px; padding: 4px 8px; opacity: 0; transition: opacity .15s;
}
.tile:hover .fs { opacity: 1; }

.messages { flex: 1; overflow-y: auto; padding: 16px 0; }
.msg { display: flex; gap: 16px; padding: 4px 16px; }
.msg:hover { background: #2e3035; }
.msg .avatar { width: 40px; height: 40px; margin-top: 2px; }
.msg.cont { padding-top: 0; }
.msg.cont .avatar { visibility: hidden; height: 0; }
.msg-head { display: flex; align-items: baseline; gap: 8px; }
.msg-author { font-weight: 600; }
.msg-time { font-size: 12px; color: var(--text-muted); }
.msg-text { white-space: pre-wrap; word-wrap: break-word; line-height: 1.4; }
.msg-text a { color: #00a8fc; }
.empty { color: var(--text-muted); padding: 16px; }

.composer { padding: 0 16px 24px; }
.composer-bar { display: flex; align-items: center; background: var(--bg-input); border-radius: 8px; }
.composer-bar input { flex: 1; min-width: 0; background: transparent; }
.attach-btn {
  width: 28px; height: 28px; margin-left: 12px; border: 0; border-radius: 50%;
  background: #b5bac1; color: var(--bg-input); font-weight: 700; font-size: 16px; line-height: 1;
}
.attach-btn:hover { background: #dbdee1; }
.attachment {
  position: relative; display: inline-block; background: #2b2d31; padding: 8px; border-radius: 8px 8px 0 0;
}
.attachment img { max-height: 160px; max-width: 240px; border-radius: 4px; display: block; }
.attachment button {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border: 0; border-radius: 4px;
  background: var(--red); color: #fff;
}
.composer-error { color: #fa777c; font-size: 13px; min-height: 0; padding-top: 4px; }
.composer-error:empty { display: none; }
.msg-image {
  display: block; margin-top: 4px; max-width: min(400px, 100%); max-height: 300px; border-radius: 6px; cursor: zoom-in;
}
.main { position: relative; }
.drop-hint {
  position: absolute; inset: 48px 0 0; display: grid; place-items: center; pointer-events: none;
  background: rgba(88,101,242,.85); color: #fff; font-size: 20px; font-weight: 700; z-index: 5;
}
.avatar { transition: box-shadow .1s; }

.members {
  width: 240px; background: var(--bg-channels); padding: 8px; flex-shrink: 0; overflow-y: auto;
}
.members li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 4px; }
.members li:hover { background: var(--bg-hover); }
.offline-list li { opacity: .4; }
.members { display: flex; flex-direction: column; }
.site-link {
  margin-top: auto; align-self: center; background: none; border: 0; padding: 12px 8px 4px;
  font-size: 11px; color: var(--text-muted); opacity: .35; cursor: pointer;
}
.site-link:hover { opacity: .9; text-decoration: underline; }

@media (max-width: 900px) {
  .members { display: none; }
}
@media (max-width: 640px) {
  .servers { display: none; }
  .channels { width: 200px; }
}

/* Participantes da voz */
.voice-user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-user-icon { font-size: 12px; opacity: .8; }
.voice-user { cursor: default; border-radius: 4px; padding-right: 4px; }
.voice-user:hover { background: var(--bg-hover); color: var(--text); }

/* Membros e cargos */
.member-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-badge { font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; text-transform: uppercase; }
.role-admin { background: rgba(237,66,69,.2); color: #fa777c; }
.role-mod { background: rgba(88,101,242,.25); color: #949cf7; }

/* Menu do botão direito */
.context-menu {
  position: fixed; z-index: 200; min-width: 200px; max-width: 260px; background: #111214; border-radius: 6px;
  padding: 6px; box-shadow: 0 8px 16px rgba(0,0,0,.5); display: flex; flex-direction: column;
}
.menu-item {
  background: transparent; border: 0; color: var(--text); text-align: left; padding: 7px 8px;
  border-radius: 3px; font-size: 14px;
}
.menu-item:hover { background: var(--accent); color: #fff; }
.menu-item.danger { color: #fa777c; }
.menu-item.danger:hover { background: var(--red); color: #fff; }
.menu-item.checked::after { content: '✓'; float: right; }
.menu-header {
  font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); padding: 6px 8px 2px;
}
.menu-sep { height: 1px; background: #2b2d31; margin: 4px 2px; }
.menu-slider { display: flex; align-items: center; gap: 8px; padding: 4px 8px 8px; font-size: 13px; }
.menu-slider input { flex: 1; accent-color: var(--accent); }
.menu-slider span { width: 38px; text-align: right; color: var(--text-muted); }

/* Configurações de voz e janelas */
.voice-meter {
  position: relative; height: 10px; background: var(--bg-input); border-radius: 5px; overflow: hidden;
}
.voice-meter-fill { height: 100%; width: 0; background: #faa61a; transition: width .05s linear; }
.voice-meter-fill.open { background: var(--green); }
.voice-meter-line { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; }
.sensitivity-legend { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); }
.voice-hint { font-size: 13px; text-align: left; margin: 0 !important; }
.dialog-text { text-align: left; color: var(--text) !important; }
.login-box button.danger { background: var(--red); }

/* Voz e áudio */
.settings-box {
  width: min(640px, 94vw); max-height: 90vh; overflow-y: auto; text-align: left; gap: 14px;
}
.settings-head { display: flex; align-items: center; justify-content: space-between; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px 20px; }
@media (max-width: 560px) { .settings-grid { grid-template-columns: 1fr; } }
.settings-box select {
  background: var(--bg-input); color: var(--text); border: 0; border-radius: 6px; padding: 10px;
  font: inherit; font-size: 14px; text-transform: none; font-weight: 400; outline: none; min-width: 0;
}
.settings-box input[type=range] { padding: 0; background: transparent; accent-color: var(--accent); width: 100%; }
.range-value { float: right; color: var(--text); font-weight: 600; text-transform: none; }
.settings-box label .range-value { margin-left: auto; }
.settings-grid label { display: flex; flex-direction: column; }
.mic-test-row { display: flex; align-items: center; gap: 14px; }
.login-box .mic-test-row button { padding: 9px 16px; white-space: nowrap; flex-shrink: 0; }
.login-box .mic-test-row button.on { background: var(--red); }
.mic-test-row .voice-meter { flex: 1; }
.settings-sep { border: 0; border-top: 1px solid #3f4147; width: 100%; margin: 4px 0; }
.settings-title { margin: 0; font-size: 15px; color: var(--text); }
.login-box label.radio-option {
  flex-direction: row; align-items: flex-start; gap: 10px; text-transform: none; font-size: 14px;
  font-weight: 400; color: var(--text); cursor: pointer;
}
.radio-option input { margin-top: 3px; accent-color: var(--accent); width: 18px; height: 18px; padding: 0; }
.radio-option small { display: block; color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.custom-options { display: flex; flex-direction: column; gap: 10px; padding-left: 28px; }
.login-box label.switch-row {
  flex-direction: row; align-items: center; justify-content: space-between; text-transform: none;
  font-size: 14px; font-weight: 400; color: var(--text); cursor: pointer;
}
.switch {
  appearance: none; width: 40px !important; height: 24px; padding: 0 !important; border-radius: 12px !important;
  background: #80848e !important; position: relative; cursor: pointer; flex-shrink: 0; transition: background .15s;
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform .15s;
}
.switch:checked { background: var(--accent) !important; }
.switch:checked::after { transform: translateX(16px); }
.ptt-box { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.login-box .ptt-key { background: var(--bg-input); padding: 8px 16px; font-weight: 600; min-width: 140px; }
.login-box .ptt-key.recording { background: var(--red); }
.tile video.mirror { transform: scaleX(-1); }
.ai-noise-row { gap: 16px; background: #2b2d31; padding: 12px 14px; border-radius: 8px; }
.ai-noise-row small { display: block; color: var(--text-muted); font-size: 12px; margin-top: 3px; }
.switch:disabled { opacity: .4; cursor: not-allowed; }
.login-box .vp-icon { background: transparent; padding: 0; color: var(--text-muted); font-size: 18px; }
.login-box .vp-icon:hover { background: var(--bg-active); color: var(--text); }
.settings-box { scrollbar-width: thin; scrollbar-color: #1a1b1e transparent; }

/* Ícones de microfone/fone */
.icon-btn { color: var(--text-muted); display: grid; place-items: center; }
.icon-btn:hover { color: var(--text); }
.icon-btn.muted { background: transparent; }
.icon-btn.muted:hover { background: var(--bg-active); }
.ui-icon.off { color: #f23f43; }
.ui-icon .slash { stroke: #f23f43; stroke-width: 2.4; }
.voice-user-icon { display: grid; place-items: center; }
.tile .loading {
  position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-muted); font-size: 14px;
  pointer-events: none;
}
.settings-box { overflow-x: hidden; }
.settings-box select { width: 100%; text-overflow: ellipsis; }

/* Jogo detectado */
.game-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px 10px;
  background: #2b2d31; border-radius: 8px; padding: 8px; margin-bottom: 10px;
}
.game-icon { width: 32px; height: 32px; border-radius: 6px; object-fit: contain; }
.game-icon.hidden + .game-text { grid-column: 1 / 3; }
.game-label { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.game-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-share {
  grid-column: 1 / -1; grid-row: 2; display: flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: 7px; font-size: 13px; font-weight: 600;
}
.game-share:hover { background: #4752c4; }
.game-dismiss {
  grid-column: 3; grid-row: 1; background: transparent; border: 0; color: var(--text-muted); font-size: 12px;
  padding: 2px 5px; border-radius: 4px; align-self: start;
}
.game-dismiss:hover { color: var(--text); background: var(--bg-active); }

/* Transmissões: só assiste quem clicar */
.badge-live.clickable { cursor: pointer; }
.badge-live.clickable:hover { filter: brightness(1.15); }
.tile.invite {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  cursor: pointer; background: #1e1f22;
}
.tile.invite .invite-name { font-size: 15px; font-weight: 600; }
.tile.invite .invite-btn {
  background: var(--accent); color: #fff; border: 0; border-radius: 4px; padding: 8px 16px; font-weight: 600;
  cursor: pointer;
}
.tile.invite .invite-btn:disabled { opacity: .6; cursor: default; }
.stream-controls {
  position: absolute; top: 8px; right: 8px; display: flex; align-items: center; gap: 8px;
  opacity: .85; transition: opacity .15s;
}
.tile:hover .stream-controls { opacity: 1; }
.stream-volume {
  display: flex; align-items: center; gap: 6px; background: rgba(0,0,0,.65); padding: 4px 8px;
  border-radius: 4px; font-size: 12px;
}
.stream-volume input { width: 90px; accent-color: var(--accent); }
.stream-volume span { min-width: 34px; text-align: right; }
.stream-stop {
  background: var(--red); color: #fff; border: 0; border-radius: 4px; padding: 5px 10px; font-weight: 600;
  cursor: pointer;
}

/* Emojis */
.composer { position: relative; }
.emoji-btn {
  background: transparent; border: 0; font-size: 22px; line-height: 1; padding: 0 12px; cursor: pointer;
  filter: grayscale(1); opacity: .7; transition: filter .15s, opacity .15s, transform .15s;
}
.emoji-btn:hover { filter: none; opacity: 1; transform: scale(1.1); }
.emoji-picker {
  position: absolute; right: 16px; bottom: calc(100% + 8px); width: min(352px, calc(100% - 32px)); max-height: 340px;
  overflow-y: auto; background: #2b2d31; border: 1px solid #1f2023; border-radius: 8px; padding: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); z-index: 20;
}
.emoji-group {
  font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); padding: 8px 4px 4px;
}
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); }
.emoji-grid button {
  background: transparent; border: 0; border-radius: 4px; font-size: 22px; line-height: 1; padding: 6px 0; cursor: pointer;
}
.emoji-grid button:hover { background: var(--bg-active); }

/* Janela separada (picture-in-picture) */
.tile .pip { right: 118px; }
.tile .hide-self { top: 8px; bottom: auto; }
.tile .stats-btn { right: auto; left: 8px; top: 8px; bottom: auto; }
.tile .stream-stats {
  position: absolute; left: 8px; top: 40px; margin: 0; padding: 6px 8px; background: rgba(0,0,0,.75);
  color: #fff; border-radius: 4px; font: 12px/1.45 ui-monospace, Consolas, monospace; pointer-events: none;
}
.tile.in-pip .pip { opacity: 1; background: var(--accent); }
.tile.in-pip::after {
  content: 'Aberta numa janela separada'; position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--text-muted); font-size: 14px; pointer-events: none;
}

/* Vários servidores */
.server-list { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.server-icon {
  cursor: pointer; background: var(--bg-main); color: var(--text); font-size: 15px;
  transition: border-radius .15s, background .15s; position: relative;
}
.server-icon:hover { border-radius: 12px; background: var(--accent); color: #fff; }
.server-icon.active { border-radius: 12px; background: var(--accent); color: #fff; }
.server-icon.active::before {
  content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0;
  background: #fff;
}
.server-icon { overflow: visible; }
.server-icon img { border-radius: inherit; }
.add-server {
  border: 0; font-size: 24px; font-weight: 400; color: var(--green); background: var(--bg-main);
}
.add-server:hover { background: var(--green); color: #fff; }

/* Mensagens privadas */
.dm-home { border: 0; font-size: 22px; }
.dm-badge {
  position: absolute; right: -4px; bottom: -4px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center; border: 3px solid var(--bg-servers); box-sizing: content-box;
}
.server-sep { width: 32px; height: 2px; border-radius: 1px; background: var(--bg-active); }
.dm-item { gap: 10px; }
.dm-item .avatar { width: 28px; height: 28px; font-size: 12px; flex-shrink: 0; }
.dm-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); flex-shrink: 0; }
.dm-empty { color: var(--text-muted); font-size: 13px; padding: 8px; line-height: 1.4; }

/* Imagem ampliada */
.lightbox {
  position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.85);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; cursor: zoom-out;
}
.lightbox img { max-width: 90vw; max-height: 85vh; object-fit: contain; border-radius: 4px; }
.msg-image { cursor: zoom-in; }

/* Vídeo do YouTube dentro do chat */
.yt-wrap { margin-top: 6px; width: 720px; max-width: 100%; }
.yt-wrap.short { width: min(340px, calc(70vh * 9 / 16)); }
.yt-embed {
  position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 6px;
  overflow: hidden; background: #000; cursor: pointer;
}
.yt-wrap.short .yt-embed { aspect-ratio: 9 / 16; }
.yt-volume {
  display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 13px; color: var(--text-muted);
}
.yt-volume input { flex: 1; max-width: 240px; accent-color: var(--accent); }
.yt-volume span { min-width: 38px; }
.yt-embed img { width: 100%; height: 100%; object-fit: cover; display: block; }
.yt-embed iframe { width: 100%; height: 100%; border: 0; display: block; }
.yt-embed.playing { cursor: default; }
.yt-play {
  position: absolute; left: 50%; top: 50%; width: 68px; height: 48px; transform: translate(-50%, -50%);
  background: rgba(33,33,33,.8); border-radius: 12px; transition: background .15s;
}
.yt-play::after {
  content: ''; position: absolute; left: 27px; top: 14px; border-style: solid; border-width: 10px 0 10px 18px;
  border-color: transparent transparent transparent #fff;
}
.yt-embed:hover .yt-play { background: #f00; }

/* o corpo da mensagem ocupa a linha toda, para os vídeos poderem ficar grandes */
.msg-body { flex: 1; min-width: 0; }
