/* ========== Volna — тёмная тема ========== */
:root {
  --bg0: #0b0c12;
  --bg1: #11131c;
  --bg2: #161927;
  --bg3: #1d2133;
  --bg4: #252a40;
  --line: rgba(255, 255, 255, 0.07);
  --line2: rgba(255, 255, 255, 0.12);
  --text: #e7e9f4;
  --dim: #9aa0b8;
  --faint: #686e87;
  --acc1: #6d7cff;
  --acc2: #a96bff;
  --acc-grad: linear-gradient(135deg, #6d7cff, #a96bff);
  --green: #3ddc97;
  --red: #ff5c6c;
  --yellow: #ffb454;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --tb-h: 38px;
  --bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --chat-bg: transparent;
}

/* ===== светлая тема (переключается data-theme на documentElement) ===== */
:root[data-theme="light"] {
  --bg0: #eef0f7;
  --bg1: #ffffff;
  --bg2: #f4f5fb;
  --bg3: #e9ebf4;
  --bg4: #dde0ee;
  --line: rgba(20, 24, 50, 0.10);
  --line2: rgba(20, 24, 50, 0.16);
  --text: #1b1e2b;
  --dim: #565d75;
  --faint: #868ca6;
  --shadow: 0 12px 40px rgba(60, 70, 120, 0.16);
}
/* в светлой теме самые заметные «белые» подложки/ховеры заменяем на тёмные */
:root[data-theme="light"] .ch-item:hover,
:root[data-theme="light"] .tb-btn:hover,
:root[data-theme="light"] .icon-btn:hover,
:root[data-theme="light"] .ctx-item:hover,
:root[data-theme="light"] .dm-pick:hover,
:root[data-theme="light"] .msg:hover { background: rgba(20, 24, 50, 0.06); }
:root[data-theme="light"] .input,
:root[data-theme="light"] .select,
:root[data-theme="light"] .composer,
:root[data-theme="light"] .switch { background: rgba(20, 24, 50, 0.05); }
:root[data-theme="light"] .btn-ghost { background: rgba(20, 24, 50, 0.05); }
:root[data-theme="light"] .modal-backdrop { background: rgba(30, 35, 60, 0.35); }

/* компактный режим — плотнее сообщения и списки */
:root.compact { font-size: 13.5px; }
:root.compact .msg { margin-top: 1px; }
:root.compact .ch-item { padding: 5px 8px; }
:root.compact .composer { padding-top: 6px; padding-bottom: 6px; }
/* опциональный фон чата (пресеты/градиенты) */
.chat-view, .voice-view { background: var(--chat-bg); }
/* выбор акцентного цвета */
.accent-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 2px 10px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; transition: transform 0.12s; }
.swatch:hover { transform: scale(1.12); }
.swatch.on { border-color: var(--text); }
.swatch.custom { background: conic-gradient(#ff5c6c, #ffb454, #3ddc97, #4aa8ff, #a96bff, #ff5c6c); -webkit-appearance: none; appearance: none; }
.swatch.custom::-webkit-color-swatch-wrapper { padding: 0; }
.swatch.custom::-webkit-color-swatch { border: none; border-radius: 50%; opacity: 0; }
/* саундборд */
.sb-wrap { display: flex; flex-direction: column; gap: 10px; }
.sb-note { font-size: 12px; }
.sb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; max-height: 50vh; overflow: auto; }
.sb-btn { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; border-radius: 12px; background: rgba(127, 127, 127, 0.08); border: 1px solid var(--line); color: var(--text); cursor: pointer; transition: transform 0.1s, background 0.15s; }
.sb-btn:hover:not(:disabled) { background: rgba(127, 127, 127, 0.16); transform: translateY(-1px); }
.sb-btn:active:not(:disabled) { transform: scale(0.95); }
.sb-btn:disabled { opacity: 0.4; cursor: default; }
.sb-e { font-size: 24px; }
.sb-n { font-size: 11px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.sb-rm { position: absolute; top: 3px; right: 3px; width: 16px; height: 16px; display: grid; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, 0.4); color: #fff; }
.sb-rm:hover { background: var(--red); }
/* кастомные эмодзи в тексте сообщений */
.cemoji { width: 1.4em; height: 1.4em; vertical-align: -0.3em; object-fit: contain; margin: 0 1px; }
/* GIF-кнопка композера */
.gif-btn { font-weight: 800; font-size: 10.5px; letter-spacing: 0.5px; }
/* пикер GIF / стикеров / эмодзи */
.pk-wrap { display: flex; flex-direction: column; gap: 10px; min-height: 300px; }
.pk-tabs { display: flex; gap: 6px; }
.pk-tab { padding: 6px 12px; border-radius: 8px; color: var(--dim); background: rgba(127, 127, 127, 0.08); }
.pk-tab.active { color: #fff; background: var(--acc-grad); }
.gif-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-height: 50vh; overflow: auto; align-content: start; }
.gif-item { width: 100%; border-radius: 8px; cursor: pointer; background: rgba(127, 127, 127, 0.1); }
.gif-item:hover { outline: 2px solid var(--acc1); }
.gif-attr { font-size: 10.5px; color: var(--faint); text-align: right; letter-spacing: 0.5px; }
.pk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; max-height: 50vh; overflow: auto; align-content: start; }
.pk-grid.emoji { grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); }
.pk-sticker { width: 100%; border-radius: 10px; cursor: pointer; background: rgba(127, 127, 127, 0.1); }
.pk-sticker:hover { outline: 2px solid var(--acc1); }
.pk-emoji { width: 40px; height: 40px; object-fit: contain; cursor: pointer; border-radius: 8px; padding: 4px; }
.pk-emoji:hover { background: rgba(127, 127, 127, 0.14); }

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  font-size: 14.5px;
  color: var(--text);
  background: var(--bg0);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
input, textarea { user-select: text; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.10); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.18); }
::-webkit-scrollbar-track { background: transparent; }
::selection { background: rgba(109, 124, 255, 0.35); }

/* ========== заголовок окна ========== */
.titlebar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--tb-h);
  display: flex; align-items: stretch; z-index: 1000;
  background: rgba(11, 12, 18, 0.85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.tb-brand { display: flex; align-items: center; gap: 8px; padding: 0 14px; -webkit-app-region: drag; }
.tb-logo { display: flex; align-items: flex-end; gap: 2.5px; height: 16px; }
.tb-logo i { width: 3.5px; border-radius: 2px; background: var(--acc-grad); animation: eq 1.4s ease-in-out infinite; }
.tb-logo i:nth-child(1) { height: 8px; animation-delay: 0s; }
.tb-logo i:nth-child(2) { height: 15px; animation-delay: 0.22s; }
.tb-logo i:nth-child(3) { height: 10px; animation-delay: 0.44s; }
@keyframes eq { 0%, 100% { transform: scaleY(0.55); } 50% { transform: scaleY(1); } }
.tb-name { font-weight: 600; font-size: 13px; letter-spacing: 0.4px; color: var(--dim); }
.tb-drag { flex: 1; -webkit-app-region: drag; }
.tb-buttons { display: flex; -webkit-app-region: no-drag; }
.tb-btn { width: 46px; display: grid; place-items: center; color: var(--dim); transition: background 0.15s, color 0.15s; }
.tb-btn svg { width: 15px; height: 15px; stroke-width: 1.8; }
.tb-btn:hover { background: rgba(255, 255, 255, 0.07); color: var(--text); }
.tb-close:hover { background: var(--red); color: #fff; }

/* ========== экраны ========== */
.screen { position: fixed; inset: var(--tb-h) 0 0 0; }
.screen[hidden] { display: none; }

/* ========== aurora-фон ========== */
.aurora { position: absolute; inset: 0; overflow: hidden; filter: blur(90px) saturate(1.3); opacity: 0.55; }
.aurora b { position: absolute; border-radius: 50%; will-change: transform; }
.aurora .a1 { width: 560px; height: 560px; left: -120px; top: -80px; background: #3641a8; animation: drift1 19s ease-in-out infinite alternate; }
.aurora .a2 { width: 480px; height: 480px; right: -100px; top: 18%; background: #6a2fa3; animation: drift2 23s ease-in-out infinite alternate; }
.aurora .a3 { width: 520px; height: 520px; left: 30%; bottom: -200px; background: #1b4a8f; animation: drift3 27s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(140px, 90px) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-120px, 110px) scale(0.9); } }
@keyframes drift3 { to { transform: translate(-90px, -120px) scale(1.2); } }

/* ========== экран входа ========== */
#screenWelcome { display: grid; place-items: center; overflow-y: auto; }
.welcome-card {
  position: relative; width: 460px; max-width: calc(100vw - 40px);
  background: rgba(20, 23, 36, 0.72); backdrop-filter: blur(24px);
  border: 1px solid var(--line2); border-radius: 22px;
  padding: 34px 38px 26px; margin: 24px 0;
  box-shadow: var(--shadow);
  animation: cardIn 0.55s var(--bounce);
}
@keyframes cardIn { from { opacity: 0; transform: translateY(26px) scale(0.96); } }
.welcome-card.shake { animation: shake 0.45s ease; }
@keyframes shake { 20% { transform: translateX(-9px); } 45% { transform: translateX(8px); } 70% { transform: translateX(-5px); } 90% { transform: translateX(3px); } }

.w-logo { display: flex; justify-content: center; align-items: flex-end; gap: 6px; height: 44px; margin-bottom: 12px; }
.w-logo i { width: 9px; border-radius: 5px; background: var(--acc-grad); box-shadow: 0 0 18px rgba(140, 115, 255, 0.5); animation: eq 1.6s ease-in-out infinite; }
.w-logo i:nth-child(1) { height: 18px; animation-delay: 0s; }
.w-logo i:nth-child(2) { height: 30px; animation-delay: 0.15s; }
.w-logo i:nth-child(3) { height: 44px; animation-delay: 0.3s; }
.w-logo i:nth-child(4) { height: 30px; animation-delay: 0.45s; }
.w-logo i:nth-child(5) { height: 18px; animation-delay: 0.6s; }
.w-title {
  text-align: center; font-size: 34px; font-weight: 800; letter-spacing: 1px;
  background: linear-gradient(120deg, #8d9aff, #c08bff 55%, #7fd6ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.w-sub { text-align: center; color: var(--dim); font-size: 13.5px; margin: 6px 0 24px; }

.w-profile { display: flex; gap: 16px; align-items: center; margin-bottom: 22px; }
.w-avatar {
  position: relative; width: 64px; height: 64px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  border: 2px solid var(--line2); transition: transform 0.2s var(--bounce), border-color 0.2s, box-shadow 0.2s;
}
.w-avatar:hover { transform: scale(1.06); border-color: var(--acc1); box-shadow: 0 0 22px rgba(109, 124, 255, 0.35); }
.w-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.w-avatar-edit {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.55); opacity: 0; transition: opacity 0.18s; color: #fff;
}
.w-avatar:hover .w-avatar-edit { opacity: 1; }
.w-name-wrap { flex: 1; }

.field-label { display: block; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: var(--dim); margin: 0 0 6px 2px; }
.set-note { margin-top: 8px; padding: 9px 11px; border-radius: var(--r-md); background: rgba(88, 101, 242, 0.12); border: 1px solid rgba(88, 101, 242, 0.35); color: var(--text); font-size: 12.5px; line-height: 1.45; }
.muted { color: var(--faint); text-transform: none; letter-spacing: 0; font-weight: 500; }
.input {
  width: 100%; padding: 11px 14px; border-radius: var(--r-md);
  background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line);
  color: var(--text); font-size: 14.5px; outline: none;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
.input:focus { border-color: var(--acc1); box-shadow: 0 0 0 3px rgba(109, 124, 255, 0.18); background: rgba(0, 0, 0, 0.4); }
.input::placeholder { color: var(--faint); }

.seg { position: relative; display: flex; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); border-radius: var(--r-md); padding: 4px; margin-bottom: 18px; }
.seg-btn { position: relative; z-index: 1; flex: 1; padding: 9px 0; border-radius: 9px; font-weight: 600; font-size: 13.5px; color: var(--dim); transition: color 0.2s; }
.seg-btn.active { color: #fff; }
.seg-pill {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px);
  background: var(--acc-grad); border-radius: 9px;
  transition: transform 0.3s var(--bounce); box-shadow: 0 4px 14px rgba(120, 110, 255, 0.4);
}
.seg-pill.right { transform: translateX(100%); }

.w-panel { display: flex; flex-direction: column; gap: 12px; animation: fadeUp 0.3s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } }
.w-row { display: flex; gap: 12px; }
.w-col { width: 110px; }
.w-col.grow { flex: 1; width: auto; }
.w-hint { font-size: 12px; color: var(--faint); text-align: center; }
.w-status { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 14px; color: var(--dim); font-size: 13.5px; }
.w-secure { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 20px; font-size: 11.5px; color: var(--faint); }
.w-secure svg { width: 14px; height: 14px; color: var(--green); }
.w-getapp { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 14px; font-size: 12.5px; color: var(--dim); text-decoration: none; transition: color 0.15s; }
.w-getapp:hover { color: var(--text); }
.w-getapp svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ========== кнопки ========== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--r-md); font-weight: 600; font-size: 14px;
  transition: transform 0.15s var(--bounce), box-shadow 0.2s, background 0.2s, opacity 0.2s;
}
.btn:active { transform: scale(0.96); }
.btn-primary { background: var(--acc-grad); color: #fff; box-shadow: 0 6px 20px rgba(120, 110, 255, 0.35); }
.btn-primary:hover { box-shadow: 0 8px 28px rgba(120, 110, 255, 0.55); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.55; pointer-events: none; }
.btn-big { padding: 13px 18px; font-size: 15px; margin-top: 4px; }
.btn-ghost { background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line2); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.12); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { box-shadow: 0 6px 20px rgba(255, 92, 108, 0.4); }

.icon-btn {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  color: var(--dim); transition: background 0.16s, color 0.16s, transform 0.16s var(--bounce);
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); transform: translateY(-1px); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn.active { color: var(--acc1); }
.icon-btn.danger-hover:hover { background: rgba(255, 92, 108, 0.15); color: var(--red); }
.icon-btn.is-off { color: var(--red); }
.icon-btn svg { width: 19px; height: 19px; }

.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2); border-top-color: var(--acc1);
  animation: spin 0.8s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== раскладка приложения ========== */
.app-grid { display: grid; grid-template-columns: 264px 1fr auto; grid-template-rows: minmax(0, 1fr); animation: appIn 0.4s ease; }
.app-grid > * { min-height: 0; min-width: 0; }
@keyframes appIn { from { opacity: 0; } }

/* ---- сайдбар ---- */
.sidebar { display: flex; flex-direction: column; background: var(--bg1); border-right: 1px solid var(--line); min-width: 0; }
.sb-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 12px 14px 16px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(109, 124, 255, 0.08), transparent);
}
.sb-title { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-header-btns { display: flex; gap: 2px; }

.channels { flex: 1; overflow-y: auto; padding: 12px 8px; }
.ch-group { margin-bottom: 18px; }
.ch-group-head { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 6px; }
.ch-group-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--faint); }
.ch-group-add { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; color: var(--faint); transition: all 0.15s; }
.ch-group-add:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.ch-group-add svg { width: 14px; height: 14px; }

.ch-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 8px; border-radius: var(--r-sm); color: var(--dim);
  transition: background 0.15s, color 0.15s; position: relative; text-align: left;
}
.ch-item:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.ch-item.active { background: rgba(109, 124, 255, 0.16); color: #fff; }
.ch-item svg { width: 17px; height: 17px; opacity: 0.75; }
.ch-item-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.ch-item .ch-del { opacity: 0; width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; color: var(--faint); transition: all 0.15s; }
.ch-item:hover .ch-del { opacity: 1; }
.ch-del:hover { color: var(--red); background: rgba(255, 92, 108, 0.15); }
.ch-del svg { width: 13px; height: 13px; }
.ch-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center; animation: pop 0.3s var(--bounce);
}
@keyframes pop { from { transform: scale(0); } }
/* заглушённый канал: приглушённое имя, иконка «без звонка», точка вместо счётчика непрочитанных */
.ch-item.muted .ch-item-name { opacity: 0.5; }
.ch-item .ch-bell { display: grid; place-items: center; }
.ch-item .ch-bell svg { width: 13px; height: 13px; opacity: 0.6; }
.ch-badge.dot { min-width: 8px; width: 8px; height: 8px; padding: 0; border-radius: 50%; background: var(--dim); animation: none; }
/* личные сообщения */
.dm-av { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.dm-av.sm { width: 22px; height: 22px; }
.dm-col { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 1px; }
.dm-last { font-size: 11.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-empty { padding: 6px 10px; font-size: 12px; }
.dm-pick { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: var(--r-sm); color: var(--text); text-align: left; transition: background 0.15s; }
.dm-pick:hover { background: rgba(255, 255, 255, 0.06); }
.dm-pick.sel { background: rgba(109, 124, 255, 0.18); }
.dm-pick img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.dm-pick span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* очередь вложений (превью до отправки) */
.attach-preview { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 10px 0; }
.att-card { position: relative; display: flex; align-items: center; gap: 8px; max-width: 230px; padding: 6px 26px 6px 6px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 10px; }
.att-card.err { border-color: var(--red); }
.att-thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.att-ic { width: 40px; height: 40px; display: grid; place-items: center; color: var(--dim); flex-shrink: 0; }
.att-meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.att-name { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.att-size { font-size: 11px; color: var(--faint); }
.att-prog { height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.att-prog i { display: block; height: 100%; width: 0; background: var(--acc1); transition: width 0.15s; }
.att-card.done .att-prog { opacity: 0; }
.att-rm { position: absolute; top: 4px; right: 4px; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, 0.4); color: #fff; }
.att-rm:hover { background: var(--red); }

.ch-voice-users { padding: 2px 0 2px 26px; display: flex; flex-direction: column; gap: 2px; }
.ch-vu {
  display: flex; align-items: center; gap: 7px; padding: 3px 6px; border-radius: 7px;
  color: var(--dim); font-size: 13px; animation: fadeUp 0.25s ease;
}
.ch-vu img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; transition: box-shadow 0.15s; }
.ch-vu.speaking img { box-shadow: 0 0 0 2px var(--bg1), 0 0 0 4px var(--green); }
.ch-vu .vu-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-vu svg { width: 13px; height: 13px; color: var(--faint); }
.ch-vu svg.st-red { color: var(--red); }
.ch-vu svg.st-acc { color: var(--acc1); }

/* ---- голосовой док ---- */
.voice-dock {
  display: flex; align-items: center; gap: 8px; margin: 0 8px 6px;
  padding: 10px 12px; border-radius: var(--r-md);
  background: rgba(61, 220, 151, 0.08); border: 1px solid rgba(61, 220, 151, 0.2);
  animation: fadeUp 0.3s ease;
}
.voice-dock[hidden] { display: none; }
.vd-info { flex: 1; min-width: 0; }
.vd-status { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--green); }
.vd-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.4; transform: scale(0.8); } }
.vd-row { display: flex; gap: 8px; align-items: baseline; }
.vd-channel { font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vd-ping { font-size: 11px; color: var(--faint); flex-shrink: 0; }
.hangup { transform: rotate(135deg); }

/* ---- панель пользователя ---- */
.user-panel {
  display: flex; align-items: center; gap: 9px; padding: 10px 10px;
  background: rgba(0, 0, 0, 0.25); border-top: 1px solid var(--line);
}
.up-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.up-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.up-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-sub { font-size: 11.5px; color: var(--faint); }
.up-btns { display: flex; gap: 1px; }
.up-btns .icon-btn { width: 31px; height: 31px; }

/* ---- основная зона ---- */
.main { display: flex; flex-direction: column; background: var(--bg2); min-width: 0; position: relative; }
.ch-header {
  display: flex; align-items: center; gap: 9px; padding: 0 16px; height: 52px;
  border-bottom: 1px solid var(--line); flex-shrink: 0;
  background: rgba(0, 0, 0, 0.12);
}
.ch-icon { color: var(--faint); display: grid; place-items: center; }
.ch-name { font-weight: 700; font-size: 15.5px; }
.ch-header-right { margin-left: auto; display: flex; gap: 4px; }

/* ---- чат ---- */
.chat-view { flex: 1; display: flex; flex-direction: column; min-height: 0; position: relative; }
.msg-list { flex: 1 1 0; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 18px 16px 8px; display: flex; flex-direction: column; }
.date-divider { display: flex; align-items: center; gap: 12px; margin: 14px 0 10px; color: var(--faint); font-size: 11.5px; font-weight: 600; }
.date-divider::before, .date-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.msg { display: flex; gap: 13px; padding: 3px 10px; border-radius: var(--r-sm); animation: msgIn 0.25s ease; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } }
.msg:hover { background: rgba(255, 255, 255, 0.025); }
.msg.first { margin-top: 12px; }
.msg-ava { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; margin-top: 2px; }
.msg-ava-spacer { width: 40px; flex-shrink: 0; }
.msg-body { flex: 1; min-width: 0; }
.msg-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.msg-author { font-weight: 600; font-size: 14.5px; }
.msg-time { font-size: 11px; color: var(--faint); }
.msg-text { line-height: 1.45; white-space: pre-wrap; word-break: break-word; user-select: text; color: #dcdff0; }
.msg-text a { color: #7ab8ff; text-decoration: none; }
.msg-text a:hover { text-decoration: underline; }
.msg-text.jumbo { font-size: 42px; line-height: 1.2; }
.msg-pending { opacity: 0.6; }

.msg-embed { margin-top: 6px; }
.msg-embed img, .msg-embed video {
  max-width: min(440px, 100%); max-height: 330px; border-radius: var(--r-md);
  display: block; cursor: pointer; background: rgba(0, 0, 0, 0.3);
  transition: filter 0.15s, transform 0.2s;
}
.msg-embed img:hover { filter: brightness(1.08); }
.msg-embed audio { max-width: 380px; width: 100%; margin-top: 4px; }
.file-card {
  display: flex; align-items: center; gap: 11px; margin-top: 6px;
  max-width: 420px; padding: 11px 13px; border-radius: var(--r-md);
  background: var(--bg3); border: 1px solid var(--line);
  transition: border-color 0.15s, background 0.15s;
}
.file-card:hover { border-color: var(--line2); background: var(--bg4); }
.file-card svg { width: 26px; height: 26px; color: var(--acc1); }
.fc-info { flex: 1; min-width: 0; }
.fc-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #9fb6ff; }
a.fc-name { text-decoration: none; }
a.fc-name:hover { text-decoration: underline; }
.fc-size { font-size: 11.5px; color: var(--faint); }
.fc-progress { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.08); margin-top: 6px; overflow: hidden; }
.fc-progress i { display: block; height: 100%; width: 0; background: var(--acc-grad); transition: width 0.2s; border-radius: 2px; }

.chat-empty { margin: auto; text-align: center; color: var(--faint); animation: fadeUp 0.4s ease; }
.chat-empty .ce-emoji { font-size: 52px; display: block; margin-bottom: 12px; animation: wave 2.2s ease-in-out infinite; transform-origin: 70% 70%; }
@keyframes wave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(14deg); } 20%, 40% { transform: rotate(-8deg); } }

.scroll-down {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 7px; padding: 7px 14px;
  border-radius: 20px; background: var(--acc-grad); color: #fff;
  font-size: 12.5px; font-weight: 600; box-shadow: 0 6px 20px rgba(120, 110, 255, 0.4);
  animation: pop 0.3s var(--bounce); z-index: 5;
}
.scroll-down svg { width: 14px; height: 14px; }
.typing-bar { height: 20px; padding: 0 22px; font-size: 12px; color: var(--dim); display: flex; align-items: center; gap: 6px; }
.typing-dots { display: inline-flex; gap: 3px; }
.typing-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--dim); animation: tdot 1.2s ease-in-out infinite; }
.typing-dots i:nth-child(2) { animation-delay: 0.18s; }
.typing-dots i:nth-child(3) { animation-delay: 0.36s; }
@keyframes tdot { 30% { transform: translateY(-4px); opacity: 1; } 0%, 60%, 100% { transform: translateY(0); opacity: 0.45; } }

.composer {
  display: flex; align-items: flex-end; gap: 4px; margin: 0 16px 16px;
  padding: 7px 8px; border-radius: var(--r-lg);
  background: var(--bg3); border: 1px solid var(--line);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.composer:focus-within { border-color: rgba(109, 124, 255, 0.5); box-shadow: 0 0 0 3px rgba(109, 124, 255, 0.12); }
.comp-btn { flex-shrink: 0; }
.msg-input {
  flex: 1; resize: none; border: none; outline: none; background: transparent;
  color: var(--text); font: inherit; line-height: 1.45; padding: 7px 6px;
  max-height: 144px; overflow-y: auto;
}
.msg-input::placeholder { color: var(--faint); }
.send-btn { color: var(--acc1); animation: pop 0.25s var(--bounce); }
.send-btn:hover { color: #fff; background: var(--acc-grad); }

/* ---- голосовая комната ---- */
.voice-view { flex: 1; display: flex; flex-direction: column; min-height: 0; background: radial-gradient(ellipse at 50% 0%, rgba(109, 124, 255, 0.06), transparent 60%); }
.voice-view[hidden] { display: none; }
.voice-alone { text-align: center; padding: 18px 0 0; color: var(--dim); animation: fadeUp 0.4s ease; }
.voice-alone p { margin-bottom: 10px; }
/* обычная сетка: ровные тайлы 16:9, число колонок задаёт JS через --cols */
.voice-grid {
  flex: 1; min-height: 0; display: grid; gap: 12px; padding: 16px;
  grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr));
  place-content: center; justify-items: center; align-items: center;
  overflow-y: auto; overflow-x: hidden;
}
.voice-grid .tile { width: 100%; aspect-ratio: 16 / 9; max-height: 100%; }

/* режим фокуса: крупный тайл сверху + лента превью снизу (как в Discord) */
.voice-grid.focused { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 10px; }
.voice-grid.focused .tile { width: 158px; height: 90px; aspect-ratio: auto; flex: 0 0 auto; }
.voice-grid.focused .tile.focus-target {
  order: -1; flex: 0 0 100%; width: 100%;
  height: calc(100% - 102px); aspect-ratio: auto;
}

.tile {
  position: relative; border-radius: var(--r-lg); overflow: hidden;
  background: var(--bg3); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  animation: tileIn 0.35s var(--bounce);
  transition: border-color 0.2s, box-shadow 0.2s;
}
@keyframes tileIn { from { opacity: 0; transform: scale(0.92); } }
.tile.speaking { border-color: var(--green); box-shadow: 0 0 0 1.5px var(--green), 0 0 26px rgba(61, 220, 151, 0.25); }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.tile.mirror video { transform: scaleX(-1); }
.tile-ava-wrap { position: relative; display: grid; place-items: center; }
.tile-ava { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; transition: box-shadow 0.18s; }
.tile.speaking .tile-ava { box-shadow: 0 0 0 4px rgba(61, 220, 151, 0.9), 0 0 30px rgba(61, 220, 151, 0.5); }
.tile-name {
  position: absolute; left: 10px; bottom: 10px; display: flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 8px; background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px); font-size: 12.5px; font-weight: 600; z-index: 2; max-width: calc(100% - 20px);
}
.tile-name svg { width: 13px; height: 13px; color: var(--red); }
.tile-name .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-stats {
  position: absolute; right: 10px; top: 10px; padding: 3px 9px; border-radius: 7px;
  background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(8px);
  font-size: 11px; color: var(--green); font-weight: 600; z-index: 2;
}
.tile-actions { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 5px; opacity: 0; transition: opacity 0.18s; z-index: 2; }
.tile:hover .tile-actions { opacity: 1; }
.tile-actions button {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(8px); color: #fff;
}
.tile-actions button:hover { background: var(--acc1); }
.tile-actions svg { width: 15px; height: 15px; }
.voice-grid.focused .tile:not(.focus-target) .tile-ava { width: 40px; height: 40px; }
.voice-grid.focused .tile:not(.focus-target) .tile-stats,
.voice-grid.focused .tile:not(.focus-target) .tile-actions { display: none; }

/* ползунок громкости собеседника */
.vol-pop {
  position: fixed; z-index: 1250; width: 248px; padding: 14px 16px;
  background: var(--bg2); border: 1px solid var(--line2); border-radius: var(--r-md);
  box-shadow: var(--shadow); animation: pickerIn 0.18s var(--bounce);
}
.vol-pop-head { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.vol-pop-head img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.vol-pop-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vol-pop-row { display: flex; align-items: center; gap: 10px; }
.vol-pop-val { font-size: 12.5px; font-weight: 700; color: var(--acc1); min-width: 42px; text-align: right; font-variant-numeric: tabular-nums; }
.vol-slider { flex: 1; -webkit-appearance: none; appearance: none; height: 6px; border-radius: 3px; background: var(--bg4); outline: none; }
.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--acc-grad); cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  transition: transform 0.12s var(--bounce);
}
.vol-slider::-webkit-slider-thumb:hover { transform: scale(1.2); }
.vol-pop-reset { margin-top: 10px; width: 100%; font-size: 12px; padding: 6px; border-radius: 8px; color: var(--dim); background: var(--bg3); transition: all 0.15s; }
.vol-pop-reset:hover { background: var(--bg4); color: var(--text); }
.member-row, .ch-vu { cursor: pointer; }

.voice-controls {
  display: flex; justify-content: center; gap: 12px; padding: 16px 0 22px; flex-shrink: 0;
}
.vc-btn {
  width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--bg4); border: 1px solid var(--line2); color: var(--text);
  transition: all 0.18s var(--bounce);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}
.vc-btn:hover { transform: translateY(-3px); background: #2e3450; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4); }
.vc-btn:active { transform: scale(0.92); }
.vc-btn svg { width: 21px; height: 21px; }
.vc-btn.on { background: var(--acc-grad); border-color: transparent; box-shadow: 0 6px 20px rgba(120, 110, 255, 0.45); }
.vc-btn.off { background: rgba(255, 92, 108, 0.15); border-color: rgba(255, 92, 108, 0.4); color: var(--red); }
.vc-danger { background: var(--red); border-color: transparent; color: #fff; }
.vc-danger:hover { background: #ff7280; box-shadow: 0 10px 26px rgba(255, 92, 108, 0.5); }

/* ---- участники ---- */
.members { width: 224px; background: var(--bg1); border-left: 1px solid var(--line); display: flex; flex-direction: column; transition: width 0.25s ease, opacity 0.2s; overflow: hidden; }
.members.collapsed { width: 0; border-left: none; opacity: 0; }
.members-title { padding: 16px 16px 10px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.7px; color: var(--faint); white-space: nowrap; }
.members-list { flex: 1; overflow-y: auto; padding: 0 8px 12px; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--r-sm); transition: background 0.15s; animation: fadeUp 0.25s ease; }
.member-row:hover { background: rgba(255, 255, 255, 0.05); }
.member-row img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; transition: box-shadow 0.15s; }
.member-row.speaking img { box-shadow: 0 0 0 2px var(--bg1), 0 0 0 4px var(--green); }
.mr-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mr-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 5px; }
.mr-name .crown { width: 13px; height: 13px; color: var(--yellow); fill: var(--yellow); stroke: none; flex-shrink: 0; }
.mr-sub { font-size: 11px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mr-icons { display: flex; gap: 4px; color: var(--faint); }
.mr-icons svg { width: 14px; height: 14px; }
.mr-icons .st-red { color: var(--red); }
.mr-icons .st-acc { color: var(--acc1); }
.mr-icons .st-green { color: var(--green); }

/* ========== модалки ========== */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1100; display: grid; place-items: center;
  background: rgba(5, 6, 10, 0.65); backdrop-filter: blur(8px);
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal-backdrop.closing { animation: fadeOut 0.18s ease forwards; }
@keyframes fadeOut { to { opacity: 0; } }
.modal {
  width: 520px; max-width: calc(100vw - 48px); max-height: calc(100vh - 90px);
  display: flex; flex-direction: column;
  background: var(--bg2); border: 1px solid var(--line2); border-radius: 18px;
  box-shadow: var(--shadow); animation: modalIn 0.32s var(--bounce); overflow: hidden;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.92) translateY(14px); } }
.modal-backdrop.closing .modal { animation: modalOut 0.18s ease forwards; }
@keyframes modalOut { to { opacity: 0; transform: scale(0.95); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 0; }
.modal-title { font-size: 17px; font-weight: 700; }
.modal-body { padding: 16px 22px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 22px 20px; }
.modal.wide { width: 720px; }

/* переключатель */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 4px 0; }
.switch-label { font-weight: 600; font-size: 14px; }
.switch-desc { font-size: 12px; color: var(--faint); margin-top: 2px; }
.switch { position: relative; width: 42px; height: 24px; border-radius: 12px; background: var(--bg4); border: 1px solid var(--line2); transition: background 0.2s, border-color 0.2s; flex-shrink: 0; }
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
  border-radius: 50%; background: var(--dim); transition: transform 0.22s var(--bounce), background 0.2s;
}
.switch.on { background: var(--acc-grad); border-color: transparent; }
.switch.on::after { transform: translateX(18px); background: #fff; }

.select {
  width: 100%; padding: 10px 12px; border-radius: var(--r-md);
  background: var(--bg3); border: 1px solid var(--line); color: var(--text);
  font: inherit; outline: none; cursor: pointer; transition: border-color 0.18s;
}
.select:focus { border-color: var(--acc1); }
.select option { background: var(--bg2); }

/* табы настроек */
.tabs { display: flex; gap: 4px; padding: 14px 22px 0; border-bottom: 1px solid var(--line); }
.tab { padding: 9px 14px; border-radius: 9px 9px 0 0; font-weight: 600; font-size: 13.5px; color: var(--dim); position: relative; transition: color 0.18s; }
.tab:hover { color: var(--text); }
.tab.active { color: #fff; }
.tab.active::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2.5px; border-radius: 2px; background: var(--acc-grad); animation: growX 0.25s ease; }
@keyframes growX { from { transform: scaleX(0); } }

/* индикатор микрофона */
.meter { height: 10px; border-radius: 5px; background: rgba(0, 0, 0, 0.35); overflow: hidden; border: 1px solid var(--line); }
.meter i { display: block; height: 100%; width: 0; border-radius: 5px; background: linear-gradient(90deg, #3ddc97, #ffe06b 70%, #ff5c6c); transition: width 0.08s linear; }

/* превью камеры */
.cam-preview { width: 100%; aspect-ratio: 16/9; border-radius: var(--r-md); background: #000; object-fit: cover; transform: scaleX(-1); border: 1px solid var(--line); }

/* выбор источника экрана */
.src-tabs { display: flex; gap: 6px; }
.src-tab { padding: 7px 14px; border-radius: 9px; font-weight: 600; font-size: 13px; color: var(--dim); background: var(--bg3); border: 1px solid var(--line); transition: all 0.15s; }
.src-tab.active { color: #fff; background: rgba(109, 124, 255, 0.2); border-color: var(--acc1); }
.src-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; max-height: 320px; overflow-y: auto; padding: 2px; }
.src-card {
  border-radius: var(--r-md); overflow: hidden; border: 2px solid var(--line);
  background: var(--bg3); transition: border-color 0.15s, transform 0.18s var(--bounce); text-align: left;
}
.src-card:hover { transform: translateY(-2px); border-color: var(--line2); }
.src-card.selected { border-color: var(--acc1); box-shadow: 0 0 0 3px rgba(109, 124, 255, 0.25); }
.src-thumb { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: #000; display: block; }
.src-name { display: flex; align-items: center; gap: 7px; padding: 8px 10px; font-size: 12px; font-weight: 600; }
.src-name img { width: 16px; height: 16px; }
.src-name span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 7px 16px; border-radius: 20px; font-weight: 600; font-size: 13px; background: var(--bg3); border: 1px solid var(--line); color: var(--dim); transition: all 0.15s; }
.chip:hover { color: var(--text); border-color: var(--line2); }
.chip.active { background: var(--acc-grad); color: #fff; border-color: transparent; box-shadow: 0 4px 14px rgba(120, 110, 255, 0.35); }

/* инвайт */
.invite-ip {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-radius: var(--r-md); background: var(--bg3); border: 1px solid var(--line);
}
.invite-ip code { flex: 1; font-family: Consolas, monospace; font-size: 15px; color: #9fb6ff; user-select: text; }
.invite-ip small { color: var(--faint); }
.invite-note { font-size: 12.5px; color: var(--dim); line-height: 1.55; background: rgba(109, 124, 255, 0.07); border: 1px solid rgba(109, 124, 255, 0.18); border-radius: var(--r-md); padding: 12px 14px; }
.invite-note b { color: var(--text); }

/* аватар в настройках */
.avatar-edit-row { display: flex; align-items: center; gap: 16px; }
.avatar-edit-row .w-avatar { width: 76px; height: 76px; }

/* ========== эмодзи-пикер ========== */
.emoji-picker {
  position: fixed; z-index: 1200; width: 356px; height: 400px;
  background: var(--bg2); border: 1px solid var(--line2); border-radius: var(--r-lg);
  box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden;
  animation: pickerIn 0.25s var(--bounce); transform-origin: bottom right;
}
@keyframes pickerIn { from { opacity: 0; transform: scale(0.85) translateY(10px); } }
.ep-cats { display: flex; gap: 2px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.ep-cat { flex: 1; height: 34px; border-radius: 8px; font-size: 17px; display: grid; place-items: center; opacity: 0.55; transition: all 0.15s; }
.ep-cat:hover { background: rgba(255, 255, 255, 0.07); opacity: 1; }
.ep-cat.active { background: rgba(109, 124, 255, 0.18); opacity: 1; }
.ep-body { flex: 1; overflow-y: auto; padding: 8px 10px; }
.ep-section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--faint); padding: 8px 4px 4px; letter-spacing: 0.6px; }
.ep-grid { display: grid; grid-template-columns: repeat(8, 1fr); }
.ep-emoji { font-size: 21px; height: 38px; border-radius: 8px; display: grid; place-items: center; transition: background 0.12s, transform 0.12s var(--bounce); }
.ep-emoji:hover { background: rgba(255, 255, 255, 0.09); transform: scale(1.18); }

/* ========== тосты ========== */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 1400; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 10px; min-width: 240px; max-width: 380px;
  padding: 12px 16px; border-radius: var(--r-md);
  background: rgba(29, 33, 51, 0.92); backdrop-filter: blur(14px);
  border: 1px solid var(--line2); box-shadow: var(--shadow);
  font-size: 13.5px; font-weight: 500;
  animation: toastIn 0.35s var(--bounce);
}
@keyframes toastIn { from { opacity: 0; transform: translateX(60px); } }
.toast.hide { animation: toastOut 0.25s ease forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateX(60px); } }
.toast svg { width: 18px; height: 18px; flex-shrink: 0; }
.toast.ok svg { color: var(--green); }
.toast.error svg { color: var(--red); }
.toast.info svg { color: var(--acc1); }

/* ========== лайтбокс ========== */
.lightbox {
  position: fixed; inset: 0; z-index: 1300; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  background: rgba(5, 6, 10, 0.88); backdrop-filter: blur(10px); animation: fadeIn 0.2s ease;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 88vw; max-height: 80vh; border-radius: var(--r-md); animation: modalIn 0.3s var(--bounce); }
.lb-actions { display: flex; gap: 10px; }

/* ========== drag&drop ========== */
.drop-overlay { position: fixed; inset: var(--tb-h) 0 0 0; z-index: 1500; display: grid; place-items: center; background: rgba(9, 10, 16, 0.8); backdrop-filter: blur(6px); animation: fadeIn 0.15s ease; }
.drop-overlay[hidden] { display: none; }
.drop-box {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 46px 64px; border-radius: 24px; font-size: 17px; font-weight: 700;
  border: 2.5px dashed var(--acc1); background: rgba(109, 124, 255, 0.08);
  color: var(--text); animation: pop 0.3s var(--bounce);
}
.drop-box svg { width: 44px; height: 44px; color: var(--acc1); }

/* подсветка цели фокуса */
.tile.clickable { cursor: pointer; }

@media (max-width: 1100px) {
  .app-grid { grid-template-columns: 224px 1fr auto; }
}

/* ========== веб-версия (в браузере нет рамки окна) ========== */
.web { --tb-h: 0px; }
.web .titlebar { display: none; }
.mobile-only { display: none; }
.drawer-backdrop { position: fixed; inset: var(--tb-h) 0 0 0; z-index: 590; background: rgba(5, 6, 10, 0.55); backdrop-filter: blur(2px); animation: fadeIn 0.18s ease; }
.drawer-backdrop[hidden] { display: none; }

/* ========== мобильная вёрстка ========== */
@media (max-width: 760px) {
  .mobile-only { display: grid; }
  /* одна колонка, боковые панели — выезжающие «шторки» */
  .app-grid { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr); }
  .sidebar, .members {
    position: fixed; top: var(--tb-h); bottom: 0; z-index: 600;
    width: 84vw; max-width: 320px; transition: transform 0.26s var(--bounce);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
  }
  .sidebar { left: 0; transform: translateX(-102%); }
  .sidebar.open { transform: none; }
  .members { right: 0; width: 78vw; max-width: 300px; transform: translateX(102%); opacity: 1; border-left: 1px solid var(--line); }
  .members.collapsed { width: 78vw; opacity: 1; border-left: 1px solid var(--line); } /* на мобиле управляем через .open */
  .members.open { transform: none; }

  .ch-header { padding: 0 10px; gap: 6px; }
  .ch-name { font-size: 15px; }
  .msg-list { padding: 12px 10px 6px; }
  .composer { margin: 0 8px 10px; }
  .voice-controls { gap: 9px; padding: 12px 0 16px; flex-wrap: wrap; }
  .vc-btn { width: 48px; height: 48px; }
  .voice-grid { padding: 10px; gap: 8px; }
  .msg-actions { opacity: 1; } /* на тач-устройствах без ховера — действия видны сразу */
  .msg-embed img, .msg-embed video { max-width: 100%; }
  /* крупнее тач-цели */
  .ch-item { padding: 10px 8px; }
  .member-row { padding: 8px; }
  .modal, .modal.wide { width: calc(100vw - 20px); max-height: calc(100vh - 60px); }
  .emoji-picker { width: calc(100vw - 20px); }
  .welcome-card { padding: 28px 22px 22px; }
}
