/* ============================================================
   BROS v2 — Design System
   Современный минимализм, тёплый dark mode
============================================================ */

:root {
  /* === Цветовая палитра === */

  /* Тёмные тёплые тона фона */
  --bg-base: #0a0a0c;
  --bg-elev-1: #111114;
  --bg-elev-2: #16161a;
  --bg-elev-3: #1c1c22;

  /* Полупрозрачные поверхности */
  --surface-1: rgba(255, 255, 255, 0.025);
  --surface-2: rgba(255, 255, 255, 0.05);
  --surface-3: rgba(255, 255, 255, 0.08);
  --surface-hover: rgba(255, 255, 255, 0.06);

  /* Границы */
  --border-1: rgba(255, 255, 255, 0.06);
  --border-2: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.14);
  --border-focus: rgba(232, 115, 43, 0.5);

  /* Текст */
  --text: #f5f5f7;
  --text-strong: #ffffff;
  --text-soft: rgba(245, 245, 247, 0.72);
  --text-muted: rgba(245, 245, 247, 0.5);
  --text-dim: rgba(245, 245, 247, 0.32);
  --text-faint: rgba(245, 245, 247, 0.16);

  /* Бренд */
  --accent: #e8732b;
  --accent-soft: #f5a268;
  --accent-bg: rgba(232, 115, 43, 0.1);
  --accent-glow: rgba(232, 115, 43, 0.2);
  --accent-glow-strong: rgba(232, 115, 43, 0.4);

  /* Статусы */
  --online: #6db474;
  --idle: #f5a268;
  --offline: rgba(245, 245, 247, 0.32);
  --danger: #e16d5c;

  /* Шрифты */
  --font-sans: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Радиусы */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-2xl: 24px;
  --r-full: 999px;

  /* Тени */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 0 1px var(--accent-glow), 0 12px 36px var(--accent-glow);

  /* Переходы */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 120ms var(--ease);
  --t-base: 200ms var(--ease);
  --t-slow: 360ms var(--ease-out);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body.v2 {
  height: 100%;
  background: var(--bg-base);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -0.008em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  outline: none;
}

input, textarea {
  font-family: inherit;
  color: inherit;
  outline: none;
}

a { color: inherit; text-decoration: none; }

.hidden { display: none !important; }

/* ============================================================
   ФОНОВЫЕ СЛОИ
============================================================ */

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 30%, var(--accent-bg), transparent 60%),
    radial-gradient(ellipse 70% 50% at 85% 75%, rgba(232, 115, 43, 0.06), transparent 60%);
}

.bg-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.015;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ============================================================
   КНОПКА "СКАЧАТЬ" в углу
============================================================ */

.download-pill {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-full);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--t-base);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.download-pill:hover {
  background: var(--surface-3);
  border-color: var(--border-2);
  color: var(--text);
}

.download-pill svg { opacity: 0.7; }

/* ============================================================
   ЭКРАН АВТОРИЗАЦИИ
============================================================ */

.auth-screen {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  z-index: 5;
}

/* Левая колонка — hero */
.auth-hero {
  padding: 64px 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background:
    radial-gradient(ellipse 600px 400px at 30% 50%, var(--accent-bg), transparent 60%),
    var(--bg-elev-1);
  position: relative;
  overflow: hidden;
}

.auth-hero::after {
  content: '';
  position: absolute;
  top: 0;
  right: -1px;
  bottom: 0;
  width: 1px;
  background: linear-gradient(180deg, transparent, var(--border-2), transparent);
}

.hero-content {
  max-width: 460px;
  animation: heroIn 0.7s var(--ease-out) both;
}

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

.hero-logo {
  width: 220px;
  height: 220px;
  margin-bottom: 48px;
  position: relative;
}

.hero-logo::before {
  content: '';
  position: absolute;
  inset: -10%;
  background: radial-gradient(circle, var(--accent-glow), transparent 65%);
  filter: blur(40px);
  z-index: -1;
}

.hero-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 8px 32px rgba(232, 115, 43, 0.35));
}

.hero-title {
  font-size: 48px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text-strong);
  margin-bottom: 16px;
}

.hero-accent {
  color: var(--accent);
  font-style: italic;
  font-weight: 600;
}

.hero-sub {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-muted);
  max-width: 360px;
}

/* Правая колонка — форма */
.auth-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
}

.auth-form-card {
  width: 100%;
  max-width: 420px;
  animation: formIn 0.7s 0.1s var(--ease-out) both;
}

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

.auth-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  margin-bottom: 32px;
}

.auth-tab {
  flex: 1;
  height: 40px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--r-sm);
  transition: all var(--t-base);
}

.auth-tab:hover { color: var(--text-soft); }

.auth-tab.active {
  background: var(--surface-3);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-form-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-strong);
  letter-spacing: -0.02em;
}

.auth-form-sub {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: -8px;
  margin-bottom: 4px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-field-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.auth-field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
}

.forgot-link {
  font-size: 12px;
  color: var(--text-muted);
  transition: color var(--t-fast);
}

.forgot-link:hover { color: var(--accent-soft); }

.auth-field input {
  height: 48px;
  padding: 0 16px;
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  font-size: 15px;
  color: var(--text);
  transition: all var(--t-base);
}

.auth-field input::placeholder { color: var(--text-dim); }

.auth-field input:hover {
  border-color: var(--border-2);
  background: var(--surface-2);
}

.auth-field input:focus {
  border-color: var(--border-focus);
  background: var(--surface-2);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.auth-hint {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: -2px;
}

.auth-submit {
  margin-top: 8px;
  height: 52px;
  background: var(--accent);
  color: #1a0a00;
  font-weight: 600;
  font-size: 15px;
  border-radius: var(--r-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--t-base);
  position: relative;
  overflow: hidden;
}

.auth-submit::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 30%, rgba(255, 255, 255, 0.18) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.auth-submit:hover::before { transform: translateX(100%); }
.auth-submit:hover {
  background: var(--accent-soft);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.auth-submit:active { transform: translateY(0); }
.auth-submit svg { transition: transform var(--t-base); }
.auth-submit:hover svg { transform: translateX(3px); }

.auth-fineprint {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
  margin-top: 4px;
}

.auth-error {
  min-height: 18px;
  font-size: 13px;
  color: var(--danger);
  text-align: center;
}

.back-link {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  transition: color var(--t-fast);
}

.back-link:hover { color: var(--text); }

/* ============================================================
   ОСНОВНОЙ ЛЕЙАУТ ПРИЛОЖЕНИЯ
============================================================ */

.app-layout {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: 76px 280px 1fr;
  z-index: 5;
}

/* === Узкий sidebar серверов === */
.server-rail {
  background: var(--bg-base);
  border-right: 1px solid var(--border-1);
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.server-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-soft);
  transition: all var(--t-base);
  position: relative;
  overflow: hidden;
}

.server-icon img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.server-icon:hover {
  background: var(--surface-3);
  border-radius: var(--r-lg);
  transform: translateY(-1px);
}

.server-icon.active {
  background: var(--accent-bg);
  color: var(--accent);
}

.server-icon.active::before {
  content: '';
  position: absolute;
  left: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 32px;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
  box-shadow: 0 0 12px var(--accent-glow-strong);
}

.server-icon.home {
  background: var(--surface-2);
}

.server-icon.home.active::before {
  background: var(--accent);
}

.server-icon-add {
  border: 1.5px dashed var(--border-2);
  background: transparent;
  color: var(--text-muted);
}

.server-icon-add:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-bg);
}

.server-rail-divider {
  width: 32px;
  height: 1px;
  background: var(--border-1);
  margin: 4px 0;
}

/* === Колонка каналов / друзей === */
.channels-panel {
  background: var(--bg-elev-1);
  border-right: 1px solid var(--border-1);
  display: flex;
  flex-direction: column;
}

.channels-header {
  height: 56px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-1);
}

.channels-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.channels-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.channel-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--t-fast);
  text-align: left;
}

.channel-nav:hover {
  background: var(--surface-2);
  color: var(--text);
}

.channel-nav.active {
  background: var(--surface-3);
  color: var(--text);
}

.channel-nav svg { flex-shrink: 0; opacity: 0.7; }
.channel-nav.active svg { opacity: 1; }

.channels-section-label {
  padding: 16px 12px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dm-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  transition: all var(--t-fast);
  text-align: left;
}

.dm-item:hover { background: var(--surface-2); }

.dm-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #1a0a00;
}

.dm-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dm-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dm-preview {
  font-size: 11px;
  color: var(--text-muted);
}

.dm-main-list {
  max-width: 760px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dm-main-item {
  width: 100%;
  min-height: 58px;
  border: 1px solid var(--border-1);
  background: var(--surface-1);
}

/* Карточка юзера снизу */
.user-card {
  margin: 8px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all var(--t-base);
}

.user-card:hover {
  background: var(--surface-3);
  border-color: var(--border-2);
}

.user-card-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: #1a0a00;
}

.user-card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.user-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-card-tag {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.user-card-actions {
  display: flex;
  gap: 2px;
}

.user-card-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-xs);
  color: var(--text-muted);
  transition: all var(--t-fast);
}

.user-card-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

/* === Основной контент === */
.main-content {
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.main-header {
  height: 56px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--border-1);
  flex-shrink: 0;
}

.main-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  padding-right: 20px;
  border-right: 1px solid var(--border-1);
  height: 100%;
  align-self: stretch;
}

.main-header-title svg { color: var(--text-muted); }

.main-header-tabs {
  display: flex;
  gap: 4px;
  flex: 1;
}

.main-tab {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--r-sm);
  transition: all var(--t-fast);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.main-tab:hover {
  background: var(--surface-2);
  color: var(--text);
}

.main-tab.active {
  background: var(--surface-3);
  color: var(--text);
}

.tab-badge {
  background: var(--accent);
  color: #1a0a00;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--r-full);
  min-width: 18px;
  text-align: center;
}

.add-friend-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--online);
  color: #0a0500;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--r-sm);
  transition: all var(--t-fast);
}

.add-friend-btn:hover {
  background: #82c590;
  transform: translateY(-1px);
}

.main-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
}

.friends-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  padding: 0 14px;
  height: 40px;
  margin-bottom: 24px;
  transition: all var(--t-base);
}

.friends-search:focus-within {
  border-color: var(--border-focus);
  background: var(--surface-2);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.friends-search svg { color: var(--text-muted); flex-shrink: 0; }

.friends-search input {
  flex: 1;
  background: none;
  border: none;
  font-size: 14px;
  color: var(--text);
}

.friends-search input::placeholder { color: var(--text-dim); }

.friends-section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
  margin-top: 16px;
}

.friend-list {
  display: flex;
  flex-direction: column;
}

.friend-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  transition: all var(--t-fast);
  border-top: 1px solid transparent;
}

.friend-row:hover {
  background: var(--surface-2);
}

.friend-row.offline { opacity: 0.6; }

.friend-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.friend-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  color: #1a0a00;
}

.friend-status {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 3px solid var(--bg-base);
}

.friend-status.online { background: var(--online); }
.friend-status.offline { background: var(--offline); }

.friend-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.friend-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

.friend-tag {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-weight: 400;
  margin-left: 6px;
}

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

.friend-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--t-fast);
}

.friend-row:hover .friend-actions { opacity: 1; }

.friend-action {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  color: var(--text-muted);
  transition: all var(--t-fast);
}

.friend-action:hover {
  background: var(--surface-3);
  color: var(--text);
}

/* ============================================================
   АДАПТИВ
============================================================ */

@media (max-width: 1024px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-form-wrap { padding: 24px; }
}

@media (max-width: 768px) {
  .app-layout { grid-template-columns: 60px 1fr; }
  .channels-panel { display: none; }
  .server-rail { padding: 12px 0; }
  .server-icon { width: 40px; height: 40px; }
  .main-header { padding: 0 16px; gap: 12px; flex-wrap: wrap; height: auto; padding-top: 12px; padding-bottom: 12px; }
  .main-header-title { border-right: none; padding-right: 0; }
  .main-header-tabs { width: 100%; overflow-x: auto; }
  .main-body { padding: 16px; }
}

/* ============================================================
   POPOVER (меню юзера, контекстные меню)
============================================================ */

.popover {
  background: var(--bg-elev-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xl);
  padding: 4px;
  min-width: 200px;
  z-index: 1000;
  animation: popoverIn 0.15s var(--ease-out);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

@keyframes popoverIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.popover-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--t-fast);
  text-align: left;
}

.popover-item:hover {
  background: var(--surface-3);
  color: var(--text);
}

.popover-item.danger { color: var(--danger); }
.popover-item.danger:hover { background: rgba(225, 109, 92, 0.12); }

.popover-item svg { opacity: 0.8; flex-shrink: 0; }

.popover-divider {
  height: 1px;
  background: var(--border-1);
  margin: 4px 0;
}

/* ============================================================
   FRIENDS — дополнения
============================================================ */

.dm-list-empty {
  padding: 16px 12px;
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
}

.friend-action.accept {
  color: var(--online);
}
.friend-action.accept:hover {
  background: rgba(109, 180, 116, 0.12);
  color: var(--online);
}

.friend-action.danger {
  color: var(--text-muted);
}
.friend-action.danger:hover {
  background: rgba(225, 109, 92, 0.12);
  color: var(--danger);
}

.empty-state-v2 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
}

.empty-icon {
  color: var(--text-dim);
  margin-bottom: 20px;
  opacity: 0.5;
}

.empty-state-v2 h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.empty-state-v2 p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 320px;
}

/* ============================================================
   MODAL
============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s var(--ease-out);
}

.modal-overlay.hidden { display: none; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-xl);
  padding: 32px;
  position: relative;
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.25s var(--ease-out);
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  transition: all var(--t-fast);
}

.modal-close:hover {
  background: var(--surface-3);
  color: var(--text);
}

.modal-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-strong);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.modal-sub {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 24px;
}

.modal-card form { display: flex; flex-direction: column; gap: 16px; }

.auth-error.success { color: var(--online); }

/* ============================================================
   SERVER PAGE — каналы, участники, инвайты
============================================================ */

.app-layout {
  /* Если есть members-panel — переключается на 4 колонки */
}

.app-layout:has(.members-panel) {
  grid-template-columns: 76px 280px 1fr 240px;
}

.server-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.server-header-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  transition: all var(--t-fast);
}

.server-header-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

.channels-section-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 12px 6px;
}

.channels-section-label-row .channels-section-label {
  padding: 0;
  margin: 0;
}

.add-channel-btn {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-xs);
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 400;
  transition: all var(--t-fast);
  line-height: 1;
}

.add-channel-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

.channel-item {
  font-family: var(--font-sans);
}

.channel-hash {
  color: var(--text-dim);
  font-weight: 400;
  margin-right: 2px;
}

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

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

/* Members panel */
.members-panel {
  background: var(--bg-elev-1);
  border-left: 1px solid var(--border-1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.members-header {
  height: 56px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-1);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.members-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.members-section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 12px 4px 6px;
}

.member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  transition: background var(--t-fast);
}

.member-row:hover {
  background: var(--surface-2);
}

.member-row.offline {
  opacity: 0.5;
}

.member-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #1a0a00;
  flex-shrink: 0;
}

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

.member-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-tag {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Voice channel body */
.voice-channel-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  gap: 24px;
}

.voice-channel-status {
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.voice-connect-btn {
  min-width: 180px;
}

.voice-channel-hint {
  font-size: 13px;
  color: var(--text-dim);
  max-width: 320px;
}

/* Invite modal */
.invite-link-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  padding: 4px 4px 4px 16px;
  height: 48px;
  margin-bottom: 16px;
}

.invite-link-box code {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invite-copy-btn {
  height: 40px;
  padding: 0 18px;
  background: var(--accent);
  color: #1a0a00;
  font-weight: 600;
  font-size: 13px;
  border-radius: var(--r-sm);
  transition: all var(--t-base);
}

.invite-copy-btn:hover {
  background: var(--accent-soft);
}

.invite-regen-btn {
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 0;
  transition: color var(--t-fast);
}

.invite-regen-btn:hover {
  color: var(--accent-soft);
}

/* Create channel modal — выбор типа */
.channel-type-pick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.channel-type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 12px;
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--t-base);
}

.channel-type-card:hover {
  background: var(--surface-2);
  border-color: var(--border-2);
}

.channel-type-card.active {
  background: var(--accent-bg);
  border-color: var(--border-focus);
  color: var(--accent-soft);
}

.channel-type-card svg {
  opacity: 0.7;
}

.channel-type-card.active svg {
  opacity: 1;
  color: var(--accent);
}

/* ============================================================
   INVITE PAGE
============================================================ */

.invite-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  z-index: 5;
}

.invite-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-xl);
  padding: 40px 32px;
  text-align: center;
  box-shadow: var(--shadow-xl);
  animation: formIn 0.5s var(--ease-out);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.invite-loading {
  color: var(--text-muted);
  font-size: 14px;
  padding: 40px 0;
}

.invite-server-icon {
  width: 80px;
  height: 80px;
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 700;
  color: #1a0a00;
  margin-bottom: 8px;
  box-shadow: var(--shadow-md);
}

.invite-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-strong);
}

.invite-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.invite-card .auth-submit {
  width: 100%;
  max-width: 280px;
}

.invite-card .back-link {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Home server icon */
.server-icon.home {
  background: var(--surface-2);
}
.server-icon.home img {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

/* ============================================================
   VOICE CHANNEL — Active Room
============================================================ */

.voice-channel-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
  gap: 24px;
}

.voice-channel-icon-big {
  color: var(--text-dim);
  opacity: 0.4;
  margin-bottom: 8px;
}

.voice-channel-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-strong);
  letter-spacing: -0.02em;
}

.voice-channel-hint {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 340px;
}

.voice-connect-btn {
  min-width: 200px;
  margin-top: 8px;
}

/* Активная голосовая комната */
.voice-room-active {
  display: flex;
  flex-direction: column;
  height: 100%;
}

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

.voice-room-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--online);
}

.voice-connected-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--online);
  box-shadow: 0 0 10px rgba(109, 180, 116, 0.5);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.leave-voice-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(225, 109, 92, 0.1);
  border: 1px solid rgba(225, 109, 92, 0.3);
  border-radius: var(--r-sm);
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--t-fast);
}

.leave-voice-btn:hover {
  background: rgba(225, 109, 92, 0.18);
}

.voice-participants {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  align-content: start;
}

.voice-participant {
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  padding: 24px 16px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  position: relative;
  transition: all var(--t-base);
}

.voice-participant.speaking {
  border-color: var(--accent);
  background: var(--surface-2);
  box-shadow: var(--shadow-glow);
}

.voice-participant.muted .voice-avatar { opacity: 0.4; }

.voice-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 600;
  color: #1a0a00;
  position: relative;
  transition: all var(--t-base);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.voice-participant.speaking .voice-avatar {
  transform: scale(1.05);
}

.voice-participant.speaking .voice-avatar::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  animation: ring 1.6s ease-out infinite;
}

@keyframes ring {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(1.4); opacity: 0; }
}

.voice-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-mute-icon {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--danger);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Контролы голоса снизу */
.voice-controls-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 28px;
  border-top: 1px solid var(--border-1);
  background: var(--surface-1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.voice-control-btn {
  width: 52px;
  height: 52px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-base);
}

.voice-control-btn:hover {
  background: var(--surface-3);
  border-color: var(--border-2);
  transform: translateY(-1px);
}

.voice-control-btn.muted {
  background: rgba(225, 109, 92, 0.1);
  border-color: rgba(225, 109, 92, 0.3);
  color: var(--danger);
}

.voice-mic-meter {
  flex: 1;
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
  min-width: 100px;
}

.voice-mic-meter-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  border-radius: 3px;
  transition: width 0.05s linear;
}

/* Мини-плашка голосового статуса */
.voice-status-bar {
  margin: 0 8px 8px;
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(109, 180, 116, 0.12), rgba(109, 180, 116, 0.06));
  border: 1px solid rgba(109, 180, 116, 0.25);
  border-radius: var(--r-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.voice-status-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.voice-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--online);
  box-shadow: 0 0 8px rgba(109, 180, 116, 0.5);
  animation: pulse 1.5s infinite;
  flex-shrink: 0;
}

.voice-status-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.voice-status-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.voice-status-server {
  font-size: 10px;
  color: var(--text-muted);
}

.voice-status-actions {
  display: flex;
  gap: 4px;
}

.voice-mini-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--r-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-3);
  color: var(--text);
  transition: all var(--t-fast);
}

.voice-mini-btn:hover {
  background: var(--surface-hover);
}

.voice-mini-btn.danger:hover {
  background: rgba(225, 109, 92, 0.2);
  color: var(--danger);
}

/* Канал в сайдбаре когда в нём голос */
.voice-channel-nav.connected {
  background: rgba(109, 180, 116, 0.08);
}

.voice-connected-dot {
  margin-left: auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--online);
  box-shadow: 0 0 6px rgba(109, 180, 116, 0.6);
}

/* ============================================================
   FRIENDS INVITE LIST
============================================================ */

.friends-invite-list {
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 16px;
}

.friend-invite-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--surface-1);
  border: 1px solid var(--border-1);
}

.friend-invite-row .friend-avatar {
  width: 40px;
  height: 40px;
}

.friend-invite-btn {
  background: var(--accent);
  color: #1a0a00;
  font-weight: 600;
  font-size: 12px;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  transition: all var(--t-fast);
}

.friend-invite-btn:hover:not(:disabled):not(.done) {
  background: var(--accent-soft);
}

.friend-invite-btn.done {
  background: var(--surface-3);
  color: var(--online);
  cursor: default;
}

.friend-invite-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

/* ============================================================
   SERVER INVITATIONS — модалка в app
============================================================ */

.server-invitations-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.server-invitation-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--surface-1);
  border: 1px solid var(--border-1);
}

.server-invitation-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #1a0a00;
  flex-shrink: 0;
}

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

.server-invitation-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.server-invitation-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.server-invitation-actions {
  display: flex;
  gap: 4px;
}

/* Кнопка с акцентным бейджем */
.server-invites-tab {
  background: var(--accent-bg) !important;
  color: var(--accent-soft) !important;
}

.tab-badge.accent {
  background: var(--accent);
  color: #1a0a00;
}

/* ============================================================
   ПАНЕЛЬ НАСТРОЕК ГОЛОСА
============================================================ */

.settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 150;
  opacity: 0;
  animation: fadeIn 0.2s var(--ease-out) forwards;
}

.settings-overlay.hidden { display: none; }

.settings-panel {
  position: fixed;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: 420px;
  max-width: calc(100vw - 24px);
  background: var(--bg-elev-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-xl);
  z-index: 160;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  animation: slideInRight 0.3s var(--ease-out);
  overflow: hidden;
}

.settings-panel.hidden { display: none; }

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

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 28px;
  border-bottom: 1px solid var(--border-1);
  flex-shrink: 0;
}

.settings-header h2 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.settings-close {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  transition: all var(--t-fast);
}

.settings-close:hover {
  background: var(--surface-3);
  color: var(--text);
}

.settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.setting-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.setting-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.setting-head label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.setting-value {
  font-size: 12px;
  color: var(--accent-soft);
  font-weight: 500;
  font-family: var(--font-mono);
}

.setting-hint {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.setting-marks {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 2px;
}

.setting-divider {
  height: 1px;
  background: var(--border-1);
  margin: 4px 0;
}

.toggle-row {
  flex-direction: row !important;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.toggle-text {
  flex: 1;
}

.toggle-text label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}

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

.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--surface-3);
  border: 1px solid var(--border-1);
  border-radius: var(--r-full);
  transition: all var(--t-base);
}

.switch-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all var(--t-base);
}

.switch input:checked + .switch-slider {
  background: var(--accent);
  border-color: var(--accent);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(18px);
  background: #fff;
}

.hotkey-static {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-soft);
  font-weight: 500;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(232, 115, 43, 0.3);
  transition: transform var(--t-fast);
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--accent);
  border-radius: 50%;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(232, 115, 43, 0.3);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.select-wrap {
  position: relative;
  width: 100%;
}

.select-wrap::after {
  content: '';
  position: absolute;
  right: 16px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--text-muted);
  border-bottom: 1.5px solid var(--text-muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 100%;
  height: 44px;
  padding: 0 36px 0 16px;
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  outline: none;
  transition: all var(--t-base);
  text-overflow: ellipsis;
}

select:hover { border-color: var(--border-2); }
select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

select option {
  background: var(--bg-elev-2);
  color: var(--text);
}

/* ============================================================
   POLISH — voice presence inline, channel row menu, profile
============================================================ */

/* Канал-строка с меню справа */
.channel-row-wrap {
  position: relative;
  display: flex;
  align-items: center;
  border-radius: var(--r-sm);
}

.channel-row-wrap:hover { background: var(--surface-2); }
.channel-row-wrap:has(.channel-item.active) { background: var(--surface-3); }

.channel-row-wrap .channel-nav {
  flex: 1;
  background: transparent;
}

.channel-row-wrap .channel-nav:hover { background: transparent; }
.channel-row-wrap .channel-nav.active { background: transparent; }

.channel-row-menu {
  width: 28px;
  height: 28px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-xs);
  color: var(--text-muted);
  margin-right: 6px;
  transition: all var(--t-fast);
}

.channel-row-wrap:hover .channel-row-menu {
  display: flex;
}

.channel-row-menu:hover {
  background: var(--surface-3);
  color: var(--text);
}

/* Voice presence inline в сайдбаре */
.voice-channel-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.voice-channel-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.voice-presence-inline {
  display: flex;
  align-items: center;
  gap: -8px;
  margin-left: auto;
}

.voice-presence-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #1a0a00;
  border: 2px solid var(--bg-elev-1);
  margin-left: -6px;
}

.voice-presence-avatar:first-child {
  margin-left: 0;
}

.voice-presence-more {
  margin-left: 4px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.voice-channel-nav.has-people {
  background: rgba(232, 115, 43, 0.04);
}

.voice-channel-nav.has-people:hover {
  background: rgba(232, 115, 43, 0.08);
}

/* === Voice preview в main-body (когда не подключён, но есть люди) === */
.voice-preview-people {
  margin: 8px 0 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  max-width: 420px;
}

.voice-preview-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.voice-preview-avatars {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.voice-preview-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: #1a0a00;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Большая кнопка подключения */
.voice-connect-btn-big {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 240px;
  padding: 16px 32px;
  background: var(--accent);
  color: #1a0a00;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  border-radius: var(--r-full);
  transition: all var(--t-base);
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(232, 115, 43, 0.25);
}

.voice-connect-btn-big::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 30%, rgba(255, 255, 255, 0.2) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.voice-connect-btn-big:hover::before { transform: translateX(100%); }

.voice-connect-btn-big:hover {
  background: var(--accent-soft);
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(232, 115, 43, 0.4);
}

.voice-connect-btn-big:active {
  transform: translateY(0);
}

.voice-connect-btn-big svg {
  flex-shrink: 0;
}

/* ============================================================
   PROFILE MODAL
============================================================ */

.modal-card.large {
  max-width: 540px;
}

.profile-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  margin-bottom: 24px;
}

.profile-tab {
  flex: 1;
  height: 38px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--r-sm);
  transition: all var(--t-base);
}

.profile-tab:hover { color: var(--text-soft); }
.profile-tab.active {
  background: var(--surface-3);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.profile-tab-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.profile-tab-content.hidden { display: none; }

.profile-avatar-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 8px;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: 700;
  color: #1a0a00;
  flex-shrink: 0;
  box-shadow: var(--shadow-md);
}

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

.profile-display-name {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-strong);
  letter-spacing: -0.01em;
}

.profile-username {
  font-size: 13px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 2px;
}

.profile-tab-content textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
  min-height: 80px;
  outline: none;
  transition: all var(--t-base);
}

.profile-tab-content textarea:focus {
  border-color: var(--border-focus);
  background: var(--surface-2);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.profile-tab-content textarea::placeholder { color: var(--text-dim); }

.account-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.account-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.account-value {
  font-size: 15px;
  color: var(--text);
  font-weight: 500;
}

.account-divider {
  height: 1px;
  background: var(--border-1);
  margin: 8px 0;
}

.account-action-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  width: 100%;
  text-align: left;
  transition: all var(--t-base);
}

.account-action-btn:hover {
  background: var(--surface-2);
  border-color: var(--border-2);
}

.account-action-btn.danger {
  color: var(--danger);
}

.account-action-btn.danger:hover {
  background: rgba(225, 109, 92, 0.08);
  border-color: rgba(225, 109, 92, 0.3);
}

.account-action-btn svg {
  opacity: 0.7;
  flex-shrink: 0;
}

/* Чтобы профиль модалка прокручивалась если контент большой */
.modal-overlay {
  overflow-y: auto;
  align-items: flex-start;
  padding-top: 5vh;
  padding-bottom: 5vh;
}

/* ============================================================
   АВАТАРЫ-КАРТИНКИ + DM ЧАТ + heartbeat polish
============================================================ */

.profile-avatar.editable {
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.profile-avatar-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  opacity: 0;
  transition: opacity var(--t-fast);
}

.profile-avatar.editable:hover .profile-avatar-overlay {
  opacity: 1;
}

/* Аватар-картинка в карточке юзера и DM */
.dm-avatar-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.user-card-avatar.has-img,
.friend-avatar.has-img,
.member-avatar.has-img,
.voice-avatar.has-img {
  background-size: cover !important;
  background-position: center !important;
  color: transparent !important;
}

/* DM непрочитанные */
.dm-unread {
  background: var(--accent);
  color: #1a0a00;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  flex-shrink: 0;
}

.nav-unread {
  margin-left: auto;
  background: var(--accent);
  color: #1a0a00;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* ===== DM ЧАТ ===== */
.dm-chat {
  display: flex;
  flex-direction: column;
  height: 100%;
  margin: -24px -32px;
}

.dm-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dm-empty {
  margin: auto;
  color: var(--text-dim);
  font-size: 13px;
}

.dm-msg {
  display: flex;
  flex-direction: column;
  max-width: 70%;
  align-self: flex-start;
}

.dm-msg.own {
  align-self: flex-end;
  align-items: flex-end;
}

.dm-msg-bubble {
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}

.dm-msg.own .dm-msg-bubble {
  background: var(--accent);
  color: #1a0a00;
  border-color: transparent;
  border-radius: var(--r-md) var(--r-md) 4px var(--r-md);
}

.dm-msg-time {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 3px;
  padding: 0 4px;
  font-family: var(--font-mono);
}

.dm-input-row {
  display: flex;
  gap: 8px;
  padding: 18px 32px;
  border-top: 1px solid var(--border-1);
  flex-shrink: 0;
}

#dm-input {
  flex: 1;
  height: 44px;
  padding: 0 16px;
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: all var(--t-base);
}

#dm-input:focus {
  border-color: var(--border-focus);
  background: var(--surface-2);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

#dm-input::placeholder { color: var(--text-dim); }

.dm-send {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #1a0a00;
  border-radius: var(--r-md);
  transition: all var(--t-base);
  flex-shrink: 0;
}

.dm-send:hover {
  background: var(--accent-soft);
  transform: translateY(-1px);
}

/* ===== ТЕКСТОВЫЙ ЧАТ КАНАЛА ===== */
.text-chat {
  display: flex;
  flex-direction: column;
  height: 100%;
  margin: -24px -32px;
}

.text-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.text-msg {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.text-msg-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  color: #1a0a00;
  flex-shrink: 0;
}

.text-msg-avatar.has-img {
  background-size: cover;
  background-position: center;
  color: transparent;
}

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

.text-msg-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}

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

.text-msg-time {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.text-msg-body {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-soft);
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}

.text-input-row {
  display: flex;
  gap: 8px;
  padding: 18px 32px;
  border-top: 1px solid var(--border-1);
  flex-shrink: 0;
}

#text-input {
  flex: 1;
  height: 44px;
  padding: 0 16px;
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: all var(--t-base);
}

#text-input:focus {
  border-color: var(--border-focus);
  background: var(--surface-2);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

#text-input::placeholder { color: var(--text-dim); }

/* ============================================================
   Premium refresh — softer, calmer, more tactile
============================================================ */

:root {
  --bg-base: #08090a;
  --bg-elev-1: #101114;
  --bg-elev-2: #15171b;
  --bg-elev-3: #1c1f24;
  --surface-1: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.072);
  --surface-3: rgba(255, 255, 255, 0.105);
  --surface-hover: rgba(255, 255, 255, 0.095);
  --border-1: rgba(255, 255, 255, 0.08);
  --border-2: rgba(255, 255, 255, 0.14);
  --border-strong: rgba(255, 255, 255, 0.2);
  --border-focus: rgba(255, 151, 78, 0.52);
  --text: #f4f1eb;
  --text-strong: #fffaf2;
  --text-soft: rgba(244, 241, 235, 0.76);
  --text-muted: rgba(244, 241, 235, 0.55);
  --text-dim: rgba(244, 241, 235, 0.34);
  --accent: #ff8a3d;
  --accent-soft: #ffc17a;
  --accent-bg: rgba(255, 138, 61, 0.12);
  --accent-glow: rgba(255, 138, 61, 0.18);
  --accent-glow-strong: rgba(255, 138, 61, 0.34);
  --online: #78d59a;
  --danger: #ff7466;
  --r-xs: 10px;
  --r-sm: 14px;
  --r-md: 18px;
  --r-lg: 24px;
  --r-xl: 30px;
  --r-2xl: 38px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 10px 24px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 22px 58px rgba(0, 0, 0, 0.36);
  --shadow-xl: 0 34px 90px rgba(0, 0, 0, 0.52);
  --shadow-glow: 0 0 0 1px rgba(255, 138, 61, 0.18), 0 18px 42px rgba(255, 138, 61, 0.14);
}

* { letter-spacing: 0 !important; }

body.v2 {
  background:
    linear-gradient(135deg, rgba(255, 138, 61, 0.055), transparent 34%),
    linear-gradient(315deg, rgba(120, 213, 154, 0.045), transparent 38%),
    var(--bg-base);
}

.bg-glow {
  background:
    linear-gradient(120deg, rgba(255, 138, 61, 0.1), transparent 32%),
    linear-gradient(280deg, rgba(120, 213, 154, 0.08), transparent 36%);
  opacity: 0.72;
}

.bg-noise { opacity: 0.018; }

.auth-hero {
  background:
    linear-gradient(135deg, rgba(255, 138, 61, 0.13), transparent 34%),
    linear-gradient(315deg, rgba(120, 213, 154, 0.07), transparent 45%),
    #0d0f12;
}

.auth-hero::before {
  content: '';
  position: absolute;
  inset: 10%;
  background-image: url('/assets/bros-logo.png');
  background-repeat: no-repeat;
  background-position: center;
  background-size: min(54vw, 560px);
  opacity: 0.035;
  filter: grayscale(1) contrast(1.25);
  pointer-events: none;
}

.hero-content { position: relative; z-index: 1; }

.hero-logo {
  width: 184px;
  height: 184px;
  margin-bottom: 42px;
  padding: 22px;
  border: 1px solid var(--border-2);
  border-radius: 44px;
  background: linear-gradient(145deg, rgba(255,255,255,0.12), rgba(255,255,255,0.035));
  box-shadow: var(--shadow-xl), inset 0 1px 0 rgba(255,255,255,0.12);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.hero-logo::before { display: none; }
.hero-logo img { filter: drop-shadow(0 18px 34px rgba(255, 138, 61, 0.24)); }
.hero-title { max-width: 520px; font-size: 52px; font-weight: 700; }
.hero-accent { color: var(--accent-soft); font-style: normal; }
.hero-sub { color: var(--text-soft); font-size: 16px; }

.auth-form-card {
  max-width: 440px;
  padding: 34px;
  border: 1px solid var(--border-1);
  border-radius: var(--r-2xl);
  background: linear-gradient(145deg, rgba(255,255,255,0.08), rgba(255,255,255,0.028));
  box-shadow: var(--shadow-xl), inset 0 1px 0 rgba(255,255,255,0.08);
  backdrop-filter: blur(26px);
  -webkit-backdrop-filter: blur(26px);
}

.download-pill,
.auth-tabs,
.auth-field input,
.auth-submit,
.modal-card,
.settings-panel,
.popover,
.invite-card,
.user-card,
.voice-status-bar,
.invite-link-box {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.07), var(--shadow-sm);
}

.auth-tabs { border-radius: var(--r-lg); padding: 5px; }
.auth-tab { border-radius: var(--r-md); }

.auth-field input,
#dm-input,
#text-input,
.auth-field textarea,
.select-wrap select {
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.055);
}

.auth-submit,
.add-friend-btn,
.voice-connect-btn-big,
.dm-send,
.invite-copy-btn,
.friend-invite-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  box-shadow: 0 14px 34px rgba(255, 138, 61, 0.2), inset 0 1px 0 rgba(255,255,255,0.22);
}

.app-layout { grid-template-columns: 82px 292px 1fr; }

.server-rail,
.channels-panel,
.members-panel {
  background: rgba(13, 15, 18, 0.82);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
}

.server-icon {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

.server-icon:hover { border-radius: 22px; }
.server-icon.active { box-shadow: var(--shadow-glow), inset 0 1px 0 rgba(255,255,255,0.1); }
.server-icon:not(.home) img { width: 100%; height: 100%; object-fit: cover; }

.channels-header,
.main-header,
.server-main-header,
.members-header,
.voice-room-header {
  height: 64px;
  background: rgba(255,255,255,0.018);
}

.channel-nav,
.channel-row-wrap,
.dm-item,
.friend-row,
.member-row,
.friend-invite-row,
.server-invitation-row {
  border-radius: var(--r-md);
}

.channel-row-wrap:hover,
.channel-row-wrap:has(.channel-item.active),
.channel-nav.active,
.dm-item:hover,
.friend-row:hover,
.member-row:hover {
  background: rgba(255,255,255,0.078);
}

.main-content,
.server-main {
  background:
    linear-gradient(145deg, rgba(255,255,255,0.022), transparent 42%),
    var(--bg-base);
}

.main-body,
.server-main-body { padding: 30px 34px; }

.friends-search {
  height: 48px;
  border-radius: var(--r-lg);
  background: rgba(255,255,255,0.055);
}

.friend-row,
.dm-main-item,
.voice-preview-people,
.voice-participant,
.text-msg,
.modal-card,
.settings-panel {
  background: linear-gradient(145deg, rgba(255,255,255,0.066), rgba(255,255,255,0.028));
  border-color: var(--border-1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

.friend-avatar,
.dm-avatar,
.dm-avatar-img,
.header-avatar,
.dm-msg-avatar,
.member-avatar,
.voice-avatar,
.voice-preview-avatar,
.voice-presence-avatar,
.text-msg-avatar,
.user-card-avatar,
.profile-avatar {
  border-radius: 36%;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.16), 0 10px 22px rgba(0,0,0,0.2);
}

.dm-avatar.has-img,
.header-avatar.has-img,
.dm-msg-avatar.has-img,
.voice-preview-avatar.has-img,
.voice-presence-avatar.has-img,
.text-msg-avatar.has-img,
.user-card-avatar.has-img,
.friend-avatar.has-img,
.member-avatar.has-img,
.voice-avatar.has-img,
.profile-avatar.has-img {
  background-size: cover !important;
  background-position: center !important;
  color: transparent !important;
}

.friend-status {
  border-width: 3px;
  box-shadow: 0 0 0 2px rgba(8,9,10,0.9), 0 0 14px rgba(120,213,154,0.42);
}

.voice-channel-icon-big {
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  border-radius: 34px;
  color: var(--accent-soft);
  opacity: 1;
  background: linear-gradient(145deg, rgba(255,255,255,0.09), rgba(255,255,255,0.025));
  border: 1px solid var(--border-1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), var(--shadow-md);
}

.voice-room-active {
  margin: -30px -34px;
  height: calc(100% + 60px);
}

.voice-participants {
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 18px;
}

.voice-participant {
  border-radius: var(--r-xl);
  padding: 28px 18px 22px;
}

.voice-avatar {
  width: 72px;
  height: 72px;
  font-size: 25px;
}

.voice-controls-bar {
  margin: 0 18px 18px;
  border: 1px solid var(--border-1);
  border-radius: var(--r-xl);
  background: rgba(16,17,20,0.78);
  box-shadow: var(--shadow-lg);
}

.voice-control-btn,
.voice-mini-btn,
.friend-action,
.user-card-btn { border-radius: 16px; }

.header-avatar {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: #1a0a00;
}

.dm-msg {
  flex-direction: row;
  align-items: flex-end;
  gap: 10px;
}

.dm-msg.own {
  flex-direction: row-reverse;
  align-items: flex-end;
}

.dm-msg-avatar {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: #1a0a00;
}

.dm-msg-stack {
  display: flex;
  flex-direction: column;
  max-width: min(560px, 100%);
}

.dm-msg.own .dm-msg-stack { align-items: flex-end; }

.dm-msg-bubble,
.text-msg-body { border-radius: 20px; }

.dm-msg.own .dm-msg-bubble { border-radius: 20px 20px 8px 20px; }

@media (max-width: 980px) {
  .auth-form-card { padding: 26px; }
  .hero-title { font-size: 40px; }
}

/* Voice upgrade: mic test, per-user volume, active speaker overlay */
.voice-participant {
  min-height: 188px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.voice-volume-control {
  width: min(100%, 180px);
  height: 34px;
  margin-top: 12px;
  display: grid;
  grid-template-columns: 16px 1fr 42px;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  background: rgba(255,255,255,0.045);
  color: var(--text-muted);
}

.voice-volume-control input,
.mic-test-meter,
.mic-test-meter-bar {
  min-width: 0;
}

.voice-volume-control input {
  width: 100%;
  accent-color: var(--accent);
}

.voice-volume-control span {
  text-align: right;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-soft);
}

.screen-toggle.active {
  background: linear-gradient(145deg, rgba(232,115,43,0.24), rgba(232,115,43,0.1));
  border-color: rgba(232,115,43,0.45);
  color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232,115,43,0.08), var(--shadow-md);
}

.voice-room-active.screen-active {
  min-height: 0;
  overflow: hidden;
}

.voice-room-active.screen-active .voice-room-header {
  flex: 0 0 auto;
}

.voice-room-active.screen-active .voice-controls-bar {
  flex: 0 0 auto;
  margin-top: auto;
}

.voice-screen-stage {
  margin: 18px 18px 0;
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(255,255,255,0.075), rgba(255,255,255,0.03));
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  flex: 0 0 auto;
}

.voice-screen-stage.hidden {
  display: none;
}

.voice-room-active.screen-active .voice-screen-stage {
  flex: 0 0 auto;
  height: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.voice-screen-head {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex: 0 0 auto;
}

.voice-screen-head > div:first-child {
  min-width: 0;
}

.voice-screen-head strong,
.voice-screen-head span {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.voice-screen-head strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.voice-screen-head span {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 12px;
}

.voice-screen-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.voice-screen-action,
.voice-screen-stop {
  height: 34px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(225,109,92,0.28);
  border-radius: 13px;
  background: rgba(225,109,92,0.1);
  color: var(--danger);
  padding: 0 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.voice-screen-action {
  width: 36px;
  padding: 0;
  border-color: rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.06);
  color: var(--text);
}

.voice-screen-action:hover,
.voice-screen-action.active {
  border-color: rgba(232,115,43,0.38);
  background: rgba(232,115,43,0.12);
  color: var(--accent);
}

.voice-screen-video-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 220px;
  max-height: min(58vh, 620px);
  display: grid;
  place-items: center;
  background: #050608;
}

.voice-room-active.screen-active .voice-screen-video-wrap {
  flex: 0 0 auto;
  aspect-ratio: 16 / 9;
  min-height: 0;
  max-height: min(42vh, 430px);
}

.voice-screen-local-placeholder {
  width: min(520px, calc(100% - 32px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px;
  text-align: center;
  color: var(--text-muted);
}

.voice-screen-local-icon {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(232,115,43,0.22);
  border-radius: 24px;
  background: rgba(232,115,43,0.1);
  color: var(--accent);
}

.voice-screen-local-placeholder strong {
  color: var(--text);
  font-size: 16px;
  font-weight: 850;
}

.voice-screen-local-placeholder span {
  max-width: 420px;
  font-size: 13px;
  line-height: 1.45;
}

.voice-screen-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #050608;
}

.voice-screen-footer {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.025);
  flex: 0 0 auto;
}

.voice-screen-audio-state {
  min-width: 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.voice-screen-volume {
  width: min(240px, 48%);
  height: 30px;
  display: grid;
  grid-template-columns: 16px 1fr 40px;
  align-items: center;
  gap: 8px;
  padding: 0 9px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
}

.voice-screen-volume.disabled {
  opacity: 0.48;
}

.voice-screen-volume input {
  width: 100%;
  min-width: 0;
  accent-color: var(--accent);
}

.voice-screen-volume span {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 800;
  text-align: right;
}

.voice-screen-badge {
  height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  border: 1px solid rgba(232,115,43,0.26);
  border-radius: 999px;
  background: rgba(232,115,43,0.1);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
}

.voice-screen-badge svg {
  flex: 0 0 auto;
}

.voice-room-active.screen-active .voice-participants {
  flex: 1 1 auto;
  height: auto;
  min-height: 132px;
  width: 100%;
  max-width: 100%;
  display: flex;
  grid-template-columns: none;
  align-items: stretch;
  gap: 10px;
  padding: 12px 18px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  overscroll-behavior-x: contain;
}

.voice-room-active.screen-active .voice-participants::-webkit-scrollbar {
  height: 8px;
}

.voice-room-active.screen-active .voice-participants::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
}

.voice-room-active.screen-active .voice-participant {
  flex: 0 0 168px;
  min-height: 0;
  height: 114px;
  padding: 12px;
  gap: 7px;
  border-radius: 18px;
}

.voice-room-active.screen-active .voice-avatar {
  width: 38px;
  height: 38px;
  font-size: 15px;
}

.voice-room-active.screen-active .voice-name {
  font-size: 12px;
}

.voice-room-active.screen-active .voice-volume-control {
  width: 100%;
  height: 26px;
  margin-top: 0;
  grid-template-columns: 1fr 34px;
  padding: 0 8px;
}

.voice-room-active.screen-active .voice-volume-control svg {
  display: none;
}

.voice-room-active.screen-active .voice-screen-badge {
  height: 22px;
  font-size: 10px;
}

.voice-screen-watch-btn {
  height: 25px;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid rgba(232,115,43,0.26);
  border-radius: 999px;
  background: rgba(232,115,43,0.1);
  color: var(--accent);
  font: inherit;
  font-size: 10px;
  font-weight: 850;
  cursor: pointer;
  white-space: nowrap;
}

.voice-screen-watch-btn:hover {
  border-color: rgba(232,115,43,0.42);
  background: rgba(232,115,43,0.16);
}

.voice-room-active.screen-active .voice-mute-icon {
  top: 8px;
  right: 8px;
  width: 18px;
  height: 18px;
}

.voice-room-active.screen-active.theater-mode .voice-participants {
  display: none;
}

.voice-room-active.screen-active.theater-mode .voice-screen-stage {
  flex: 1 1 auto;
  height: auto;
  margin-bottom: 18px;
}

.voice-room-active.screen-active.theater-mode .voice-screen-video-wrap {
  flex: 1 1 auto;
  aspect-ratio: auto;
  max-height: none;
}

.voice-room-active.screen-active.screen-focus-mode .voice-screen-stage {
  position: fixed;
  inset: 0;
  z-index: 10000;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: #050608;
  box-shadow: 0 30px 120px rgba(0,0,0,0.72);
}

.voice-room-active.screen-active.screen-focus-mode .voice-screen-video-wrap {
  flex: 1 1 auto;
  aspect-ratio: auto;
  max-height: none;
}

.voice-room-active.screen-active.screen-focus-mode .voice-participants,
.voice-room-active.screen-active.screen-focus-mode .voice-controls-bar,
.voice-room-active.screen-active.screen-focus-mode .voice-room-header {
  filter: brightness(0.55);
  pointer-events: none;
}

.voice-screen-stage:fullscreen,
.voice-screen-stage:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: #050608;
  display: flex;
  flex-direction: column;
  box-shadow: none;
}

.voice-screen-stage:fullscreen .voice-screen-video-wrap,
.voice-screen-stage:-webkit-full-screen .voice-screen-video-wrap {
  flex: 1 1 auto;
  aspect-ratio: auto;
  min-height: 0;
  max-height: none;
}

.voice-screen-stage:fullscreen .voice-screen-head,
.voice-screen-stage:-webkit-full-screen .voice-screen-head,
.voice-screen-stage:fullscreen .voice-screen-footer,
.voice-screen-stage:-webkit-full-screen .voice-screen-footer {
  background: rgba(5,6,8,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

@media (max-width: 760px) {
  .voice-screen-stage {
    margin: 12px 12px 0;
    border-radius: 18px;
  }

  .voice-screen-head {
    align-items: flex-start;
    gap: 10px;
    min-height: 0;
    padding: 10px 12px;
  }

  .voice-screen-actions {
    gap: 6px;
  }

  .voice-screen-action,
  .voice-screen-stop {
    height: 32px;
    border-radius: 12px;
  }

  .voice-screen-stop {
    padding: 0 10px;
  }

  .voice-screen-footer {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .voice-screen-volume {
    width: 100%;
  }

  .voice-room-active.screen-active .voice-participants {
    min-height: 116px;
    gap: 8px;
    padding: 10px 12px;
  }

  .voice-room-active.screen-active .voice-participant {
    flex-basis: 142px;
    height: 104px;
    padding: 10px;
  }

  .voice-room-active.screen-active .voice-avatar {
    width: 34px;
    height: 34px;
  }

  .voice-room-active.screen-active .voice-volume-control {
    height: 24px;
  }
}

.mic-test-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border-1);
  border-radius: 20px;
  background: rgba(255,255,255,0.045);
}

.mic-test-btn {
  height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255,255,255,0.12), rgba(255,255,255,0.045));
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.mic-test-btn.active {
  color: #16110b;
  background: linear-gradient(135deg, var(--accent), #ffd28b);
  box-shadow: 0 14px 28px rgba(229, 177, 108, 0.18);
}

.mic-test-meter {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.24);
}

.mic-test-meter-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #78d59a, #e5b16c, #ff7f7f);
  transition: width 80ms linear;
}

.voice-speaking-overlay {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 70;
  width: min(320px, calc(100vw - 32px));
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 24px;
  background: rgba(12,13,16,0.82);
  box-shadow: 0 24px 60px rgba(0,0,0,0.42), inset 0 1px 0 rgba(255,255,255,0.08);
  backdrop-filter: blur(18px);
}

.voice-speaking-overlay.hidden {
  display: none;
}

.voice-speaking-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.voice-speaking-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.24);
}

.voice-speaking-dot.live {
  background: #78d59a;
  box-shadow: 0 0 18px rgba(120,213,154,0.65);
}

.voice-speaking-list {
  display: grid;
  gap: 8px;
}

.voice-speaking-person {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 6px 8px 6px 6px;
  border-radius: 18px;
  background: rgba(255,255,255,0.055);
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.voice-speaking-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 36%;
  font-size: 13px;
  font-weight: 900;
  color: #1a0a00;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
}

.voice-speaking-avatar.has-img {
  background-size: cover !important;
  background-position: center !important;
  color: transparent !important;
}

.voice-speaking-empty {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
}

.voice-visuals-paused .voice-speaking-overlay {
  display: none !important;
}

.voice-visuals-paused *,
.voice-visuals-paused *::before,
.voice-visuals-paused *::after {
  animation-play-state: paused !important;
  transition-duration: 0s !important;
}

.voice-home-bridge {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  grid-template-rows: 1fr;
  background: var(--bg);
}

.voice-home-bridge.open {
  display: grid;
}

.voice-home-bridge-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border-1);
  background: rgba(12,13,16,0.88);
  backdrop-filter: blur(18px);
}

.voice-home-bridge-bar strong,
.voice-home-bridge-bar span {
  display: block;
}

.voice-home-bridge-bar strong {
  font-size: 14px;
  color: var(--text);
}

.voice-home-bridge-bar span {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-muted);
}

.voice-home-bridge-bar button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-1);
  border-radius: 14px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  cursor: pointer;
}

.voice-home-bridge iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--bg);
}

@media (max-width: 720px) {
  .voice-speaking-overlay {
    right: 14px;
    bottom: 14px;
  }

  .mic-test-card {
    grid-template-columns: 1fr;
  }
}

/* Final spacing and background voice polish */
#server-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.server-rail {
  gap: 10px;
}

.server-icon {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
}

.server-icon.home {
  width: 48px;
  height: 48px;
  flex-basis: 48px;
}

.server-icon:not(.home) img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.friends-section-label {
  line-height: 1.25;
  margin: 20px 0 10px;
}

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

.friend-row {
  min-height: 68px;
  align-items: center;
}

.bg-voice-bar {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 85;
  width: min(520px, calc(100vw - 28px));
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px 10px 14px;
  border: 1px solid var(--border-1);
  border-radius: 22px;
  background: rgba(12,13,16,0.88);
  box-shadow: 0 22px 55px rgba(0,0,0,0.42), inset 0 1px 0 rgba(255,255,255,0.08);
  backdrop-filter: blur(18px);
  transform: translateX(-50%);
}

.bg-voice-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.bg-voice-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #78d59a;
  box-shadow: 0 0 16px rgba(120,213,154,0.65);
  flex-shrink: 0;
}

.bg-voice-info strong,
.bg-voice-info span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bg-voice-info strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.bg-voice-info span {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}

.bg-voice-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.bg-voice-actions button {
  height: 36px;
  padding: 0 13px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  background: rgba(255,255,255,0.065);
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
}

.bg-voice-actions button.muted {
  color: #16110b;
  background: linear-gradient(135deg, var(--accent), #ffd28b);
}
