/* // 1. СБРОС И БАЗОВЫЕ СТИЛИ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
}

html.theme-dark {
  color-scheme: dark;
}

html.theme-light {
  color-scheme: light;
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.app-root {
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}

html.ui-scaled .app-root {
  width: calc(100% / var(--ui-scale));
  height: calc(100% / var(--ui-scale));
  transform: scale(var(--ui-scale));
  transform-origin: top left;
}

/* // 2. CSS-ПЕРЕМЕННЫЕ (единые для всего) */
:root {
  --ui-scale: 1;
  /* // Цвета */
  --accent: #b04cff;
  --accent-strong: #ff6ad5;
  --accent-light: rgba(176, 76, 255, 0.15);
  
  --bg: #0b0f14;
  --panel: rgba(255, 255, 255, 0.03);
  --panel-solid: #1a1d21;
  --border: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.04);
  
  --text: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: rgba(255, 255, 255, 0.6);
  
  --online: #3fb950;
  --idle: #f0883e;
  --dnd: #f85149;
  
  /* // Размеры */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
}

/* // 3. УТИЛИТЫ (переиспользуемые классы) */
.hidden { display: none !important; }
[hidden] { display: none !important; }
.muted { color: var(--text-muted); }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

.status { font-size: 12px; }
.status.online { color: var(--online); }
.status.idle { color: var(--idle); }
.status.dnd { color: var(--dnd); }
.status.offline { color: var(--text-secondary); }

/* // 4. КОМПОНЕНТЫ (кнопки, инпуты, аватарки) */

/* // Кнопки */
.btn {
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--accent);
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
}

.btn:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(176, 76, 255, 0.35);
}

.btn:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--panel-solid);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-ghost {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
  color: var(--text);
}

.btn-small {
  padding: 6px 12px;
  font-size: 13px;
}

/* // Поля ввода */
.inp {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}

.inp:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(176, 76, 255, 0.1);
}

.inp::placeholder {
  color: var(--text-muted);
}

/* // Аватарки */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: white;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.avatar.small {
  width: 24px;
  height: 24px;
  font-size: 12px;
}

.avatar.large {
  width: 48px;
  height: 48px;
  font-size: 18px;
}

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

/* // Иконки */
.icon-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}


/* // file input */
.file-input,
#fileInput,
.composer input[type="file"] {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
}
/* // 5. ШАПКА */
.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  font-weight: 800;
  font-size: 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.topbar-center {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}

.download-page-btn {
  position: absolute;
  top: 50%;
  right: var(--space-lg);
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-secondary);
  font-size: 22px;
  line-height: 1;
}

.download-page-btn:hover,
.download-page-btn:focus-visible {
  color: var(--text);
  border-color: rgba(176, 76, 255, 0.42);
  background: rgba(176, 76, 255, 0.12);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-only {
  display: none;
}

@media (max-width: 900px), (pointer: coarse) {
  .mobile-only {
    display: inline-flex;
  }

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


/* // 6. ОСНОВНОЙ МАКЕТ */
.layout {
  display: flex;
  height: calc(100vh - 56px);
  height: calc(100svh - 56px);
  height: calc(100dvh - 56px);
gap: var(--space-md);
  padding: var(--space-md);
  position: relative;
  overflow: hidden;

}

.ui-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

body.channels-open .ui-overlay,
body.servers-open .ui-overlay,
body.members-open .ui-overlay {
  opacity: 1;
  pointer-events: all;
}


/* // 7. ПАНЕЛИ (серверы, каналы, чат, участники) */
.panel {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 0;
}

/* // Левая панель - серверы */
.panel.servers {
  width: 240px;
  flex-shrink: 0;
}

/* // Правая панель - участники */
.panel.members {
  width: 240px;
  flex-shrink: 0;
}

/* // Центральная панель - чат */
.panel.chat {
  flex: 1;
  min-width: 0;
}

/* // Панель каналов */
.panel.channels {
  width: 240px;
  flex-shrink: 0;
}

/* // Заголовок панели */
.panelHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panelHeader h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* // 8. СПИСКИ (серверы, каналы, друзья) */
.list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm);
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.list::-webkit-scrollbar {
  width: 6px;
}

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

.list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.list::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* // Элемент списка */
.item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 4px;
  text-decoration: none;
  color: inherit;
}

.item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.item.active {
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
  font-weight: 600;
}

.item.active:hover {
  background: rgba(176, 76, 255, 0.25);
}

.item .text {
  flex: 1;
  min-width: 0;
}

.item .title {
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item .sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* DM preview should be single-line (no raw markers / ids leaking by wrapping) */
.item.dm .sub {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* channel admin (delete) */
.channel-del {
  margin-left: auto;
  width: 34px;
  height: 28px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.80);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
}
.channel-del:hover {
  background: rgba(255, 80, 80, 0.14);
  border-color: rgba(255, 80, 80, 0.35);
  color: rgba(255,255,255,0.92);
}



.item.dm {
  position: relative;
}

.item.dm .dm-hide {
  margin-left: 8px;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
  flex: 0 0 auto;
}

.item.dm:hover .dm-hide {
  opacity: 1;
}

.item.dm .dm-hide:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text);
}

/* // Специальные элементы */
.friends-button.item {
  margin-bottom: var(--space-md);
  background: rgba(176, 76, 255, 0.1);
  border: 1px solid rgba(176, 76, 255, 0.2);
}

.friends-button.item:hover {
  background: rgba(176, 76, 255, 0.15);
}

.friends-button.item.active {
  background: rgba(176, 76, 255, 0.2);
}

/* // 9. ЧАТ (основная часть) */
#chatView {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

/* // Контейнер сообщений */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  scrollbar-width: thin;
  scrollbar-color: rgba(176, 76, 255, 0.3) transparent;
}

.messages::-webkit-scrollbar {
  width: 8px;
}

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

.messages::-webkit-scrollbar-thumb {
  background: rgba(176, 76, 255, 0.3);
  border-radius: 4px;
}

.messages::-webkit-scrollbar-thumb:hover {
  background: rgba(176, 76, 255, 0.5);
}

/* // Маркер новых сообщений + кнопка "вниз" */
.new-messages-marker {
  margin: 8px 0;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  border: 1px solid rgba(176, 76, 255, 0.35);
  background: rgba(176, 76, 255, 0.08);
}

.jump-to-present {
  position: absolute;
  right: 18px;
  bottom: 76px; /* над полем ввода */
  z-index: 30;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(176, 76, 255, 0.45);
  background: rgba(20, 22, 30, 0.95);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.45);
}

.jump-to-present:hover {
  border-color: rgba(176, 76, 255, 0.7);
}

.jump-to-present.hidden {
  display: none;
}

/* // Приветствие канала */
.channel-welcome {
  text-align: center;
  padding: var(--space-xl);
  color: var(--text-secondary);
}

.channel-welcome h2 {
  font-size: 24px;
  margin-bottom: var(--space-sm);
  color: var(--text);
}

/* // Форма ввода */
.composer {
  padding: var(--space-md);
  padding-bottom: calc(var(--space-md) + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.composer-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.attach-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md);
}

.attach-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.composer .inp {
  flex: 1;
}

.composer .btn {
  flex-shrink: 0;
}

.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  max-width: 100%;
}

.attachment-chip .name {
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

.attachment-chip .meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.attachment-chip .remove {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  cursor: pointer;
}

.attachment-chip .remove:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.10);
}

/* // 11. ПОЛЬЗОВАТЕЛЬСКАЯ ПАНЕЛЬ */
.userbar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

.userinfo {
  flex: 1;
  min-width: 0;
}

.username {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-status {
  font-size: 12px;
  color: var(--text-secondary);
}


/* // 11.1 VOICE BAR */
.voicebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.28);
}

.voicebar[hidden] {
  display: none !important;
}

.voicebar-main {
  min-width: 0;
}

.voicebar-title {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.voicebar-sub {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.voicebar-peers {
  margin-top: 2px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 260px;
}

.voicebar-stream {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.22);
}

.voicebar-stream .live-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ff3b3b;
  box-shadow: 0 0 0 4px rgba(255, 59, 59, 0.14);
  flex-shrink: 0;
}

.voicebar-stream-text {
  font-size: 12px;
  font-weight: 900;
  color: rgba(255,255,255,0.88);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.voice-peer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 3px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  max-width: 160px;
}

.voice-peer.me {
  border-color: rgba(176, 76, 255, 0.40);
  background: rgba(176, 76, 255, 0.10);
}

.voice-peer .va {
  width: 22px;
  height: 22px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.10);
  flex-shrink: 0;
}

.voice-peer .vn {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.icon-btn.danger {
  border-color: rgba(255, 80, 80, 0.35);
}

.icon-btn.danger:hover {
  background: rgba(255, 80, 80, 0.12);
  border-color: rgba(255, 80, 80, 0.55);
}

.voice-muted #voiceMuteBtn {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
}

.voice-deafened #voiceDeafenBtn {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
}

/* screenshare button active */
.voice-sharing #voiceShareBtn {
  background: rgba(176, 76, 255, 0.14);
  border-color: rgba(176, 76, 255, 0.45);
}

.voice-muted #vcMuteBtn {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
}

.voice-deafened #vcDeafenBtn {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
}

.voice-sharing #vcShareBtn {
  background: rgba(176, 76, 255, 0.14);
  border-color: rgba(176, 76, 255, 0.45);
}

/* // 11.2 SCREEN SHARE (Discord-like) */
.ss-modal {
  width: min(980px, calc(100vw - 24px));
  max-width: 980px;
}

.ss-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.ss-tab {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.86);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
}

.ss-tab:hover {
  background: rgba(255,255,255,0.06);
}

.ss-tab.active {
  border-color: rgba(176, 76, 255, 0.55);
  background: rgba(176, 76, 255, 0.12);
}

.ss-mobile-capture .ss-tabs {
  display: none;
}

.ss-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 860px) {
  .ss-grid { grid-template-columns: 1fr; }
}

.ss-card {
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 16px;
  background: rgba(255,255,255,0.03);
  padding: 12px;
  min-height: 220px;
}

.ss-card-title {
  font-weight: 900;
  font-size: 13px;
  margin-bottom: 10px;
  color: rgba(255,255,255,0.88);
}

.ss-quality {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ss-radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.22);
  cursor: pointer;
  user-select: none;
  font-weight: 800;
  font-size: 12px;
}

.ss-radio:hover {
  background: rgba(0,0,0,0.32);
}

.ss-radio input { accent-color: var(--accent); }

.ss-toggles {
  margin-top: 12px;
}

.ss-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: rgba(255,255,255,0.84);
  cursor: pointer;
  user-select: none;
}

.ss-check input { accent-color: var(--accent); }

.ss-note {
  margin-top: 10px;
  font-size: 12px;
  color: rgba(255,255,255,0.62);
}

.ss-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.08);
}

.ss-preview video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.ss-preview-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  text-align: center;
  font-size: 12px;
  color: rgba(255,255,255,0.72);
  background: linear-gradient(180deg, rgba(0,0,0,0.10), rgba(0,0,0,0.35));
}

/* Remote viewer panel */
.ss-panel {
  position: fixed;
  right: 14px;
  bottom: 14px;
  width: min(520px, calc(100vw - 28px));
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(20, 20, 24, 0.98);
  box-shadow: 0 16px 40px rgba(0,0,0,0.45);
  z-index: 2100;
}

.ss-panel[hidden] { display: none !important; }

.ss-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.ss-panel-title {
  font-weight: 900;
  font-size: 13px;
  color: rgba(255,255,255,0.90);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ss-panel-actions {
  display: inline-flex;
  gap: 8px;
}

.ss-panel-body {
  width: 100%;
  aspect-ratio: 16/9;
  background: rgba(0,0,0,0.40);
}

.ss-panel-body video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* // 11.3 VOICE VIEW (Discord-like stage) */
body.voice-view-open #ssPanel {
  display: none !important;
}

body.voice-view-open #voiceBar {
  display: none !important;
}

.voice-view {
  position: relative;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.voice-view[hidden] {
  display: none !important;
}


/* voice split layout (Discord-like): stage in the center panel, chat in the right panel */
body.voice-split-open #chatPanel {
  flex: 1;
}

body.voice-split-open #membersPanel {
  width: 420px;
}

body.voice-split-open #membersPanelMembers {
  display: none;
}

body.voice-split-open #voiceChatSide {
  display: flex;
  flex-direction: column;
  height: 100%;
}

body.voice-split-open #chatView {
  height: 100%;
}

@media (max-width: 1100px) {
  body.voice-split-open #membersPanel {
    width: 320px;
  }
}

@media (max-width: 900px) {
  body.voice-split-open #membersPanel {
    width: 100%;
  }
}

.voice-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.18);
}

.voice-view-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
  font-size: 13px;
  color: rgba(255,255,255,0.90);
  min-width: 0;
}

.voice-view-title > span {
  white-space: nowrap;
}

.voice-view-title #voiceViewChannelName {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.voice-view-sep {
  color: rgba(255,255,255,0.42);
}

#voiceViewState {
  color: rgba(255,255,255,0.68);
  font-weight: 800;
}

.voice-view-header-actions {
  display: inline-flex;
  gap: 8px;
}

.voice-stage-wrap {
  flex: 1;
  min-height: 0;
  padding: 14px;
  display: flex;
}

.voice-stage {
  flex: 1;
  min-height: 0;
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(40, 41, 47, 0.92);
}

.voice-stage-content {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 12px;
  padding: 12px;
  align-items: stretch;
}

.voice-stage-video-wrap {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(0,0,0,0.20);
}

.voice-peer-tile {
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.28);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px;
  box-shadow: 0 16px 36px rgba(0,0,0,0.28);
}

.voice-peer-ava {
  width: 92px;
  height: 92px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 40px;
  color: rgba(255,255,255,0.92);
  background: rgba(176, 76, 255, 0.22);
  border: 1px solid rgba(176, 76, 255, 0.28);
}

.voice-peer-name {
  font-weight: 900;
  color: rgba(255,255,255,0.88);
  text-align: center;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .voice-stage-content {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .voice-peer-tile {
    position: absolute;
    top: 54px;
    left: 12px;
    right: 12px;
    flex-direction: row;
    justify-content: flex-start;
    padding: 8px 10px;
    gap: 10px;
  }

  .voice-peer-ava {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    font-size: 18px;
  }

  .voice-peer-name {
    text-align: left;
    max-width: none;
  }
}


.voice-stage video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: rgba(0,0,0,0.18);
  display: block;
}

.voice-stage-top {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.voice-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.40);
  color: rgba(255,255,255,0.92);
  font-weight: 900;
  font-size: 12px;
}

.voice-live-badge .live-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ff3b3b;
  box-shadow: 0 0 0 4px rgba(255, 59, 59, 0.14);
}

.voice-stage-name {
  margin-left: auto;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.30);
  color: rgba(255,255,255,0.86);
  font-weight: 900;
  font-size: 12px;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-stage-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  gap: 10px;
  pointer-events: none;
}

.voice-stage-empty > * {
  position: relative;
  z-index: 1;
}

.voice-stage-empty::before {
  content: "🖥️";
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 18px 40px rgba(0,0,0,0.26);
  position: relative;
  z-index: 2;
}

.voice-stage-empty-title {
  font-weight: 1000;
  font-size: 16px;
  color: rgba(255,255,255,0.92);
}

.voice-stage-empty-sub {
  font-size: 13px;
  color: rgba(255,255,255,0.70);
  max-width: 520px;
}

.voice-stage-empty-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  pointer-events: auto;
}

.voice-self-preview {
  position: absolute;
  left: 12px;
  bottom: 74px;
  width: 220px;
  max-width: 35vw;
  aspect-ratio: 16/9;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.28);
  box-shadow: 0 16px 36px rgba(0,0,0,0.35);
}

.voice-self-preview video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.voice-self-label {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,0.52);
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.88);
  font-weight: 900;
  font-size: 12px;
}

.voice-stage-strip {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 84px;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.voice-stage-strip::-webkit-scrollbar {
  height: 0;
}

.voice-strip-item {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.28);
  color: rgba(255,255,255,0.86);
  font-weight: 900;
  font-size: 12px;
}

.voice-strip-item.me {
  border-color: rgba(176, 76, 255, 0.45);
  background: rgba(176, 76, 255, 0.12);
}

.voice-strip-ava {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 1000;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
}

.voice-controls {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 28px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(32, 34, 37, 0.95);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.05) inset;
  z-index: 5;
  transition: all 0.3s ease;
}

.voice-controls.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(20px);
}

.voice-controls-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.voice-controls-divider {
  width: 1px;
  height: 28px;
  background: rgba(255,255,255,0.15);
  margin: 0 4px;
}

.vc-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.92);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vc-btn:hover {
  background: rgba(255,255,255,0.15);
  transform: scale(1.05);
}

.vc-btn:active {
  transform: scale(0.95);
}

.vc-btn.vc-btn-control {
  background: rgba(255,255,255,0.1);
  font-size: 14px;
}

.vc-btn.vc-btn-control:hover {
  background: rgba(255,255,255,0.18);
}

.vc-btn.active {
  background: rgba(255, 80, 80, 0.25);
  color: #ff6b6b;
}

.vc-btn.active:hover {
  background: rgba(255, 80, 80, 0.35);
}

.vc-btn.active[data-action="mute"]::after,
.vc-btn.active[data-action="deafen"]::after {
  content: '';
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff6b6b;
}

.vc-btn.danger {
  background: rgba(255, 80, 80, 0.2);
  color: #ff6b6b;
}

.vc-btn.danger:hover {
  background: rgba(255, 80, 80, 0.35);
  transform: scale(1.05);
}

.vc-btn.danger:active {
  transform: scale(0.95);
}

@media (max-width: 760px) {
  .voice-stage-wrap { padding: 10px; }
  .voice-self-preview { width: 180px; bottom: 86px; }
  .voice-controls { bottom: 12px; }
}

/* Кнопка показа панели управления (когда скрыта) */
.voice-controls-show {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(32, 34, 37, 0.95);
  backdrop-filter: blur(12px);
  color: rgba(255,255,255,0.85);
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 5;
  transition: all 0.3s ease;
}

.voice-controls-show:hover {
  background: rgba(32, 34, 37, 1);
  transform: translateX(-50%) scale(1.08);
  border-color: rgba(255,255,255,0.25);
}

.voice-controls-show.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(20px);
}

/* voice channels in list */
.item.channel.voice .hash {
  width: 18px;
}

.item.channel.voice .hash::after {
  content: "";
}

.item.channel.voice .hash {
  color: var(--text-secondary);
}

.item.channel.voice.voice-joined {
  background: rgba(176, 76, 255, 0.10);
  outline: 1px solid rgba(176, 76, 255, 0.25);
}


/* voice users under voice channel (expected placement) */
.item.channel.voice .voice-users {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.item.channel.voice .voice-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: rgba(255,255,255,0.78);
}

.item.channel.voice .voice-user .vua {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  background: var(--accent-light);
  border: 1px solid rgba(255,255,255,0.08);
  flex: 0 0 auto;
}

.item.channel.voice .voice-user.me .vua {
  background: rgba(176, 76, 255, 0.22);
}

.item.channel.voice .voice-user .vun {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* unread badge in channel list */
.badge-unread {
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 14px rgba(176, 76, 255, 0.25);
  flex-shrink: 0;
}

.panel.channels .item .title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

/* // 12. ЗАГРУЗКА И ОВЕРЛЕЙ */
#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.6s;
}

#loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: var(--space-md);
}

.loading-text {
  color: var(--text-secondary);
  font-size: 14px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* // 13. АНИМАЦИИ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from { transform: translateX(-20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.7; background-color: rgba(176, 76, 255, 0.25); }
  100% { opacity: 1; }
}

.message {
  animation: fadeIn 0.2s ease;
}


.message.has-media {
    padding-bottom: 4px;
}

.message.has-media .content {
    gap: 3px;
}
.item {
  animation: slideIn 0.2s ease;
}

.item.server.refreshing {
  animation: pulse 0.3s ease-in-out;
}

/* // 14. АДАПТИВНОСТЬ */
@media (max-width: 1200px) {
  /* keep members visible (Discord-like right sidebar), just shrink panels */
  .panel.members { width: 220px; }
  .panel.servers { width: 210px; }
  .panel.channels { width: 210px; }
}

@media (max-width: 900px) {
  .panel.channels {
    display: none;
  }
  
  .panel.servers {
    width: 70px;
  }
  
  .panel.servers .text {
    display: none;
  }
  
  .panel.servers .panelHeader h3 {
    display: none;
  }
  
  .panel.servers .panelHeader {
    justify-content: center;
  }
}

@media (max-width: 600px) {
  .layout {
    padding: var(--space-sm);
    gap: var(--space-sm);
  }
  
  .panel.chat {
    min-width: 300px;
  }
  
  .brand {
    font-size: 18px;
  }
  
  .topbar {
    padding: 0 var(--space-md);
  }
}

/* // 15. ПОЛЬЗОВАТЕЛЬСКИЕ ЭЛЕМЕНТЫ */


/* // Подсказки */
[data-tooltip] {
  position: relative;
}

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  white-space: nowrap;
  z-index: 1000;
  margin-bottom: 8px;
}

/* // Выделение кода */
pre, code {
  font-family: 'Courier New', monospace;
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

/* // Скелетон для загрузки */
.skeleton {
  background: linear-gradient(90deg, 
    rgba(255,255,255,0.05) 25%, 
    rgba(255,255,255,0.1) 50%, 
    rgba(255,255,255,0.05) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* // 16. СТРАНИЦА АВТОРИЗАЦИИ */
body.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  background: radial-gradient(ellipse at top, #1a0f2e, #0b0f14);
  overflow: auto;
}

.auth-card {
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  width: 380px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.auth-card h1 {
  text-align: center;
  margin-bottom: var(--space-xl);
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 28px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.auth-form .inp {
  width: 100%;
}

.auth-form .btn {
  width: 100%;
  margin-top: var(--space-sm);
}

.auth-legal {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.auth-legal input {
  margin-top: 2px;
  accent-color: var(--accent);
}

.auth-legal a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

.auth-legal a:hover {
  text-decoration: underline;
}

.auth-error {
  color: #f85149;
  font-size: 14px;
  text-align: center;
  margin-top: var(--space-sm);
  padding: var(--space-sm);
  background: rgba(248, 81, 73, 0.1);
  border-radius: var(--radius-sm);
}

/* // 17. СТРАНИЦА АВТОРИЗАЦИИ (дополнительно) */
.auth-switch {
  margin-top: var(--space-lg);
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

.auth-switch a {
  color: var(--accent);
  text-decoration: none;
  margin-left: 6px;
  font-weight: 500;
}

.auth-switch a:hover {
  text-decoration: underline;
}

/* // 18. КОМПОНЕНТЫ ДРУЗЕЙ */
.friends-header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.friends-tabs {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  flex-wrap: wrap;
}

.tab {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.tab.add {
  margin-left: auto;
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}

.tab.add:hover {
  background: var(--accent);
  color: white;
}

.friends-layout {
  display: flex;
  height: 100%;
}

#friendsView {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#friendsView .friends {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.friends-layout {
  flex: 1;
  min-height: 0;
}

.friends-list {
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(176, 76, 255, 0.3) transparent;
}

.friends-list::-webkit-scrollbar {
  width: 8px;
}

.friends-list::-webkit-scrollbar-track {
  background: transparent;
}

.friends-list::-webkit-scrollbar-thumb {
  background: rgba(176, 76, 255, 0.3);
  border-radius: 4px;
}

.friends-list::-webkit-scrollbar-thumb:hover {
  background: rgba(176, 76, 255, 0.5);
}


.friends-list {
  flex: 1;
  padding: var(--space-lg);
}

.friends-active {
  width: 280px;
  border-left: 1px solid var(--border);
  padding: var(--space-lg);
  flex-shrink: 0;
}

.no-friends {
  text-align: center;
  padding: var(--space-xl);
  color: var(--text-secondary);
}

.no-friends p {
  margin-bottom: var(--space-md);
}

/* // Friends search */
.friends-search-panel {
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.friends-search-row {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

.friends-search-row .inp {
  flex: 1;
  min-width: 0;
}

.friends-search-results {
  margin-top: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.friend-search-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.02);
}

.friend-search-item .text {
  flex: 1;
  min-width: 0;
}

.friend-search-item .name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friend-search-item .role {
  font-size: 12px;
  color: var(--text-secondary);
}

/* // 19. СПИСОК УЧАСТНИКОВ */
.members-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-sm);
}

#membersPanelMembers {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}


/* voice members tiles (Discord-like) */
.voice-members-section {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.16);
}

.voice-members-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 6px 10px;
  color: rgba(255,255,255,0.86);
  font-weight: 900;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.voice-members-head .c {
  color: rgba(255,255,255,0.60);
  font-weight: 900;
}

.voice-members-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 34vh;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(176, 76, 255, 0.22) transparent;
}

/* voice members dock inside the stage (tiles in rectangles, like Discord call grid) */
.voice-members-dock {
  position: absolute;
  left: 250px; /* leave space for self preview */
  right: 12px;
  bottom: 84px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.32);
  backdrop-filter: blur(10px);
  box-shadow: 0 16px 36px rgba(0,0,0,0.28);
}

.voice-members-dock .voice-members-head {
  padding: 0 2px 8px;
}

.voice-members-dock .voice-members-grid {
  flex-direction: row;
  gap: 10px;
  max-height: none;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
}

.voice-members-dock .voice-member-tile {
  min-width: 180px;
  flex: 0 0 auto;
}

@media (max-width: 720px) {
  .voice-members-dock {
    left: 12px;
    bottom: 96px;
  }
}

/* No-stream: keep the stage placeholder visible; dock stays compact at the bottom */

.voice-members-grid::-webkit-scrollbar {
  width: 8px;
}

.voice-members-grid::-webkit-scrollbar-thumb {
  background: rgba(176, 76, 255, 0.22);
  border-radius: 6px;
}

.voice-member-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.03);
  transition: background 0.15s ease, border-color 0.15s ease;
  user-select: none;
}

.voice-member-tile:hover {
  background: rgba(255,255,255,0.05);
}

.voice-member-tile.focused {
  border-color: rgba(176, 76, 255, 0.55);
  background: rgba(176, 76, 255, 0.10);
  box-shadow: 0 0 0 2px rgba(176, 76, 255, 0.12);
}

.voice-member-tile.me {
  border-color: rgba(176, 76, 255, 0.35);
}

.voice-member-ava {
  width: 44px;
  height: 44px;
  border-radius: 12px; /* rectangular avatar container */
  overflow: hidden;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(255,255,255,0.10);
  font-weight: 1000;
  color: rgba(255,255,255,0.90);
}

.voice-member-ava img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.voice-member-live {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.6px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 59, 59, 0.18);
  border: 1px solid rgba(255, 59, 59, 0.42);
  color: rgba(255,255,255,0.92);
  pointer-events: none;
}

.voice-member-meta {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.voice-member-name {
  font-weight: 900;
  font-size: 13px;
  line-height: 1.15;
  color: rgba(255,255,255,0.92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.voice-member-sub {
  font-size: 12px;
  line-height: 1.1;
  color: rgba(255,255,255,0.58);
}


.members-group-title {
  margin: 12px 8px 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--text-secondary);
  padding: 0 4px;
}

.members-group-box[hidden] {
  display: none;
}

.members-group-box {
  display: grid;
  gap: 2px;
}

.member {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  transition: background 0.2s;
}

.member:hover {
  background: rgba(255, 255, 255, 0.05);
}

.member.offline {
  opacity: 0.72;
}

.member .text {
  flex: 1;
  min-width: 0;
}

.member .role:empty {
  display: none;
}

.member-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
}

.member .name {
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.member .role {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.member .role::before {
  content: '';
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--text-secondary);
}

.member.status-online .role::before {
  background: var(--online);
}

.member.status-idle .role::before {
  background: var(--idle);
}

.member.status-dnd .role::before {
  background: var(--dnd);
}

.member.status-offline .role::before {
  background: var(--text-secondary);
}

/* // 20. РАЗНОЕ */
.hash {
  color: var(--text-secondary);
  font-weight: bold;
  font-size: 18px;
}

.count {
  color: var(--text-secondary);
  font-weight: normal;
  font-size: 14px;
}

.separator {
  height: 1px;
  background: var(--border);
  margin: var(--space-md) 0;
}

/* // 21. СТИЛИ СЕРВЕРОВ И КАНАЛОВ */
.server .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
    transition: all 0.2s;
}

.server.active .avatar {
    background: var(--accent-strong);
    box-shadow: 0 0 0 2px rgba(176, 76, 255, 0.3);
}

.channel .hash {
    color: var(--text-secondary);
    font-weight: bold;
    font-size: 18px;
    margin-right: 8px;
}

.channel.active .hash {
    color: var(--accent);
}

.empty-servers, .empty-channels {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
}

.empty-servers p, .empty-channels p {
    margin-bottom: 10px;
}

/* // 22. СООБЩЕНИЯ (улучшенная версия) */
.message {
    display: grid;
    grid-template-columns: 40px 1fr;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    transition: background 0.2s;
    animation: fadeIn 0.2s ease;
    align-items: start;
}

.message:hover {
    background: rgba(255, 255, 255, 0.03);
}

.message .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    align-self: start;

  overflow: hidden;
}

.message .avatar.you {
    background: linear-gradient(135deg, #3fb950, #2ea043);
}

.message .content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message .author {
    font-weight: 600;
    font-size: 14px;
    line-height: 1.2;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
}

.message .badge {
    background: var(--accent);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

.message .text {
    font-size: 15px;
    line-height: 1.45;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
}

.message .author .msg-time {
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0.7;
    font-weight: 400;
    margin-left: 8px;
}

/* message tools (reply/copy/emoji/pin) */
.msg-tools {
  margin-left: auto;
  display: inline-flex;
  gap: 6px;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity .12s ease, transform .12s ease;
}

.message:hover .msg-tools {
  opacity: 1;
  transform: translateY(0);
}

.msg-tools .tool {
  width: 28px;
  height: 26px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.28);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}

.msg-tools .tool:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.20);
}

.msg-tools .tool.active {
  border-color: rgba(176, 76, 255, 0.45);
  background: rgba(176, 76, 255, 0.12);
}

/* reply preview above message text */
.reply-preview {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px 2px 14px;
  margin: 2px 0 6px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.02);
  max-width: 100%;
  cursor: pointer;
}

.reply-preview:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.14);
}

.reply-preview::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 5px;
  bottom: 5px;
  width: 2px;
  border-radius: 2px;
  background: rgba(176, 76, 255, 0.45);
}

.reply-preview .rp-icon {
  font-size: 12px;
  color: var(--text-secondary);
  opacity: 0.9;
}

.reply-preview .rp-author {
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
}

.reply-preview .rp-text {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 520px;
}

/* reactions row (Discord-like) */
.msg-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.msg-reactions .react-pill,
.msg-reactions .react-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}

.msg-reactions .react-pill:hover,
.msg-reactions .react-add:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.18);
}

.msg-reactions .react-pill.me {
  border-color: rgba(176, 76, 255, 0.45);
  background: rgba(176, 76, 255, 0.12);
}

.msg-reactions .react-pill .cnt {
  font-size: 12px;
  color: var(--text-secondary);
}

.msg-reactions .react-add {
  width: 30px;
  padding: 0;
  justify-content: center;
}

.message.flash {
  outline: 2px solid rgba(176, 76, 255, 0.45);
  background: rgba(176, 76, 255, 0.08);
}

/* reply bar in composer */
.replybar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.03);
}

.replybar .rb-left {
  min-width: 0;
}

.replybar .rb-title {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.replybar .rb-preview {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* emoji picker */
.emoji-backdrop {
  position: fixed;
  inset: 0;
  background: transparent;
  z-index: 2100;
}

.emoji-picker {
  position: fixed;
  z-index: 2101;
  width: 250px;
  max-width: calc(100vw - 20px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: rgba(10, 10, 10, 0.92);
  box-shadow: 0 18px 50px rgba(0,0,0,0.45);
  padding: 10px;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  max-height: 240px;
  overflow: auto;
}

.emoji-btn {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.03);
  cursor: pointer;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", system-ui, sans-serif;
  font-size: 18px;
  line-height: 1;
}

.emoji-btn:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.18);
}

/* GIF picker */
.gif-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2100;
  background: transparent;
}

.gif-picker {
  position: fixed;
  z-index: 2101;
  width: min(420px, calc(100vw - 20px));
  max-height: min(620px, calc(100vh - 20px));
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(12, 16, 27, 0.96);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(16px);
}

.gif-picker-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.gif-picker-title {
  color: var(--text);
  font-weight: 900;
  font-size: 18px;
  line-height: 1.1;
}

.gif-picker-sub {
  color: var(--text-secondary);
  font-size: 12px;
  margin-top: 4px;
}

.gif-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
}

.gif-picker-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.gif-picker-actions button {
  min-height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(176, 76, 255, 0.28);
  background: rgba(176, 76, 255, 0.12);
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.gif-section {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gif-section-title {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.gif-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding-right: 2px;
}

.gif-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.gif-thumb {
  width: 100%;
  aspect-ratio: 1.55 / 1;
  display: block;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.26);
  cursor: pointer;
  overflow: hidden;
}

.gif-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.gif-card-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 8px;
}

.gif-card-bar span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--text-secondary);
}

.gif-mini-btn {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--accent);
  cursor: pointer;
}

.gif-mini-btn:disabled {
  cursor: default;
  opacity: .72;
}

.gif-mini-btn.danger {
  color: #ffd166;
}

.gif-empty {
  grid-column: 1 / -1;
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--text-secondary);
  text-align: center;
  font-size: 13px;
}

.composer-picker-tabs,
.sticker-scope-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.composer-picker-tabs button,
.sticker-scope-tabs button {
  min-height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.035);
  color: var(--text-secondary);
  cursor: pointer;
  font-weight: 900;
}

.composer-picker-tabs button.active,
.sticker-scope-tabs button.active {
  color: var(--text);
  border-color: rgba(176, 76, 255, 0.42);
  background: rgba(176, 76, 255, 0.16);
}

.composer-picker-panel {
  display: none;
  min-height: 0;
}

.composer-picker-panel.active {
  display: grid;
  gap: 12px;
  min-height: 0;
}

.composer-emoji-grid {
  max-height: 310px;
}

.composer-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2100;
  background: transparent;
}

.composer-attach-menu {
  position: fixed;
  z-index: 2101;
  width: min(330px, calc(100vw - 20px));
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(12, 16, 27, 0.97);
  box-shadow: 0 22px 70px rgba(0,0,0,0.46);
  backdrop-filter: blur(14px);
}

.composer-attach-menu button {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 58px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  padding: 8px;
}

.composer-attach-menu button:hover {
  background: rgba(255,255,255,0.07);
}

.composer-menu-ic {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(176, 76, 255, 0.14);
  color: var(--accent);
  font-weight: 900;
}

.composer-attach-menu b,
.composer-attach-menu small {
  display: block;
  min-width: 0;
}

.composer-attach-menu small {
  margin-top: 3px;
  color: var(--text-secondary);
  line-height: 1.25;
}

.message-textarea {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.message-textarea::-webkit-scrollbar {
  width: 0;
  height: 0;
}

@media (max-width: 520px) {
  .gif-picker {
    left: 10px !important;
    right: 10px;
    width: auto;
  }
  .gif-grid {
    grid-template-columns: 1fr;
  }
}



.voice-text-lock {
  margin: 22px auto;
  max-width: 520px;
  padding: 18px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.20);
  text-align: center;
  color: rgba(255,255,255,0.86);
}

.voice-text-lock .ttl {
  font-weight: 900;
  font-size: 18px;
  margin-bottom: 8px;
}

.voice-text-lock .sub {
  color: rgba(255,255,255,0.70);
  font-weight: 700;
  margin-bottom: 10px;
}

.voice-text-lock .hint {
  color: rgba(255,255,255,0.56);
  font-weight: 700;
  font-size: 12px;
}
.empty-chat {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.empty-chat h3 {
    font-size: 20px;
    margin-bottom: 10px;
    color: var(--text);
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    background-clip: text;
    -webkit-text-fill-color: transparent;
}


/* // Вложения в сообщениях */
.msg-attachment {
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  max-width: 520px;
}

.msg-attachment a {
  color: var(--accent);
  text-decoration: none;
}

.msg-attachment a:hover {
  text-decoration: underline;
}

.msg-attachment .file-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
}

.msg-attachment .file-name {
  font-size: 13px;
  color: var(--text);
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-attachment .file-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

/* // attachments (discord-like) */
.msg-link {
  color: var(--accent-strong);
  text-decoration: none;
}
.msg-link:hover {
  text-decoration: underline;
}

.msg-attachment {
  margin-top: 2px;
}

.message .text > .msg-attachment:first-child {
  margin-top: 0;
}

.message .text > .msg-attachment:last-child {
  margin-bottom: 0;
}

.msg-attachment .file-preview-link {
  display: inline-block;
}

.msg-attachment .file-preview {
  display: block;
  max-width: 520px;
  max-height: 360px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.msg-attachment--video .file-preview {
  width: 520px;
  max-width: 100%;
  height: auto;
}

.file-card {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel);
  max-width: 520px;
}

.file-icon {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.4px;
  user-select: none;
}

.file-info {
  flex: 1;
  min-width: 0;
}

.file-card .file-name {
  display: block;
  max-width: 100%;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-card .file-name:hover {
  text-decoration: underline;
}

.file-card .file-meta {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  text-decoration: none;
}
.file-download:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* // audio */
.audio-card {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel);
  max-width: 520px;
}

.audio-play {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  cursor: pointer;
}
.audio-play:hover {
  background: rgba(255, 255, 255, 0.05);
}

.audio-range {
  flex: 1;
  accent-color: var(--accent);
}

.audio-time {
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 96px;
  text-align: right;
}

.audio-el {
  display: none;
}

/* // link embeds */
.link-embed {
  margin-top: 8px;
  max-width: 520px;
}

.embed-card {
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  background: var(--panel);
  padding: 10px;
}

.embed-card--loading {
  color: var(--text-secondary);
  font-size: 13px;
}

.embed-head {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.embed-body {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.embed-text {
  flex: 1;
  min-width: 0;
}

.embed-title {
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.embed-desc {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

.embed-thumb {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.02);
}

/* // attachment chips */
.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
}

.att-icon {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.4px;
  user-select: none;
}

.att-name {
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.att-meta {
  color: var(--text-secondary);
}

.msg-attachment img {
  max-width: 520px;
  max-height: 360px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
}

.msg-attachment .file-preview {
  max-width: 520px;
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
}
/* // 23. УВЕДОМЛЕНИЯ И ОШИБКИ */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: var(--space-md);
    border-radius: var(--radius-md);
    background: var(--panel-solid);
    border: 1px solid var(--border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    animation: slideIn 0.3s ease;
    max-width: 400px;
}

.notification.success {
    border-left: 4px solid var(--online);
}

.notification.error {
    border-left: 4px solid var(--dnd);
}

.notification.warning {
    border-left: 4px solid var(--idle);
}

.notification.info {
    border-left: 4px solid var(--accent);
}

/* // 24. МОДАЛЬНЫЕ ОКНА */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

/* ===== Typing indicator ===== */
.typing-indicator {
  margin: 0 18px 8px 18px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.72);
  font-size: 13px;
  line-height: 1.2;
}

/* ===== Archive viewer ===== */
.archive-viewer {
  width: min(900px, calc(100vw - 24px));
  height: min(740px, calc(100vh - 24px));
  background: rgba(20, 20, 24, 0.98);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.archive-body {
  padding: 14px 14px 18px 14px;
  overflow: auto;
}
.archive-tree {
  list-style: none;
  padding-left: 18px;
  margin: 8px 0;
}
.archive-tree > li { margin: 6px 0; }
.archive-tree summary {
  cursor: pointer;
  user-select: none;
}
.att-archive {
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.9);
  border-radius: 8px;
  padding: 4px 8px;
  margin-right: 8px;
  cursor: pointer;
}
.att-archive:hover { background: rgba(255,255,255,0.08); }

/* ===== Settings scrollbar ===== */
.modal .modal-body::-webkit-scrollbar,
.settings-modal::-webkit-scrollbar,
.settings-modal *::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
.modal .modal-body::-webkit-scrollbar-thumb,
.settings-modal::-webkit-scrollbar-thumb,
.settings-modal *::-webkit-scrollbar-thumb {
  background: rgba(168, 85, 247, 0.35);
  border-radius: 12px;
  border: 2px solid rgba(20,20,24,0.85);
}
.modal .modal-body::-webkit-scrollbar-track,
.settings-modal::-webkit-scrollbar-track,
.settings-modal *::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
}

.modal {
    background: var(--panel-solid);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: fadeIn 0.3s ease;
}

.modal-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 44px);
}

.modal-body {
  padding: var(--space-lg);
}

body.modal-open {
  overflow: hidden;
}

/* profile modal */
.profile-modal {
  background-image: none !important;
  max-width: 520px;
}

.profile-modal .modal-body {
  background-image: none !important;
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 22px;
  background: rgba(176, 76, 255, 0.18);
  border: 1px solid rgba(176, 76, 255, 0.30);
  overflow: hidden;
}

.profile-avatar .avatar-img,
.profile-avatar .profile-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-avatar-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.profile-meta {
  min-width: 0;
}

.profile-name {
  font-weight: 900;
  font-size: 18px;
  line-height: 1.15;
}

.profile-username {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.profile-section {
  margin-top: 12px;
}

.profile-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.profile-text {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.02);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
  max-width: 100%;
}

.profile-actions {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-header h2 {
    font-size: 18px;
    color: var(--text);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.modal-content {
    padding: var(--space-lg);
}

.modal-footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
}

/* // 24.1 НАСТРОЙКИ (Discord-like) */


/* profile avatar image safe */
.profile-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* settings helpers */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.setting-copy {
  flex: 1 1 220px;
  min-width: 0;
}

.setting-row-range {
  align-items: flex-start;
}
.setting-row:last-child { border-bottom: 0; }

.setting-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 2px;
}

.setting-desc {
  color: var(--text-secondary);
  font-size: 12px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex: 0 0 auto;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.12);
  transition: .18s ease;
  border-radius: 999px;
}

.switch .slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  background: #fff;
  transition: .18s ease;
  border-radius: 999px;
}

.switch input:checked + .slider {
  background: rgba(88,101,242,0.6);
  border-color: rgba(88,101,242,0.6);
}

.switch input:checked + .slider:before {
  transform: translate(18px, -50%);
}

.range-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: min(100%, 320px);
  min-width: 0;
  flex: 1 1 240px;
}

.range-wrap input[type=range] {
  width: 100%;
  min-width: 0;
}

.range-val {
  min-width: 50px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  font-size: 12px;
}

.settings-side-sep {
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 12px 0;
}

/* connections */
.conn-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.conn-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
}

.conn-kind {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
}

.conn-main {
  flex: 1;
  min-width: 0;
}

.conn-label {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conn-url {
  display: block;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 600px) {
  .settings-modal {
    width: 95vw;
    height: 92vh;
    flex-direction: column;
  }

  .settings-sidebar {
    width: 100%;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }

  .settings-nav {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
  }

  .settings-nav-item {
    white-space: nowrap;
  }

  .settings-content {
    height: 100%;
  }
}

.settings-modal {
  background: var(--panel-solid);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  width: 92%;
  max-width: 980px;
  height: 90vh;
  overflow: hidden;
  display: flex;
}

.settings-sidebar {
  width: 260px;
  background: rgba(0, 0, 0, 0.18);
  border-right: 1px solid var(--border);
  padding: var(--space-md);
  overflow-y: auto;
}

.settings-side-header {
  margin-top: var(--space-md);
  margin-bottom: 8px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.settings-nav-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  cursor: pointer;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 14px;
  transition: all 0.15s;
}

.settings-nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.settings-nav-item.active {
  background: var(--accent-light);
  color: var(--text);
}

.settings-nav-item.danger {
  color: var(--dnd);
}

.settings-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.settings-topbar {
  padding: var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.settings-topbar-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.settings-sections-btn {
  display: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
  font-weight: 600;
}

.settings-sections-btn:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
}

.settings-close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text-secondary);
}

.settings-close:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
}

.settings-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.settings-body {
  padding: var(--space-lg);
  overflow-y: auto;
}

.settings-section {
  max-width: 680px;
}

.settings-section h3 {
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.settings-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.settings-card-title {
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.settings-card-note {
  margin-bottom: var(--space-md);
  line-height: 1.45;
}

.settings-suggestion-form {
  display: grid;
  gap: var(--space-sm);
}

.settings-suggestion-form .inp {
  width: 100%;
}

.settings-suggestion-form textarea {
  min-height: 120px;
  resize: vertical;
}

.settings-slow-note {
  margin-top: 10px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.4;
}

.settings-ticket-list {
  display: grid;
  gap: 10px;
}

.settings-ticket-empty {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 14px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.025);
}

.settings-ticket-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.16);
  padding: 12px;
  min-width: 0;
}

.settings-ticket-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.settings-ticket-title {
  font-weight: 900;
  color: var(--text);
  word-break: break-word;
}

.settings-ticket-meta {
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 12px;
}

.settings-ticket-status {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 900;
}

.settings-ticket-status.status-reviewed {
  color: var(--online);
  border-color: rgba(63, 185, 80, 0.35);
  background: rgba(63, 185, 80, 0.08);
}

.settings-ticket-status.status-rejected {
  color: #ff8b8b;
  border-color: rgba(248, 81, 73, 0.35);
  background: rgba(248, 81, 73, 0.08);
}

.settings-ticket-message {
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
}

.settings-ticket-answer {
  display: grid;
  gap: 5px;
  margin-top: 10px;
  border-top: 1px solid var(--border-light);
  padding-top: 10px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.settings-ticket-answer b {
  color: var(--text);
}

.settings-ticket-answer.empty span {
  opacity: 0.78;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-row .label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-row .label .hint {
  font-size: 12px;
  color: var(--text-muted);
}

.settings-row .control {
  min-width: 220px;
}

.settings-inline {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

.settings-inline .inp,
.settings-inline select,
.settings-inline textarea {
  width: 100%;
}

.settings-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  user-select: none;
}

.settings-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.settings-inline-msg {
  margin-top: var(--space-sm);
  font-size: 13px;
  color: var(--text-secondary);
}

.settings-inline-msg.ok { color: var(--online); }
.settings-inline-msg.err { color: var(--dnd); }

/* // 24.2 ПРЕДСТАВЛЕНИЕ (настройки) */
body.hide-header-status #status { display: none !important; }
body.hide-timestamps .message .msg-time { display: none !important; }

body.compact-mode .message {
  padding: 8px 10px;
  gap: 10px;
}

body.compact-mode .message .avatar {
  width: 28px;
  height: 28px;
  font-size: 12px;
}

body.compact-mode .message .content .text {
  font-size: 14px;
}

/* // 25. ТЕМНАЯ ТЕМА (по умолчанию) */
.theme-dark {
  --accent: #b04cff;
  --accent-strong: #ff6ad5;
  --accent-light: rgba(176, 76, 255, 0.15);
  --bg: #0b0f14;
  --panel: rgba(255, 255, 255, 0.03);
  --panel-solid: #1a1d21;
  --border: rgba(255, 255, 255, 0.08);
  --text: #e6edf3;
  --text-secondary: #8b949e;
}

/* // 26. СВЕТЛАЯ ТЕМА (опционально) */
.theme-light {
  --accent: #7c3aed;
  --accent-strong: #a855f7;
  --accent-light: rgba(124, 58, 237, 0.1);
  --bg: #f8fafc;
  --panel: rgba(0, 0, 0, 0.02);
  --panel-solid: #ffffff;
  --border: rgba(0, 0, 0, 0.1);
  --text: #1e293b;
  --text-secondary: #64748b;
  --online: #10b981;
  --idle: #f59e0b;
  --dnd: #ef4444;
  --text-muted: rgba(30, 41, 59, 0.6);
  --muted: var(--text-muted);
}


/* // 27. СТИЛИ ДЛЯ ПРОИЗВОДИТЕЛЬНОСТИ */
.will-change-transform {
  will-change: transform;
}

.will-change-opacity {
  will-change: opacity;
}

/* // 28. ФИНАЛЬНЫЕ ШТРИХИ */
::selection {
  background: rgba(176, 76, 255, 0.3);
  color: white;
}

::-moz-selection {
  background: rgba(176, 76, 255, 0.3);
  color: white;
}

*:focus {
  outline: 2px solid rgba(176, 76, 255, 0.3);
  outline-offset: 2px;
}

*:focus:not(:focus-visible) {
  outline: none;
}

*:focus-visible {
  outline: 2px solid rgba(176, 76, 255, 0.3);
  outline-offset: 2px;
}

/* // mobile drawers */
@media (max-width: 900px) {
  .panel.channels {
    display: none;
    position: absolute;
    left: 80px;
    top: 0;
    bottom: 0;
    width: 280px;
    z-index: 110;
    background: var(--panel-solid);
    box-shadow: 5px 0 15px rgba(0, 0, 0, 0.3);
    animation: slideInRight 0.25s ease;
  }

  .panel.channels.show-channels {
    display: flex;
  }
}

@media (max-width: 900px), (pointer: coarse) {
  .layout {
    padding: 0;
    gap: 0;
  }

  .panel {
    border-radius: 0;
  }

  .panel.chat {
    min-width: 0;
  }

  /* servers drawer */
  .panel.servers {
    display: none;
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(92vw, 360px);
    z-index: 120;
    background: var(--panel-solid);
    box-shadow: 5px 0 15px rgba(0, 0, 0, 0.3);
    animation: slideInRight 0.25s ease;
  }

  .panel.servers.show-servers {
    display: flex;
  }

  /* channels should slide from left edge on phone */
  .panel.channels {
    left: 0;
    z-index: 130;
  }

  /* members drawer */
  .panel.members {
    display: none;
    position: absolute;
    right: 0;
    left: auto;
    top: 0;
    bottom: 0;
    width: min(92vw, 360px);
    min-height: 0;
    z-index: 140;
    background: var(--panel-solid);
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
    animation: slideInLeft 0.25s ease;
  }

  .panel.members.show-members {
    display: flex;
  }

  .panel.members[hidden],
  .panel.members[hidden].show-members {
    display: none !important;
  }

  /* compact messages on phone */
  .messages {
    padding: 10px 12px;
    gap: 10px;
  }

  .message {
    grid-template-columns: 34px 1fr;
    gap: 10px;
    padding: 8px 10px;
  }

  .message .avatar {
    width: 32px;
    height: 32px;
  }

  .message .author { font-size: 13px; }
  .message .text { font-size: 14px; line-height: 1.35; }

  .composer {
    padding: 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
}

@keyframes slideInRight {
  from { transform: translateX(-20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideInLeft {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}


/* // PATCH: UI missing styles (attachments viewer, user menu, settings forms, errors) */

/* errors used in friends/search */
.error {
  background: rgba(248, 81, 73, 0.10);
  border: 1px solid rgba(248, 81, 73, 0.35);
  color: #ffb4b0;
  padding: 10px 12px;
  border-radius: var(--radius-md);
}

/* user context menu + toast */
.lb-menu-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1200;
}

.lb-user-menu {
  position: fixed;
  min-width: 220px;
  max-width: min(320px, calc(100vw - 24px));
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  z-index: 1201;
}

.lb-menu-title {
  padding: 10px 10px 8px;
  font-weight: 800;
  font-size: 13px;
  color: var(--text);
}

.lb-menu-sep {
  height: 1px;
  background: var(--border-light);
  margin: 6px 2px;
}

.lb-menu-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  padding: 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
}

.lb-menu-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.lb-menu-item.danger {
  color: var(--dnd);
}

.lb-menu-item.danger:hover {
  background: rgba(248, 81, 73, 0.12);
}

.lb-toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: var(--panel-solid);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  font-weight: 700;
  font-size: 13px;
  z-index: 1202;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

/* message attachments (new markup: att-preview / att-dl) */
.msg-attachment.media {
  padding: 0;
  display: inline-flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
  width: auto;
  max-width: min(520px, 100%);
}

.msg-attachment.media.media-audio {
  width: min(420px, 100%);
}

.msg-attachment.media.gif-sticker {
  max-width: min(270px, 100%);
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.msg-attachment.media.gif-sticker .att-preview {
  border-radius: 12px;
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.18);
  box-shadow: none;
}

.msg-attachment.media.gif-sticker .att-img {
  max-width: min(260px, 100%);
  max-height: 260px;
}

.att-preview {
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  align-self: flex-start;
  line-height: 0;
  font-size: 0;
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(circle at top right, rgba(176, 76, 255, 0.18), transparent 38%),
    rgba(0, 0, 0, 0.3);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.att-preview.att-preview-image,
.att-preview.att-preview-video {
  cursor: pointer;
}

.att-img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 360px;
  object-fit: contain;
  background: transparent;
}

.att-video {
  display: block;
  width: 100%;
  max-width: 520px;
  max-height: 360px;
  background: #000;
}

.att-preview-video::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 72px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.34), transparent);
  pointer-events: none;
  opacity: .8;
  transition: opacity .18s ease;
}

.msg-attachment.media.is-playing .att-preview-video::after {
  opacity: .32;
}

.att-play,
.att-dl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  color: inherit;
}

.att-play {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 62px;
  height: 62px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(8, 10, 14, 0.58);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32);
  transition: opacity .18s ease, transform .18s ease, background .18s ease;
}

.att-play:hover {
  background: rgba(8, 10, 14, 0.72);
  transform: translate(-50%, -50%) scale(1.04);
}

.msg-attachment.media.is-playing .att-play {
  opacity: 0;
  pointer-events: none;
}

.play-ico {
  width: 22px;
  height: 22px;
  margin-left: 3px;
}

.att-preview .att-dl {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: rgba(8, 10, 14, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.18);
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity .15s ease, transform .15s ease, background .15s ease;
  z-index: 2;
}

.att-fav {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(8, 10, 14, 0.62);
  color: #ffd166;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity .15s ease, transform .15s ease, background .15s ease;
}

.att-fav:hover,
.att-fav.saved {
  background: rgba(8, 10, 14, 0.78);
}

.att-preview:hover .att-dl,
.att-preview:focus-within .att-dl,
.att-preview:hover .att-fav,
.att-preview:focus-within .att-fav,
.msg-attachment.media.is-playing .att-preview:hover .att-dl {
  opacity: 1;
  transform: translateY(0);
}

.att-preview-audio {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: min(320px, 100%);
  padding: 14px 14px 14px 16px;
  line-height: normal;
  font-size: 14px;
}

.att-audio-shell {
  min-width: 0;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
}

.att-audio-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  background: linear-gradient(135deg, rgba(176, 76, 255, 0.95), rgba(255, 106, 213, 0.95));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.att-audio-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.att-audio-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-weight: 700;
  line-height: 1.25;
}

.att-audio-sub {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.2;
}

.att-audio {
  width: 100%;
  min-width: 0;
  color-scheme: dark;
  accent-color: var(--accent);
}

html.theme-light .att-audio {
  color-scheme: light;
}

html.theme-dark .att-audio::-webkit-media-controls-panel {
  background-color: #151922;
}

html.theme-dark .att-audio::-webkit-media-controls-current-time-display,
html.theme-dark .att-audio::-webkit-media-controls-time-remaining-display {
  color: var(--text);
}

.msg-attachment.media .file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(12px);
}

.msg-attachment.media .file-row .file-name {
  flex: 1;
  min-width: 0;
}

.msg-attachment.media .file-row .file-meta {
  white-space: nowrap;
}

.msg-attachment.media .file-row .att-dl {
  display: inline-flex;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.msg-attachment.media .file-row .att-dl:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* compact: hide media, show file row like Discord compact mode */
body.compact-mode .msg-attachment.media .att-preview {
  display: none;
}
body.compact-mode .msg-attachment.media .file-row {
  display: flex;
}
body.compact-mode .msg-attachment.media.media-audio .att-preview {
  display: flex;
}
body.compact-mode .msg-attachment.media.media-audio .file-row {
  display: none;
}

/* download icon svg sizing */
.dl-ico {
  width: 18px;
  height: 18px;
}



/* expired temporary attachments */
.msg-attachment.is-expired {
  cursor: default;
}

.att-expired {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: min(520px, 100%);
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-secondary);
}

.att-expired-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 16px;
}

.att-expired-main {
  min-width: 0;
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
}

.att-expired-name {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
}

.att-expired-meta {
  color: var(--text-secondary);
  font-size: 12px;
}

.att-expired-badge {
  margin-left: auto;
  flex: 0 0 auto;
  padding: 4px 7px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
}

/* attachment viewer */
#attachmentOverlay.modal-overlay {
  z-index: 1150;
}

.attachment-viewer {
  width: min(980px, calc(100vw - 24px));
  height: min(760px, calc(100dvh - 24px));
  background: rgba(20, 22, 28, 0.96);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.5);
}

.theme-light .attachment-viewer {
  background: rgba(255, 255, 255, 0.96);
}

.av-topbar {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border-light);
}

.av-left {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.av-sender {
  font-weight: 900;
  font-size: 13px;
}

.av-time {
  font-size: 12px;
  color: var(--text-secondary);
}

.av-filename {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.av-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

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

.av-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
}

.av-icon:hover {
  background: rgba(255, 255, 255, 0.08);
}

.av-icon svg {
  width: 18px;
  height: 18px;
}

.av-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: hidden;
}

.av-body.zoomed {
  overflow: auto;
}

.av-media {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

.av-video {
  background: #000;
}

.av-audio {
  width: min(520px, calc(100% - 40px));
}

.av-img.zoomed {
  transform-origin: top left;
}

.av-unknown {
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  text-align: center;
}

.av-unknown-name {
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}

.av-unknown-hint {
  font-size: 13px;
}

/* settings helpers */
.settings-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.settings-kv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.settings-k {
  font-weight: 800;
  color: var(--text-secondary);
  font-size: 12px;
}

.settings-v {
  font-weight: 800;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.form-row label {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-secondary);
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* friends: hide right column on smaller screens */
@media (max-width: 900px) {
  .friends-active { display: none; }
}


/* askTextModal missing classes */
.modal-body {
  padding: 14px 16px;
}

.modal-actions {
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* file badge in attachment rows */
.file-badge {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  font-weight: 900;
  font-size: 11px;
  letter-spacing: 0.4px;
  flex-shrink: 0;
}

/* ===== Scrollbar helpers (members drawer) ===== */
.members-list {
  overflow: auto;
  scrollbar-width: none; /* Firefox */
}
.members-list::-webkit-scrollbar {
  width: 0;
  height: 0;
}


/* avatar settings */
.settings-modal .av-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.settings-modal .av-preview {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
}

.settings-modal .av-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.settings-modal .av-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.settings-modal .av-filebtn {
  cursor: pointer;
}

/* avatar cropper */
.avatar-crop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.66);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.avatar-crop-modal {
  width: min(560px, 94vw);
  max-height: 92vh;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
}

.avatar-crop-topbar {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.avatar-crop-title {
  font-weight: 900;
}

.avatar-crop-close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text-secondary);
}

.avatar-crop-close:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
}

.avatar-crop-body {
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr 140px;
  gap: 14px;
}

.avatar-crop-area {
  position: relative;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 280px;
}

.avatar-crop-image {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  user-select: none;
  -webkit-user-drag: none;
}

.avatar-crop-mask {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at center, rgba(0,0,0,0) 0 70px, rgba(0,0,0,0.68) 72px);
}

.avatar-crop-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.avatar-crop-preview {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  margin: 0 auto;
}

.avatar-crop-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-crop-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.avatar-crop-controls .inp {
  width: 100%;
}

.avatar-crop-actions {
  padding: 12px 14px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--border);
}

@media (max-width: 560px) {
  .avatar-crop-body {
    grid-template-columns: 1fr;
  }
  .avatar-crop-side {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}


/* ===== PATCH: Settings header + avatar upload + cropper overlay ===== */
body.no-scroll { overflow: hidden; }

/* ensure cropper is above settings modal */
#avatarCropOverlay.modal-overlay { z-index: 10000; }

/* settings header smaller */
.settings-topbar {
  padding: 12px 16px;
}

.settings-close {
  border-radius: 8px;
  color: rgba(255,255,255,0.85);
}

/* avatar upload (settings) */
.avatar-upload-row {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.avatar-preview {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  flex-shrink: 0;
}

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

.avatar-preview-letter {
  font-size: 22px;
  line-height: 1;
}

.avatar-upload-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 240px;
  flex: 1;
}

.avatar-file-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.avatar-file-name {
  font-size: 13px;
  color: var(--text-secondary);
}

.avatar-actions-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.avatar-file-hint {
  font-size: 12px;
  color: var(--text-muted);
}

/* avatar cropper (matches avatar-cropper.js markup) */
.avatar-crop-header {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.avatar-crop-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.avatar-crop-preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.avatar-crop-preview {
  width: 240px;
  height: 240px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  position: relative;
  touch-action: none;
}

.avatar-crop-img {
  position: absolute;
  top: 0;
  left: 0;
  user-select: none;
  -webkit-user-drag: none;
}

.avatar-crop-hint {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

.avatar-crop-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-crop-label {
  width: 80px;
  font-size: 13px;
  color: var(--text-secondary);
}

.avatar-crop-zoom {
  flex: 1;
}

.reply-preview{
  display:flex;
  align-items:center;
  gap:8px;
  margin:6px 0 8px;
  padding:6px 10px;
  border-left:3px solid var(--accent, #a855f7);
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  cursor:pointer;
  max-width: 100%;
}

.reply-preview .rp-icon{ opacity:.8; }
.reply-preview .rp-author{
  font-weight:600;
  opacity:.95;
  white-space:nowrap;
}

.reply-preview .rp-text{
  opacity:.85;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  min-width: 0;
}

/* важно: чтобы эллипсис работал */
.message .content{ min-width:0; }

/* ===== Extra UI: uploads, pins, danger buttons ===== */

.panelHeader.chat-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.chat-header-actions{
  display:flex;
  align-items:center;
  gap:8px;
}

.members-panel-hide {
  margin-left: auto;
}

.btn-danger{
  background: rgba(255, 70, 70, 0.20);
  border: 1px solid rgba(255, 70, 70, 0.55);
  color: #ff6b6b;
}
.btn-danger:hover{
  background: rgba(255, 70, 70, 0.28);
}

.sub-row{
  display:flex;
  align-items:center;
  gap:6px;
  min-width:0;
}
.server-muted-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:18px;
  height:18px;
  border-radius:999px;
  background:rgba(255,255,255,0.08);
  font-size:11px;
}
.server-menu-btn{
  margin-left:auto;
  width:28px;
  height:28px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,0.08);
  background:rgba(255,255,255,0.04);
  color:rgba(255,255,255,0.88);
  cursor:pointer;
  flex:0 0 auto;
}
.server-menu-btn:hover{
  background:rgba(255,255,255,0.10);
  border-color:rgba(255,255,255,0.14);
}
.server-menu-backdrop{
  position:fixed;
  inset:0;
  background:transparent;
  border:0;
  padding:0;
  margin:0;
  z-index:9998;
}
.server-menu-popover{
  position:fixed;
  width:min(220px, calc(100vw - 24px));
  border-radius:14px;
  border:1px solid rgba(255,255,255,0.10);
  background:rgba(17,19,26,0.98);
  box-shadow:0 18px 46px rgba(0,0,0,0.34);
  padding:8px;
  z-index:9999;
}
.server-menu-item{
  width:100%;
  text-align:left;
  border:0;
  background:transparent;
  color:var(--text);
  padding:10px 12px;
  border-radius:10px;
  cursor:pointer;
}
.server-menu-item:hover{ background:rgba(255,255,255,0.08); }
.server-settings-modal{
  width:min(520px, calc(100vw - 24px));
}
.server-settings-body{
  display:flex;
  flex-direction:column;
  gap:14px;
}
.server-settings-head{
  display:flex;
  align-items:center;
  gap:12px;
}
.server-settings-avatar{
  width:52px;
  height:52px;
  border-radius:18px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
  background:rgba(168,85,247,0.18);
  color:#f2d7ff;
  border:1px solid rgba(168,85,247,0.36);
}
.server-settings-name{ font-size:18px; font-weight:800; }
.server-settings-sub, .server-settings-note{ color:var(--text-secondary); font-size:13px; }
.server-settings-section{
  border:1px solid rgba(255,255,255,0.08);
  border-radius:14px;
  padding:14px;
  background:rgba(255,255,255,0.03);
}
.server-settings-section.danger{
  border-color:rgba(255,82,82,0.22);
  background:rgba(255,82,82,0.05);
}
.server-settings-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.server-settings-label, .server-settings-title{ font-weight:800; }
.server-settings-actions-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin-top:10px;
}
.dm-member .role{ color:var(--text-secondary); }

.dm-home-menu{
  display:grid;
  gap:6px;
  padding:10px 8px 6px;
}
.dm-find-btn{
  width:100%;
  min-height:34px;
  border:1px solid rgba(255,255,255,0.08);
  border-radius:8px;
  background:rgba(255,255,255,0.055);
  color:var(--text);
  cursor:pointer;
  font-weight:700;
}
.dm-find-btn:hover{ background:rgba(255,255,255,0.09); }
.dm-home-item{
  width:100%;
  display:flex;
  align-items:center;
  gap:12px;
  min-height:38px;
  border:0;
  border-radius:8px;
  padding:0 10px;
  color:var(--text-secondary);
  background:transparent;
  cursor:pointer;
  text-align:left;
  font-weight:800;
}
.dm-home-item:hover{ background:rgba(255,255,255,0.07); color:var(--text); }
.dm-home-item.active{ background:rgba(255,255,255,0.10); color:var(--text); }
.dm-home-ic{
  width:20px;
  display:inline-grid;
  place-items:center;
  color:var(--text-secondary);
}
.dm-home-sep{
  height:1px;
  margin:6px 0;
  background:rgba(255,255,255,0.08);
}
.dm-section-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:3px 4px 0;
  color:var(--text-secondary);
  font-size:12px;
  font-weight:900;
  text-transform:uppercase;
}
.dm-create-group-btn{
  width:24px;
  height:24px;
  min-width:24px;
}
.dm-list .item.dm{
  position:relative;
}
.dm-list .item.dm .dm-hide{
  opacity:0;
  transition:opacity .12s ease;
}
.dm-list .item.dm:hover .dm-hide{ opacity:1; }
.dm-group-avatar{
  background:rgba(255,255,255,0.10);
}
.utility-view{
  height:100%;
  overflow:auto;
  background:var(--bg);
}
.utility-shell{
  min-height:100%;
  padding:28px;
  display:grid;
  align-content:start;
  gap:20px;
}
.utility-hero{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:18px;
  padding:26px;
  border:1px solid rgba(255,255,255,0.08);
  border-radius:8px;
  background:
    linear-gradient(135deg, rgba(178,74,255,0.18), rgba(37,99,235,0.08)),
    rgba(255,255,255,0.035);
}
.utility-hero.compact{
  align-items:center;
}
.utility-kicker{
  color:var(--accent);
  font-weight:900;
  text-transform:uppercase;
  font-size:12px;
}
.utility-hero h2{
  margin:6px 0 8px;
  font-size:30px;
  line-height:1.08;
}
.utility-hero p{
  margin:0;
  color:var(--text-secondary);
  max-width:620px;
}
.subscription-switch{
  display:flex;
  gap:8px;
  padding:4px;
  border:1px solid rgba(255,255,255,0.08);
  border-radius:8px;
  background:rgba(0,0,0,0.18);
}
.subscription-switch button{
  border:0;
  border-radius:6px;
  color:var(--text-secondary);
  background:transparent;
  padding:9px 12px;
  cursor:pointer;
  font-weight:800;
}
.subscription-switch button.active{
  color:var(--text);
  background:rgba(255,255,255,0.10);
}
.subscription-layout{
  display:grid;
  grid-template-columns:minmax(0, 1fr) 300px;
  gap:18px;
}
.subscription-plans{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:12px;
}
.subscription-plan{
  text-align:left;
  border:1px solid rgba(255,255,255,0.09);
  border-radius:8px;
  padding:18px;
  color:var(--text);
  background:rgba(255,255,255,0.035);
  cursor:pointer;
}
.subscription-plan:hover,
.subscription-plan.selected{
  border-color:rgba(184,74,255,0.55);
  background:rgba(184,74,255,0.10);
}
.subscription-plan.featured{
  background:linear-gradient(180deg, rgba(184,74,255,0.22), rgba(255,255,255,0.035));
}
.subscription-plan-name,
.subscription-plan-price{
  display:block;
  font-weight:900;
}
.subscription-plan-price{
  margin-top:8px;
  color:var(--accent);
}
.subscription-plan ul{
  margin:14px 0 0;
  padding-left:18px;
  color:var(--text-secondary);
  line-height:1.55;
}
.subscription-checkout-card{
  display:grid;
  gap:10px;
  align-content:start;
  border:1px solid rgba(255,255,255,0.09);
  border-radius:8px;
  padding:16px;
  background:rgba(255,255,255,0.04);
}
.subscription-checkout-title{
  font-weight:900;
  font-size:18px;
}
.subscription-option{
  display:flex;
  align-items:center;
  gap:8px;
  color:var(--text);
}
.subscription-field{
  display:grid;
  gap:7px;
  color:var(--text-secondary);
  font-size:12px;
  font-weight:800;
}
.subscription-payment-methods{
  display:grid;
  gap:8px;
  padding-top:6px;
  border-top:1px solid rgba(255,255,255,0.08);
}
.subscription-qr-box{
  display:flex;
  align-items:center;
  gap:12px;
  padding:12px;
  border:1px solid rgba(116,245,176,0.26);
  border-radius:8px;
  background:rgba(116,245,176,0.07);
  color:var(--text-secondary);
  font-size:12px;
  line-height:1.35;
}
.subscription-qr-mark{
  width:54px;
  height:54px;
  flex:0 0 54px;
  display:grid;
  place-items:center;
  border-radius:8px;
  background:repeating-linear-gradient(45deg, #fff 0 6px, #111 6px 12px);
  color:#fff;
  font-weight:900;
  text-shadow:0 1px 4px #000;
}
.subscription-save-pay{
  display:flex;
  align-items:center;
  gap:9px;
  color:var(--text);
  font-size:13px;
}
.subscription-danger-note{
  padding:11px 12px;
  border:1px solid rgba(255,82,82,0.42);
  border-radius:8px;
  background:rgba(255,82,82,0.13);
  color:#ffd5d5;
  font-weight:800;
  font-size:12px;
  line-height:1.4;
}
.subscription-note{
  color:var(--text-secondary);
  font-size:12px;
  line-height:1.4;
}
.utility-grid{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:12px;
}
.utility-card{
  border:1px solid rgba(255,255,255,0.08);
  border-radius:8px;
  padding:18px;
  background:rgba(255,255,255,0.035);
}
.utility-card-ic{
  width:42px;
  height:42px;
  display:grid;
  place-items:center;
  border-radius:8px;
  background:rgba(184,74,255,0.18);
  color:var(--accent);
  font-weight:900;
}
.utility-card h3{
  margin:14px 0 6px;
}
.utility-card p{
  margin:0;
  color:var(--text-secondary);
}
.utility-action-card{
  text-align:left;
  color:var(--text);
  cursor:pointer;
  transition:border-color .16s ease, background .16s ease, transform .16s ease;
}
.utility-action-card:hover,
.utility-action-card:focus-visible{
  border-color:rgba(176,76,255,0.42);
  background:rgba(176,76,255,0.10);
  transform:translateY(-1px);
}
.download-list{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:12px;
}
.download-card{
  display:grid;
  grid-template-columns:58px minmax(0,1fr) auto;
  align-items:center;
  gap:14px;
  border:1px solid rgba(255,255,255,0.08);
  border-radius:8px;
  padding:16px;
  background:rgba(255,255,255,0.035);
  min-width:0;
}
.download-card.disabled{
  opacity:.68;
}
.download-card-ic{
  width:58px;
  height:58px;
  display:grid;
  place-items:center;
  border-radius:10px;
  background:rgba(176,76,255,0.14);
  border:1px solid rgba(176,76,255,0.22);
  color:var(--accent);
  font-weight:900;
}
.download-card-main{
  min-width:0;
}
.download-card h3{
  margin:0 0 4px;
  font-size:16px;
}
.download-card p{
  margin:0;
  color:var(--text-secondary);
  line-height:1.4;
}
.download-file-name{
  margin-top:8px;
  color:var(--text);
  font-size:12px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.quests-list{
  display:grid;
  gap:10px;
}
.quest-row{
  display:grid;
  grid-template-columns:40px minmax(0,1fr) auto;
  align-items:center;
  gap:12px;
  border:1px solid rgba(255,255,255,0.08);
  border-radius:8px;
  padding:14px;
  background:rgba(255,255,255,0.035);
}
.quest-row > span{
  color:var(--accent);
  font-weight:900;
}
.quest-row small{
  display:block;
  color:var(--text-secondary);
  margin-top:3px;
}
.group-chat-modal{
  width:min(520px, calc(100vw - 24px));
}
.group-chat-body{
  display:grid;
  gap:12px;
}
.group-chat-picker{
  max-height:320px;
  overflow:auto;
  display:grid;
  gap:6px;
  padding:4px;
  border:1px solid rgba(255,255,255,0.08);
  border-radius:8px;
  background:rgba(0,0,0,0.14);
}
.group-chat-user{
  display:grid;
  grid-template-columns:auto 32px minmax(0,1fr);
  align-items:center;
  gap:10px;
  padding:8px;
  border-radius:8px;
  cursor:pointer;
}
.group-chat-user:hover{
  background:rgba(255,255,255,0.06);
}
.group-chat-user-main{
  min-width:0;
  display:grid;
}
.group-chat-user-main span{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-weight:800;
}
.group-chat-user-main small{
  color:var(--text-secondary);
}
.server-menu-popover{
  width:min(270px, calc(100vw - 24px));
  border-radius:8px;
  padding:8px;
}
.server-menu-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  min-height:36px;
  border-radius:6px;
  font-weight:700;
}
.server-menu-ic{
  color:var(--text-secondary);
  font-size:13px;
}
.server-menu-divider{
  height:1px;
  margin:6px;
  background:rgba(255,255,255,0.08);
}
.server-settings-overlay{
  align-items:stretch;
  justify-content:stretch;
  padding:0;
  background:rgba(0,0,0,0.76);
}
.server-settings-workspace{
  width:100%;
  height:100%;
  display:grid;
  grid-template-columns:minmax(220px, 32vw) minmax(0, 1fr) 120px;
  background:#202127;
  color:var(--text);
}
.server-settings-nav{
  display:block;
  overflow:auto;
  padding:34px 24px 34px max(24px, calc(32vw - 300px));
  background:#15161b;
}
.server-settings-nav-group{
  display:grid;
  gap:4px;
  padding:10px 0;
  border-bottom:1px solid rgba(255,255,255,0.08);
}
.server-settings-nav-group:last-child{
  border-bottom:0;
}
.server-settings-nav-title{
  color:var(--text-secondary);
  font-size:11px;
  font-weight:900;
  text-transform:uppercase;
  padding:0 10px 4px;
}
.server-settings-nav-item{
  width:100%;
  min-height:32px;
  border:0;
  border-radius:4px;
  padding:0 10px;
  text-align:left;
  color:var(--text-secondary);
  background:transparent;
  cursor:pointer;
  font-weight:700;
}
.server-settings-nav-item:hover{
  color:var(--text);
  background:rgba(255,255,255,0.08);
}
.server-settings-nav-item.active{
  color:var(--text);
  background:rgba(255,255,255,0.14);
}
.server-settings-nav-item.danger{
  color:#ff6b6b;
}
.server-settings-content{
  overflow:auto;
  padding:56px 40px;
}
.server-settings-content-inner{
  max-width:980px;
}
.server-settings-close{
  align-self:start;
  justify-self:center;
  margin-top:48px;
  border:0;
  background:transparent;
  color:var(--text-secondary);
  cursor:pointer;
  display:grid;
  gap:6px;
  justify-items:center;
}
.server-settings-close span{
  width:42px;
  height:42px;
  display:grid;
  place-items:center;
  border:2px solid rgba(255,255,255,0.38);
  border-radius:50%;
  font-size:20px;
}
.server-settings-close small{
  font-size:11px;
  font-weight:900;
}
.server-settings-page-grid{
  display:grid;
  grid-template-columns:minmax(0, 1fr) 300px;
  gap:40px;
  align-items:start;
}
.server-settings-main-section{
  display:grid;
  gap:14px;
}
.server-settings-main-section h2{
  margin:0;
  font-size:22px;
}
.server-settings-main-section p{
  margin:0 0 20px;
  color:var(--text-secondary);
  max-width:680px;
}
.server-settings-field{
  display:grid;
  gap:8px;
}
.server-settings-divider{
  height:1px;
  margin:18px 0;
  background:rgba(255,255,255,0.12);
}
.server-settings-block-title{
  font-weight:900;
}
.server-banner-swatches{
  display:grid;
  grid-template-columns:repeat(5, minmax(70px, 1fr));
  gap:8px;
}
.server-banner-swatch{
  height:62px;
  border:1px solid rgba(255,255,255,0.10);
  border-radius:6px;
  cursor:pointer;
}
.server-banner-swatch.dark{ background:linear-gradient(180deg, #111, #555); }
.server-banner-swatch.pink{ background:#ff35a9; }
.server-banner-swatch.red{ background:#f3342e; }
.server-banner-swatch.orange{ background:#ff8426; }
.server-banner-swatch.yellow{ background:#f7d635; }
.server-banner-swatch.purple{ background:linear-gradient(180deg, #6d2d91, #b45dde); }
.server-banner-swatch.blue{ background:#25b4f5; }
.server-banner-swatch.mint{ background:#63d8cc; }
.server-banner-swatch.green{ background:#58931e; }
.server-banner-swatch.gray{ background:linear-gradient(180deg, #181818, #686868); }
.server-traits-grid{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:8px;
}
.server-settings-footer-actions{
  margin-top:8px;
}
.server-profile-preview{
  position:sticky;
  top:0;
  min-height:270px;
  border:1px solid rgba(255,255,255,0.10);
  border-radius:14px;
  overflow:hidden;
  background:#303137;
  padding:120px 16px 18px;
}
.server-profile-preview-banner{
  position:absolute;
  inset:0 0 auto 0;
  height:120px;
  background:linear-gradient(180deg, #222, #6a6a6a);
}
.server-profile-preview-icon{
  position:absolute;
  top:88px;
  left:18px;
  width:68px;
  height:68px;
  display:grid;
  place-items:center;
  border-radius:16px;
  background:#111217;
  border:4px solid #303137;
  font-weight:900;
}
.server-profile-preview-name{
  font-weight:900;
  margin-top:8px;
}
.server-profile-preview-meta,
.server-profile-preview-date{
  color:var(--text-secondary);
  font-size:12px;
  margin-top:4px;
}
.server-profile-preview-badges{
  display:flex;
  gap:6px;
  margin-top:14px;
}
.server-profile-preview-badges span{
  padding:4px 6px;
  border-radius:6px;
  background:rgba(255,255,255,0.10);
  font-size:11px;
  font-weight:900;
}
.online-dot{
  width:7px;
  height:7px;
  display:inline-block;
  border-radius:50%;
  background:#3fb950;
}
.server-settings-info-grid{
  display:grid;
  grid-template-columns:repeat(3, minmax(0,1fr));
  gap:10px;
}
.server-settings-info-card{
  border:1px solid rgba(255,255,255,0.08);
  border-radius:8px;
  padding:14px;
  display:grid;
  gap:6px;
  background:rgba(255,255,255,0.035);
}
.server-settings-info-card span{
  color:var(--text-secondary);
}
.danger-page{
  max-width:560px;
  border:1px solid rgba(255,82,82,0.25);
  border-radius:8px;
  padding:18px;
  background:rgba(255,82,82,0.06);
}
.dm-group-profile-panel .dm-group-profile-head{
  display:flex;
  align-items:center;
  gap:12px;
}
.dm-group-profile-avatar{
  width:58px;
  height:58px;
  border-radius:16px;
  display:grid;
  place-items:center;
  background:rgba(255,255,255,0.10);
}
.dm-group-members-list{
  display:grid;
  gap:6px;
}
.dm-group-member{
  display:flex;
  align-items:center;
  gap:10px;
  width:100%;
  border:0;
  border-radius:8px;
  padding:8px;
  background:transparent;
  color:var(--text);
  text-align:left;
  cursor:pointer;
}
.dm-group-member:hover{
  background:rgba(255,255,255,0.06);
}
.dm-group-member-main{
  min-width:0;
  display:grid;
}
.dm-group-member-name{
  font-weight:800;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.dm-group-member-name em{
  color:var(--accent);
  font-style:normal;
  font-size:11px;
}
.dm-group-member-status{
  color:var(--text-secondary);
  font-size:12px;
}

@media (max-width: 980px){
  .subscription-layout,
  .server-settings-page-grid{
    grid-template-columns:1fr;
  }
  .subscription-plans,
  .utility-grid,
  .download-list,
  .server-settings-info-grid{
    grid-template-columns:1fr;
  }
  .server-settings-workspace{
    grid-template-columns:190px minmax(0,1fr);
  }
  .server-settings-close{
    position:fixed;
    right:14px;
    top:14px;
    margin:0;
  }
}

@media (max-width: 720px){
  .utility-shell{
    padding:18px;
  }
  .utility-hero{
    align-items:stretch;
    flex-direction:column;
    padding:18px;
  }
  .download-card{
    grid-template-columns:46px minmax(0,1fr);
  }
  .download-card .btn{
    grid-column:1 / -1;
    width:100%;
  }
  .download-card-ic{
    width:46px;
    height:46px;
  }
  .server-settings-workspace{
    grid-template-columns:1fr;
  }
  .server-settings-nav{
    max-height:220px;
    padding:16px;
  }
  .server-settings-content{
    padding:20px 16px 72px;
  }
}

.upload-queue{
  padding: 8px 10px;
  border-top: 1px solid rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.12);
}

.upload-job{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 6px 0;
}

.upload-job .u-left{
  min-width: 0;
  flex: 1;
}

.upload-job .u-name{
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-job .u-sub{
  font-size: 12px;
  opacity: 0.75;
}

.upload-job .u-bar{
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  overflow: hidden;
  margin-top: 4px;
}

.upload-job .u-bar > i{
  display:block;
  height: 100%;
  width: 0%;
  background: var(--accent, #a855f7);
}

.upload-job .u-actions{
  display:flex;
  align-items:center;
  gap:6px;
}

.upload-job .u-btn{
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  color: var(--text, #fff);
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
}

.upload-job .u-btn:hover{ background: rgba(255,255,255,0.10); }

.pins-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 2000;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 14px;
}

.pins-modal{
  width: min(760px, 100%);
  max-height: min(78vh, 720px);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(23,23,30,0.98), rgba(16,16,22,0.98));
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 24px 80px rgba(0,0,0,0.40);
  overflow: hidden;
  display:flex;
  flex-direction: column;
}

.pins-top{
  display:flex;
  align-items:center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.02);
}

.pins-body{
  overflow:auto;
  padding: 14px 16px 16px;
  display:flex;
  flex-direction:column;
  gap:12px;
}

.pin-row{
  padding: 0;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  border-radius: 16px;
  overflow: hidden;
}

.pin-message{
  display:flex;
  gap:12px;
  align-items:flex-start;
  padding: 14px;
}

.pin-avatar{
  width: 42px;
  min-width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(255,255,255,0.06);
}

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

.pin-main{
  min-width: 0;
  flex: 1;
  display:flex;
  flex-direction:column;
  gap:6px;
}

.pin-head{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:6px;
  line-height: 1.2;
}

.pin-author{
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.pin-dot,
.pin-time,
.pin-submeta{
  font-size: 12px;
  color: var(--text-secondary);
}

.pin-submeta{
  opacity: 0.9;
}

.pin-text{
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.pin-text.is-missing{
  color: var(--text-secondary);
}

.pin-actions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top: 2px;
}

.pin-actions .btn{
  min-height: 34px;
}

@media (max-width: 600px) {
  .settings-modal{
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    display:flex;
    flex-direction: column;
    position: relative;
  }

  .settings-modal.show-sections::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.42);
    z-index: 1;
  }

  .settings-sidebar{
    display: none;
  }

  .settings-modal.show-sections .settings-sidebar{
    display:flex;
    flex-direction: column;
    gap: 6px;
    position: absolute;
    left: 12px;
    right: 12px;
    top: 72px;
    bottom: 12px;
    width: auto;
    min-width: 0;
    height: auto;
    overflow-y: auto;
    padding: 12px;
    border-right: 0;
    border-bottom: 0;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    background: var(--panel-solid);
    z-index: 2;
  }

  .settings-side-header, .settings-side-sep{
    display:none;
  }

  .settings-nav-item{
    width: 100%;
    white-space: nowrap;
    border-radius: 10px;
  }

  .settings-sections-btn{
    display:inline-flex;
    flex: 0 0 auto;
  }

  .settings-content{
    width: 100%;
    min-width: 0;
    flex: 1;
  }

  .settings-body {
    padding: 16px;
  }

  .setting-row {
    flex-direction: column;
    align-items: stretch;
  }

  .range-wrap {
    width: 100%;
  }
}

html.ui-scaled,
html.ui-scaled body {
  overflow: hidden;
}

html.ui-scaled .layout {
  height: calc((100vh / var(--ui-scale)) - 56px);
  height: calc((100svh / var(--ui-scale)) - 56px);
  height: calc((100dvh / var(--ui-scale)) - 56px);
}

/* states for voice buttons */
.icon-btn.is-on, .vc-btn.is-on {
  border-color: rgba(176, 76, 255, 0.55);
  background: rgba(176, 76, 255, 0.16);
}
.icon-btn.is-off, .vc-btn.is-off {
  border-color: rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
}

/* keep controls usable in fullscreen */
.voice-view:fullscreen .voice-controls {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 9999;
}
.voice-view:fullscreen .voice-view-header {
  position: sticky;
  top: 0;
  z-index: 9999;
}

/* DM call overlay */
.dm-call-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, rgba(168,85,247,0.18), rgba(0,0,0,0.72) 46%, rgba(0,0,0,0.82));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 18px;
}
.dm-call-overlay.hidden { display: none; }

.dm-call-card {
  position: relative;
  width: min(420px, calc(100% - 24px));
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.10);
  background: linear-gradient(180deg, rgba(24,24,31,0.98), rgba(13,14,19,0.98));
  box-shadow: 0 28px 80px rgba(0,0,0,0.42);
  padding: 22px;
  text-align: center;
  overflow: hidden;
}
.dm-call-glow {
  position:absolute;
  inset:auto;
  top:-120px;
  left:50%;
  width:260px;
  height:260px;
  transform:translateX(-50%);
  border-radius:999px;
  background:radial-gradient(circle, rgba(168,85,247,0.30), rgba(168,85,247,0.00) 68%);
  pointer-events:none;
}
.dm-call-state {
  position: relative;
  z-index: 1;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,0.12);
  background:rgba(255,255,255,0.05);
  color:rgba(255,255,255,0.82);
  font-size:12px;
  font-weight:700;
  letter-spacing:0.02em;
}
.dm-call-avatar-wrap {
  position:relative;
  z-index:1;
  margin:18px auto 10px;
  width:108px;
  height:108px;
  border-radius:999px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(168,85,247,0.10);
  border:1px solid rgba(168,85,247,0.30);
}
.dm-call-avatar {
  width:84px;
  height:84px;
  border-radius:999px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:30px;
  font-weight:900;
  color:#fff;
  background:linear-gradient(180deg, rgba(176,76,255,0.95), rgba(132,56,199,0.92));
}
.dm-call-name {
  position: relative;
  z-index:1;
  margin-top:6px;
  font-size:24px;
  font-weight:900;
  color:#fff;
}
.dm-call-title {
  position: relative;
  z-index:1;
  margin-top:12px;
  font-weight:800;
  font-size:18px;
  color: rgba(255,255,255,0.94);
}
.dm-call-sub {
  position: relative;
  z-index:1;
  margin-top:8px;
  font-size:13px;
  line-height:1.45;
  color: rgba(255,255,255,0.72);
}
.dm-call-actions {
  position: relative;
  z-index:1;
  margin-top: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.dm-call-btn {
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.05);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}
.dm-call-btn.accept {
  background: linear-gradient(180deg, rgba(99, 226, 155, 0.95), rgba(64, 165, 120, 0.95));
  border-color: rgba(99,226,155,0.45);
  color: #08150f;
}
.dm-call-btn.decline {
  background: rgba(255, 94, 94, 0.16);
  border-color: rgba(255, 94, 94, 0.42);
}
.dm-call-btn:hover { filter: brightness(1.04); }
@media (max-width: 640px) {
  .pins-overlay{
    padding: 0;
  }

  .pins-modal{
    width: 100vw;
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
  }

  .pin-message{
    padding: 12px;
  }
}


/* ===== Voice call stage: Discord-like panel grid ===== */
.voice-stage {
  --voice-stage-gap: clamp(10px, 1.2vw, 16px);
  background: #050506;
}

.voice-stage-content {
  grid-template-columns: repeat(2, minmax(0, 640px));
  grid-template-rows: minmax(0, 1fr);
  gap: var(--voice-stage-gap);
  padding: clamp(12px, 1.4vw, 18px) clamp(12px, 1.4vw, 18px) clamp(86px, 10vh, 108px);
  place-content: center;
  place-items: stretch;
}

.voice-peer-tile,
.voice-stage-video-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.11);
  background: rgba(24,25,29,0.94);
  box-shadow: 0 18px 42px rgba(0,0,0,0.34);
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.voice-peer-tile:hover,
.voice-stage-video-wrap:hover {
  border-color: rgba(176, 76, 255, 0.34);
  background: rgba(30,31,36,0.98);
}

.voice-stage.stage-focused .voice-peer-tile,
.voice-stage.stage-focused .voice-stage-video-wrap {
  box-shadow: 0 14px 34px rgba(0,0,0,0.30);
}

.voice-stage.mode-stream .voice-stage-video-wrap,
.voice-stage.mode-user .voice-peer-tile {
  border-color: rgba(88, 242, 135, 0.68);
  box-shadow: 0 0 0 2px rgba(88, 242, 135, 0.16), 0 20px 48px rgba(0,0,0,0.40);
}

.voice-stage.has-stream.mode-grid .voice-stage-video-wrap,
.voice-stage.has-stream.mode-grid .voice-peer-tile {
  align-self: center;
  justify-self: center;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 100%;
}

.voice-stage.has-stream.mode-grid .voice-stage-video-wrap {
  grid-column: 1;
  grid-row: 1;
}

.voice-stage.has-stream.mode-grid .voice-peer-tile {
  grid-column: 2;
  grid-row: 1;
  justify-content: center;
  padding: clamp(14px, 2vw, 24px);
}

.voice-stage.has-stream.mode-stream .voice-stage-content,
.voice-stage.has-stream.mode-user .voice-stage-content {
  grid-template-columns: minmax(0, 1180px);
  grid-template-rows: minmax(0, 1fr) minmax(112px, 22%);
}

.voice-stage.has-stream.mode-stream .voice-stage-video-wrap,
.voice-stage.has-stream.mode-user .voice-peer-tile {
  grid-column: 1;
  grid-row: 1;
  align-self: stretch;
  justify-self: stretch;
}

.voice-stage.has-stream.mode-stream .voice-peer-tile,
.voice-stage.has-stream.mode-user .voice-stage-video-wrap {
  grid-column: 1;
  grid-row: 2;
  align-self: stretch;
  justify-self: center;
  width: min(420px, 100%);
  flex-direction: row;
  justify-content: center;
  padding: 12px 16px;
}

.voice-stage-video-wrap video {
  border-radius: inherit;
}

.voice-stage.has-stream.mode-grid .voice-peer-ava {
  width: clamp(76px, 8vw, 112px);
  height: clamp(76px, 8vw, 112px);
  border-radius: 24px;
  font-size: clamp(30px, 4vw, 48px);
}

.voice-stage.has-stream.mode-grid .voice-peer-name {
  font-size: 17px;
  max-width: min(360px, 100%);
}

.voice-stage.has-stream.mode-stream .voice-peer-ava {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  font-size: 24px;
}

.voice-stage.has-stream.mode-stream .voice-peer-name {
  max-width: 260px;
  text-align: left;
}

.voice-stage.has-stream.mode-user .voice-peer-tile {
  justify-content: center;
  padding: clamp(18px, 2.4vw, 28px);
}

.voice-stage.has-stream.mode-user .voice-peer-ava {
  width: clamp(118px, 12vw, 168px);
  height: clamp(118px, 12vw, 168px);
  border-radius: 32px;
  font-size: clamp(48px, 6vw, 72px);
}

.voice-stage.has-stream.mode-user .voice-peer-name {
  font-size: clamp(20px, 2vw, 26px);
  max-width: min(520px, 100%);
}

.voice-stage.no-stream .voice-stage-video-wrap {
  display: none;
}

.voice-stage.no-stream .voice-stage-content {
  grid-template-columns: minmax(0, 460px);
  grid-template-rows: auto;
  place-content: center;
  place-items: stretch;
}

.voice-stage.no-stream .voice-peer-tile {
  grid-column: 1;
  grid-row: 1;
  width: 100%;
  min-height: min(340px, 58vh);
  justify-content: center;
  padding: 22px;
}

.voice-stage.no-stream .voice-peer-ava {
  width: 132px;
  height: 132px;
  border-radius: 28px;
  font-size: 54px;
}

.voice-stage.no-stream .voice-peer-name {
  font-size: 20px;
  max-width: 100%;
}

.voice-self-preview {
  display: none !important;
}

/* Voice participants are the main call surface, not a separate lower list. */
.voice-stage.has-member-grid.no-stream .voice-stage-content {
  display: none;
}

.voice-stage.has-member-grid.no-stream .voice-members-dock {
  left: clamp(14px, 2vw, 24px);
  right: clamp(14px, 2vw, 24px);
  top: clamp(14px, 2vw, 24px);
  bottom: clamp(86px, 11vh, 112px);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.voice-stage.has-member-grid .voice-members-head {
  display: none;
}

.voice-stage.has-member-grid.no-stream .voice-members-grid {
  display: grid;
  height: 100%;
  max-height: none;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  grid-auto-rows: minmax(180px, 1fr);
  gap: var(--voice-stage-gap);
  overflow: auto;
  padding: 0;
  align-content: center;
}

.voice-stage.has-member-grid.no-stream .voice-member-tile {
  position: relative;
  min-width: 0;
  min-height: 180px;
  width: 100%;
  height: 100%;
  flex: initial;
  flex-direction: column;
  justify-content: center;
  padding: clamp(16px, 2.2vw, 26px);
  border-radius: 16px;
  background: rgba(24, 25, 29, 0.94);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
  cursor: pointer;
}

.voice-stage.has-member-grid.no-stream .voice-member-ava {
  width: clamp(72px, 9vw, 132px);
  height: clamp(72px, 9vw, 132px);
  border-radius: 26px;
  font-size: clamp(30px, 4vw, 54px);
}

.voice-stage.has-member-grid.no-stream .voice-member-meta {
  align-items: center;
  text-align: center;
  flex: 0 0 auto;
}

.voice-stage.has-member-grid.no-stream .voice-member-name {
  font-size: clamp(15px, 1.6vw, 20px);
  max-width: 100%;
}

.voice-stage.has-member-grid.no-stream.mode-user .voice-members-grid {
  grid-template-columns: minmax(0, min(760px, 100%));
  justify-content: center;
}

.voice-stage.has-member-grid.no-stream.mode-user .voice-member-tile:not(.focused) {
  display: none;
}

.voice-stage.has-member-grid.no-stream.mode-user .voice-member-tile.focused {
  min-height: min(430px, 64vh);
  border-color: rgba(88, 242, 135, 0.68);
  box-shadow: 0 0 0 2px rgba(88, 242, 135, 0.16), 0 22px 58px rgba(0, 0, 0, 0.42);
}

@media (max-width: 900px) {
  .voice-stage-content,
  .voice-stage.has-stream.mode-stream .voice-stage-content,
  .voice-stage.has-stream.mode-user .voice-stage-content {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-content: center;
  }

  .voice-stage.has-stream.mode-grid .voice-stage-video-wrap,
  .voice-stage.has-stream.mode-grid .voice-peer-tile,
  .voice-stage.has-stream.mode-stream .voice-stage-video-wrap,
  .voice-stage.has-stream.mode-stream .voice-peer-tile,
  .voice-stage.has-stream.mode-user .voice-stage-video-wrap,
  .voice-stage.has-stream.mode-user .voice-peer-tile {
    grid-column: 1;
    width: 100%;
    min-height: 150px;
    aspect-ratio: 16 / 9;
  }

  .voice-stage.has-stream.mode-grid .voice-stage-video-wrap,
  .voice-stage.has-stream.mode-stream .voice-stage-video-wrap,
  .voice-stage.has-stream.mode-user .voice-peer-tile {
    grid-row: 1;
  }

  .voice-stage.has-stream.mode-grid .voice-peer-tile,
  .voice-stage.has-stream.mode-stream .voice-peer-tile,
  .voice-stage.has-stream.mode-user .voice-stage-video-wrap {
    grid-row: 2;
  }

  .voice-stage.has-stream.mode-grid .voice-peer-ava,
  .voice-stage.has-stream.mode-stream .voice-peer-ava,
  .voice-stage.has-stream.mode-user .voice-peer-ava {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    font-size: 28px;
  }

  .voice-stage.has-stream.mode-user .voice-peer-name {
    font-size: 16px;
  }
}


/* ===== LaBerry patch: server search, textarea composer, safe markdown ===== */
.server-search-wrap {
  padding: 0 var(--space-md) var(--space-sm);
}

.server-search-input {
  width: 100%;
  min-height: 34px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  outline: none;
  font-size: 13px;
}

.server-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(176, 76, 255, 0.12);
}

.server-search-input::placeholder {
  color: var(--text-muted);
}

.composer .message-textarea,
textarea#message.inp {
  flex: 1;
  min-height: 40px;
  max-height: 180px;
  resize: none;
  overflow-y: auto;
  line-height: 1.35;
  font-family: inherit;
  white-space: pre-wrap;
}

.message .text,
.message .body,
.message .content {
  white-space: normal;
}

.msg-md {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: normal;
  white-space: normal;
}

.msg-md-p {
  margin: 0 0 8px;
  white-space: normal;
}

.msg-md-p:last-child,
.msg-md > :last-child {
  margin-bottom: 0;
}

.msg-md-h {
  margin: 4px 0 8px;
  font-weight: 800;
  line-height: 1.25;
}

.msg-md-h1 { font-size: 1.22em; }
.msg-md-h2 { font-size: 1.12em; }
.msg-md-h3 { font-size: 1.04em; }

.msg-md-list {
  margin: 4px 0 8px 1.35em;
  padding: 0;
}

.msg-md-list li {
  margin: 2px 0;
}

.msg-md-pre {
  position: relative;
  margin: 6px 0 10px;
  padding: 10px 12px;
  max-width: min(820px, 100%);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.34);
  white-space: pre;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.42;
}

.msg-md-pre[data-lang]::before {
  content: attr(data-lang);
  display: block;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.msg-md-code {
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.28);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: .92em;
}

.msg-md-quote {
  margin: 6px 0 10px;
  padding: 6px 10px;
  border-left: 3px solid var(--accent);
  color: var(--text-secondary);
  background: rgba(176, 76, 255, 0.08);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.msg-md-hr {
  margin: 10px 0;
  border: 0;
  border-top: 1px solid var(--border);
}


.msg-md-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  margin: 8px 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.18);
}

.msg-md-table {
  width: max-content;
  min-width: min(100%, 520px);
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.35;
}

.msg-md-table th,
.msg-md-table td {
  padding: 8px 10px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  white-space: normal;
  overflow-wrap: anywhere;
}

.msg-md-table th:last-child,
.msg-md-table td:last-child {
  border-right: 0;
}

.msg-md-table tr:last-child td {
  border-bottom: 0;
}

.msg-md-table th {
  color: var(--text);
  background: rgba(176, 76, 255, 0.10);
  font-weight: 900;
}

.msg-md-table td {
  color: var(--text-secondary);
}

.msg-md-table tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.025);
}

.msg-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.msg-attachment.media .file-row {
  display: none !important;
}


/* Link previews / external safety cards */
.message-link-embeds {
    display: grid;
    gap: 10px;
    margin-top: 10px;
    max-width: min(560px, 100%);
}

.link-embed {
    border: 1px solid var(--border);
    background: rgba(12, 17, 26, 0.72);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.18);
}

.link-embed-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 11px;
    border-bottom: 1px solid var(--border);
    min-width: 0;
}

.link-provider {
    font-weight: 800;
    color: var(--text);
    font-size: 13px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.link-embed-note {
    color: var(--muted);
    font-size: 12px;
    margin-right: auto;
}

.link-open-direct,
.link-card-open {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.link-open-direct:hover,
.link-card-open:hover {
    background: rgba(180, 75, 255, 0.14);
    text-decoration: none;
}

.link-frame-wrap {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #05070c;
}

.link-frame-wrap.drive {
    aspect-ratio: 4 / 3;
    max-height: 520px;
}

.link-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #05070c;
}

.link-video-summary {
    max-width: 420px;
}

.link-video-summary .link-thumb-wrap {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #080b12;
    overflow: hidden;
    text-decoration: none;
}

.link-thumb {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.link-play-badge {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 46px;
    height: 34px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    padding-left: 3px;
    color: #fff;
    background: rgba(176, 76, 255, 0.88);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.34);
    font-size: 16px;
    font-weight: 900;
}

.link-summary-card {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
}

.link-summary-card[data-provider="github"] {
    border-left: 3px solid #7c8cff;
}

.link-summary-card[data-provider="github"] .link-card-mark {
    color: #d8ddff;
    background: rgba(124, 140, 255, 0.13);
    border-color: rgba(124, 140, 255, 0.28);
    font-size: 11px;
}

.link-warning-card {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
    border-left: 3px solid #ffcc66;
}

.link-card-mark {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-weight: 900;
    color: #ffcc66;
    background: rgba(255, 204, 102, 0.11);
    border: 1px solid rgba(255, 204, 102, 0.24);
}

.link-card-main {
    min-width: 0;
}

.link-card-provider {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 3px;
}

.link-card-title {
    color: var(--text);
    font-weight: 900;
    margin-bottom: 4px;
}

.link-card-url {
    color: var(--accent);
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.link-card-hint {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
    margin-top: 6px;
}

.link-card-actions {
    margin-top: 10px;
}

.msg-attachment img.att-img.is-broken {
    min-width: 220px;
    min-height: 120px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px dashed var(--border);
}

.msg-md-safe-plain {
  max-width: min(920px, 100%);
}

.msg-md-plain {
  margin: 4px 0 0;
  padding: 8px 10px;
  max-width: 100%;
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  font: inherit;
  line-height: 1.42;
}

.msg-md-note {
  margin: 4px 0 6px;
  padding: 5px 8px;
  width: fit-content;
  max-width: 100%;
  border: 1px solid rgba(176, 76, 255, 0.35);
  border-radius: 999px;
  background: rgba(176, 76, 255, 0.10);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.25;
}

/* Targeted media/markdown hardening */
.att-preview-image .att-broken-label {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.62);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
}

.msg-md-safe-plain .msg-md-note {
  margin-bottom: 6px;
}


.msg-attachment.is-thumb-only .att-preview {
  border-style: dashed;
  border-color: rgba(245, 199, 77, 0.42);
}

.att-preview-image .att-thumb-only-label {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(245, 199, 77, 0.40);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.70);
  color: #ffe59a;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  z-index: 3;
}

.att-dl.is-disabled,
.av-icon.is-disabled {
  opacity: 0.38 !important;
  cursor: not-allowed !important;
  pointer-events: auto;
}

.att-dl.is-disabled svg,
.av-icon.is-disabled svg {
  opacity: 0.75;
}

/* Safe avatar fallback when profile/avatar file is missing */
.avatar .avatar-fallback,
.pin-avatar .avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-weight: 800;
}

.profile-avatar .profile-avatar-fallback {
  width: 100%;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  font-weight: 900;
}

.att-preview-image .att-thumb-only-label,
.att-preview-image .att-broken-label {
  pointer-events: none;
}


/* Markdown file composer */
.md-attach-btn { width: 40px; height: 40px; border: 1px solid var(--border); background: rgba(176, 76, 255, 0.08); color: var(--accent); border-radius: var(--radius-md); font-weight: 900; font-size: 12px; letter-spacing: .02em; }
.md-attach-btn:hover { background: rgba(176, 76, 255, 0.16); border-color: rgba(176, 76, 255, 0.38); }
.composer-emoji-btn,
.gif-btn { width: 40px; height: 40px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.025); color: var(--text); border-radius: var(--radius-md); font-weight: 900; font-size: 13px; }
.composer-emoji-btn,
.react-add,
.dm-home-ic,
.voice-ic,
.voice-view-ic,
.topbar .icon-btn.mobile-only {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", system-ui, sans-serif;
  line-height: 1;
}
.composer-emoji-btn:hover,
.gif-btn:hover { background: rgba(176, 76, 255, 0.13); border-color: rgba(176, 76, 255, 0.34); }
.gif-btn { color: var(--accent); letter-spacing: .02em; }
.md-file-modal { position: fixed; inset: 0; z-index: 1600; display: grid; place-items: center; padding: 18px; background: rgba(0, 0, 0, 0.62); backdrop-filter: blur(7px); }
.md-file-modal.hidden { display: none; }
.md-file-dialog { width: min(760px, 100%); max-height: min(780px, calc(100vh - 36px)); display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 18px; background: rgba(14, 18, 27, 0.98); box-shadow: 0 24px 80px rgba(0, 0, 0, 0.48); overflow: hidden; }
.md-file-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.md-file-title { color: var(--text); font-size: 18px; font-weight: 900; }
.md-file-sub { margin-top: 3px; color: var(--muted); font-size: 12px; }
.md-help-btn { margin-left: auto; width: 34px; height: 34px; border-radius: 12px; border: 1px solid rgba(176, 76, 255, 0.35); background: rgba(176, 76, 255, 0.10); color: var(--text); cursor: pointer; font-weight: 900; }
.md-help-btn:hover { background: rgba(176, 76, 255, 0.18); }
.md-file-x { width: 34px; height: 34px; border-radius: 12px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.04); color: var(--text); cursor: pointer; }
.md-file-x:hover { background: rgba(255, 255, 255, 0.08); }
.md-file-body { display: grid; gap: 8px; padding: 16px 18px; min-height: 0; }
.md-help-panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 12px; border: 1px solid rgba(176, 76, 255, 0.24); border-radius: 12px; background: rgba(176, 76, 255, 0.07); color: var(--text-secondary); font-size: 12px; line-height: 1.35; }
.md-help-panel[hidden] { display: none; }
.md-help-panel b { color: var(--text); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.md-file-label { color: var(--text-secondary); font-size: 12px; font-weight: 800; }
.md-file-name, .md-file-text { width: 100%; border: 1px solid var(--border); border-radius: 12px; background: rgba(0, 0, 0, 0.22); color: var(--text); outline: none; }
.md-file-name { height: 38px; padding: 0 12px; }
.md-file-text { min-height: 300px; max-height: min(520px, 48vh); padding: 12px; resize: vertical; white-space: pre; overflow: auto; font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.md-file-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px 16px; border-top: 1px solid var(--border); }
.msg-attachment.text-doc { width: min(720px, 100%); }
.att-text-toggle, .att-archive { flex: 0 0 auto; min-height: 30px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.045); color: var(--accent); font-size: 12px; font-weight: 900; cursor: pointer; }
.att-text-toggle:hover, .att-archive:hover { background: rgba(176, 76, 255, 0.12); border-color: rgba(176, 76, 255, 0.35); }
.text-attachment-preview { margin-top: 8px; border: 1px solid var(--border); border-radius: 14px; background: rgba(0, 0, 0, 0.22); overflow: hidden; }
.text-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; border-bottom: 1px solid var(--border); color: var(--text-secondary); font-size: 12px; font-weight: 800; }
.text-preview-head span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.text-preview-body { margin: 0; padding: 11px 12px; max-height: 560px; overflow: auto; color: var(--text); white-space: normal; word-break: break-word; overflow-wrap: anywhere; font: inherit; line-height: 1.45; }
.text-preview-body.is-plain { white-space: pre-wrap; font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.text-preview-body.is-plain-wrap { padding: 0; }
.text-preview-body.is-markdown { padding: 12px; }
.text-preview-body.is-markdown .msg-md { max-width: 100%; }
.text-attachment-preview.markdown-open { max-width: min(920px, 100%); }
.msg-md-open-full { margin-top: 8px; padding: 7px 10px; border-radius: 10px; border: 1px solid rgba(176, 76, 255, 0.35); background: rgba(176, 76, 255, 0.10); color: var(--text-secondary); font-weight: 800; font-size: 12px; cursor: pointer; }
.msg-md-open-full:hover { background: rgba(176, 76, 255, 0.18); color: var(--text); }
.markdown-full-overlay { z-index: 2000; }
.markdown-full-dialog { width: min(1040px, calc(100vw - 28px)); max-height: min(86vh, 900px); display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 18px; background: var(--panel); box-shadow: 0 24px 80px rgba(0,0,0,.45); overflow: hidden; }
.markdown-full-head { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; padding:14px 16px; border-bottom:1px solid var(--border); background: rgba(255,255,255,.03); }
.markdown-full-title { font-size: 18px; font-weight: 900; color: var(--text); }
.markdown-full-sub { margin-top: 4px; color: var(--muted); font-size: 12px; }
.markdown-full-body { padding: 16px; overflow: auto; min-height: 0; }
.markdown-full-body .msg-md { max-width: 100%; }
.markdown-full-body .msg-md-pre { max-width: 100%; max-height: none; }
.text-preview-error { padding: 12px; color: var(--muted); font-size: 13px; }

/* Discord-like composer and media picker */
.composer {
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  background: rgba(0, 0, 0, 0.28);
}

.composer-row {
  min-height: 48px;
  padding: 0 8px;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
}

.composer-row .icon-btn,
.composer-row .attach-btn,
.composer-row .composer-emoji-btn,
.composer-row .gif-btn,
.composer-row .md-attach-btn {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  box-shadow: none;
}

.composer-row .icon-btn:hover,
.composer-row .attach-btn:hover,
.composer-row .composer-emoji-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.composer .message-textarea {
  min-height: 42px;
  padding: 12px 6px 10px;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.composer .message-textarea:focus {
  border-color: transparent !important;
  box-shadow: none !important;
}

#sendBtn {
  display: none;
}

body.show-send-button #sendBtn {
  display: inline-flex;
}

.discord-picker.gif-picker {
  width: min(500px, calc(100vw - 20px));
  gap: 8px;
  padding: 8px;
  border-radius: 10px;
  background: rgba(31, 31, 36, 0.98);
}

.discord-picker .discord-picker-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  gap: 8px;
}

.discord-picker .composer-picker-tabs {
  display: flex;
  gap: 6px;
}

.discord-picker .composer-picker-tabs button {
  min-height: 30px;
  padding: 0 13px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
}

.discord-picker .composer-picker-tabs button.active {
  background: rgba(255, 255, 255, 0.10);
  border-color: transparent;
}

.gif-search-row {
  display: block;
}

.gif-search-input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.20);
  color: var(--text);
  outline: none;
}

.gif-search-input:focus {
  border-color: rgba(176, 76, 255, 0.38);
}

.gif-category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding-top: 6px;
}

.gif-category-card {
  position: relative;
  min-height: 108px;
  border: 0;
  border-radius: 5px;
  overflow: hidden;
  color: white;
  cursor: pointer;
  background: linear-gradient(135deg, rgba(125, 92, 255, 0.86), rgba(70, 58, 148, 0.78));
}

.gif-category-card.popular {
  background: linear-gradient(135deg, rgba(214, 156, 60, 0.82), rgba(80, 58, 24, 0.78));
}

.gif-category-card.calm {
  background: linear-gradient(135deg, rgba(96, 170, 255, 0.74), rgba(39, 57, 116, 0.84));
}

.gif-category-card.mood {
  background: linear-gradient(135deg, rgba(215, 70, 150, 0.75), rgba(79, 35, 92, 0.86));
}

.gif-category-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.20);
}

.gif-category-card span {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  height: 100%;
  padding: 12px;
  font-weight: 900;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
}

.discord-picker .sticker-scope-tabs {
  grid-template-columns: 1fr 1fr;
}

.discord-picker .gif-grid {
  max-height: 320px;
}

.discord-picker .gif-thumb img {
  object-fit: cover;
}
@media (max-width: 700px) { .md-attach-btn, .gif-btn { width: 36px; height: 36px; font-size: 11px; } .md-file-actions { flex-direction: column; } }
@media (pointer: coarse), (max-width: 900px) {
  .composer-emoji-btn { display: none !important; }
}

/* ===== LaBerry patch: Add server hub + tablet header cleanup ===== */
#mobileChannelsBtn { display: none !important; }
.server-hub-overlay { z-index: 9998; }
.server-hub-modal {
  width: min(860px, 94vw);
  max-height: min(760px, 92vh);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.server-hub-head h2 { margin-bottom: 4px; }
.server-hub-tabs,
.server-hub-request-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.10);
}
.server-hub-tab,
.server-hub-subtab {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  border-radius: 12px;
  padding: 9px 12px;
  font-weight: 800;
  cursor: pointer;
}
.server-hub-tab.active,
.server-hub-subtab.active {
  color: var(--text);
  border-color: rgba(188, 85, 255, 0.55);
  background: rgba(188, 85, 255, 0.16);
}
.server-hub-body {
  padding: 14px;
  overflow: auto;
}
.server-hub-pane { display: none; }
.server-hub-pane.active { display: block; }
.form-label {
  display: block;
  margin: 0 0 8px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 800;
}
.form-label.small { margin-top: 12px; }
.server-visibility-pick {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.server-vis-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 112px;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  background: rgba(255,255,255,0.035);
  cursor: pointer;
}
.server-vis-card.active {
  border-color: rgba(188, 85, 255, 0.62);
  background: rgba(188, 85, 255, 0.14);
  box-shadow: 0 0 0 1px rgba(188, 85, 255, 0.18) inset;
}
.server-vis-card input { display: none; }
.server-vis-title { font-weight: 900; }
.server-vis-desc { color: var(--text-secondary); font-size: 13px; line-height: 1.35; }
.server-hub-actions { display: flex; justify-content: flex-end; margin-top: 14px; }
.server-search-line { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.server-hub-results { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.server-hub-empty {
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 18px;
  color: var(--text-secondary);
  text-align: center;
}
.server-hub-empty.bad { color: #ff8b8b; border-color: rgba(255, 80, 80, 0.35); }
.server-discover-card {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255,255,255,0.035);
}
.server-discover-card.is-requested { opacity: .72; }
.server-discover-avatar {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
}
.server-discover-main { min-width: 0; }
.server-discover-title { font-weight: 900; margin-bottom: 3px; }
.server-discover-meta { color: var(--text-secondary); font-size: 13px; }
.server-discover-desc { color: var(--text-muted); font-size: 12px; margin-top: 4px; }
.server-discover-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
@media (max-width: 620px) {
  .server-hub-modal { width: 96vw; }
  .server-visibility-pick { grid-template-columns: 1fr; }
  .server-search-line { grid-template-columns: 1fr; }
  .server-discover-card { grid-template-columns: 42px 1fr; }
  .server-discover-actions { grid-column: 1 / -1; justify-content: flex-start; }
}


/* LaBerry patch: server menu moved to channels header, drawers opaque */
.channel-server-menu-btn {
  min-width: 34px;
  font-weight: 800;
}
.item.server .server-menu-btn {
  display: none !important;
}
.panel.servers,
.panel.channels,
.panel.members,
.topbar {
  background: var(--panel) !important;
  opacity: 1 !important;
  backdrop-filter: none !important;
}
@media (max-width: 900px) {
  .panel.servers,
  .panel.channels,
  .panel.members {
    background: var(--panel) !important;
    opacity: 1 !important;
  }
}

/* LaBerry markdown collapse/full controls */
.text-preview-head { position: sticky; top: 0; z-index: 3; background: rgba(10, 14, 24, 0.96); backdrop-filter: blur(8px); }
.text-preview-actions { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
.text-preview-actions button {
  padding: 5px 9px;
  border-radius: 10px;
  border: 1px solid rgba(176, 76, 255, 0.34);
  background: rgba(176, 76, 255, 0.10);
  color: var(--text-secondary);
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
}
.text-preview-actions button:hover { background: rgba(176, 76, 255, 0.18); color: var(--text); }
.text-preview-collapse { border-color: rgba(255,255,255,.14) !important; background: rgba(255,255,255,.05) !important; }
.text-preview-body.is-markdown { max-height: min(72vh, 760px); }
.text-preview-body.is-markdown .msg-md-pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.markdown-full-body .msg-md-pre { white-space: pre-wrap; overflow-wrap: anywhere; }


/* LaBerry patch: opaque slide panels + click shield */
:root {
  --panel: #10151f;
  --panel-solid: #10151f;
}

.topbar,
.panel,
.panel.servers,
.panel.channels,
.panel.members,
.friends-view,
.friends-panel,
.friends-list,
.members-list,
.list {
  opacity: 1 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.topbar,
.panel.servers,
.panel.channels,
.panel.members {
  background: #10151f !important;
}

.panel.chat {
  background: #0d1118 !important;
}

.ui-overlay {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  top: 56px !important;
  bottom: 0 !important;
  z-index: 1500 !important;
  background: rgba(0, 0, 0, 0.76) !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

body.channels-open .ui-overlay,
body.servers-open .ui-overlay,
body.members-open .ui-overlay,
body.drawer-open .ui-overlay {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

body.channels-open,
body.servers-open,
body.members-open,
body.drawer-open {
  overflow: hidden;
}

@media (max-width: 900px), (pointer: coarse) {
  .panel.servers,
  .panel.channels,
  .panel.members {
    background: #10151f !important;
    opacity: 1 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    pointer-events: auto !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
  }

  .panel.servers {
    z-index: 1600 !important;
    box-shadow: 16px 0 50px rgba(0, 0, 0, 0.58) !important;
  }

  .panel.channels {
    z-index: 1620 !important;
    box-shadow: 16px 0 50px rgba(0, 0, 0, 0.58) !important;
  }

  .panel.members {
    z-index: 1640 !important;
    box-shadow: -16px 0 50px rgba(0, 0, 0, 0.58) !important;
  }

  .panel.servers:not(.show-servers),
  .panel.channels:not(.show-channels),
  .panel.members:not(.show-members) {
    pointer-events: none !important;
  }

  .panel.servers.show-servers,
  .panel.channels.show-channels,
  .panel.members.show-members {
    pointer-events: auto !important;
  }
}

.modal-overlay,
.pins-overlay,
.lb-menu-backdrop,
.server-hub-overlay,
.markdown-full-overlay,
.dm-call-overlay {
  pointer-events: auto !important;
}

.modal-overlay,
.pins-overlay,
.lb-menu-backdrop,
.server-hub-overlay,
.markdown-full-overlay {
  background: rgba(0, 0, 0, 0.78) !important;
}

.modal,
.pins-modal,
.lb-user-menu,
.server-hub-modal,
.markdown-full-dialog,
.dm-call-card {
  background: #10151f !important;
  opacity: 1 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* ===== LaBerry final fix: mobile drawers layering/clicks ===== */
@media (max-width: 900px), (pointer: coarse) {
  .layout {
    position: relative !important;
    overflow: hidden !important;
  }

  .topbar {
    position: relative !important;
    z-index: 2400 !important;
    background: #10151f !important;
  }

  .ui-overlay {
    position: fixed !important;
    inset: 56px 0 0 0 !important;
    z-index: 1800 !important;
    background: rgba(0, 0, 0, 0.72) !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transition: opacity .18s ease, visibility .18s ease !important;
  }

  body.channels-open .ui-overlay,
  body.servers-open .ui-overlay,
  body.members-open .ui-overlay,
  body.drawer-open .ui-overlay {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }

  .panel.servers,
  .panel.channels,
  .panel.members {
    position: fixed !important;
    top: 56px !important;
    bottom: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    display: flex !important;
    opacity: 1 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    background: #10151f !important;
    border-radius: 0 !important;
    border-color: rgba(255, 255, 255, 0.10) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    transition: transform .18s ease, visibility .18s ease !important;
  }

  .panel.servers,
  .panel.channels {
    left: 0 !important;
    right: auto !important;
    width: min(88vw, 360px) !important;
    z-index: 2100 !important;
    transform: translateX(-105%) !important;
    box-shadow: 18px 0 54px rgba(0, 0, 0, .62) !important;
  }

  .panel.members {
    right: 0 !important;
    left: auto !important;
    width: min(88vw, 360px) !important;
    z-index: 2120 !important;
    transform: translateX(105%) !important;
    box-shadow: -18px 0 54px rgba(0, 0, 0, .62) !important;
  }

  .panel.servers.show-servers,
  .panel.channels.show-channels,
  .panel.members.show-members {
    visibility: visible !important;
    transform: translateX(0) !important;
    pointer-events: auto !important;
  }

  .panel.chat {
    position: relative !important;
    z-index: 1 !important;
    width: 100% !important;
    min-width: 0 !important;
    background: #0d1118 !important;
  }

  .panel.servers *,
  .panel.channels *,
  .panel.members * {
    pointer-events: auto;
  }

  body.drawer-open .panel.chat,
  body.channels-open .panel.chat,
  body.servers-open .panel.chat,
  body.members-open .panel.chat {
    pointer-events: none !important;
  }
}

/* ===== LaBerry fix: stable mobile slide drawers ===== */
@media (max-width: 900px), (pointer: coarse) {
  .layout {
    position: relative !important;
    overflow: hidden !important;
    padding: 0 !important;
    gap: 0 !important;
  }

  .ui-overlay {
    position: fixed !important;
    inset: 56px 0 0 0 !important;
    z-index: 1800 !important;
    display: block !important;
    background: rgba(0, 0, 0, 0.72) !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transition: opacity 0.18s ease, visibility 0.18s ease !important;
  }

  body.channels-open .ui-overlay,
  body.servers-open .ui-overlay,
  body.members-open .ui-overlay,
  body.drawer-open .ui-overlay {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }

  .panel.servers,
  .panel.channels,
  .panel.members {
    position: fixed !important;
    top: 56px !important;
    bottom: 0 !important;
    height: auto !important;
    max-height: calc(100dvh - 56px) !important;
    display: flex !important;
    visibility: hidden !important;
    opacity: 1 !important;
    pointer-events: none !important;
    background: #10151f !important;
    border-radius: 0 !important;
    border-top: 0 !important;
    transition: transform 0.18s ease, visibility 0.18s ease !important;
    will-change: transform !important;
  }

  .panel.servers,
  .panel.channels {
    left: 0 !important;
    right: auto !important;
    width: min(88vw, 360px) !important;
    transform: translate3d(-105%, 0, 0) !important;
    box-shadow: 18px 0 54px rgba(0, 0, 0, 0.62) !important;
  }

  .panel.members {
    right: 0 !important;
    left: auto !important;
    width: min(88vw, 360px) !important;
    transform: translate3d(105%, 0, 0) !important;
    box-shadow: -18px 0 54px rgba(0, 0, 0, 0.62) !important;
  }

  .panel.servers { z-index: 2100 !important; }
  .panel.channels { z-index: 2110 !important; }
  .panel.members { z-index: 2120 !important; }

  .panel.servers.show-servers,
  .panel.channels.show-channels,
  .panel.members.show-members {
    visibility: visible !important;
    transform: translate3d(0, 0, 0) !important;
    pointer-events: auto !important;
  }

  .panel.chat {
    width: 100% !important;
    min-width: 0 !important;
    position: relative !important;
    z-index: 1 !important;
  }

  body.channels-open .panel.chat,
  body.servers-open .panel.chat,
  body.members-open .panel.chat,
  body.drawer-open .panel.chat {
    pointer-events: none !important;
  }

  body.channels-open,
  body.servers-open,
  body.members-open,
  body.drawer-open {
    overflow: hidden !important;
  }
}


/* ===== LaBerry fix v2: mobile server drawer must be a compact rail ===== */
@media (max-width: 900px), (pointer: coarse) {
  .panel.servers {
    left: 0 !important;
    right: auto !important;
    width: 78px !important;
    min-width: 78px !important;
    max-width: 78px !important;
    z-index: 2130 !important;
    transform: translate3d(-105%, 0, 0) !important;
    box-shadow: 14px 0 38px rgba(0, 0, 0, 0.62) !important;
    overflow: hidden !important;
  }

  .panel.servers.show-servers {
    visibility: visible !important;
    transform: translate3d(0, 0, 0) !important;
    pointer-events: auto !important;
  }

  .panel.servers .panelHeader {
    height: 56px !important;
    padding: 8px !important;
    justify-content: center !important;
    align-items: center !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  }

  .panel.servers .panelHeader h3,
  .panel.servers .item .text,
  .panel.servers .userinfo {
    display: none !important;
  }

  .panel.servers #addServerBtn {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    padding: 0 !important;
    border-radius: 15px !important;
    font-size: 20px !important;
  }

  .panel.servers .list {
    padding: 10px 8px !important;
    overflow-x: hidden !important;
  }

  .panel.servers .item.server,
  .panel.servers .friends-button.item {
    width: 52px !important;
    height: 52px !important;
    min-height: 52px !important;
    margin: 0 auto 10px !important;
    padding: 0 !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 0 !important;
    border: 0 !important;
    border-radius: 18px !important;
    background: rgba(255, 255, 255, 0.045) !important;
  }

  .panel.servers .item.server.active,
  .panel.servers .friends-button.item.active {
    background: rgba(176, 76, 255, 0.24) !important;
    box-shadow: inset 4px 0 0 var(--accent), 0 0 0 1px rgba(176, 76, 255, 0.22) !important;
  }

  .panel.servers .item.server:hover,
  .panel.servers .friends-button.item:hover {
    background: rgba(176, 76, 255, 0.18) !important;
  }

  .panel.servers .item.server .avatar {
    width: 40px !important;
    height: 40px !important;
    font-size: 15px !important;
  }

  .panel.servers .friends-button.item::before {
    content: "👥";
    display: inline-flex;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
  }

  .panel.servers .userbar {
    padding: 10px 8px calc(10px + env(safe-area-inset-bottom, 0px)) !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 8px !important;
    background: rgba(0, 0, 0, 0.22) !important;
  }

  .panel.servers .userbar .avatar {
    width: 42px !important;
    height: 42px !important;
  }

  .panel.servers .userbar .icon-btn {
    width: 38px !important;
    height: 32px !important;
    justify-content: center !important;
  }

  .panel.servers .voicebar {
    display: none !important;
  }

  .panel.channels {
    left: 0 !important;
    right: auto !important;
    width: min(88vw, 360px) !important;
    z-index: 2110 !important;
    transform: translate3d(-105%, 0, 0) !important;
  }

  .panel.channels.show-channels {
    visibility: visible !important;
    transform: translate3d(0, 0, 0) !important;
    pointer-events: auto !important;
  }
}


/* ===== LaBerry fix v3: mobile servers drawer keeps desktop names ===== */
@media (max-width: 900px), (pointer: coarse) {
  .panel.servers {
    left: 0 !important;
    right: auto !important;
    width: min(82vw, 280px) !important;
    min-width: 0 !important;
    max-width: 280px !important;
    z-index: 2130 !important;
    transform: translate3d(-105%, 0, 0) !important;
    box-shadow: 16px 0 46px rgba(0, 0, 0, 0.62) !important;
    overflow: hidden !important;
  }

  .panel.servers.show-servers {
    visibility: visible !important;
    transform: translate3d(0, 0, 0) !important;
    pointer-events: auto !important;
  }

  .panel.servers .panelHeader {
    height: auto !important;
    min-height: 56px !important;
    padding: 14px 16px !important;
    justify-content: space-between !important;
    align-items: center !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  }

  .panel.servers .panelHeader h3 {
    display: block !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    letter-spacing: 0.5px !important;
    color: var(--text) !important;
    white-space: nowrap !important;
  }

  .panel.servers #addServerBtn {
    width: auto !important;
    height: 32px !important;
    min-width: 32px !important;
    padding: 0 10px !important;
    border-radius: 10px !important;
    font-size: 16px !important;
  }

  .panel.servers .list {
    padding: 12px 10px !important;
    overflow-x: hidden !important;
  }

  .panel.servers .item.server,
  .panel.servers .friends-button.item {
    width: auto !important;
    height: auto !important;
    min-height: 56px !important;
    margin: 0 0 8px !important;
    padding: 10px 12px !important;
    justify-content: flex-start !important;
    align-items: center !important;
    gap: 10px !important;
    border-radius: 12px !important;
    border: 1px solid transparent !important;
    background: transparent !important;
  }

  .panel.servers .item.server.active,
  .panel.servers .friends-button.item.active {
    background: rgba(176, 76, 255, 0.20) !important;
    border-color: rgba(176, 76, 255, 0.22) !important;
    box-shadow: inset 3px 0 0 var(--accent) !important;
  }

  .panel.servers .item.server:hover,
  .panel.servers .friends-button.item:hover {
    background: rgba(176, 76, 255, 0.14) !important;
  }

  .panel.servers .item.server .avatar,
  .panel.servers .friends-button.item .avatar {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    font-size: 15px !important;
    flex: 0 0 auto !important;
  }

  .panel.servers .item .text,
  .panel.servers .userinfo {
    display: block !important;
  }

  .panel.servers .item .text {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  .panel.servers .item .title,
  .panel.servers .item .sub,
  .panel.servers .item .sub-row {
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .panel.servers .friends-button.item::before {
    content: none !important;
    display: none !important;
  }

  .panel.servers .userbar {
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px)) !important;
    flex-direction: row !important;
    justify-content: flex-start !important;
    align-items: center !important;
    gap: 10px !important;
    background: rgba(0, 0, 0, 0.22) !important;
  }

  .panel.servers .userbar .avatar {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
  }

  .panel.servers .userbar .userinfo {
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }

  .panel.servers .userbar .icon-btn {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    justify-content: center !important;
    flex: 0 0 auto !important;
  }
}

/* ===== LaBerry fix v4-assets: settings modal above mobile topbar ===== */
#settingsOverlay.modal-overlay {
  z-index: 5000 !important;
}

#settingsOverlay .settings-modal {
  position: relative !important;
  z-index: 5001 !important;
}

@media (max-width: 600px), (pointer: coarse) {
  #settingsOverlay.modal-overlay {
    inset: 0 !important;
    padding: 0 !important;
    align-items: stretch !important;
    justify-content: stretch !important;
  }

  #settingsOverlay .settings-modal {
    width: 100vw !important;
    height: 100dvh !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
    border-left: 0 !important;
    border-right: 0 !important;
    border-top: 0 !important;
    border-bottom: 0 !important;
  }

  #settingsOverlay .settings-content {
    min-width: 0 !important;
    width: 100% !important;
  }

  #settingsOverlay .settings-topbar {
    display: flex !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 4 !important;
    background: #10151f !important;
    padding: 12px 14px !important;
  }

  #settingsOverlay .settings-sections-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 36px !important;
  }

  #settingsOverlay .settings-close {
    flex: 0 0 auto !important;
  }

  #settingsOverlay .settings-body {
    padding: 14px !important;
  }
}


/* ===== LaBerry fix v6: settings rows inline + help popover ===== */
.settings-card h4 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 800;
}

.setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
}

.setting-row-range {
  grid-template-columns: minmax(0, 1fr) minmax(160px, 220px);
  align-items: center;
}

.setting-copy {
  min-width: 0;
}

.setting-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.setting-title {
  min-width: 0;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.setting-desc {
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.3;
  color: var(--text-secondary);
}

.setting-help {
  width: 18px;
  height: 18px;
  min-width: 18px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.setting-help:hover {
  color: var(--text);
  background: rgba(176, 76, 255, 0.14);
  border-color: rgba(176, 76, 255, 0.32);
}

.setting-help-popover {
  position: fixed;
  z-index: 4000;
  width: min(280px, calc(100vw - 24px));
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: #111722;
  box-shadow: 0 18px 44px rgba(0,0,0,0.42);
}

.setting-help-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}

.setting-help-text {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-secondary);
  white-space: normal;
}

.setting-help-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  cursor: pointer;
}

.setting-help-close:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text);
}

.switch {
  flex: 0 0 auto;
}

.range-wrap {
  width: min(220px, 42vw);
  min-width: 160px;
  flex: 0 0 auto;
}

.range-wrap input[type=range] {
  width: 100%;
}

@media (max-width: 600px) {
  .settings-body {
    padding: 14px;
  }

  .settings-card {
    padding: 14px;
    margin-bottom: 14px;
  }

  .setting-row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
  }

  .setting-row-range {
    grid-template-columns: minmax(0, 1fr) minmax(150px, 170px);
  }

  .setting-title {
    font-size: 13px;
  }

  .setting-desc {
    font-size: 11px;
    display: none;
  }

  .range-wrap {
    width: 170px;
    min-width: 150px;
  }
}


/* ===== LaBerry fix v7: settings help layers + save toast ===== */
#settingsOverlay .settings-modal {
  position: relative !important;
  isolation: isolate !important;
}

#settingsOverlay.hidden .setting-help-popover,
#settingsOverlay.hidden .settings-save-toast {
  display: none !important;
}

#settingsOverlay .setting-help-popover {
  z-index: 20 !important;
  pointer-events: auto !important;
}

#settingsOverlay .setting-help-close {
  pointer-events: auto !important;
}

.settings-save-toast {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%) translateY(10px) scale(0.98);
  z-index: 30;
  min-height: 36px;
  max-width: calc(100% - 28px);
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(16, 21, 31, 0.96);
  color: rgba(255,255,255,0.92);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.42), inset 0 0 0 1px rgba(176, 76, 255, 0.10);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

.settings-save-toast.ok {
  border-color: rgba(63, 185, 80, 0.34);
}

.settings-save-toast.err {
  border-color: rgba(248, 81, 73, 0.36);
  color: #ffb4b0;
}

.settings-save-toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

.settings-save-toast.is-hide {
  opacity: 0;
  transform: translateX(-50%) translateY(8px) scale(0.98);
}

@media (max-width: 600px), (pointer: coarse) {
  .settings-save-toast {
    bottom: max(18px, env(safe-area-inset-bottom, 0px));
  }
}

/* ===== LaBerry email verification UI ===== */
.email-verify-state {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.035);
  margin-bottom: 12px;
}

.email-verify-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-top: 5px;
  background: var(--text-secondary);
  box-shadow: 0 0 0 4px rgba(255,255,255,0.04);
}

.email-verify-state.verified {
  border-color: rgba(63,185,80,0.28);
  background: rgba(63,185,80,0.07);
}

.email-verify-state.verified .email-verify-dot {
  background: var(--online);
  box-shadow: 0 0 0 4px rgba(63,185,80,0.12);
}

.email-verify-state.pending {
  border-color: rgba(240,136,62,0.30);
  background: rgba(240,136,62,0.07);
}

.email-verify-state.pending .email-verify-dot {
  background: var(--idle);
  box-shadow: 0 0 0 4px rgba(240,136,62,0.12);
}

.email-verify-state.unverified {
  border-color: rgba(248,81,73,0.25);
  background: rgba(248,81,73,0.06);
}

.email-verify-state.unverified .email-verify-dot {
  background: var(--dnd);
  box-shadow: 0 0 0 4px rgba(248,81,73,0.11);
}

.email-verify-main {
  min-width: 0;
}

.email-verify-title {
  font-weight: 900;
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-verify-desc {
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-secondary);
}

.email-code-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.email-code-msg {
  min-width: 0;
  flex: 1 1 180px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-secondary);
}

.email-code-msg.ok { color: var(--online); }
.email-code-msg.err { color: #ff8b8b; }

.email-code-confirm {
  display: none;
  grid-template-columns: minmax(0, 180px) auto;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.email-code-confirm.is-visible {
  display: grid;
}

@media (max-width: 600px) {
  .email-code-confirm {
    grid-template-columns: 1fr;
  }

  .email-code-actions .btn,
  .email-code-confirm .btn {
    width: 100%;
  }
}

/* ===== Profile details + device sessions ===== */
.dm-call-float {
  position: fixed;
  z-index: 2500;
  width: min(320px, calc(100vw - 28px));
  min-height: 74px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: 12px;
  background: rgba(18, 22, 31, 0.94);
  box-shadow: 0 18px 48px rgba(0,0,0,0.42), inset 0 1px 0 rgba(255,255,255,0.08);
  backdrop-filter: blur(16px);
  color: var(--text);
  user-select: none;
  touch-action: none;
}

.dm-call-float[hidden] {
  display: none !important;
}

.dm-call-float.corner-tl { left: 18px; top: 72px; }
.dm-call-float.corner-tr { right: 18px; top: 72px; }
.dm-call-float.corner-bl { left: 18px; bottom: 18px; }
.dm-call-float.corner-br { right: 18px; bottom: 18px; }

.dm-call-float.is-dragging {
  opacity: 0.9;
  cursor: grabbing;
  transition: none;
}

.dm-call-float-grip {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: grab;
}

.dm-call-float-avatar {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  font-weight: 900;
  font-size: 18px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.16);
}

.dm-call-float-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.dm-call-float-name,
.dm-call-float-status {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dm-call-float-name {
  font-weight: 900;
  font-size: 14px;
}

.dm-call-float-status {
  color: var(--text-secondary);
  font-size: 12px;
}

.dm-call-float-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

@media (max-width: 700px) {
  .dm-call-float {
    width: min(300px, calc(100vw - 20px));
  }
  .dm-call-float.corner-tl { left: 10px; top: 64px; }
  .dm-call-float.corner-tr { right: 10px; top: 64px; }
  .dm-call-float.corner-bl { left: 10px; bottom: 10px; }
  .dm-call-float.corner-br { right: 10px; bottom: 10px; }
}

.lb-notify-stack {
  position: fixed;
  z-index: 2600;
  right: max(18px, env(safe-area-inset-right));
  top: max(72px, env(safe-area-inset-top));
  width: min(360px, calc(100vw - 28px));
  display: grid;
  gap: 10px;
  pointer-events: none;
}

.lb-notify-card {
  pointer-events: auto;
  width: 100%;
  min-height: 72px;
  display: grid;
  grid-template-columns: 5px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  padding: 12px 14px 12px 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(18, 22, 31, 0.94);
  color: var(--text);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42), 0 1px 0 rgba(255, 255, 255, 0.08) inset;
  backdrop-filter: blur(16px);
  text-align: left;
  cursor: pointer;
  animation: lbNotifyIn 0.18s ease-out;
}

/* Cookie consent / trust review gate */
.cookie-consent-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, .72);
  backdrop-filter: blur(12px);
}

.cookie-consent-card {
  width: min(560px, calc(100vw - 28px));
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 18px;
  background: #121723;
  color: var(--text, #f4f0ff);
  padding: 24px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .48);
}

.cookie-consent-kicker {
  color: #cf53ff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.cookie-consent-card h2 {
  margin: 0 0 12px;
  font-size: 24px;
  line-height: 1.1;
}

.cookie-consent-card p {
  margin: 0 0 10px;
  color: var(--muted, #b8b0c7);
  line-height: 1.55;
}

.cookie-consent-link {
  display: inline-flex;
  margin: 6px 0 14px;
  color: #d66bff;
  text-decoration: none;
  border-bottom: 1px solid rgba(214, 107, 255, .45);
}

.cookie-consent-warning {
  border: 1px solid rgba(255, 190, 88, .26);
  border-radius: 14px;
  background: rgba(255, 190, 88, .08);
  color: #ffe3b0;
  padding: 12px 14px;
  line-height: 1.45;
}

.cookie-consent-actions {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 10px;
  margin-top: 16px;
}

.cookie-consent-actions .btn {
  width: 100%;
}

@media (max-width: 560px) {
  .cookie-consent-card {
    padding: 18px;
    border-radius: 16px;
  }

  .cookie-consent-actions {
    grid-template-columns: 1fr;
  }
}

.lb-notify-card.is-leaving {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.lb-notify-accent {
  width: 5px;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
}

.lb-notify-card.is-call .lb-notify-accent {
  background: linear-gradient(180deg, #58f287, var(--accent));
}

.lb-notify-main {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 3px;
}

.lb-notify-title,
.lb-notify-body {
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-notify-title {
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
}

.lb-notify-body {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

@keyframes lbNotifyIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 700px) {
  .lb-notify-stack {
    left: 14px;
    right: 14px;
    top: max(62px, env(safe-area-inset-top));
    width: auto;
  }
}

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.profile-chip,
.session-chip {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(176,76,255,0.16);
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.session-chip.muted-chip {
  background: rgba(255,255,255,0.08);
  color: var(--text-secondary);
}

.profile-presence {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.profile-presence::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-secondary);
}

.profile-presence.status-online::before { background: var(--online); }
.profile-presence.status-idle::before { background: var(--idle); }
.profile-presence.status-dnd::before { background: var(--dnd); }
.profile-presence.status-offline::before { background: var(--text-secondary); }

.profile-id,
.profile-joined {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.profile-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,0.025);
  padding: 12px;
  min-width: 0;
}

.profile-text.empty {
  color: var(--text-secondary);
}

.profile-connections {
  display: grid;
  gap: 8px;
}

.profile-connection {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  background: rgba(255,255,255,0.035);
  color: var(--text);
  text-decoration: none;
}

.profile-connection:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(176,76,255,0.28);
}

.profile-connection-kind {
  width: 42px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(176,76,255,0.16);
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 900;
}

.profile-connection-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.profile-connection-label,
.profile-connection-url {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-connection-label {
  font-size: 13px;
  font-weight: 800;
}

.profile-connection-url {
  color: var(--text-secondary);
  font-size: 12px;
}

.dm-profile-panel {
  display: grid;
  gap: 12px;
  padding: 12px 10px 18px;
  min-width: 0;
}

.dm-profile-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 4px 2px 8px;
}

.dm-profile-avatar {
  width: 68px;
  height: 68px;
  flex: 0 0 68px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  font-size: 26px;
  font-weight: 900;
  border: 0;
  cursor: pointer;
  padding: 0;
}

.dm-profile-avatar .avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.dm-profile-avatar:hover {
  box-shadow: 0 0 0 2px rgba(176,76,255,0.42), 0 10px 24px rgba(0,0,0,0.28);
}

.dm-profile-meta {
  min-width: 0;
}

.dm-profile-name,
.dm-profile-username {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dm-profile-name {
  font-size: 17px;
  font-weight: 900;
  color: var(--text);
}

.dm-profile-username {
  color: var(--text-secondary);
  font-size: 12px;
}

.dm-profile-panel .profile-card {
  padding: 11px;
  min-width: 0;
}

.dm-profile-panel .profile-label {
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.dm-profile-open {
  width: 100%;
}

.dm-profile-panel .profile-text,
.dm-profile-panel .profile-connection-label,
.dm-profile-panel .profile-connection-url {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 700px), (pointer: coarse) {
  .dm-profile-panel {
    padding: 12px 10px 20px;
  }

  .dm-profile-head {
    align-items: flex-start;
    gap: 10px;
  }

  .dm-profile-avatar {
    width: 56px;
    height: 56px;
    flex-basis: 56px;
    border-radius: 16px;
    font-size: 22px;
  }

  .dm-profile-name {
    font-size: 16px;
  }
}

.session-list {
  display: grid;
  gap: 8px;
}

.session-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  background: rgba(255,255,255,0.035);
}

.session-item.current {
  border-color: rgba(63,185,80,0.34);
  background: rgba(63,185,80,0.06);
}

.session-item.revoked {
  opacity: 0.62;
}

.session-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  font-size: 12px;
}

.session-item.current .session-icon {
  color: var(--online);
}

.session-main {
  min-width: 0;
}

.session-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.session-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 900;
  font-size: 13px;
}

.session-meta {
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.3;
}

@media (max-width: 600px) {
  .session-item {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .session-revoke {
    grid-column: 1 / -1;
    width: 100%;
  }
}


/* ===== LaBerry start-page prompt ===== */
.start-page-title,
.brand-start-trigger {
  cursor: pointer;
  user-select: none;
  transition: color 0.16s ease, text-shadow 0.16s ease, transform 0.16s ease;
}

.start-page-title:hover,
.start-page-title:focus-visible,
.brand-start-trigger:hover,
.brand-start-trigger:focus-visible {
  color: #ff8bc3;
  text-shadow: 0 0 24px rgba(255, 79, 163, 0.35);
  outline: none;
}

.brand-start-trigger:active,
.start-page-title:active {
  transform: translateY(1px);
}

.start-page-prompt-open {
  overflow: hidden;
}

.start-page-prompt-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(6, 4, 10, 0.68);
  backdrop-filter: blur(14px);
}

.start-page-prompt-overlay[hidden] {
  display: none;
}

.start-page-prompt {
  position: relative;
  width: min(460px, 100%);
  padding: 26px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 28px;
  color: var(--text, #fff7fb);
  background:
    radial-gradient(circle at 16% 0%, rgba(255, 79, 163, 0.25), transparent 36%),
    linear-gradient(145deg, rgba(35, 20, 45, 0.98), rgba(18, 9, 25, 0.98));
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
}

.start-page-prompt-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: inherit;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.start-page-prompt-close:hover,
.start-page-prompt-close:focus-visible {
  background: rgba(255, 255, 255, 0.11);
  outline: none;
}

.start-page-prompt-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  margin-bottom: 16px;
  padding: 0 12px;
  border-radius: 999px;
  color: #ffd5e9;
  background: rgba(255, 79, 163, 0.13);
  border: 1px solid rgba(255, 79, 163, 0.24);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.start-page-prompt h2 {
  margin: 0 34px 12px 0;
  font-size: clamp(1.5rem, 5vw, 2.15rem);
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.start-page-prompt p {
  margin: 0 0 22px;
  color: var(--muted, #cdbbd2);
  line-height: 1.6;
}

.start-page-prompt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.start-page-prompt-actions .btn {
  min-height: 42px;
}

.start-page-prompt-actions .btn-ghost {
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--text, #fff7fb);
  background: rgba(255, 255, 255, 0.06);
}

.start-page-prompt-actions .btn-ghost:hover,
.start-page-prompt-actions .btn-ghost:focus-visible {
  background: rgba(255, 255, 255, 0.11);
  outline: none;
}

@media (max-width: 520px) {
  .start-page-prompt {
    padding: 22px;
    border-radius: 22px;
  }

  .start-page-prompt-actions {
    flex-direction: column;
  }

  .start-page-prompt-actions .btn {
    width: 100%;
  }
}
