:root {
  --bg: #0e1016;
  --panel: #151821;
  --panel-2: #1b1f2b;
  --line: #242938;
  --text: #e8eaf2;
  --muted: #8b91a7;
  --accent: #7c5cff;
  --accent-hover: #8c70ff;
  --bubble: #1e2331;
  --bubble-mine: #6a4dff;
  --input: #1b1f2b;
  --hover: #1c2130;
  --active: #262c40;
  --danger: #ff5d6c;
  --online: #3ddc84;
  --shadow: 0 10px 40px rgb(0 0 0 / .45);
  color-scheme: dark;
}


* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, textarea { font: inherit; color: inherit; }
a { color: var(--accent-hover); }

#app { height: 100dvh; display: flex; flex-direction: column; }

.ic { width: 22px; height: 22px; flex-shrink: 0; }

/* ---------- Desktop overlay window ---------- */

html.overlay, html.overlay body { background: transparent; }
html.overlay #app {
  height: 100vh;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg);
}
.overlay-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 34px;
  padding: 0 4px 0 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  -webkit-app-region: drag;
  user-select: none;
  flex-shrink: 0;
}
.overlay-bar .ob-title { flex: 1; display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.overlay-bar .ob-title .ic { width: 15px; height: 15px; color: var(--accent); }
.overlay-bar .icon-btn { -webkit-app-region: no-drag; width: 30px; height: 28px; }
.overlay-bar .icon-btn .ic { width: 16px; height: 16px; }

/* ---------- Common controls ---------- */

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  color: var(--muted);
  flex-shrink: 0;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.round { border-radius: 50%; }
.icon-btn.accent { background: var(--accent); color: #fff; }
.icon-btn.accent:hover { background: var(--accent-hover); color: #fff; }

.primary {
  height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.primary:hover { background: var(--accent-hover); }
.primary:disabled { opacity: .5; cursor: default; }
.link { color: var(--accent-hover); font-weight: 600; margin-top: 6px; }

.field {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--input);
  outline: none;
  font-size: 16px;
}
.field:focus { border-color: var(--accent); }

.seg { display: flex; padding: 3px; border-radius: 12px; background: var(--input); gap: 3px; }
.seg button { flex: 1; height: 34px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: 14px; }
.seg button.active { background: var(--panel); color: var(--text); box-shadow: 0 1px 4px rgb(0 0 0 / .2); }

.hint { color: var(--muted); text-align: center; padding: 24px 16px; font-size: 14px; }
.hint.small { padding: 8px; font-size: 12px; }

.avatar {
  --h: 250;
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  background: linear-gradient(135deg, hsl(var(--h) 70% 62%), hsl(calc(var(--h) + 30) 65% 48%));
}
.avatar.sm { width: 38px; height: 38px; font-size: 14px; }
.avatar .dot {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--online);
  border: 2px solid var(--panel);
}

.logo-big {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #8f74ff, #5a3cf0);
  color: #fff;
  margin: 0 auto 12px;
}
.logo-big .ic { width: 34px; height: 34px; }

.center-screen { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; text-align: center; color: var(--muted); }

/* ---------- Auth ---------- */

.auth { flex: 1; display: flex; align-items: center; justify-content: center; padding: 16px; overflow-y: auto; }
.auth-card {
  width: 100%;
  max-width: 380px;
  padding: 28px 22px;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.auth-card h1 { text-align: center; font-size: 22px; margin: 0 0 18px; }
.auth-card form { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.auth-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.form-error { color: var(--danger); font-size: 13px; min-height: 18px; }

/* ---------- Layout ---------- */

/* ничто не выезжает за край экрана: ни чат, «въезжающий» справа при открытии, ни стрелка свайпа —
   иначе на телефоне всю страницу можно чуть сдвинуть пальцем вбок */
html { overflow: hidden; }
.layout { flex: 1; display: flex; min-height: 0; overflow: hidden; }
.sidebar { width: 100%; display: flex; flex-direction: column; min-height: 0; background: var(--panel); }
.chat { display: none; flex: 1; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); position: relative; }
.layout.chat-open .sidebar { display: none; }
.layout.chat-open .chat { display: flex; }

@media (min-width: 760px) {
  /* ширину списка чатов человек двигает сам, она запоминается в этом браузере */
  .sidebar { width: var(--side-width, 340px); flex-shrink: 0; border-right: 1px solid var(--line); }
  .layout.chat-open .sidebar { display: flex; }
  .chat { display: flex; }
  .back { display: none; }
  .layout .side-grip { display: block; }   /* правило посильнее: базовое «спрятать» идёт ниже по файлу */
}

/* полоска между списком чатов и перепиской: тонкая, но ухватить легко */
.side-grip {
  display: none;
  position: relative;
  width: 7px;
  margin: 0 -4px 0 -3px;
  flex-shrink: 0;
  cursor: col-resize;
  z-index: 5;
  touch-action: none;
}
.side-grip::after {
  content: '';
  position: absolute;
  inset: 0 3px;
  border-radius: 2px;
  background: transparent;
  transition: background .15s;
}
.side-grip:hover::after, .layout.resizing .side-grip::after { background: var(--accent); }
.layout.resizing { cursor: col-resize; user-select: none; }

.side-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px 10px 14px;
  padding-top: max(10px, env(safe-area-inset-top));
}
.me { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.me b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me small { color: var(--muted); font-size: 12px; }
.me small.offline { color: #f5a524; }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 12px 8px;
  padding: 0 12px;
  height: 40px;
  border-radius: 12px;
  background: var(--input);
  color: var(--muted);
}
.search .ic { width: 18px; height: 18px; }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 16px; }

.chat-list { flex: 1; overflow-y: auto; padding: 0 6px 8px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
.chat-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 12px;
  text-align: left;
}
.chat-item:hover { background: var(--hover); }
.chat-item.active { background: var(--active); }
.ci-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ci-row { display: flex; align-items: center; gap: 8px; }
.ci-title { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-time { font-size: 12px; color: var(--muted); }
.ci-preview { flex: 1; font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.typing { color: var(--accent-hover); font-style: normal; }
.badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Chat ---------- */

.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); }

.chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 6px;
  padding-top: max(8px, env(safe-area-inset-top));
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
@media (min-width: 760px) { .chat-head { padding-left: 16px; } }
.chat-head .avatar { width: 40px; height: 40px; font-size: 15px; }
.ch-info { flex: 1; min-width: 0; }
.ch-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-status { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-status.online, .ch-status.typing { color: var(--accent-hover); }

.messages {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;          /* лента только листается вверх-вниз; вбок — это свайп «ответить» */
  padding: 8px 10px 12px;
}
.msg-inner { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; }

.day { display: flex; justify-content: center; margin: 14px 0 6px; position: sticky; top: 0; z-index: 1; }
.day span { font-size: 12px; padding: 3px 10px; border-radius: 10px; background: var(--panel-2); color: var(--muted); }

.msg { display: flex; margin-top: 8px; position: relative; }
.msg.grouped { margin-top: 2px; }
.msg.mine { justify-content: flex-end; }

/* Телефон: потянуть сообщение влево — ответить на него. Стрелка выезжает справа вместе с пузырём. */
.msg.swiping { transition: none; }
.msg.swipe-back { transition: transform .2s ease-out; }
.msg.swiping::after, .msg.swipe-back::after {
  content: '';
  position: absolute;
  right: -34px;
  top: 50%;
  width: 26px;
  height: 26px;
  margin-top: -13px;
  border-radius: 50%;
  background: var(--panel-2) url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 17 4 12 9 7'/%3E%3Cpath d='M20 18v-2a4 4 0 0 0-4-4H4'/%3E%3C/svg%3E") center / 15px no-repeat;
  opacity: var(--swipe-o, 0);
}
.msg.swipe-ready::after { background-color: var(--accent); }

.bubble {
  position: relative;
  max-width: min(80%, 540px);
  padding: 6px 10px;
  border-radius: 16px;
  background: var(--bubble);
  overflow-wrap: anywhere;
  box-shadow: 0 1px 1px rgb(0 0 0 / .08);
}
.mine .bubble { background: var(--bubble-mine); color: #fff; }
.mine .bubble a { color: #fff; }
.sender { font-size: 13px; font-weight: 600; margin-bottom: 2px; color: hsl(var(--h) 75% 68%); }
.text { white-space: pre-wrap; display: inline; }

.meta {
  float: right;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  line-height: 1;
  margin: 8px 0 -2px 10px;
  opacity: .65;
  user-select: none;
}
.tick .ic { width: 15px; height: 15px; }
.tick.read { opacity: 1; }

.type-image .bubble, .type-video .bubble { padding: 3px; }
.type-image .text, .type-video .text { display: block; padding: 4px 7px 0; }
/* Пузырь с подписью шириной ровно с картинку: иначе длинная подпись растягивала его, и сбоку
   оставалась полоса цвета темы. Ширину считает app.js по размеру самой картинки (--media-w). */
.type-image.has-text .bubble, .type-video.has-text .bubble { width: calc(var(--media-w, 340px) + 6px); }
.type-image.has-text img.media { width: 100%; }
/* и без подписи тоже: пузырь ровно по картинке, высота — по её пропорциям, без пустого места сбоку */
.type-image:not(.has-text):not(.small-media) .bubble { width: calc(var(--media-w, 340px) + 6px); }
.type-image:not(.small-media) img.media { width: 100%; max-width: 100%; height: auto; }
.media {
  display: block;
  max-width: min(340px, 100%);
  max-height: 420px;
  border-radius: 13px;
  background: rgb(0 0 0 / .2);
}
img.media { cursor: zoom-in; min-width: 120px; min-height: 80px; object-fit: cover; }
video.media { width: 340px; }
.type-image:not(.has-text) .meta {
  position: absolute;
  right: 9px;
  bottom: 9px;
  margin: 0;
  padding: 3px 6px;
  border-radius: 10px;
  background: rgb(0 0 0 / .55);
  color: #fff;
  opacity: 1;
}
.type-image.has-text .meta, .type-video .meta { margin-right: 7px; margin-bottom: 4px; }

.file { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; padding: 4px 0; min-width: 200px; }
.file-ico {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  flex-shrink: 0;
}
.mine .file-ico { background: rgb(255 255 255 / .2); }
.file-meta { display: flex; flex-direction: column; min-width: 0; }
.file-meta b { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.file-meta small { opacity: .7; }

.audio-file { display: flex; flex-direction: column; gap: 6px; padding: 4px 0; }
.audio-file audio { width: 260px; max-width: 100%; height: 36px; }
.file-name { font-size: 14px; font-weight: 600; }

.voice { --p: 0%; display: flex; align-items: center; gap: 8px; width: 274px; max-width: 100%; padding: 3px 0; }
.voice .play {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  flex-shrink: 0;
}
.mine .voice .play { background: #fff; color: var(--bubble-mine); }
.voice .play .ic { width: 18px; height: 18px; }
.wave { flex: 1; height: 30px; position: relative; cursor: pointer; }
.bars { position: absolute; inset: 0; display: flex; align-items: center; gap: 2px; }
.bars i { flex: 1; height: var(--b); border-radius: 2px; background: currentColor; opacity: .3; }
.bars.fill { clip-path: inset(0 calc(100% - var(--p)) 0 0); }
.bars.fill i { opacity: 1; }
.theirs .bars.fill i { background: var(--accent); }

/* докуда дослушал собеседник: своя полоска другим цветом, под полоской проигрывания */
.bars.heard { clip-path: inset(0 calc(100% - var(--heard, 0%)) 0 0); transition: clip-path .3s linear; }
.bars.heard i { opacity: .85; background: var(--online); }

/* точка у голосового, которое ещё не слушали */
.voice.unheard .play::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bubble);
}
.voice .play { position: relative; }
.mine .voice.unheard .play::after { border-color: var(--bubble-mine); }
.vdur { font-size: 12px; opacity: .8; min-width: 32px; font-variant-numeric: tabular-nums; }
.vspeed {
  flex-shrink: 0;
  min-width: 34px;
  padding: 2px 6px;
  border-radius: 9px;
  background: rgb(255 255 255 / .1);
  color: inherit;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  opacity: .75;
  cursor: pointer;
}
.vspeed:hover { opacity: 1; }
.voice.fast .vspeed { background: var(--accent); color: #fff; opacity: 1; }
.mine .vspeed { background: rgb(0 0 0 / .18); }
.mine .voice.fast .vspeed { background: #fff; color: var(--bubble-mine); }

/* ---------- Uploads ---------- */

.uploads { display: flex; flex-direction: column; gap: 4px; padding: 0 12px; }
.uploads:not(:empty) { padding-bottom: 6px; }
.upload {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--panel);
  font-size: 13px;
}
.up-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress { width: 90px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.up-pct { width: 36px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Composer ---------- */

.composer {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 8px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  background: var(--panel);
  border-top: 1px solid var(--line);
}
/* клавиатура открыта — полоски жестов под полем уже не видно, отступ под неё не нужен */
html.kb-open .composer {
  padding-bottom: 8px;
  flex-shrink: 0;
}
.composer textarea {
  flex: 1;
  min-width: 0;
  resize: none;
  max-height: 160px;
  min-height: 40px;
  padding: 9px 14px;
  border-radius: 20px;
  border: 0;
  outline: none;
  background: var(--input);
  font-size: 16px;
  line-height: 22px;
}
.composer .send { display: none; }
.composer.has-text .send { display: inline-flex; }
.composer.has-text .mic { display: none; }

.rec-panel { display: none; }
.composer.recording > :not(.rec-panel) { display: none !important; }
.composer.recording .rec-panel { display: flex; flex: 1; align-items: center; gap: 10px; }
/* кружок записи дышит в такт голосу: --level ставит app.js, 0 — тишина, 1 — громко */
.rec-panel { --level: 0; }
.rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
  animation: pulse 1s infinite;
  transform: scale(calc(1 + var(--level) * 1.1));
  box-shadow: 0 0 0 calc(var(--level) * 10px) rgb(255 93 108 / .18);
  transition: transform .08s linear, box-shadow .08s linear;
}
@media (prefers-reduced-motion: reduce) {
  .rec-dot { transform: none; animation: none; }
}
.rec-time { font-variant-numeric: tabular-nums; font-weight: 600; }
.rec-hint { flex: 1; color: var(--muted); font-size: 14px; }
@keyframes pulse { 50% { opacity: .25; } }

.chat.drop::after {
  content: 'Отпустите, чтобы отправить';
  position: absolute;
  inset: 10px;
  border: 2px dashed var(--accent);
  border-radius: 16px;
  background: rgb(124 92 255 / .12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  pointer-events: none;
}

/* ---------- Modal ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgb(0 0 0 / .5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: max(40px, env(safe-area-inset-top)) 12px 12px;
}
.overlay .backdrop { padding-top: 44px; }
.modal {
  width: 100%;
  max-width: 440px;
  max-height: calc(100dvh - 60px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.modal[data-mode="direct"] .group-only { display: none; }
.modal-head { display: flex; align-items: center; gap: 8px; }
.modal-head .seg { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 5px 10px; border-radius: 14px; background: var(--active); font-size: 13px; cursor: pointer; }
.user-results { overflow-y: auto; min-height: 80px; }
.user-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; text-align: left; }
.user-row:hover { background: var(--hover); }
.user-row .avatar { width: 40px; height: 40px; font-size: 15px; }
.ur-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ur-meta small { color: var(--muted); }
.check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); }
.user-row.selected .check { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--panel); }

/* ---------- Popover, viewer, toast ---------- */

/* кнопки и всплывающие меню — не текст: долгое нажатие на телефоне открывает меню, а не выделяет слово */
button, .popover, .chat-list { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

.popover.over-call { z-index: 110; }   /* меню трансляции — поверх окна звонка */

.popover {
  position: fixed;
  z-index: 60;
  width: 220px;
  padding: 6px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.popover button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 9px; text-align: left; }
.popover button:hover { background: var(--hover); }
.popover .ic { width: 18px; height: 18px; color: var(--muted); }
.popover .danger, .popover .danger .ic { color: var(--danger); }

.viewer {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgb(0 0 0 / .92);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-dl { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; color: #fff; background: rgb(255 255 255 / .12); }

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom));
  z-index: 80;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 12px;
  background: #2a2f40;
  color: #fff;
  font-size: 14px;
  box-shadow: var(--shadow);
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* полоски прокрутки: тонкие и незаметные, пока в них не ткнули мышью */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: transparent;
  border: 3px solid transparent;
  border-radius: 6px;
  background-clip: padding-box;
  box-shadow: inset 0 0 0 10px var(--line);
}
::-webkit-scrollbar-thumb:hover { box-shadow: inset 0 0 0 10px var(--muted); }
::-webkit-scrollbar-track { background: transparent; }
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
::selection { background: color-mix(in srgb, var(--accent) 45%, transparent); }

/* ---------- Avatars ---------- */

.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.avatar:has(img) { background: var(--panel-2); }
.avatar.saved { background: linear-gradient(135deg, hsl(285 80% 62%), hsl(330 78% 55%)); color: #fff; }
.avatar.saved .ic { width: 22px; height: 22px; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }
.avatar.xl { width: 112px; height: 112px; font-size: 40px; }
.avatar.xl .dot { width: 22px; height: 22px; border-width: 4px; border-color: var(--bg); }
.avatar.xl.saved .ic { width: 48px; height: 48px; }

.me-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 4px 4px;
  margin-left: -4px;
  border-radius: 12px;
  text-align: left;
}
.me-btn:hover { background: var(--hover); }

.ch-click {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 3px 8px 3px 3px;
  border-radius: 12px;
  text-align: left;
}
.ch-click:not(:disabled):hover { background: var(--hover); }
.ch-click:disabled { cursor: default; }
.ch-info { display: flex; flex-direction: column; }

.fwd { font-size: 12px; font-weight: 600; color: var(--accent-hover); margin-bottom: 2px; }
.mine .fwd { color: rgb(255 255 255 / .85); }
.type-image .fwd, .type-video .fwd { padding: 4px 7px 2px; }

@media (pointer: coarse) {
  .bubble { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
}

.popover a { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 9px; color: inherit; text-decoration: none; }
.popover a:hover { background: var(--hover); }
.popover a .ic { width: 18px; height: 18px; color: var(--muted); }

.viewer video { max-width: 100%; max-height: 100%; cursor: default; }
.viewer-close { position: absolute; top: max(12px, env(safe-area-inset-top)); left: 12px; color: #fff; background: rgb(255 255 255 / .12); }

/* ---------- Pages (profile, Mail, settings) ---------- */

.page-backdrop { display: none; }
.page {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  animation: page-in .18s ease-out;
}
.page-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px 8px 6px;
  padding-top: max(8px, env(safe-area-inset-top));
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.page-title { flex: 1; font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding-bottom: env(safe-area-inset-bottom); }
@keyframes page-in { from { transform: translateX(24px); opacity: 0; } }
@keyframes pop-in { from { transform: scale(.97); opacity: 0; } }

@media (min-width: 760px) {
  html:not(.overlay) .page-backdrop { display: block; position: fixed; inset: 0; z-index: 39; background: rgb(0 0 0 / .5); }
  html:not(.overlay) .page {
    top: 20px;
    bottom: 20px;
    left: 50%;
    right: auto;
    width: 580px;
    margin-left: -290px;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    animation: pop-in .18s ease-out;
  }
}
html.overlay .page { top: 35px; left: 1px; right: 1px; bottom: 1px; border-radius: 0 0 13px 13px; }

/* ---------- Profile ---------- */

.profile { max-width: 580px; margin: 0 auto; padding-bottom: 24px; }
/* Насколько высоко обложка накрывает профиль — выбор хозяина профиля, его видят все.
   Отступы заданы в процентах от ширины: на телефоне и на компьютере картина одинаковая. */
.profile-cover {
  --h: 250;
  /* ровно та же полоса, которую человек выбрал в кадрировании обложки — иначе часть картинки
     обрезалась бы и обложка выглядела бы случайным куском */
  aspect-ratio: 2 / 1;
  background:
    radial-gradient(circle at 20% 10%, hsl(var(--h) 85% 70% / .8), transparent 55%),
    radial-gradient(circle at 90% 90%, hsl(calc(var(--h) + 80) 80% 60% / .6), transparent 50%),
    linear-gradient(135deg, hsl(var(--h) 65% 42%), hsl(calc(var(--h) + 50) 60% 30%));
}
/* Высота обложки — ползунок: --ck от 0 (тонкая полоса сверху) до 1 (накрывает и имя, и кнопки).
   Наезд задан в пикселях, потому что аватарка одного размера на любом экране; чтобы обложку было
   видно и на узком телефоне, ей задана наименьшая высота. */
.profile { --ck: .5; }
.profile-cover {
  aspect-ratio: calc(3 / (1 + var(--ck)));
  min-height: calc(180px + 150px * var(--ck));
  max-height: calc(210px + 400px * var(--ck));
  /* без этого браузер «переносит» наименьшую высоту через пропорцию в ширину — и на телефоне
     обложка становилась шире экрана, а вся страница ездила вбок */
  min-width: 0;
  max-width: 100%;
  /* ширина — всегда во всю страницу: пропорция задаёт высоту, а не сужает шапку */
  width: 100%;
}
.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 16px;
  /* две прямые через три опорные точки: 0 — полоса (−34), середина — имя на краю обложки (−174),
     1 — обложка кончается сразу под кнопками (−246: высота карточки с аватаркой, именем и кнопками + 8) */
  margin-top: max(calc(-34px - 280px * var(--ck)), calc(-102px - 144px * var(--ck)));
}

/* Когда имя лежит на картинке, оно должно читаться при любой её яркости. */
.profile.cover-on .profile-cover.has-image + .profile-card .profile-name,
.profile.cover-on .profile-cover.has-image + .profile-card .profile-sub {
  color: #fff;
  text-shadow: 0 1px 6px rgb(0 0 0 / .55);
}
.profile-avatar { border-radius: 50%; padding: 4px; background: var(--bg); box-shadow: 0 2px 10px rgb(0 0 0 / .18); }
.profile-avatar[data-p] { cursor: zoom-in; }
.profile-name { margin: 10px 0 2px; font-size: 22px; overflow-wrap: anywhere; }
.profile-sub { color: var(--muted); font-size: 14px; }
.online { color: var(--online); }
.profile-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; justify-content: center; }

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 20px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}
.pill:hover { background: var(--hover); }
.pill .ic { width: 18px; height: 18px; }
.pill[hidden] { display: none; }
.pill.primary-pill { background: var(--accent); border-color: var(--accent); color: #fff; }
.pill.primary-pill:hover { background: var(--accent-hover); }
.pill.ghost { background: transparent; }
.pill.sm { height: 34px; padding: 0 12px; font-size: 13px; }
.pill-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pill-count:empty { display: none; }
.mail-pill { background: linear-gradient(135deg, rgb(124 92 255 / .2), rgb(95 184 255 / .2)); border-color: rgb(124 92 255 / .5); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; margin: 12px 12px 0; overflow: hidden; }
.card.pad { padding: 14px; }
.card-title { display: flex; align-items: center; gap: 8px; font-size: 15px; margin: 0 0 12px; }
.card-title .ic { width: 18px; height: 18px; color: var(--accent-hover); }

.section-title { margin: 20px 16px 0; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.section-title small { text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: 6px; }
.section-title.row { display: flex; justify-content: space-between; align-items: center; }

.info-row { display: flex; align-items: center; gap: 12px; padding: 12px 8px 12px 14px; }
.info-row + .info-row { border-top: 1px solid var(--line); }
.info-ico {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgb(124 92 255 / .15);
  color: var(--accent-hover);
  flex-shrink: 0;
}
.info-ico .ic { width: 18px; height: 18px; }
.info-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.info-text > a { color: var(--text); text-decoration: none; font-weight: 600; font-size: 16px; }
.info-text small { color: var(--muted); font-size: 12px; }
.bio { white-space: pre-wrap; overflow-wrap: anywhere; }

.links-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin: 10px 12px 0; }
.link-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 10px 12px 10px 10px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  transition: transform .15s, border-color .15s;
}
.link-tile:hover { transform: translateY(-1px); border-color: var(--accent); }
.lt-ico {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -.02em;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .12);
}
.lt-ico .ic { width: 20px; height: 20px; }
.lt-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lt-text b, .lt-text small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lt-text small { color: var(--muted); }
.link-tile > .ic { width: 16px; height: 16px; color: var(--muted); }
.empty-links { width: calc(100% - 24px); display: flex; align-items: center; gap: 12px; padding: 14px; color: var(--muted); text-align: left; border-style: dashed; }

.menu-card button, .menu-card > a { width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px; text-align: left; }
.menu-card > a { color: inherit; text-decoration: none; }
.menu-card button + button, .menu-card > a + a { border-top: 1px solid var(--line); }
.menu-card button:hover, .menu-card > a:hover { background: var(--hover); }
.menu-card button span, .menu-card > a span { flex: 1; }
.menu-card .ic { width: 20px; height: 20px; color: var(--muted); }
.menu-card .danger, .menu-card .danger .ic { color: var(--danger); }

.list-card .user-row { border-radius: 0; padding: 10px 14px; }
.list-card .user-row + .user-row { border-top: 1px solid var(--line); }
.user-row > .ic { width: 18px; height: 18px; color: var(--muted); }

/* ---------- Forms ---------- */

.form-page { max-width: 580px; margin: 0 auto; padding-bottom: 24px; display: flex; flex-direction: column; }
.form-pad { padding: 16px; gap: 14px; }
.form-pad .section-title { margin: 8px 0 0; }
.form-label { position: relative; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field.textarea { height: auto; min-height: 44px; padding: 10px 14px 22px; resize: vertical; line-height: 1.4; }
.counter { position: absolute; right: 12px; bottom: 6px; font-size: 11px; }
.switch-row { display: flex; align-items: center; gap: 12px; cursor: pointer; font-size: 14px; }
.switch-row input { display: none; }
.switch { position: relative; width: 44px; height: 26px; border-radius: 13px; background: var(--line); flex-shrink: 0; transition: background .2s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch-row input:checked + .switch { background: var(--accent); }
.switch-row input:checked + .switch::after { transform: translateX(18px); }
.avatar-edit { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.avatar-edit.busy { opacity: .6; pointer-events: none; }
.avatar-edit-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.link-edit { display: flex; align-items: flex-start; gap: 10px; padding: 10px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.link-edit + .link-edit { margin-top: 8px; }
.link-edit-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.link-edit .field { height: 38px; }
.links-editor .hint { padding: 8px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.muted { color: var(--muted); }
.note { display: flex; gap: 10px; margin: 16px; font-size: 13px; }
.note .ic { width: 18px; height: 18px; flex-shrink: 0; }
.danger-link { color: var(--danger); text-transform: none; letter-spacing: 0; font-size: 13px; margin: 0; }
.danger-link[hidden] { display: none; }

.session { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.session + .session { border-top: 1px solid var(--line); }
.session-ico { width: 38px; height: 38px; border-radius: 10px; background: var(--panel-2); display: flex; align-items: center; justify-content: center; color: var(--muted); flex-shrink: 0; }
.session-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.session-info small { color: var(--muted); }

/* ---------- Mail ---------- */

.mail { max-width: 640px; margin: 0 auto; padding-bottom: 24px; }
.mail-hero { display: flex; align-items: center; gap: 12px; padding: 16px 16px 4px; }
.mail-hero-text { display: flex; flex-direction: column; min-width: 0; }
.mail-hero-text b { font-size: 17px; }
.mail-hero-text small { color: var(--muted); }

.mail-composer { padding: 12px; transition: border-color .15s; }
.mail-composer.drop { border-color: var(--accent); border-style: dashed; }
.mc-text { width: 100%; min-height: 48px; border: 0; outline: none; background: transparent; resize: none; font-size: 16px; line-height: 1.45; }
.mc-files { display: flex; flex-wrap: wrap; gap: 8px; }
.mc-files:not(:empty) { margin: 6px 0 10px; }
.mc-thumb { position: relative; width: 76px; height: 76px; border-radius: 12px; overflow: hidden; }
.mc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.mc-thumb button, .mc-chip button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgb(0 0 0 / .6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mc-thumb button .ic, .mc-chip button .ic { width: 14px; height: 14px; }
.mc-chip { position: relative; display: flex; align-items: center; gap: 8px; height: 40px; max-width: 240px; padding: 0 36px 0 10px; border-radius: 12px; background: var(--panel-2); font-size: 13px; }
.mc-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-chip > .ic { width: 18px; height: 18px; color: var(--accent-hover); flex-shrink: 0; }
.mc-chip button { top: 9px; right: 8px; }
.mc-bar { display: flex; align-items: center; gap: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.mc-progress { flex: 1; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.mc-progress[hidden] { display: none; }
.mc-progress i { display: block; width: 0; height: 100%; background: var(--accent); transition: width .2s; }
.mc-bar .primary { margin-left: auto; }
.primary.sm { height: 34px; padding: 0 14px; border-radius: 10px; font-size: 14px; }

.mail-tabs { margin: 14px 12px 0; }
.mail .more { display: flex; margin: 14px auto 0; }
.mail-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 40px 24px; color: var(--muted); text-align: center; }
.mail-empty .ic { width: 40px; height: 40px; color: var(--accent-hover); margin-bottom: 6px; }
.mail-empty b { color: var(--text); font-size: 16px; }

.post { padding: 10px 14px 14px; }
.post-head { display: flex; align-items: center; justify-content: space-between; min-height: 30px; }
.post-date { font-size: 12px; color: var(--muted); }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn.sm .ic { width: 16px; height: 16px; }
.post-text { margin: 2px 0; font-size: 15px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.post-media { display: grid; grid-template-columns: repeat(2, 1fr); grid-auto-rows: 180px; gap: 4px; margin-top: 10px; border-radius: 12px; overflow: hidden; }
.post-media > * { display: block; width: 100%; height: 100%; object-fit: cover; background: rgb(0 0 0 / .25); }
.post-media img { cursor: zoom-in; }
.post-media.n-1 { grid-template-columns: 1fr; grid-auto-rows: auto; }
.post-media.n-1 > * { height: auto; max-height: 520px; object-fit: contain; }
.post-media.n-3 > :first-child { grid-row: span 2; }
.post-files { display: flex; flex-direction: column; margin-top: 10px; border-radius: 12px; background: var(--panel-2); overflow: hidden; }

.file-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; color: inherit; text-decoration: none; }
.file-row + .file-row { border-top: 1px solid var(--line); }
a.file-row:hover { background: var(--hover); }
.file-row > .ic { width: 18px; height: 18px; color: var(--muted); }
.file-row .file-ico { width: 40px; height: 40px; }
.file-row .file-ico .ic { width: 20px; height: 20px; }
.file-row .file-meta { flex: 1; }
.file-row .file-meta b { max-width: none; }
.audio-row audio { width: 100%; height: 34px; margin-top: 4px; }

.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 12px 12px 0; border-radius: 14px; overflow: hidden; }
.g-item { position: relative; aspect-ratio: 1; overflow: hidden; background: var(--panel-2); cursor: zoom-in; }
.g-item img, .g-item video { display: block; width: 100%; height: 100%; object-fit: cover; }
.g-play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgb(0 0 0 / .55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.g-play .ic { width: 18px; height: 18px; }

/* ---------- Connection indicator ---------- */

.net-line { display: flex; align-items: center; gap: 5px; white-space: nowrap; overflow: hidden; }
.net-sep { opacity: .5; }
.net-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #5b6072;
  transition: background .3s, box-shadow .3s;
}
.net-dot.green { background: #3ddc84; box-shadow: 0 0 6px rgb(61 220 132 / .7); }
.net-dot.yellow { background: #f5c542; box-shadow: 0 0 6px rgb(245 197 66 / .6); }
.net-dot.red { background: #ff5d6c; box-shadow: 0 0 6px rgb(255 93 108 / .6); }
.net-dot.black { background: #14161c; box-shadow: 0 0 0 2px #5b6072; }
.chat-head > .net-dot { margin: 0 8px 0 4px; }

/* ---------- Editing, deleted and edited messages ---------- */

.edit-bar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 6px 14px;
  background: var(--panel);
  border-top: 1px solid var(--line);
}
.edit-bar.show { display: flex; }
.edit-ico { display: flex; color: var(--accent-hover); }
.edit-ico .ic { width: 18px; height: 18px; }
.edit-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; }
.edit-text b { color: var(--accent-hover); }
.edit-text small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.edit-bar.show + .composer { border-top: 0; }
.composer.editing .attach, .composer.editing .mic { display: none; }
.composer.editing .send { display: inline-flex; }

.msg.deleted .bubble { background: transparent; border: 1px dashed var(--line); color: var(--muted); box-shadow: none; }
.deleted-text { display: inline-flex; align-items: center; gap: 6px; font-style: italic; font-size: 14px; }
.deleted-text .ic { width: 15px; height: 15px; }
.edited { font-style: italic; margin-right: 3px; }
.ci-lock { display: inline-flex; margin-right: 4px; color: var(--muted); vertical-align: -2px; }
.ci-lock .ic { width: 13px; height: 13px; }

/* ---------- New chat / groups search ---------- */

.newchat:not([data-tab="create"]) .tab-create { display: none; }
.newchat .seg button { font-size: 13px; }
.prefix-field {
  display: flex;
  align-items: center;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--input);
  overflow: hidden;
}
.prefix-field:focus-within { border-color: var(--accent); }
.prefix-field > span { padding: 0 2px 0 12px; color: var(--accent-hover); font-weight: 700; }
.prefix-field input { flex: 1; min-width: 0; height: 100%; padding-right: 12px; border: 0; outline: none; background: transparent; font-size: 16px; color: var(--text); }
.section-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.small-text { font-size: 13px; }
.field.sm { height: 34px; padding: 0 10px; font-size: 14px; }
.field[hidden] { display: none; }
.tag { padding: 2px 8px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); font-size: 11px; color: var(--muted); white-space: nowrap; }
.tag.role-owner { color: #f5c542; border-color: rgb(245 197 66 / .4); }
.tag.role-admin { color: #ff8a65; border-color: rgb(255 138 101 / .4); }
.tag.role-moderator { color: #5fb8ff; border-color: rgb(95 184 255 / .4); }

.group-hit { padding: 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel-2); }
.group-hit + .group-hit { margin-top: 8px; }
.gh-head { display: flex; align-items: center; gap: 12px; }
.gh-head .avatar { width: 40px; height: 40px; font-size: 15px; }
.gh-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.gh-actions:empty { display: none; }
.join-password { display: flex; flex: 1; gap: 6px; min-width: 220px; }
.join-password input { flex: 1; min-width: 0; }
.gh-error { min-height: 0; margin-top: 6px; }
.gh-error:empty { display: none; }

/* ---------- Dialogs ---------- */

.dialog-backdrop { z-index: 90; align-items: center; }
/* выбор окна для показа экрана должен быть выше полноэкранного звонка (z-index 95), иначе он
   «появляется» только после выхода из полного экрана */
.dialog-backdrop:has(.source-picker) { z-index: 120; }
.dialog { max-width: 380px; gap: 12px; padding: 18px; }
.dialog h3 { margin: 0; font-size: 17px; }
.dialog p { margin: 0; font-size: 14px; }
.dialog-buttons { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.dialog-buttons .pill, .dialog-buttons .primary { width: 100%; }
.danger-btn { background: var(--danger); }
.danger-btn:hover { background: #ff7582; }
.danger-text { color: var(--danger); }

/* ---------- Group page ---------- */

.privacy { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 4px; }
.privacy .ic { width: 14px; height: 14px; }
.member-row { gap: 8px; }
.member-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; text-align: left; }
.member-main .avatar { width: 40px; height: 40px; font-size: 15px; }
.section-title.row .link { margin: 0; text-transform: none; letter-spacing: 0; font-size: 13px; }
.row-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.small-note { margin: 0 0 10px; font-size: 13px; }
.password-card { margin-bottom: 24px; }

/* ---------- Goals ---------- */

.goals { max-width: 640px; margin: 0 auto; padding-bottom: 24px; }
.goals-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 0; }
.switch-row.small { font-size: 13px; }
.switch-row.small .switch { width: 36px; height: 22px; }
.switch-row.small .switch::after { width: 16px; height: 16px; }
.switch-row.small input:checked + .switch::after { transform: translateX(14px); }
.goal { padding: 14px; }
.goal.archived { opacity: .6; }
.goal-head { display: flex; align-items: center; gap: 8px; }
.goal-head h3 { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; margin: 0; font-size: 16px; }
.goal-head h3 .ic { width: 18px; height: 18px; flex-shrink: 0; color: var(--accent-hover); }
.goal-head h3 span { overflow-wrap: anywhere; }
.goal-desc { margin-top: 6px; color: var(--muted); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.goal-media { display: block; max-width: 100%; max-height: 220px; margin-top: 10px; border-radius: 12px; cursor: zoom-in; }
.goal-file { margin-top: 10px; border-radius: 12px; background: var(--panel-2); }
.goal-progress { position: relative; height: 12px; margin-top: 14px; border-radius: 6px; background: var(--panel-2); overflow: hidden; }
.goal-progress i {
  display: block;
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--accent), #5fb8ff);
  transition: width .4s ease;
}
.goal.completed .goal-progress i { background: linear-gradient(90deg, #2fbf71, #3ddc84); }
.goal.overdue .goal-progress i { background: linear-gradient(90deg, #ff5d6c, #ff8a65); }
.goal-numbers { display: flex; align-items: baseline; justify-content: space-between; margin-top: 6px; font-size: 13px; color: var(--muted); }
.goal-numbers b { font-size: 18px; color: var(--text); }
.goal-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 10px; font-size: 13px; }
.goal-deadline { color: var(--muted); }
.goal-status { display: inline-flex; align-items: center; gap: 4px; color: var(--accent-hover); }
.goal-status .ic { width: 14px; height: 14px; }
.goal-status.done { color: var(--online); }
.goal-status.overdue { color: var(--danger); }
.goal-controls { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.goal-value { width: 96px; text-align: center; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 10px; }
.goal-form:not([data-deadline="date"]) .deadline-date { display: none; }
.goal-form:not([data-deadline="timer"]) .deadline-timer { display: none; }
.goal-current-file:empty { display: none; }
.goal-current-file .mc-chip { display: inline-flex; margin-bottom: 8px; }

/* ---------- Group Mail ---------- */

.gm-intro { display: flex; gap: 10px; margin: 14px 16px 0; font-size: 13px; }
.gm-intro .ic { width: 18px; height: 18px; flex-shrink: 0; }
.gm-new summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}
.gm-new summary::-webkit-details-marker { display: none; }
.gm-new summary .ic { width: 18px; height: 18px; color: var(--accent-hover); }
.gm-new[open] summary { border-bottom: 1px solid var(--line); }
.gm-composer, .reply-composer { display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.reply-composer { margin-bottom: 24px; }
.gm-composer.drop, .reply-composer.drop { outline: 2px dashed var(--accent); }
.gm-subject { font-weight: 600; }
.gm-thread { display: block; width: calc(100% - 24px); padding: 12px 14px; text-align: left; }
.gm-thread:hover { border-color: var(--accent); }
.gm-head, .letter-head { display: flex; align-items: center; gap: 10px; }
.gm-preview {
  display: -webkit-box;
  margin-top: 8px;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.gm-meta { display: flex; align-items: center; gap: 12px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.gm-meta span { display: inline-flex; align-items: center; gap: 4px; }
.gm-meta .ic { width: 13px; height: 13px; }
.gm-activity { margin-left: auto; }
.letter { padding: 14px; }
.letter.reply { margin-left: 28px; }
.letter-subject { margin: 0 0 12px; font-size: 20px; overflow-wrap: anywhere; }
.letter-head .ur-meta { flex: 1; }
.letter-body { margin-top: 10px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- Notifications, block list, server status ---------- */

.badge.muted { background: var(--muted); }
.ci-mute { display: inline-flex; vertical-align: -2px; margin-left: 6px; color: var(--muted); }
.ci-mute .ic { width: 14px; height: 14px; }

.pop-label { display: flex; flex-direction: column; line-height: 1.25; }
.pop-label small { color: var(--muted); font-size: 12px; }
.pop-note { padding: 0 10px 6px 38px; margin-top: -4px; font-size: 12px; color: var(--muted); }

.composer.hidden { display: none; }
.blocked-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}
.blocked-bar[hidden] { display: none; }
.blocked-bar span { display: inline-flex; align-items: center; gap: 8px; }
.blocked-bar .ic { width: 18px; height: 18px; color: var(--danger); }

button.switch { padding: 0; border: 0; cursor: pointer; }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(18px); }

.notify-state { display: flex; align-items: center; gap: 12px; }
.notify-state > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.notify-state b { font-size: 16px; }
.notify-ico {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgb(124 92 255 / .15);
  color: var(--accent-hover);
}
.notify-ico .ic { width: 22px; height: 22px; }
.notify-card.is-off .notify-ico { background: var(--panel-2); color: var(--muted); }
.notify-card .section-title { margin: 16px 0 8px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-row .pill { height: 36px; font-size: 14px; }
.note.warn .ic { color: var(--danger); }
.card > .note { margin: 14px; }

.session-user { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; text-align: left; }

.status-hero { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.status-hero > div:not(.status-uptime) { flex: 1; min-width: 150px; display: flex; flex-direction: column; gap: 2px; }
.status-hero b { font-size: 16px; }
.status-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--online);
  box-shadow: 0 0 0 5px rgb(61 220 132 / .18);
  animation: pulse 2s infinite;
}
.status-hero.down .status-dot { background: var(--danger); box-shadow: 0 0 0 5px rgb(255 93 108 / .18); }
.status-uptime { display: flex; flex-direction: column; align-items: flex-end; }
.status-uptime small { color: var(--muted); font-size: 12px; }
.status-uptime b { font-size: 26px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; margin: 10px 12px 0; }
.stat-grid.four { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 560px) { .stat-grid.four { grid-template-columns: 1fr 1fr; } }
.stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 12px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.stat small { color: var(--muted); font-size: 12px; }
.stat b { font-size: 20px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat span { font-size: 12px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 11px 14px; font-size: 14px; }
.kv + .kv { border-top: 1px solid var(--line); }
.kv b { font-weight: 600; text-align: right; overflow-wrap: anywhere; }
@media (max-width: 420px) {
  .status-uptime { align-items: flex-start; width: 100%; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- Розовая тема ---------- */
/* Каждый цвет — смесь «полностью розового» и стандартного: долю задаёт ползунок (--pink-k, 0.2…1).
   Селектор с атрибутом «сильнее» обычного :root, поэтому светлый вариант описан ниже отдельно. */

:root[data-theme="pink"] {
  --pink-k: .8;
  --k: calc(var(--pink-k) * 100%);
  --bg: color-mix(in srgb, #1b060e var(--k), #0e1016);
  --panel: color-mix(in srgb, #290f1d var(--k), #151821);
  --panel-2: color-mix(in srgb, #331526 var(--k), #1b1f2b);
  --line: color-mix(in srgb, #4a2035 var(--k), #242938);
  --text: color-mix(in srgb, #ffe9f2 var(--k), #e8eaf2);
  --muted: color-mix(in srgb, #cf8dab var(--k), #8b91a7);
  --accent: color-mix(in srgb, #ff3d91 var(--k), #7c5cff);
  --accent-hover: color-mix(in srgb, #ff63a8 var(--k), #8c70ff);
  --bubble: color-mix(in srgb, #331526 var(--k), #1e2331);
  --bubble-mine: color-mix(in srgb, #e63a86 var(--k), #6a4dff);
  --input: color-mix(in srgb, #331526 var(--k), #1b1f2b);
  --hover: color-mix(in srgb, #38182a var(--k), #1c2130);
  --active: color-mix(in srgb, #4a2035 var(--k), #262c40);
  --shadow: 0 10px 40px rgb(40 0 20 / .5);
  color-scheme: dark;
}


/* ---------- Сердечки ---------- */

.hearts-layer { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 60; }
.heart {
  position: absolute;
  bottom: -40px;
  color: var(--accent);
  line-height: 1;
  will-change: transform;
  animation-name: heart-float;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}
@keyframes heart-float {
  from { transform: translate3d(0, 0, 0) rotate(0deg); }
  to { transform: translate3d(var(--drift, 0), calc(-100vh - 80px), 0) rotate(var(--spin, 0deg)); }
}
@media (prefers-reduced-motion: reduce) {
  .hearts-layer { display: none; }
}

/* ---------- Ползунок ---------- */

.range-row { display: flex; align-items: center; gap: 12px; font-size: 12px; }
.range-row input[type="range"] { flex: 1; accent-color: var(--accent); height: 24px; }

/* ---------- Выбор темы ---------- */

.theme-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-align: left; }
.theme-row + .theme-row { border-top: 1px solid var(--line); }
.theme-row:hover { background: var(--hover); }
.theme-preview {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, var(--b) 0 45%, var(--p) 45% 72%, var(--a) 72% 100%);
}
.theme-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.theme-text small { color: var(--muted); }
.theme-check .ic { width: 22px; height: 22px; color: var(--accent); }
.theme-row.active .theme-text b { color: var(--accent-hover); }

/* ---------- Админ ---------- */

.admin-tabs {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  gap: 4px;
  padding: 10px 12px;
  overflow-x: auto;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.admin-tabs button { flex: 0 0 auto; height: 36px; padding: 0 14px; border-radius: 18px; color: var(--muted); font-weight: 600; }
.admin-tabs button:hover { background: var(--hover); color: var(--text); }
.admin-tabs button.active { background: var(--accent); color: #fff; }
.admin-search { margin: 12px 12px 0; }

.admin-user { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 14px; text-align: left; }
.admin-user + .admin-user { border-top: 1px solid var(--line); }
.admin-user:hover { background: var(--hover); }
.admin-user.deleted { opacity: .55; }
.admin-user > .ic { width: 18px; height: 18px; color: var(--muted); }
.admin-user-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.admin-user-info b, .admin-user-info small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-user-head { display: flex; align-items: center; gap: 14px; }
.admin-user-head h3 { margin: 0 0 2px; font-size: 18px; }
.more-btn { align-self: center; margin-top: 10px; }
.more-btn[hidden] { display: none; }

.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tags:empty { display: none; }
.tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: var(--panel-2); color: var(--muted); }
.tag.accent { background: rgb(124 92 255 / .18); color: var(--accent-hover); }
.tag.danger { background: rgb(255 93 108 / .15); color: var(--danger); }

.row-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.perms .switch-row { font-size: 14px; }

.usage-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 6px; }
.warn-text { color: var(--danger); }
.stack-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--panel-2); }
.stack-bar i { display: block; height: 100%; }
.stack-bar i + i { box-shadow: -1px 0 0 var(--panel); }
.legend { display: flex; flex-direction: column; gap: 2px; }
.legend-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 14px; }
.legend-row + .legend-row { border-top: 1px dashed var(--line); }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend-label { flex: 1; min-width: 0; }
.legend-row b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.section-title .link { display: inline-flex; align-items: center; gap: 6px; text-transform: none; letter-spacing: 0; font-size: 13px; }
.section-title .link .ic { width: 14px; height: 14px; }

.log-row { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; font-size: 14px; }
.log-row + .log-row { border-top: 1px solid var(--line); }

/* ---------- Обновление приложения ---------- */

.app-update { display: flex; flex-direction: column; gap: 12px; }
.update-row { display: flex; align-items: center; gap: 12px; }
.app-update > button { align-self: flex-start; }
.download-link { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; color: var(--muted); font-size: 14px; text-decoration: none; }
.download-link:hover { color: var(--accent-hover); }
.download-link[hidden] { display: none; }
.download-link .ic { width: 16px; height: 16px; }

/* ---------- Ответы ---------- */

.reply-bar.show ~ .composer { border-top: 0; }
.quote {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  min-width: 140px;
  margin: 2px 0 6px;
  padding: 5px 10px;
  border-left: 3px solid hsl(var(--h, 260) 70% 65%);
  border-radius: 6px;
  background: rgb(255 255 255 / .06);
  text-align: left;
  font-size: 13px;
  line-height: 1.3;
  cursor: pointer;
}
.quote:hover { background: rgb(255 255 255 / .1); }
.quote b { color: hsl(var(--h, 260) 75% 72%); font-weight: 600; }
.quote span { color: var(--text); opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }
.quote.missing { cursor: default; border-left-color: var(--muted); }
.quote.missing span { font-style: italic; }
.msg.mine .quote { background: rgb(0 0 0 / .14); border-left-color: rgb(255 255 255 / .75); }
.msg.mine .quote b { color: #fff; }
.msg.flash .bubble { animation: flash 1.4s ease-out; }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 3px transparent; } }

/* Проверка микрофона: полоска ходит вслед за голосом. */
.mic-test { height: 8px; border-radius: 4px; background: var(--panel-2); overflow: hidden; }
.mic-test[hidden] { display: none; }
.mic-test i { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--accent); transition: width .07s linear; }

/* Настоящий полный экран для трансляции: картинка на весь монитор, кнопки поверх неё. */
.call-panel.screen-full {
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none;
  max-height: none;
  border-radius: 0;
  transform: none !important;
}
.call-panel.screen-full .call-video { flex: 1; aspect-ratio: auto; }
.hint.sm { padding: 8px 10px; font-size: 13px; }

/* ---------- Дорожка мелодии: откуда начинается рингтон ---------- */

/* один ползунок с двумя ручками прямо поверх дорожки: левая — начало, правая — конец */
.ring-cut { position: relative; height: 54px; }
.ring-wave { display: block; width: 100%; height: 54px; }
.ring-cut .wave-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  background: none;
  pointer-events: none;            /* ловят нажатия только ручки, иначе верхний ползунок закрыл бы нижний */
  -webkit-appearance: none;
  appearance: none;
}
.ring-cut .wave-range::-webkit-slider-runnable-track { background: none; height: 100%; }
.ring-cut .wave-range::-moz-range-track { background: none; }
.ring-cut .wave-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  pointer-events: auto;
  width: 14px;
  height: 100%;
  border-radius: 7px;
  background: var(--accent);
  border: 3px solid var(--panel);
  box-shadow: 0 1px 4px rgb(0 0 0 / .35);
  cursor: ew-resize;
}
.ring-cut .wave-range::-moz-range-thumb {
  pointer-events: auto;
  width: 8px;
  height: 50px;
  border-radius: 7px;
  background: var(--accent);
  border: 3px solid var(--panel);
  cursor: ew-resize;
}
.wave-time { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 12px; }
.wave-time b { color: var(--accent-hover); font-size: 14px; }

/* ---------- Обложка профиля ---------- */

.profile-cover.has-image {
  background: var(--cover) center / cover no-repeat, var(--panel-2);
  cursor: zoom-in;
}
.profile-cover.has-image::after {  /* a soft fade so the avatar and the name stay readable */
  content: '';
  display: block;
  height: 100%;
  background: linear-gradient(to bottom, transparent 45%, rgb(0 0 0 / .45));
}
.cover-edit { display: flex; flex-direction: column; gap: 10px; }
.cover-edit.busy { opacity: .6; pointer-events: none; }
.cover-edit-preview {
  aspect-ratio: calc(3 / (1 + var(--ck, .5)));
  height: auto;
  min-height: 0;
  max-height: none;
  border-radius: 14px;
  overflow: hidden;
}
.cover-sizes { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.cover-sizes input[type="range"] { flex: 1; }
.cover-edit-preview.has-image { cursor: default; }
.cover-edit-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.cover-edit-actions [hidden] { display: none; }

/* ---------- Индикатор связи ---------- */
/* мышь и точный указатель = компьютер (сайт в браузере или приложение для ПК): там остаётся
   только кружок рядом с логином, а миллисекунды не мозолят глаза */
@media (hover: hover) and (pointer: fine) {
  .chat-head > .net-dot, .net-sep, #net-text { display: none; }
  html.net-offline .net-sep, html.net-offline #net-text { display: inline; color: var(--danger); }
}
.net-line .net-dot { margin-left: 2px; }

.test-sound { align-self: flex-start; }

/* ---------- Звонки ---------- */

.call-panel {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 70;
  width: min(360px, calc(100vw - 32px));
  padding: 14px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.call-panel { cursor: grab; touch-action: none; }
.call-panel.dragging { cursor: grabbing; user-select: none; transition: none; }
.call-panel button { cursor: pointer; }

/* кнопки окна: свернуть и на весь экран */
.call-tools { position: absolute; top: 4px; right: 6px; display: flex; gap: 2px; z-index: 3; }
.call-tools .icon-btn { width: 24px; height: 24px; color: var(--muted); }
/* поверх картинки кнопки на своей подложке — иначе демонстрация экрана их закрывает */
.call-panel.with-video .call-tools { top: 8px; right: 10px; background: rgb(0 0 0 / .45); border-radius: 12px; padding: 2px; }
.call-panel.with-video .call-tools .icon-btn { color: #fff; }
.call-tools .ic { width: 14px; height: 14px; }
.call-panel.incoming .call-tools { display: none; }

/* свёрнуто в полоску: только имя, время и «завершить» */
.call-panel.mini { width: auto; padding: 8px 10px; cursor: grab; }
.call-panel.mini .call-content { gap: 8px; }
.call-panel.mini .call-info small { font-size: 13px; }
.call-panel.mini .icon-btn.round { width: 34px; height: 34px; }
.call-panel.mini .icon-btn.round .ic { width: 16px; height: 16px; }

/* во весь экран. Классы перечислены вдвоём нарочно: правило «.call-panel.with-video» стоит ниже по
   файлу и иначе пересилило бы ширину — окно превращалось в узкий столбик слева. */
.call-panel.full, .call-panel.full.with-video {
  inset: 0;
  left: 0 !important;
  top: 0 !important;
  width: auto;
  height: auto;
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #0b0d12;
  cursor: default;
  z-index: 95;
}
.call-panel.full .call-content, .call-panel.full.with-video .call-content {
  flex-direction: column;
  justify-content: center;
  height: 100%;
  padding: max(16px, env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  gap: 20px;
}
.call-panel.full .call-tools { top: max(10px, env(safe-area-inset-top)); right: 14px; }
.call-panel.full .call-tools .icon-btn { width: 36px; height: 36px; color: #fff; background: rgb(255 255 255 / .12); }
.call-panel.full .call-tools .ic { width: 18px; height: 18px; }
.call-panel.full .call-video { flex: 1; width: 100%; min-height: 0; aspect-ratio: auto; border-radius: 12px; }
.call-panel.full .call-info { flex: 0 0 auto; align-items: center; text-align: center; }
.call-panel.full .call-info b { font-size: 20px; }
.call-panel.full .avatar { width: 140px; height: 140px; font-size: 48px; }
.call-panel.full .call-buttons .icon-btn.round { width: 58px; height: 58px; }
.call-panel.full .call-buttons .ic { width: 24px; height: 24px; }

/* карточка, вынесенная в отдельное окошко поверх рабочего стола */
html.pip-call, html.pip-call body { margin: 0; height: 100%; background: var(--panel); overflow: hidden; }
html.pip-call .call-panel {
  position: static;
  width: 100%;
  height: 100%;
  max-width: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  cursor: default;
  animation: none;
}
html.pip-call .call-content { height: 100%; }
html.pip-call .call-panel.with-video .call-video { flex: 1; min-height: 0; aspect-ratio: auto; }

.call-panel.incoming { border-color: var(--accent); animation: call-pulse 1.6s ease-in-out infinite; }
@keyframes call-pulse { 50% { box-shadow: 0 0 0 6px rgb(124 92 255 / .18), var(--shadow); } }
.call-content { display: flex; align-items: center; gap: 12px; }
.call-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.call-info b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.call-info small { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.call-buttons { display: flex; gap: 8px; }
.call-panel .icon-btn.round { width: 44px; height: 44px; background: var(--panel-2); }
.call-accept { background: var(--online) !important; color: #06210f !important; }
.call-end { background: var(--danger) !important; color: #fff !important; }
.call-muted { background: var(--active) !important; color: var(--danger) !important; }
@media (max-width: 520px) {
  .call-panel { left: 16px; right: 16px; bottom: 16px; width: auto; }
}

.call-line { display: flex; justify-content: center; margin: 6px 0; }
.call-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 14px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 13px;
}
.call-chip .ic { width: 16px; height: 16px; color: var(--accent-hover); }
.call-chip i { font-style: normal; opacity: .7; font-size: 12px; }
.call-line.missed .call-chip { color: var(--danger); }
.call-line.missed .call-chip .ic { color: var(--danger); }

/* маленькие картинки и стикеры: без пузыря и без растягивания */
.small-media .bubble { background: transparent; box-shadow: none; padding: 0; }
.small-media img.media { min-width: 0; min-height: 0; object-fit: contain; background: transparent; }
.small-media .meta { background: rgb(0 0 0 / .45); }

/* ---------- Выбор области картинки ---------- */

.cropper { max-width: min(92vw, 360px); }
.crop-view { position: relative; margin: 4px auto 10px; overflow: hidden; border-radius: 14px; background: #000; touch-action: none; }
.crop-view canvas { display: block; cursor: grab; }
.crop-view canvas:active { cursor: grabbing; }
.crop-mask { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 0 2px rgb(255 255 255 / .35); border-radius: 14px; }
.crop-view.round .crop-mask { border-radius: 50%; box-shadow: 0 0 0 999px rgb(0 0 0 / .45), inset 0 0 0 2px rgb(255 255 255 / .5); }
.crop-view.round { border-radius: 50%; }
.crop-hint { margin: 0 0 6px; font-size: 13px; text-align: center; }
.cropper .range-row { margin-bottom: 4px; }

/* ---------- Видео в звонке и выбор экрана ---------- */

.call-panel.with-video { width: min(420px, calc(100vw - 32px)); }
.call-panel.with-video .call-content { flex-direction: column; align-items: stretch; }
.call-video { position: relative; border-radius: 14px; overflow: hidden; background: #000; aspect-ratio: 16 / 9; }
.call-video video#call-remote-video { width: 100%; height: 100%; object-fit: contain; display: block; }
.call-video video#call-remote-video[hidden] { display: none; }
.call-video-note { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: 13px; }
.call-video #call-local-video {   /* старое окно звонка; в плитках своё видео — как у всех */
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 30%;
  border-radius: 8px;
  border: 1px solid rgb(255 255 255 / .25);
  background: #000;
  object-fit: cover;
}
.call-on { background: var(--accent) !important; color: #fff !important; }

.source-picker { max-width: min(94vw, 620px); max-height: 82vh; overflow: auto; }
.source-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 8px 0 4px; }
.source { display: flex; flex-direction: column; gap: 6px; padding: 6px; border-radius: 12px; background: var(--panel-2); text-align: left; }
.source:hover { background: var(--hover); outline: 2px solid var(--accent); }
.source img { width: 100%; border-radius: 8px; background: #000; aspect-ratio: 16 / 9; object-fit: contain; }
.source span { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.source-icon { width: 16px; height: 16px; border-radius: 4px; aspect-ratio: auto; background: none; }
.source span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- @логин и @@группа в тексте ---------- */

.mention {
  color: var(--accent-hover);
  font-weight: 600;
  cursor: pointer;
  border-radius: 4px;
  outline-offset: 2px;
}
.mention:hover { text-decoration: underline; }
.msg.mine .mention { color: #fff; text-decoration: underline; text-decoration-color: rgb(255 255 255 / .5); }

/* ---------- Выбранные файлы перед отправкой ---------- */

.picked { display: flex; gap: 8px; align-items: center; padding: 0 12px 8px; overflow-x: auto; }
.picked:empty { display: none; }
.pick {
  position: relative;
  width: 62px;
  height: 62px;
  flex-shrink: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.pick img { width: 100%; height: 100%; object-fit: cover; }
.pick-file { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 100%; padding: 4px; text-align: center; }
.pick-file .ic { width: 18px; height: 18px; color: var(--muted); }
.pick-file small { font-size: 9px; line-height: 1.1; color: var(--muted); overflow: hidden; max-height: 22px; overflow-wrap: anywhere; }
.pick-x {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgb(0 0 0 / .55);
  color: #fff;
  cursor: pointer;
}
.pick-x .ic { width: 12px; height: 12px; }
.pick-hint { display: flex; flex-direction: column; font-size: 13px; color: var(--text); white-space: nowrap; }
.pick-hint small { color: var(--muted); font-size: 11px; }


/* ---------- Живые анимации ---------- */
/* Всё короткое (до .25 с) и только там, где что-то появляется или нажимается: интерфейс отзывается,
   но не отвлекает. Тем, у кого в системе включено «уменьшить движение», всё это выключено в конце. */

@keyframes fade-in { from { opacity: 0; } }
@keyframes msg-in-mine { from { opacity: 0; transform: translate(14px, 10px) scale(.96); } }
@keyframes msg-in-theirs { from { opacity: 0; transform: translate(-14px, 10px) scale(.96); } }
@keyframes rise-in { from { opacity: 0; transform: translateY(10px); } }

/* новое сообщение въезжает со стороны автора */
.msg.enter.mine .bubble { animation: msg-in-mine .26s cubic-bezier(.2, .9, .3, 1.15); transform-origin: right bottom; }
.msg.enter:not(.mine) .bubble { animation: msg-in-theirs .26s cubic-bezier(.2, .9, .3, 1.15); transform-origin: left bottom; }
.msg.enter.call-line { animation: fade-in .3s ease-out; }

/* открыли чат: лента плавно проявляется, на телефоне ещё и подъезжает справа */
.chat.opening .messages { animation: rise-in .22s ease-out; }
@media (max-width: 759px) {
  .chat.opening { animation: page-in .2s ease-out; }
}

/* кнопки отзываются на нажатие */
.icon-btn, .pill, .primary, .chat-item, .theme-row { transition: background .15s, color .15s, transform .12s; }
.icon-btn:active, .pill:active, .primary:active { transform: scale(.93); }
.chat-item:active { transform: scale(.985); }
.icon-btn.accent:hover, .primary:hover { transform: translateY(-1px); }
.icon-btn.accent:active, .primary:active { transform: scale(.93); }

/* «микрофон» и «отправить» подменяют друг друга: новая кнопка появляется с лёгким «хлопком» */
.composer .send, .composer .mic { animation: pop-in .2s ease-out; }

/* окна и меню */
.backdrop { animation: fade-in .16s ease-out; }
.modal { animation: pop-in .18s ease-out; }
.popover { animation: pop-in .14s ease-out; transform-origin: top right; }

/* страницы профиля, настроек и Wall: карточки появляются друг за другом — только при открытии
   страницы (класс fresh), иначе смена темы гоняла бы их заново при каждом нажатии */
.page.fresh .form-page > *, .page.fresh .profile > * { animation: rise-in .28s ease-out backwards; }
.page.fresh .form-page > :nth-child(2), .page.fresh .profile > :nth-child(2) { animation-delay: .04s; }
.page.fresh .form-page > :nth-child(3), .page.fresh .profile > :nth-child(3) { animation-delay: .08s; }
.page.fresh .form-page > :nth-child(4), .page.fresh .profile > :nth-child(4) { animation-delay: .12s; }
.page.fresh .form-page > :nth-child(n+5), .page.fresh .profile > :nth-child(n+5) { animation-delay: .16s; }

/* аватарка в профиле слегка «дышит» при наведении */
.profile-avatar { transition: transform .2s; }
.profile-avatar[data-p]:hover { transform: scale(1.04); }

/* Удалённое сообщение истлевает: чернеет, подсыхает и рассыпается чёрной пылью. */
@keyframes msg-rot {
  0%   { filter: none; }
  30%  { filter: grayscale(1) brightness(.45) contrast(1.4); }
  60%  { filter: grayscale(1) brightness(.15) contrast(1.8); transform: scale(.99) translateY(1px); }
  100% { filter: grayscale(1) brightness(0) blur(3px); opacity: 0; transform: scale(.96) translateY(-7px); }
}

@keyframes msg-dust {
  0%   { opacity: 0; transform: none; }
  35%  { opacity: .9; }
  100% { opacity: 0; transform: translateY(-16px) scale(1.08); }
}

.msg.rotting .bubble { animation: msg-rot .85s ease-in forwards; }
.msg.rotting .bubble::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 30% 40%, #000 0 1.4px, transparent 1.8px),
    radial-gradient(circle at 70% 20%, #000 0 1.1px, transparent 1.5px),
    radial-gradient(circle at 15% 80%, #000 0 1.7px, transparent 2.1px);
  background-size: 13px 13px, 19px 19px, 27px 27px;
  animation: msg-dust .85s ease-out forwards;
}

/* Чат смыкается на месте удалённого — это не отключается, иначе переписка дёргается. */
.msg.collapsing {
  overflow: hidden;
  transition: height .3s ease, margin-top .3s ease;
}

@media (prefers-reduced-motion: reduce) {
  .msg.enter .bubble, .msg.enter.call-line, .chat.opening, .chat.opening .messages,
  .composer .send, .composer .mic, .backdrop, .modal, .popover,
  .page.fresh .form-page > *, .page.fresh .profile > * { animation: none !important; }
  .msg.rotting .bubble, .msg.rotting .bubble::before { animation: none; }
  .icon-btn:active, .pill:active, .primary:active, .chat-item:active,
  .icon-btn.accent:hover, .primary:hover, .profile-avatar[data-p]:hover { transform: none; }
}

/* ---------- Горячие клавиши ---------- */

.hotkey-row { display: flex; align-items: center; gap: 12px; }
.hotkey-row .info-text { flex: 1; min-width: 0; }
.hotkey-key { flex-shrink: 0; min-width: 130px; justify-content: center; font-variant-numeric: tabular-nums; }
.hotkey-key.listening { border-color: var(--accent); color: var(--accent-hover); }

/* ---------- Групповой звонок ---------- */

.room-panel { width: min(420px, calc(100vw - 32px)); }
.room-panel.full { width: auto; }
/* в групповом звонке сверху сетка участников, под ней подпись и кнопки — а не всё в одну строку */
.room-panel.active:not(.mini) .call-content { flex-direction: column; align-items: stretch; gap: 10px; }
.room-panel.active:not(.mini) .call-info { align-items: center; text-align: center; }
.room-panel.active:not(.mini) .call-buttons { justify-content: center; flex-wrap: wrap; }
.room-panel.ringing .call-content, .room-panel.joining .call-content { flex-wrap: wrap; }
.room-panel.mini { width: auto; }
.room-grid {
  display: grid;
  gap: 6px;
  width: 100%;
  grid-template-columns: repeat(2, 1fr);
}
.room-grid.n1 { grid-template-columns: 1fr; }
.room-grid.n3 .room-tile:first-child, .room-grid.n5 .room-tile:first-child { grid-column: span 2; }
.room-panel.full .room-grid { flex: 1; min-height: 0; align-content: center; gap: 10px; }
.room-panel.full .room-grid.n2, .room-panel.full .room-grid.n4 { grid-template-columns: repeat(2, 1fr); }
.room-panel.full .room-grid.n3, .room-panel.full .room-grid.n5 { grid-template-columns: repeat(3, 1fr); }
.room-panel.full .room-grid.n3 .room-tile:first-child, .room-panel.full .room-grid.n5 .room-tile:first-child { grid-column: auto; }
/* во весь экран плитки группового звонка вписываются по высоте: один в звонке или вчетвером —
   плитка не выпирает вниз и не накрывает кнопки */
.room-panel.full:not(.talking) .room-grid { container-type: size; }
.room-panel.full:not(.talking) .room-tile { justify-self: center; width: 100%; max-width: calc(100cqh * 1.6); }
.room-panel.full:not(.talking) .room-grid.n4 .room-tile,
.room-panel.full:not(.talking) .room-grid.n5 .room-tile { max-width: calc((100cqh - 10px) * .8); }

.room-tile {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  border-radius: 12px;
  background: var(--panel-2);
  overflow: hidden;
  box-shadow: inset 0 0 0 2px transparent;
  transition: box-shadow .15s;
}
.room-tile .avatar.lg { width: 56px; height: 56px; font-size: 20px; }
.room-panel.full .room-tile .avatar.lg { width: 96px; height: 96px; font-size: 34px; }
.room-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.room-tile.screen video { object-fit: contain; }
/* кто сейчас говорит — рамка цветом темы */
.room-tile.speaking { box-shadow: inset 0 0 0 2px var(--accent); }
.room-name {
  position: absolute;
  left: 6px;
  bottom: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: calc(100% - 12px);
  padding: 2px 8px;
  border-radius: 10px;
  background: rgb(0 0 0 / .5);
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.room-name .ic { width: 12px; height: 12px; color: #ff6b6b; flex-shrink: 0; }
.room-tile:fullscreen { border-radius: 0; background: #000; }
.room-tile:fullscreen video { object-fit: contain; }

/* плашка «идёт звонок» над перепиской группы */
.room-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 10px 0;
  padding: 8px 10px 8px 12px;
  border-radius: 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.room-banner-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--online); flex-shrink: 0; animation: room-pulse 1.6s ease-in-out infinite; }
.room-banner-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.room-banner-text small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes room-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .room-banner-dot { animation: none; } }

/* выбор человека: кого позвать в звонок */
.person-picker { width: min(420px, calc(100vw - 32px)); }
.person-picker .input { width: 100%; margin: 4px 0 8px; }
.person-list { display: flex; flex-direction: column; gap: 2px; max-height: min(50vh, 380px); overflow-y: auto; }
.person-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; text-align: left; }
.person-row:hover { background: var(--hover); }
.person-row span { display: flex; flex-direction: column; min-width: 0; }
.person-row small { color: var(--muted); font-size: 12px; }

/* ---------- Кружочки (видеосообщения) ---------- */

.composer.has-text .round-video, html.no-rounds .composer .round-video { display: none; }
.composer .round-video .ic { width: 22px; height: 22px; }

.type-round .bubble { background: transparent; box-shadow: none; padding: 0; }
.round-msg {
  position: relative;
  width: min(240px, 62vw);
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  background: #000;
  cursor: pointer;
}
.round-msg video { width: 100%; height: 100%; object-fit: cover; display: block; }
.round-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); pointer-events: none; }
.round-ring circle {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 302;
  stroke-dashoffset: 302;
  transition: stroke-dashoffset .1s linear;
}
.round-msg:not(.playing) .round-ring { opacity: 0; }
.round-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  pointer-events: none;
  transition: opacity .15s;
}
.round-play .ic { width: 46px; height: 46px; padding: 11px; border-radius: 50%; background: rgb(0 0 0 / .45); }
.round-msg.playing .round-play { opacity: 0; }
.round-dur {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  padding: 2px 8px;
  border-radius: 10px;
  background: rgb(0 0 0 / .5);
  color: #fff;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.round-msg.playing .round-dur { opacity: 0; }
.type-round .meta {
  position: absolute;
  right: 4px;
  bottom: 4px;
  margin: 0;
  padding: 3px 6px;
  border-radius: 10px;
  background: rgb(0 0 0 / .55);
  color: #fff;
  opacity: 1;
}

/* запись: круглое окно камеры посередине экрана */
.round-rec {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: rgb(0 0 0 / .78);
  animation: fade-in .15s ease-out;
}
.round-rec-circle { position: relative; width: min(72vw, 320px); aspect-ratio: 1; border-radius: 50%; overflow: hidden; background: #000; }
.round-rec-circle video { width: 100%; height: 100%; object-fit: cover; display: block; }
.round-rec-circle video.mirror { transform: scaleX(-1); }
.round-rec .round-ring circle { stroke-width: 3; stroke-dashoffset: 302; }
.round-rec-time { color: #fff; font-size: 16px; font-variant-numeric: tabular-nums; }
.round-rec-buttons { display: flex; gap: 22px; }
.round-rec .icon-btn.round { width: 56px; height: 56px; background: rgb(255 255 255 / .14); color: #fff; }
.round-rec .icon-btn.round.accent { background: var(--accent); }

/* ---------- Меню участника звонка: громкость ползунками ---------- */

.popover.vol-menu { width: 270px; padding: 8px 10px 10px; }
.vol-name { font-weight: 600; font-size: 14px; padding: 4px 2px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vol-row { display: flex; flex-direction: column; gap: 4px; padding: 6px 2px; }
.vol-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.vol-label .ic { width: 16px; height: 16px; }
.vol-label b { margin-left: auto; color: var(--text); font-variant-numeric: tabular-nums; font-weight: 600; }
.vol-row input[type="range"] { width: 100%; accent-color: var(--accent); }
.vol-sub { font-size: 12px; color: var(--muted); padding: 8px 2px 4px; }
.vol-chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Качество демонстрации экрана ---------- */

.share-quality { display: flex; flex-direction: column; gap: 8px; }
.sq-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sq-row > span { flex: 0 0 auto; min-width: 130px; font-size: 13px; color: var(--muted); }
.source-picker .share-quality { margin-bottom: 4px; }

/* ---------- Плеер для музыки: чаты и Wall ---------- */

.player { display: flex; align-items: center; gap: 12px; width: min(320px, 100%); min-width: 230px; padding: 4px 2px; }
.player-btn {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent);
  transition: transform .15s, box-shadow .15s;
}
.player-btn:hover { transform: scale(1.06); }
.player-btn .ic { width: 20px; height: 20px; }
.player.playing .player-btn { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.player-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.player-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-bar { position: relative; height: 14px; cursor: pointer; touch-action: none; }
.player-bar::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 5px;
  height: 4px;
  border-radius: 2px;
  background: color-mix(in srgb, currentColor 18%, transparent);
}
.player-fill { position: absolute; left: 0; top: 5px; height: 4px; border-radius: 2px; background: var(--accent); }
.player-knob {
  position: absolute;
  top: 1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateX(-50%) scale(0);
  transition: transform .15s;
}
.player:hover .player-knob, .player.playing .player-knob { transform: translateX(-50%) scale(1); }
.player-time { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* в своём (цветном) пузыре — белый плеер */
.mine .player-btn { background: #fff; color: var(--bubble-mine); box-shadow: none; }
.mine .player.playing .player-btn { box-shadow: 0 0 0 4px rgb(255 255 255 / .25); }
.mine .player-fill, .mine .player-knob { background: #fff; }
.mine .player-time { color: rgb(255 255 255 / .8); }
.type-audio .bubble { min-width: 250px; }

/* в Wall — плеер во всю строку */
.file-row.audio-row { display: block; padding: 8px 10px; }
.file-row.audio-row .player { width: 100%; }

/* ---------------------------------------------------------------- окно-форма */
.form-dialog { max-width: 420px; overflow: hidden; }
.form-dialog-body { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 0; margin: 0 -4px; padding: 0 4px; }
.form-dialog .section-title { margin: 6px 0 0; }
.stack-label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.pill.sm { height: 32px; padding: 0 12px; font-size: 13px; gap: 6px; }
.pill.sm .ic { width: 15px; height: 15px; }
.form-dialog .pill[data-add] { align-self: flex-start; }
.form-dialog .pill[data-add][hidden] { display: none; }
.avatar.xs { width: 20px; height: 20px; font-size: 9px; }

/* ---------------------------------------------------------------- опросы */
.poll-edit-list { display: flex; flex-direction: column; gap: 6px; }
.poll-edit-row { display: flex; gap: 6px; align-items: center; }
.poll-edit-row .field { flex: 1; }
.poll-edit-row .icon-btn { flex: none; }

.type-poll .bubble { min-width: min(300px, 78vw); }
.poll { display: flex; flex-direction: column; gap: 6px; padding: 2px 0 4px; }
.poll-q { font-weight: 700; font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.poll-kind { display: flex; align-items: center; gap: 5px; font-size: 12px; opacity: .7; }
.poll-kind .ic { width: 13px; height: 13px; }
.poll-opts { display: flex; flex-direction: column; gap: 5px; margin-top: 2px; }
.poll-opt {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 6px 10px;
  border-radius: 10px;
  text-align: left;
  background: color-mix(in srgb, currentColor 7%, transparent);
  overflow: hidden;
  transition: background .15s;
}
.poll-opt:not(:disabled):not(.shown):hover { background: color-mix(in srgb, currentColor 13%, transparent); }
.poll-opt > span { position: relative; z-index: 1; }
.poll-opt > .poll-bar {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 0;
  width: var(--p, 0%);
  background: color-mix(in srgb, var(--accent) 28%, transparent);
  transition: width .5s cubic-bezier(.2, .8, .2, 1);
}
.mine .poll-opt > .poll-bar { background: rgb(255 255 255 / .22); }
.poll-opt.top > .poll-bar { background: color-mix(in srgb, var(--accent) 42%, transparent); }
.mine .poll-opt.top > .poll-bar { background: rgb(255 255 255 / .32); }
.poll-mark { flex: none; width: 18px; height: 18px; display: grid; place-items: center; }
.poll-mark .ic { width: 16px; height: 16px; }
.poll-mark i { width: 16px; height: 16px; border: 2px solid currentColor; opacity: .55; border-radius: 50%; }
.poll-mark i.box { border-radius: 5px; }
.poll-opt.chosen .poll-mark i { opacity: 1; background: currentColor; box-shadow: inset 0 0 0 3px var(--bubble); }
.mine .poll-opt.chosen .poll-mark i { box-shadow: inset 0 0 0 3px var(--bubble-mine); }
.poll-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.poll-pct { flex: none; font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.poll-voters { display: flex; flex: none; padding-left: 6px; }
.poll-voters .avatar { margin-left: -6px; box-shadow: 0 0 0 2px var(--bubble); }
.mine .poll-voters .avatar { box-shadow: 0 0 0 2px var(--bubble-mine); }
.poll-opt:disabled { cursor: default; }
.poll-foot { display: flex; align-items: center; justify-content: center; min-height: 26px; }
.poll-total { font-size: 12px; opacity: .7; }
.poll-submit:disabled { opacity: .5; }
.mine .poll-submit { background: rgb(255 255 255 / .18); border-color: transparent; color: #fff; }

/* ---------------------------------------------------------------- отложенные сообщения */
.sched-slot { display: contents; }
.sched-btn { position: relative; color: var(--accent-hover); }
.sched-n {
  position: absolute; top: 2px; right: 0; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700;
  display: grid; place-items: center;
}
.time-chips { gap: 6px; }
.time-chips .chip { padding: 7px 12px; }
.sched-dialog { max-width: 460px; overflow: hidden; }
.sched-dialog h3 { display: flex; align-items: center; gap: 8px; }
.sched-dialog h3 .ic { width: 18px; height: 18px; color: var(--accent-hover); }
.sched-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 0; }
.sched-item { padding: 10px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.sched-when { font-size: 12px; font-weight: 700; color: var(--accent-hover); }
.sched-text { margin: 4px 0 8px; overflow-wrap: anywhere; white-space: pre-wrap; display: flex; gap: 6px; align-items: flex-start; }
.sched-text .ic { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--muted); }
.sched-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sched-actions .danger { margin-left: auto; color: var(--danger); }

/* ---------------------------------------------------------------- папки чатов */
.folder-tabs {
  position: relative;
  display: flex;
  gap: 4px;
  margin: 0 12px 6px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: none;
}
.folder-tabs::-webkit-scrollbar { display: none; }
.folder-tabs[hidden] { display: none; }
.folder-tab {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  transition: background .15s, color .15s;
}
.folder-tab:hover { background: var(--hover); color: var(--text); }
.folder-tab.active { background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent-hover); }
.folder-n {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: #fff; font-size: 11px; display: grid; place-items: center;
}
.folder-tab:not(.active) .folder-n { background: var(--active); color: var(--text); }
.folder-add { padding: 0 8px; }
.folder-add .ic { width: 16px; height: 16px; }
.folder-row { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.folder-ico { color: var(--accent-hover); display: grid; place-items: center; width: 28px; }
.folder-ico .ic { width: 20px; height: 20px; }
.folder-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.folder-meta small { color: var(--muted); font-size: 12px; }
.folder-row .danger { color: var(--danger); }
.card .menu-row {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 12px 14px; font-weight: 600; color: var(--accent-hover);
}
.card .menu-row:hover { background: var(--hover); }
.card .muted.pad { padding: 12px 14px; margin: 0; }
.folder-pick { display: flex; flex-direction: column; max-height: 240px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; flex: none; }
.folder-pick-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; font-size: 14px; }
.folder-pick-row:hover { background: var(--hover); }
.folder-pick-row span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-pick-row input { accent-color: var(--accent); width: 17px; height: 17px; }

/* ---------------------------------------------------------------- поиск по сообщениям */
.search-clear { margin-right: -6px; color: var(--muted); }
.search-clear[hidden] { display: none; }
.search-tabs { margin: 0 12px 8px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; flex: none; }
.search-tabs::-webkit-scrollbar { display: none; }
.search-tabs[hidden] { display: none; }
.search-tabs .chip { flex: none; background: transparent; border: 1px solid var(--line); color: var(--muted); font-weight: 600; }
.search-tabs .chip.active { background: color-mix(in srgb, var(--accent) 20%, transparent); border-color: transparent; color: var(--accent-hover); }
.sr-title { margin: 10px 10px 4px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.sr-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; text-align: left; }
button.sr-item:hover, .sr-head:hover { background: var(--hover); }
.sr-item .file-ico { flex: none; }
.sr-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sr-row { display: flex; gap: 8px; align-items: baseline; }
.sr-where { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-time { flex: none; font-size: 12px; color: var(--muted); }
.sr-text { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
b.sr-text { color: var(--text); font-weight: 600; }
.sr-text mark { background: color-mix(in srgb, var(--accent) 35%, transparent); color: var(--text); border-radius: 3px; padding: 0 1px; }
.sr-music, .sr-links { flex-direction: column; align-items: stretch; gap: 4px; }
.sr-head { display: flex; align-items: center; gap: 10px; padding: 2px 4px; border-radius: 8px; text-align: left; width: 100%; }
.sr-music .sr-head { font-size: 13px; }
.sr-music .player { padding: 0 4px; }
.sr-link-list { display: flex; flex-direction: column; gap: 2px; padding-left: 52px; }
.sr-link-list a { display: flex; align-items: center; gap: 6px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-link-list .ic { width: 14px; height: 14px; flex: none; }
.sr-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; }
.sr-media { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--panel-2); }
.sr-media.round { border-radius: 50%; }
.sr-media img, .sr-media video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.sr-play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; filter: drop-shadow(0 1px 3px rgb(0 0 0 / .6)); }
.sr-more { display: block; margin: 8px auto; }

/* ---------------------------------------------------------------- полоска плеера сверху */
.music-bar {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 42px;
  padding: env(safe-area-inset-top) 8px 0;
  box-sizing: content-box;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  animation: music-bar-in .25s ease-out;
  z-index: 5;
}
@keyframes music-bar-in { from { transform: translateY(-100%); opacity: 0; } }
.music-bar .icon-btn { width: 32px; height: 32px; flex: none; }
.music-bar .icon-btn .ic { width: 16px; height: 16px; }
.music-bar .icon-btn:disabled { opacity: .35; }
.music-bar .mb-toggle { background: var(--accent); color: #fff; }
.music-bar .mb-toggle:hover { background: var(--accent-hover); }
.mb-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; margin-left: 6px; font-size: 14px; font-weight: 600; }
.mb-title .ic { width: 15px; height: 15px; flex: none; color: var(--accent-hover); }
.mb-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mb-time { flex: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 2px; }
.mb-line { position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; cursor: pointer; }
.mb-fill { display: block; height: 100%; background: var(--accent); transition: width .25s linear; pointer-events: none; }
.mb-line:hover { height: 5px; }
@media (max-width: 420px) { .mb-time { display: none; } }

/* ---------------------------------------------------------------- запись звонка */
.icon-btn.round.call-rec { background: var(--danger); color: #fff; animation: rec-pulse 1.6s ease-in-out infinite; }
@keyframes rec-pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--danger) 25%, transparent); } }
.rec-badge { display: inline-flex; align-items: center; gap: 4px; color: var(--danger); font-weight: 700; font-variant-numeric: tabular-nums; }
.rec-badge .ic { width: 12px; height: 12px; animation: rec-blink 1.2s steps(2) infinite; }
@keyframes rec-blink { 50% { opacity: .3; } }
.rec-warn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin: 0 8px; padding: 6px 10px; border-radius: 10px;
  background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger);
  font-size: 12px; font-weight: 700; text-align: center;
}
.rec-warn .ic { width: 13px; height: 13px; flex: none; animation: rec-blink 1.2s steps(2) infinite; }
.over-call-dialog { z-index: 130; }
.rec-dialog h3 { display: flex; align-items: center; gap: 8px; }
.rec-dialog h3 .ic { width: 18px; height: 18px; color: var(--danger); }
.rec-choice {
  display: flex; flex-direction: column; gap: 3px; width: 100%; padding: 12px 14px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); text-align: left;
}
.rec-choice:hover { border-color: var(--accent); background: var(--hover); }
.rec-choice small { color: var(--muted); font-size: 12px; }
.small-note { font-size: 12px; margin: 0; }

/* телефон: шапке чата не хватает места — цели и Wall группы уходят в меню, кнопки ближе друг к другу */
@media (max-width: 759px) {
  .chat-head { gap: 2px; }
  .chat-head .head-extra { display: none; }
}

/* ---------------------------------------------------------------- звук разговора (сутки на сервере) */
.call-line { align-items: center; gap: 6px; }
.call-audio-btn {
  display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px;
  border-radius: 13px; background: var(--panel-2); border: 1px solid var(--line);
  color: var(--muted); font-size: 12px; font-weight: 600;
}
.call-audio-btn .ic { width: 13px; height: 13px; }
.call-audio-btn:hover { color: var(--text); border-color: var(--accent); }
.call-audio-btn.ready { color: var(--accent-hover); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.call-note { margin: -2px 10px 0; font-size: 11px; color: var(--muted); text-align: center; line-height: 1.3; }
.ca-dialog { max-width: 400px; }
.ca-dialog h3 { display: flex; align-items: center; gap: 8px; }
.ca-dialog h3 .ic { width: 18px; height: 18px; color: var(--accent-hover); }
.ca-facts { display: flex; gap: 8px; }
.ca-facts span {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px;
  border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line);
}
.ca-facts b { font-size: 15px; font-variant-numeric: tabular-nums; }
.ca-facts small { font-size: 11px; color: var(--muted); }
.ca-people { display: flex; flex-direction: column; gap: 6px; }
.ca-person { display: flex; align-items: center; gap: 10px; }
.ca-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ca-status { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 10px; }
.ca-status.ok { color: var(--online); background: color-mix(in srgb, var(--online) 14%, transparent); }
.ca-status.wait { color: var(--muted); background: var(--panel-2); }
.ca-status.no { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }
.ca-hint { margin: 0; font-size: 13px; color: var(--muted); text-align: center; }
.ca-hint.no { color: var(--danger); }
.ca-dialog .primary { display: flex; align-items: center; justify-content: center; gap: 8px; }
.ca-dialog .primary .ic { width: 17px; height: 17px; }
.ca-dialog .dialog-buttons { flex-direction: column; }
.danger-text { color: var(--danger); }
.ca-note { font-size: 11px; margin: 0; text-align: center; }

/* ---------------------------------------------------------------- просмотр фото и видео */
.viewer.gallery { cursor: default; background: rgb(0 0 0 / calc(.94 * var(--gv-fade, 1))); touch-action: none; user-select: none; }
.gv-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.gv-stage img { max-width: 100%; max-height: 100%; object-fit: contain; transform-origin: center; cursor: zoom-in; }
.viewer.zoomed .gv-stage img { cursor: grab; }
.gv-stage video { max-width: 100%; max-height: calc(100% - 120px); }
.gv-top {
  position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) 12px 10px;
  background: linear-gradient(rgb(0 0 0 / .55), transparent); color: #fff; z-index: 2;
}
.gv-info { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.gv-info b { font-size: 14px; }
.gv-info small { font-size: 12px; opacity: .75; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.gv-btn { color: #fff; background: rgb(255 255 255 / .14); }
.gv-btn:hover { background: rgb(255 255 255 / .24); }
.gv-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; z-index: 2; }
.gv-nav[hidden] { display: none; }
.gv-prev { left: 14px; }
.gv-next { right: 14px; }
.gv-nav .ic { width: 22px; height: 22px; }
.gv-caption {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 14px 18px max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgb(0 0 0 / .6)); color: #fff; text-align: center; font-size: 14px;
  white-space: pre-wrap; overflow-wrap: anywhere; max-height: 30vh; overflow-y: auto;
}
.gv-caption[hidden] { display: none; }
@media (pointer: coarse) { .gv-nav { display: none; } }   /* на телефоне листают пальцем */

/* ---------------------------------------------------------------- видео в чате и альбомы */
.video-tile { position: relative; padding: 0; overflow: hidden; width: min(340px, 100%); aspect-ratio: 16 / 10; }
.video-tile video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.vt-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center; background: rgb(0 0 0 / .5); color: #fff; backdrop-filter: blur(4px);
  transition: transform .15s;
}
.video-tile:hover .vt-play { transform: translate(-50%, -50%) scale(1.08); }
.vt-play .ic { width: 22px; height: 22px; margin-left: 3px; }
.vt-dur { position: absolute; left: 8px; top: 8px; padding: 2px 7px; border-radius: 9px; background: rgb(0 0 0 / .5); color: #fff; font-size: 12px; }

.type-album .bubble { padding: 3px; width: min(346px, 82vw); }
.type-album .text { display: block; padding: 5px 7px 0; }
.type-album .meta { margin-right: 7px; margin-bottom: 4px; }
.type-album:not(.has-text) .meta {
  position: absolute; right: 9px; bottom: 9px; margin: 0; padding: 2px 7px; border-radius: 10px;
  background: rgb(0 0 0 / .45); color: #fff;
}
.type-album:not(.has-text) .bubble { position: relative; }
.album { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px; border-radius: 13px; overflow: hidden; }
.album.n3 > :first-child, .album.n5 > :first-child, .album.n7 > :first-child, .album.n9 > :first-child { grid-column: span 2; }
.album.n5, .album.n6, .album.n7, .album.n8, .album.n9, .album.n10 { grid-template-columns: repeat(3, 1fr); }
.album.n5 > :first-child, .album.n7 > :first-child { grid-column: span 3; }
.album > * { aspect-ratio: 1; width: 100%; border-radius: 0; min-width: 0; }
.album.n3 > :first-child, .album.n5 > :first-child, .album.n7 > :first-child { aspect-ratio: 2 / 1; }
.album-tile { padding: 0; display: block; overflow: hidden; background: rgb(0 0 0 / .2); cursor: zoom-in; }
.album-tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.album-tile:hover img { transform: scale(1.03); }
.album .video-tile { aspect-ratio: 1; }
.album .vt-play { width: 40px; height: 40px; }

/* ---------------------------------------------------------------- переслать */
.forward-dialog { max-width: 400px; }
.fw-search { margin: 0; }
.fw-list { display: flex; flex-direction: column; max-height: 46vh; overflow-y: auto; margin: 0 -6px; }
.fw-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 12px; cursor: pointer; }
.fw-row[hidden] { display: none; }
.fw-row:hover { background: var(--hover); }
.fw-row input { position: absolute; opacity: 0; pointer-events: none; }
.fw-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fw-check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; color: transparent; flex: none; }
.fw-check .ic { width: 14px; height: 14px; }
.fw-row:has(input:checked) .fw-check { background: var(--accent); border-color: var(--accent); color: #fff; }
.fw-row:has(input:checked) { background: color-mix(in srgb, var(--accent) 12%, transparent); }

/* ---------------------------------------------------------------- громкость музыки */
.player-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.player-head .player-title { flex: 1; min-width: 0; }
.player-vol { flex: none; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); opacity: .8; }
.player-vol:hover { opacity: 1; background: color-mix(in srgb, currentColor 12%, transparent); }
.player-vol .ic { width: 15px; height: 15px; }
.mine .player-vol { color: rgb(255 255 255 / .85); }
.vol-range {
  -webkit-appearance: none; appearance: none; width: 110px; height: 18px; background: transparent; cursor: pointer; margin: 0;
}
.vol-range::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent) var(--v, 80%), color-mix(in srgb, var(--muted) 35%, transparent) var(--v, 80%));
}
.vol-range::-moz-range-track { height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--muted) 35%, transparent); }
.vol-range::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
.vol-range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #fff; margin-top: -5px;
  box-shadow: 0 1px 4px rgb(0 0 0 / .35);
}
.vol-range::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgb(0 0 0 / .35); }
.popover.vol-pop { padding: 6px 10px; min-width: 0; }
.music-vol-pop { display: flex; align-items: center; gap: 6px; }
.music-vol-pop .vol-range { width: 140px; }
.popover.vol-pop button.icon-btn { width: 30px; padding: 0; justify-content: center; }
.mb-vol { display: flex; align-items: center; gap: 2px; margin-right: 4px; }
.mb-vol .vol-range { width: 90px; }
@media (max-width: 520px) { .mb-vol .vol-range { display: none; } }

/* ---------------------------------------------------------------- запись звонка в чате */
.rec-card { display: flex; flex-direction: column; gap: 8px; min-width: min(280px, 70vw); }
.rec-head { display: flex; align-items: center; gap: 10px; padding: 2px 2px 0; }
.rec-ico {
  width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent-hover);
}
.mine .rec-ico { background: rgb(255 255 255 / .2); color: #fff; }
.rec-ico .ic { width: 18px; height: 18px; }
.rec-meta { display: flex; flex-direction: column; min-width: 0; }
.rec-meta b { font-size: 14px; }
.rec-meta small { font-size: 12px; opacity: .75; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-card .player { padding-top: 2px; border-top: 1px solid color-mix(in srgb, currentColor 12%, transparent); padding: 8px 2px 2px; }
.type-video .rec-head { padding: 6px 6px 8px; }
.range-row .ic { width: 18px; height: 18px; color: var(--muted); flex: none; }
.ring-volume-num { min-width: 42px; text-align: right; font-size: 13px; }

/* ---------------------------------------------------------------- поиск в одном чате */
.cs-page { display: flex; flex-direction: column; gap: 10px; padding: 12px; }
.cs-search { margin: 0; }
.cs-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.cs-tabs .chip { flex: none; background: transparent; border: 1px solid var(--line); color: var(--muted); font-weight: 600; }
.cs-tabs .chip.active { background: color-mix(in srgb, var(--accent) 20%, transparent); border-color: transparent; color: var(--accent-hover); }
.cs-tools { display: flex; gap: 8px; }
.cs-tools .field { flex: 1; min-width: 0; height: 38px; padding: 0 10px; }
.cs-count { font-size: 12px; color: var(--muted); padding: 0 4px 4px; }
.cs-results { display: flex; flex-direction: column; }

/* ---------------------------------------------------------------- звонок на телефоне: как в обычной звонилке */
@media (pointer: coarse) {
  .call-panel.full, .room-panel.full {
    background: radial-gradient(120% 70% at 50% 0%, color-mix(in srgb, var(--accent) 38%, #0b0d12) 0%, #0b0d12 70%);
  }
  .call-panel.full .call-content { justify-content: space-between; gap: 14px; }
  /* подписи под кнопками */
  .call-panel.full .call-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); gap: 16px 8px; width: 100%; max-width: 380px; margin: 0 auto; justify-items: center; }
  .call-panel.full .call-buttons .icon-btn.round { position: relative; width: 60px; height: 60px; margin-bottom: 18px; background: rgb(255 255 255 / .12); color: #fff; }
  .call-panel.full .call-buttons .icon-btn.round.call-on { background: #fff; color: #0b0d12; }
  .call-panel.full .call-buttons .icon-btn.round.call-muted { background: #fff; color: var(--danger); }
  .call-panel.full .call-buttons .icon-btn.round.call-end { background: var(--danger); color: #fff; grid-column: 1 / -1; width: 68px; height: 68px; }
  .call-panel.full .call-buttons .icon-btn.round[data-label]::after {
    content: attr(data-label); position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
    font-size: 12px; font-weight: 500; color: rgb(255 255 255 / .8); white-space: nowrap; pointer-events: none;
  }
  .call-panel.full .call-info b { font-size: 24px; color: #fff; }
  .call-panel.full .call-info small { font-size: 15px; color: rgb(255 255 255 / .7); }
  .call-panel.full .call-note { color: rgb(255 255 255 / .55); }

  /* личный звонок без картинки: большая аватарка собеседника по центру, своя плитка не нужна */
  .call-panel.full.talking .room-grid.n2 { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; position: relative; }
  .call-panel.full.talking .room-tile[data-tile="peer"]:not(.with-video) { background: transparent; box-shadow: none; aspect-ratio: auto; width: 100%; height: 100%; }
  .call-panel.full.talking .room-tile[data-tile="peer"]:not(.with-video) .avatar.lg { width: 150px; height: 150px; font-size: 52px; box-shadow: 0 0 0 10px rgb(255 255 255 / .06), 0 0 0 22px rgb(255 255 255 / .03); }
  .call-panel.full.talking .room-tile[data-tile="peer"]:not(.with-video) .room-name { display: none; }
  .call-panel.full.talking .room-tile[data-tile="peer"].with-video { width: 100%; height: 100%; border-radius: 16px; }
  .call-panel.full.talking .room-tile[data-tile="me"]:not(.with-video) { display: none; }
  /* своя камера — маленьким окошком в углу, как в видеозвонке */
  .call-panel.full.talking .room-tile[data-tile="me"].with-video {
    position: absolute; right: 10px; top: 10px; width: 96px; height: 136px; aspect-ratio: auto; z-index: 2;
    border-radius: 14px; box-shadow: 0 6px 20px rgb(0 0 0 / .5);
  }
  .call-panel.full.talking .room-tile[data-tile="me"].with-video .room-name { display: none; }

  /* групповой звонок на телефоне: плитки крупнее, подписи под кнопками те же */
  .room-panel.full .room-grid { gap: 8px; }
  .room-panel.full .room-tile { border-radius: 16px; }
}

/* меню скрепки на телефоне — снизу, крупными кнопками */
.popover.sheet {
  left: 8px !important; right: 8px !important; top: auto !important; bottom: max(8px, env(safe-area-inset-bottom));
  width: auto; max-width: none; padding: 6px 8px 10px; border-radius: 18px;
  animation: sheet-up .22s cubic-bezier(.2, .8, .2, 1);
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
.popover.sheet button { padding: 14px 12px; font-size: 16px; gap: 14px; }
.popover.sheet button .ic { width: 22px; height: 22px; color: var(--accent-hover); }
.sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 8px; }

/* кружок с демонстрации экрана: экран виден целиком, как и в самой записи */
.round-rec[hidden] { display: none; }
.round-rec.screen .round-rec-circle { width: min(86vw, 760px); aspect-ratio: 16 / 9; border-radius: 16px; }
.round-rec.screen video { object-fit: contain; background: #0e1016; }
.screen-rec-dot {
  position: absolute; top: 10px; left: 10px; padding: 4px 10px; border-radius: 999px;
  background: rgb(0 0 0 / .6); color: #ff5d73; font-size: 12px; font-weight: 600; animation: turn-pulse 1.6s ease-in-out infinite;
}

/* ---------------------------------------------------------------- живые аватарки */
.avatar video { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; pointer-events: none; }
.avatar-preview { max-width: 360px; }
.ap-row { display: flex; align-items: center; justify-content: center; gap: 24px; padding: 8px 0; }
.ap-big { width: 150px; height: 150px; }
.ap-small { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ap-small small { font-size: 11px; }
.avatar-preview .primary { display: flex; align-items: center; justify-content: center; gap: 8px; }
.avatar-preview .primary .ic { width: 18px; height: 18px; }

/* ---------------------------------------------------------------- музыка вместе */
.together-bar {
  display: flex; align-items: center; gap: 6px; padding: 7px 8px 7px 10px; border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 16%, var(--panel-2)); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
.tb-ico { color: var(--accent-hover); display: grid; place-items: center; animation: tb-beat 1.2s ease-in-out infinite; }
.tb-ico .ic { width: 18px; height: 18px; }
@keyframes tb-beat { 50% { transform: scale(1.15); } }
.tb-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tb-text b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-text small { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.together-bar .tb-play { background: var(--accent); color: #fff; }
.call-panel.full .together-bar { max-width: 420px; width: 100%; margin: 0 auto; background: rgb(255 255 255 / .1); border-color: rgb(255 255 255 / .15); color: #fff; }
.together-offer {
  position: fixed; left: 50%; top: max(16px, env(safe-area-inset-top)); transform: translateX(-50%); z-index: 140;
  width: min(380px, calc(100vw - 24px)); padding: 12px 14px; border-radius: 16px; background: var(--panel);
  border: 1px solid var(--accent); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px;
  animation: sheet-up .25s ease-out;
}
.to-text { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.to-text .ic { width: 20px; height: 20px; color: var(--accent-hover); flex: none; margin-top: 2px; }
.to-text i { color: var(--muted); }
.to-buttons { display: flex; gap: 8px; justify-content: flex-end; }
.together-pick { max-width: 420px; }
.together-pick h3 { display: flex; align-items: center; gap: 8px; }
.together-pick h3 .ic { width: 18px; height: 18px; color: var(--accent-hover); }
.tp-list { display: flex; flex-direction: column; max-height: 45vh; overflow-y: auto; margin: 0 -6px; }
.tp-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; text-align: left; }
.tp-row:hover { background: var(--hover); }
.tp-row .ic { width: 18px; height: 18px; color: var(--accent-hover); flex: none; }
.tp-row span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.tp-row small { color: var(--muted); font-size: 12px; }

/* ---------------------------------------------------------------- смотреть вместе */
.watch-panel {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -55%); z-index: 105;
  width: min(900px, calc(100vw - 32px)); background: #000; border-radius: 16px; overflow: hidden;
  box-shadow: 0 20px 60px rgb(0 0 0 / .6); display: flex; flex-direction: column;
}
.watch-panel:fullscreen { width: 100vw; height: 100vh; border-radius: 0; transform: none; left: 0; top: 0; }
.wp-stage { position: relative; background: #000; aspect-ratio: 16 / 9; max-height: 70vh; }
.watch-panel:fullscreen .wp-stage { flex: 1; max-height: none; aspect-ratio: auto; }
.wp-stage video { width: 100%; height: 100%; object-fit: contain; display: block; cursor: pointer; }
.wp-bar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: #111319; color: #fff; }
.wp-bar .icon-btn { color: #fff; }
.wp-bar [data-together="toggle"] { background: var(--accent); }
.wp-seek { flex: 1; accent-color: var(--accent); }
.wp-time, .wp-total { font-size: 12px; font-variant-numeric: tabular-nums; color: rgb(255 255 255 / .75); }
.wp-title { padding: 0 12px 10px; background: #111319; color: rgb(255 255 255 / .7); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (pointer: coarse) { .watch-panel { top: 12px; transform: translateX(-50%); } }

/* ---------------------------------------------------------------- живая шапка профиля (видео) */
.profile-cover, .cover-edit-preview { position: relative; overflow: hidden; }
.cover-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.profile-cover.has-image::after { position: relative; z-index: 1; }
/* шапка — под всем содержимым профиля, как и раньше (видео внутри неё требует position) */
.profile { isolation: isolate; }
.profile > .profile-cover { z-index: -1; }

/* ---------------------------------------------------------------- свой фон переписки */
.chat.has-wallpaper > :not(.wallpaper) { position: relative; z-index: 1; }
.chat.has-wallpaper .messages { background: transparent; }
.wallpaper { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; background: #000; }
.wallpaper img, .wallpaper video {
  width: 100%; height: 100%; object-fit: cover; display: block;
  filter: blur(var(--wp-blur, 0px)); transform: scale(calc(1 + var(--wp-blur, 0px) / 200px));   /* края размытия не видно */
}
.wallpaper::after { content: ''; position: absolute; inset: 0; background: rgb(0 0 0 / var(--wp-dim, .3)); }
.chat.has-wallpaper .day span { background: rgb(0 0 0 / .45); color: #fff; backdrop-filter: blur(6px); }
.chat.has-wallpaper .call-line .call-chip, .chat.has-wallpaper .hint { background: rgb(0 0 0 / .45); color: #fff; border-radius: 12px; backdrop-filter: blur(6px); }
.wallpaper-dialog { max-width: 420px; }
.wallpaper-dialog h3 { display: flex; align-items: center; gap: 8px; }
.wallpaper-dialog h3 .ic { width: 18px; height: 18px; color: var(--accent-hover); }
.wp-preview {
  position: relative; height: 220px; border-radius: 14px; overflow: hidden; background: var(--bg);
  display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; padding: 12px; border: 1px solid var(--line);
}
.wp-preview .wallpaper { border-radius: 14px; }
.wp-bubble { position: relative; z-index: 1; max-width: 70%; padding: 7px 11px; border-radius: 14px; font-size: 14px; }
.wp-bubble.theirs { align-self: flex-start; background: var(--bubble); }
.wp-bubble.mine { align-self: flex-end; background: var(--bubble-mine); color: #fff; }
.wp-label { min-width: 84px; font-size: 13px; }
.wp-num { min-width: 42px; text-align: right; font-size: 13px; }
.contact-ring { max-width: 420px; }
.contact-ring h3 { display: flex; align-items: center; gap: 8px; }
.contact-ring h3 .ic { width: 18px; height: 18px; color: var(--accent-hover); }
.cr-list { display: flex; flex-direction: column; max-height: 50vh; overflow-y: auto; margin: 0 -6px; }
.cr-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer; }
.cr-row:hover { background: var(--hover); }
.cr-row.active { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.cr-check { width: 20px; display: grid; place-items: center; color: var(--accent-hover); }
.cr-check .ic { width: 18px; height: 18px; }
.cr-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cr-text b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-text small { font-size: 12px; color: var(--muted); }

/* ---------------------------------------------------------------- цитата куска сообщения */
.quote.is-quote b { display: flex; align-items: center; gap: 4px; }
.quote.is-quote b .ic { width: 13px; height: 13px; opacity: .8; }
.quote.is-quote span { white-space: normal; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; font-style: italic; opacity: .92; }
::highlight(yc-quote) { background: color-mix(in srgb, #ffd23f 70%, transparent); color: #111; }
.quote-fab {
  position: fixed; z-index: 60; display: flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 999px; background: var(--accent); color: #fff;
  font-size: 13px; font-weight: 600; box-shadow: 0 6px 20px rgb(0 0 0 / .35);
  animation: pop-in .14s ease-out;
}
.quote-fab .ic { width: 15px; height: 15px; }
.quote-pick { font-size: 15px; line-height: 1.45; resize: vertical; }

/* ---------------------------------------------------------------- список дел */
.type-todo .bubble { min-width: min(300px, 78vw); }
.todo { display: flex; flex-direction: column; gap: 6px; padding: 2px 0 4px; }
.todo-head { display: flex; align-items: center; gap: 7px; font-size: 15px; }
.todo-head .ic { width: 18px; height: 18px; flex: none; opacity: .85; }
.todo-head b { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.todo-count { flex: none; font-size: 12px; opacity: .7; font-variant-numeric: tabular-nums; }
.todo-bar { height: 4px; border-radius: 2px; background: color-mix(in srgb, currentColor 14%, transparent); overflow: hidden; }
.todo-bar i { display: block; height: 100%; background: #3ecf8e; border-radius: inherit; transition: width .4s cubic-bezier(.2, .8, .2, 1); }
.todo-items { display: flex; flex-direction: column; gap: 2px; }
.todo-item { display: flex; align-items: center; gap: 9px; min-height: 34px; padding: 3px 4px; border-radius: 8px; }
.todo-item:hover { background: color-mix(in srgb, currentColor 6%, transparent); }
.todo-check {
  flex: none; width: 22px; height: 22px; display: grid; place-items: center;
  border: 2px solid currentColor; border-radius: 7px; opacity: .6; transition: background .15s, opacity .15s, transform .15s;
}
.todo-check:hover { opacity: 1; }
.todo-check:active { transform: scale(.88); }
.todo-check .ic { width: 15px; height: 15px; stroke-width: 3; }
.todo-item.done .todo-check { background: #3ecf8e; border-color: #3ecf8e; color: #fff; opacity: 1; animation: todo-pop .25s ease-out; }
@keyframes todo-pop { 50% { transform: scale(1.18); } }
.todo-text { flex: 1; min-width: 0; overflow-wrap: anywhere; line-height: 1.3; transition: opacity .2s; }
.todo-item.done .todo-text { text-decoration: line-through; opacity: .55; }
.todo-who { flex: none; display: flex; }
.todo-del { flex: none; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; opacity: 0; transition: opacity .15s; }
.todo-del .ic { width: 14px; height: 14px; }
.todo-item:hover .todo-del { opacity: .6; }
.todo-del:hover { opacity: 1 !important; background: color-mix(in srgb, currentColor 12%, transparent); }
@media (pointer: coarse) { .todo-del { opacity: .45; } }
.todo-add { display: flex; align-items: center; gap: 9px; padding: 2px 4px; }
.todo-plus { flex: none; width: 22px; display: grid; place-items: center; opacity: .55; }
.todo-plus .ic { width: 16px; height: 16px; }
.todo-add input {
  flex: 1; min-width: 0; padding: 6px 0; border: 0; border-bottom: 1px dashed color-mix(in srgb, currentColor 30%, transparent);
  background: none; color: inherit; font: inherit; outline: none;
}
.todo-add input::placeholder { color: inherit; opacity: .5; }
.todo-add input:focus { border-bottom-color: currentColor; }

/* ---------------------------------------------------------------- игры */
.type-game .bubble { min-width: min(260px, 78vw); }
.game { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 2px 0 4px; }
.game-head { align-self: stretch; display: flex; align-items: center; gap: 7px; font-size: 15px; }
.game-head .ic { width: 19px; height: 19px; opacity: .85; }
.game-status { font-size: 13px; text-align: center; opacity: .85; line-height: 1.35; }
.game-status.your-turn { opacity: 1; font-weight: 700; animation: turn-pulse 1.6s ease-in-out infinite; }
@keyframes turn-pulse { 50% { opacity: .55; } }
.game-again { margin-top: 2px; }
.mine .game-again { background: rgb(255 255 255 / .18); border-color: transparent; color: #fff; }

.ttt-players { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.ttt-players span { display: flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 999px; opacity: .7; }
.ttt-players span.now { opacity: 1; background: color-mix(in srgb, currentColor 12%, transparent); font-weight: 600; }
.ttt-players .vs { opacity: .5; font-size: 11px; padding: 0; }
.ttt-board { display: grid; grid-template-columns: repeat(3, 62px); grid-template-rows: repeat(3, 62px); gap: 5px; }
.ttt-cell {
  display: grid; place-items: center; border-radius: 12px;
  background: color-mix(in srgb, currentColor 9%, transparent); transition: background .15s, transform .1s;
}
.ttt-cell:not(:disabled):hover { background: color-mix(in srgb, currentColor 18%, transparent); }
.ttt-cell:not(:disabled):active { transform: scale(.93); }
.ttt-cell:disabled { cursor: default; }
.ttt-cell.win { background: color-mix(in srgb, #ffd23f 45%, transparent); animation: todo-pop .35s ease-out; }
.ttt-x, .ttt-o { position: relative; display: inline-block; width: 30px; height: 30px; }
.ttt-players .ttt-x, .ttt-players .ttt-o { width: 13px; height: 13px; }
.ttt-x::before, .ttt-x::after {
  content: ""; position: absolute; left: 50%; top: 0; width: 16%; height: 100%; margin-left: -8%;
  border-radius: 99px; background: #ff5d73;
}
.ttt-x::before { transform: rotate(45deg); }
.ttt-x::after { transform: rotate(-45deg); }
.ttt-o { border: 5px solid #4fc3ff; border-radius: 50%; }
.ttt-players .ttt-o { border-width: 2.5px; }
.ttt-cell .ttt-x, .ttt-cell .ttt-o { animation: mark-in .22s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes mark-in { from { transform: scale(.2); opacity: 0; } }
.mine .ttt-x::before, .mine .ttt-x::after { background: #ffd0d7; }
.mine .ttt-o { border-color: #c9eeff; }

.dice-wrap { perspective: 400px; padding: 6px 0 2px; }
.dice {
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 4px;
  width: 64px; height: 64px; padding: 9px; border-radius: 14px;
  background: linear-gradient(145deg, #ffffff, #dfe3ee); box-shadow: 0 6px 16px rgb(0 0 0 / .3), inset 0 -3px 0 rgb(0 0 0 / .08);
}
.dice i { border-radius: 50%; }
.dice i.on { background: #1d2233; box-shadow: inset 0 2px 2px rgb(0 0 0 / .35); }
.dice.rolling { animation: dice-roll 1.1s cubic-bezier(.2, .7, .3, 1); }
@keyframes dice-roll {
  0% { transform: translateY(-30px) rotateX(0) rotateZ(0); }
  60% { transform: translateY(4px) rotateX(540deg) rotateZ(200deg); }
  80% { transform: translateY(-6px) rotateX(720deg) rotateZ(350deg); }
  100% { transform: translateY(0) rotateX(720deg) rotateZ(360deg); }
}

.rps-pick { display: flex; gap: 8px; justify-content: center; }
.rps-btn {
  width: 56px; height: 56px; border-radius: 16px; font-size: 30px; line-height: 1;
  background: color-mix(in srgb, currentColor 10%, transparent); transition: transform .12s, background .15s;
}
.rps-btn:hover { background: color-mix(in srgb, currentColor 18%, transparent); transform: translateY(-2px); }
.rps-btn:active { transform: scale(.9); }
.popover .rps-pick { padding: 4px; }
.popover .rps-btn { width: 56px; padding: 0; justify-content: center; font-size: 30px; }
.rps-wait { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rps-wait > span:first-child { font-size: 34px; }
.rps-result { display: flex; align-items: center; gap: 14px; }
.rps-result .vs { opacity: .5; font-size: 12px; }
.rps-hand { display: flex; flex-direction: column; align-items: center; gap: 2px; opacity: .65; }
.rps-hand b { font-size: 40px; line-height: 1.1; animation: mark-in .35s cubic-bezier(.2, 1.4, .4, 1); }
.rps-hand small { font-size: 12px; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rps-hand.won { opacity: 1; }
.rps-hand.won b { filter: drop-shadow(0 0 10px rgb(255 210 63 / .8)); }

.game-menu { display: flex; flex-direction: column; min-width: 280px; }
.popover .game-menu button { align-items: center; gap: 12px; }
.gm-ico {
  flex: none; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 16%, transparent); font-size: 22px; line-height: 1;
}
.gm-ttt { grid-template-columns: auto auto; gap: 3px; place-content: center; }
.gm-ttt .ttt-x, .gm-ttt .ttt-o { width: 14px; height: 14px; }
.gm-ttt .ttt-o { border-width: 3px; }
.game-menu b { display: block; font-weight: 600; }
.game-menu small { display: block; color: var(--muted); font-size: 12px; }

/* ---------------------------------------------------------------- свои имена и заметки */
.contact-card { padding: 0; overflow: hidden; }
.contact-edit { width: 100%; text-align: left; padding: 12px 14px; display: flex; align-items: flex-start; gap: 12px; }
.contact-edit:hover { background: var(--hover); }
.contact-edit .muted-b { font-weight: 600; color: var(--muted); }
.contact-note { margin-top: 6px; white-space: pre-wrap; }
.contact-pen { margin-left: auto; color: var(--muted); }
.contact-pen .ic { width: 16px; height: 16px; }

/* ---------------------------------------------------------------- QR-коды: вход и приглашения */
.qr-box {
  width: min(240px, 70vw); aspect-ratio: 1; margin: 6px auto; padding: 0; border-radius: 16px;
  overflow: hidden; background: #fff; box-shadow: 0 8px 26px rgb(0 0 0 / .3);
}
.qr-box .qr-svg { display: block; width: 100%; height: 100%; }
.qr-wait { display: grid; place-items: center; }
.spinner { width: 34px; height: 34px; border: 3px solid #d7dbe6; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.qr-login { display: flex; flex-direction: column; align-items: stretch; gap: 10px; text-align: left; }
.qr-login[hidden], #auth-form[hidden], .seg[hidden] { display: none; }
.qr-steps { margin: 4px 0 0; padding-left: 20px; font-size: 14px; line-height: 1.5; }
.qr-login-btn { width: 100%; justify-content: center; margin-top: 4px; }
.qr-scan-card { width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px; text-align: left; margin-bottom: 14px; }
.qr-scan-card:hover { background: var(--hover); }
.qr-scan-card .info-text { flex: 1; }
.qr-scan-card .info-text small { display: block; color: var(--muted); margin-top: 2px; }
.qr-cam { position: relative; aspect-ratio: 1; width: min(300px, 76vw); margin: 0 auto; border-radius: 16px; overflow: hidden; background: #000; }
.qr-cam video { width: 100%; height: 100%; object-fit: cover; }
.qr-frame { position: absolute; inset: 18%; border: 3px solid rgb(255 255 255 / .85); border-radius: 14px; box-shadow: 0 0 0 999px rgb(0 0 0 / .35); }
.qr-device { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 12px; background: var(--hover); }
.qr-device small { color: var(--muted); }
.qr-dialog { text-align: center; }

.invite-intro { margin: 0 0 12px; }
.invite-new { width: 100%; margin-bottom: 12px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.invite-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.invite-row + .invite-row { border-top: 1px solid var(--border, rgb(255 255 255 / .06)); }
.invite-row.dead { opacity: .5; }
.invite-ico { flex: none; color: var(--accent-hover); }
.invite-row .ur-meta { flex: 1; min-width: 0; }
.invite-code { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.invite-row small { color: var(--muted); }
.row-links { display: flex; gap: 14px; }
.row-links .link { display: inline-flex; align-items: center; gap: 4px; }
.row-links .ic { width: 14px; height: 14px; }
.invite-card { text-align: center; align-items: center; }
.invite-avatar { display: flex; justify-content: center; margin-bottom: 4px; }
.invite-desc { margin: 4px 0; font-size: 14px; opacity: .85; white-space: pre-wrap; }

/* ---------------------------------------------------------------- рисование поверх демонстрации */
.annot-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.room-tile.annot-on .annot-canvas { pointer-events: auto; cursor: crosshair; touch-action: none; }
.annot-pen {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  background: rgb(0 0 0 / .55); color: #fff; backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .15s;
}
.room-tile:hover .annot-pen, .annot-pen.call-on { opacity: 1; }
.annot-pen.call-on { background: var(--accent); }
@media (pointer: coarse) { .annot-pen { opacity: .85; } }

/* ---------------------------------------------------------------- громкость «вместе» */
.tb-vol, .wp-vol { display: flex; align-items: center; gap: 2px; flex: none; }
.tb-vol input, .wp-vol input { width: 76px; accent-color: var(--accent); cursor: pointer; }
.wp-vol-slot { display: contents; }
@media (max-width: 520px) { .tb-vol input { width: 54px; } }
.together-ask { border-color: var(--accent); animation: turn-pulse 1.6s ease-in-out 3; }
.together-ask .pill { flex: none; }

/* ---------------------------------------------------------------- видео в переписке: пузырь по размеру видео */
.type-video:not(.has-text) .bubble { width: calc(var(--media-w, 340px) + 6px); position: relative; }
.type-video .bubble > .video-tile { width: 100%; max-width: 100%; aspect-ratio: var(--media-ar, 16 / 10); }
.type-video:not(.has-text) .bubble > .meta {
  position: absolute; right: 9px; bottom: 9px; margin: 0; padding: 3px 6px; border-radius: 10px;
  background: rgb(0 0 0 / .55); color: #fff; opacity: 1;
}

/* ---------------------------------------------------------------- выбор нескольких сообщений */
.select-bar {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border, rgb(255 255 255 / .08)); background: var(--panel, var(--bg));
}
.select-bar[hidden] { display: none; }
.select-count { flex: 1; min-width: 0; font-size: 15px; }
.select-bar .pill { display: inline-flex; align-items: center; gap: 6px; }
.select-bar .pill .ic { width: 16px; height: 16px; }
.select-bar .pill:disabled { opacity: .45; }
.select-bar .danger-pill { color: var(--danger); }
.chat.selecting .composer, .chat.selecting .reply-bar, .chat.selecting .edit-bar { display: none !important; }
@media (max-width: 560px) { .select-bar .pill span { display: none; } .select-bar .pill { padding: 8px 10px; } }

.chat.selecting #msg-inner .msg { cursor: pointer; user-select: none; position: relative; }
.chat.selecting #msg-inner .msg::before {
  content: ""; position: absolute; left: 6px; top: 50%; width: 20px; height: 20px; margin-top: -10px;
  border: 2px solid var(--muted); border-radius: 50%; box-sizing: border-box; transition: background .12s, border-color .12s;
}
.chat.selecting #msg-inner .msg.selected::before {
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5 10 17.5 19 7.5'/%3E%3C/svg%3E") center / 13px no-repeat;
  border-color: var(--accent);
}
.chat.selecting #msg-inner .msg.theirs, .chat.selecting #msg-inner .msg.call-line { padding-left: 34px; }
.chat.selecting #msg-inner .msg.selected { background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 10px; }

/* ---------- «Добавить людей» в личном чате: новый общий чат с собеседником и выбранными ---------- */

.dmg-backdrop { position: fixed; inset: 0; z-index: 88; }
.dmg-backdrop.sheet { display: flex; align-items: flex-end; background: rgb(0 0 0 / .45); transition: background .24s; animation: dmg-dim .25s ease-out; }
@keyframes dmg-dim { from { background: transparent; } }
.dmg {
  position: fixed; width: 384px; max-height: 620px; display: flex; flex-direction: column; overflow: hidden;
  border-radius: 20px; color: var(--text);
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel) 90%, var(--accent) 10%), var(--panel) 45%);
  border: 1px solid color-mix(in srgb, var(--line) 70%, var(--accent) 30%);
  box-shadow: 0 34px 90px -24px rgb(0 0 0 / .75), inset 0 1px 0 rgb(255 255 255 / .05);
  animation: dmg-pop .4s cubic-bezier(.2,1.25,.3,1);
}
@keyframes dmg-pop { from { opacity: 0; transform: translateY(-10px) scale(.9); filter: blur(4px); } }
.dmg-backdrop.sheet .dmg {
  position: relative; width: 100%; max-height: 86dvh; border-radius: 22px 22px 0 0;
  padding-bottom: env(safe-area-inset-bottom); animation: dmg-up .45s cubic-bezier(.16,1,.3,1);
}
.dmg-backdrop.sheet .dmg::before { content: ""; align-self: center; width: 40px; height: 4px; margin-top: 8px; border-radius: 2px; background: var(--line); }
@keyframes dmg-up { from { transform: translateY(100%); } }
.dmg-backdrop.leaving { pointer-events: none; }
.dmg-backdrop.leaving .dmg { animation: dmg-out .22s ease-in forwards; }
.dmg-backdrop.sheet.leaving { background: transparent; }
.dmg-backdrop.sheet.leaving .dmg { animation: dmg-down .24s ease-in forwards; }
@keyframes dmg-out { to { opacity: 0; transform: translateY(-8px) scale(.95); } }
@keyframes dmg-down { to { transform: translateY(100%); } }
.dmg-backdrop.launch { pointer-events: none; background: transparent; }
.dmg-backdrop.launch .dmg { animation: dmg-launch .42s cubic-bezier(.4,0,.2,1) forwards; }
@keyframes dmg-launch { 35% { transform: scale(1.02); } to { opacity: 0; transform: translate(-40px, 10px) scale(.88); filter: blur(6px); } }

.dmg-head { display: flex; align-items: center; gap: 12px; padding: 16px 12px 10px 16px; }
.dmg-faces { display: flex; flex: none; }
.dmg-face { display: inline-flex; margin-left: -12px; border-radius: 50%; box-shadow: 0 0 0 3px var(--panel); }
.dmg-face:first-child { margin-left: 0; }
.dmg-face .avatar { width: 34px; height: 34px; font-size: 13px; }
.dmg-face.more { width: 34px; height: 34px; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--muted); background: var(--panel-2); }
.dmg-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.dmg-titles b { font-size: 16px; }
.dmg-titles small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.dmg-chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 98px; overflow-y: auto; padding: 0 16px 10px; }
.dmg-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 5px 0 4px; border-radius: 15px; font-size: 13px; font-weight: 600;
  background: color-mix(in srgb, var(--accent) 16%, var(--panel-2)); border: 1px solid color-mix(in srgb, var(--accent) 38%, transparent);
}
.dmg-chip .avatar { width: 22px; height: 22px; font-size: 9px; }
.dmg-chip.fixed { padding-right: 11px; background: var(--panel-2); border-color: var(--line); }
.dmg-chip-x { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); transition: background .15s, color .15s; }
.dmg-chip-x:hover { background: rgb(255 255 255 / .1); color: var(--text); }
.dmg-chip-x .ic { width: 13px; height: 13px; }

.dmg-search {
  display: flex; align-items: center; gap: 8px; height: 40px; margin: 0 14px 4px; padding: 0 12px; border-radius: 12px;
  background: var(--input); border: 1px solid var(--line); transition: border-color .2s, box-shadow .2s;
}
.dmg-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.dmg-search .ic { width: 18px; height: 18px; color: var(--muted); }
.dmg-search input { flex: 1; min-width: 0; border: 0; outline: none; background: none; font-size: 14px; }

.dmg-list { flex: 1; min-height: 120px; overflow-y: auto; overscroll-behavior: contain; padding: 4px 8px 8px; scrollbar-width: thin; }
.dmg-sec { padding: 10px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.dmg-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 7px 8px; border-radius: 12px; text-align: left; transition: background .15s; }
.dmg-backdrop.first .dmg-row { animation: dmg-row-in .4s ease-out backwards; animation-delay: calc(.08s + var(--i) * 22ms); }
@keyframes dmg-row-in { from { opacity: 0; transform: translateX(-8px); } }
.dmg-row:hover { background: var(--hover); }
.dmg-row.on { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.dmg-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.dmg-row-text b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dmg-row-text small { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dmg-online { color: var(--online); }
.dmg-check {
  flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--line); transition: background .2s, border-color .2s, transform .25s cubic-bezier(.2,1.6,.4,1);
}
.dmg-check svg { width: 15px; height: 15px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset .28s ease .05s; }
.dmg-row.on .dmg-check { background: var(--accent); border-color: var(--accent); transform: scale(1.08); }
.dmg-row.on .dmg-check svg { stroke-dashoffset: 0; }
.dmg-empty { padding: 30px 16px; text-align: center; color: var(--muted); font-size: 13.5px; }

.dmg-foot { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px 14px; border-top: 1px solid var(--line); background: rgb(0 0 0 / .12); }
.dmg-name { height: 40px; }
.dmg-go {
  position: relative; height: 44px; display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 13px;
  font-weight: 650; color: #fff; background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #ff4fa0));
  box-shadow: 0 12px 28px -12px var(--accent); transition: transform .15s, filter .2s, opacity .2s, box-shadow .25s;
}
.dmg-go:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.dmg-go:active:not(:disabled) { transform: scale(.98); }
.dmg-go:disabled { opacity: .45; cursor: default; box-shadow: none; }
.dmg-go .ic { width: 18px; height: 18px; transition: transform .2s; }
.dmg-go:hover:not(:disabled) .ic { transform: translateX(3px); }
.dmg-spin { display: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgb(255 255 255 / .35); border-top-color: #fff; animation: dmg-spin .7s linear infinite; }
.dmg-go.busy .dmg-spin { display: block; }
.dmg-go.busy .ic { display: none; }
@keyframes dmg-spin { to { transform: rotate(360deg); } }
.dmg-note { color: var(--muted); font-size: 11.5px; text-align: center; }
@media (prefers-reduced-motion: reduce) { .dmg, .dmg *, .dmg-backdrop { animation: none !important; transition: none !important; } }

/* ---------- Ещё личные чаты с тем же человеком («ветки» личной переписки) ---------- */

.dmt-btn { position: relative; }
.dmt-btn.in-thread { color: var(--accent-hover); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.dmt-btn-badge {
  position: absolute; top: 3px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  display: grid; place-items: center; font-size: 10px; font-weight: 800; color: #fff; background: var(--accent);
  box-shadow: 0 0 0 2px var(--panel); animation: dmt-pop .4s cubic-bezier(.2,1.6,.4,1);
}
@keyframes dmt-pop { from { transform: scale(.3); opacity: 0; } }
.ch-thread {
  display: inline-flex; align-items: center; gap: 4px; max-width: 46%; margin-left: 8px; padding: 1px 9px; border-radius: 999px;
  vertical-align: 1px; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--accent-hover); background: color-mix(in srgb, var(--accent) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); cursor: pointer;
  animation: dmt-chip-in .45s cubic-bezier(.2,1.3,.4,1); transition: background .2s;
}
.ch-thread:hover { background: color-mix(in srgb, var(--accent) 24%, transparent); }
@keyframes dmt-chip-in { from { opacity: 0; transform: translateX(-6px) scale(.9); } }
.ci-thread { color: var(--accent-hover); }

/* переход между основным чатом и веткой — лёгкий сдвиг вбок */
.chat.thread-switch .messages { animation: dmt-slide .34s cubic-bezier(.2,.8,.2,1); }
.chat.thread-switch.to-main .messages { animation-name: dmt-slide-back; }
@keyframes dmt-slide { from { opacity: 0; transform: translateX(26px); } }
@keyframes dmt-slide-back { from { opacity: 0; transform: translateX(-26px); } }

/* окошко «Чаты с …» — то же стекло, что у «Нового общего чата» */
.dmt { width: 360px; }
.dmt .dmg-head { padding-bottom: 8px; }
.dmt-peer .avatar { width: 40px; height: 40px; }
.dmt-people {
  flex: none; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; color: var(--accent-hover);
  background: color-mix(in srgb, var(--accent) 14%, var(--panel-2)); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  transition: transform .2s, background .2s;
}
.dmt-people:hover { transform: translateY(-1px) scale(1.06); background: color-mix(in srgb, var(--accent) 24%, var(--panel-2)); }
.dmt-people .ic { width: 18px; height: 18px; }
.dmt-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 2px 8px 6px; scrollbar-width: thin; }
.dmt-row {
  position: relative; display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 14px; cursor: pointer;
  outline: none; transition: background .15s, transform .15s;
}
.dmg-backdrop.first .dmt-row { animation: dmg-row-in .4s ease-out backwards; animation-delay: calc(.06s + var(--i) * 45ms); }
.dmt-row:hover, .dmt-row:focus-visible { background: var(--hover); }
.dmt-row:active { transform: scale(.985); }
.dmt-row.on { background: color-mix(in srgb, var(--accent) 13%, transparent); }
.dmt-row.on::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 2px; background: var(--accent); }
.dmt-ico {
  flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 19px;
  background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line); transition: transform .25s cubic-bezier(.2,1.6,.4,1);
}
.dmt-row:hover .dmt-ico { transform: rotate(-8deg) scale(1.08); }
.dmt-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.dmt-text b { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dmt-text small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dmt-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.dmt-side time { font-size: 11px; color: var(--muted); }
.dmt-here { font-size: 10.5px; font-weight: 700; color: var(--accent-hover); }
.dmt-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; background: var(--accent); animation: dmt-pop .4s cubic-bezier(.2,1.6,.4,1); }
.dmt-acts { position: absolute; right: 8px; top: 50%; display: flex; gap: 2px; padding: 2px; border-radius: 10px; opacity: 0; transform: translate(6px, -50%); background: var(--panel); box-shadow: 0 6px 16px rgb(0 0 0 / .35); transition: opacity .15s, transform .2s; pointer-events: none; }
.dmt-row:hover .dmt-acts, .dmt-row:focus-within .dmt-acts { opacity: 1; transform: translate(0, -50%); pointer-events: auto; }
.dmt-acts .icon-btn { width: 30px; height: 30px; }
.dmt-acts .ic { width: 15px; height: 15px; }
@media (pointer: coarse) { .dmt-acts { position: static; opacity: 1; transform: none; pointer-events: auto; box-shadow: none; background: none; } }

/* пока других чатов нет */
.dmt-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 18px 8px; text-align: center; }
.dmt-empty b { font-size: 14.5px; }
.dmt-empty small { color: var(--muted); font-size: 12.5px; line-height: 1.45; max-width: 290px; }
.dmt-bubbles { position: relative; width: 120px; height: 66px; margin-bottom: 4px; }
.dmt-bubbles i {
  position: absolute; width: 44px; height: 44px; border-radius: 15px 15px 15px 5px; display: grid; place-items: center; font-style: normal; font-size: 21px;
  background: color-mix(in srgb, var(--accent) 16%, var(--panel-2)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent), 0 10px 22px -12px var(--accent);
  animation: dmt-float 3.4s ease-in-out infinite;
}
.dmt-bubbles i:nth-child(1) { left: 0; top: 16px; animation-delay: -.4s; }
.dmt-bubbles i:nth-child(2) { left: 38px; top: 0; z-index: 1; animation-delay: -1.5s; background: color-mix(in srgb, var(--accent) 28%, var(--panel-2)); }
.dmt-bubbles i:nth-child(3) { left: 76px; top: 18px; animation-delay: -2.4s; }
@keyframes dmt-float { 50% { transform: translateY(-6px) rotate(-4deg); } }

/* добавить новый личный чат */
.dmt-add { display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 10px 14px 14px; border-top: 1px solid var(--line); background: rgb(0 0 0 / .12); }
.dmt-add-btn {
  height: 44px; display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 13px; font-weight: 650;
  color: var(--accent-hover); border: 1.5px dashed color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--accent) 7%, transparent); transition: background .2s, border-color .2s, transform .15s;
}
.dmt-add-btn:hover { background: color-mix(in srgb, var(--accent) 15%, transparent); border-color: var(--accent); }
.dmt-add-btn:active { transform: scale(.98); }
.dmt-add-btn .ic { width: 18px; height: 18px; transition: transform .3s cubic-bezier(.2,1.6,.4,1); }
.dmt-add-btn:hover .ic { transform: rotate(90deg); }
.dmt-hint { text-align: center; color: var(--muted); font-size: 11.5px; }
.dmt-form { display: flex; flex-direction: column; gap: 10px; animation: dmt-open .35s cubic-bezier(.2,1.1,.3,1); }
@keyframes dmt-open { from { opacity: 0; transform: translateY(8px); } }
.dmt-emojis { display: flex; flex-wrap: wrap; gap: 5px; }
.dmt-emojis label { position: relative; cursor: pointer; }
.dmt-form .dmt-emojis label { animation: dmt-pop .35s cubic-bezier(.2,1.5,.4,1) backwards; animation-delay: calc(var(--i) * 25ms); }
.dmt-emojis input { position: absolute; opacity: 0; pointer-events: none; }
.dmt-emojis span { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; background: var(--panel-2); transition: transform .2s, box-shadow .2s, background .2s; }
.dmt-emojis label:hover span { transform: translateY(-2px); }
.dmt-emojis input:checked + span { background: color-mix(in srgb, var(--accent) 22%, var(--panel-2)); box-shadow: 0 0 0 2px var(--accent); transform: scale(1.08); }
.dmt-emojis.big span { width: 40px; height: 40px; font-size: 21px; }
.dmt-form-row { display: flex; gap: 8px; }
.dmt-form-row .field { flex: 1; min-width: 0; height: 40px; }
.dmt-create {
  flex: none; height: 40px; display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; border-radius: 12px; font-weight: 650; color: #fff;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #ff4fa0)); box-shadow: 0 10px 24px -12px var(--accent);
  transition: filter .2s, transform .15s, opacity .2s;
}
.dmt-create:hover { filter: brightness(1.08); }
.dmt-create:active { transform: scale(.97); }
.dmt-create:disabled { opacity: .6; }
.dmt-create .ic { width: 16px; height: 16px; }
.dmt-create.busy .ic { animation: dmg-spin .8s linear infinite; }
.field.shake { animation: dmt-shake .4s ease; border-color: var(--danger); }
@keyframes dmt-shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
@media (prefers-reduced-motion: reduce) {
  .dmt-btn-badge, .ch-thread, .chat.thread-switch .messages, .dmt-bubbles i, .dmt-form, .dmt-emojis label, .dmt-badge { animation: none !important; }
}

/* ---------- Капсула звонка (как Dynamic Island), полоса в чате и окно звонка ---------- */

/* звонок свёрнут в капсулу: окна не видно, внутри остаются только проигрыватели звука */
.call-panel.island-mode { display: none !important; }

.side-island { display: flex; align-items: center; flex: 0 1 auto; min-width: 0; }
.side-island:empty { display: none; }
.side-island .call-island { min-width: 0; max-width: 100%; }
.side-island .cis-pill { min-width: 0; }
/* узкий список: капсула занимает место имени (аватарка остаётся) — иначе имя сжималось до одной буквы */
.side-head { container-type: inline-size; }
@container (max-width: 430px) {
  .side-head:has(.side-island:not(:empty)) .me { display: none; }
  .side-head:has(.side-island:not(:empty)) .me-btn { flex: none; padding-right: 4px; }
  .side-island { flex: 1 1 auto; justify-content: center; }
}
.sp-island-slot { display: flex; align-items: center; }
.sp-island-slot:empty { display: none; }

/* капсула: тёмная, как «остров», но в цвет темы — лёгкий оттенок акцента и тонкая цветная кромка */
.call-island {
  --ok: #34d88b; --isl: color-mix(in srgb, var(--accent) 14%, #07080c); --isl-edge: color-mix(in srgb, var(--accent) 34%, rgb(255 255 255 / .08));
  position: relative; display: flex; align-items: center; gap: 6px; z-index: 66;
}
.call-island.floating { position: fixed; top: calc(6px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 92; }
.cis-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 5px; border-radius: 999px;
  font-size: 13px; font-weight: 650; white-space: nowrap; color: #fff; position: relative;
  background: linear-gradient(115deg, var(--isl), #07080c 70%);
  border: 1px solid var(--isl-edge); box-shadow: 0 8px 22px -8px rgb(0 0 0 / .7), inset 0 1px 0 rgb(255 255 255 / .06);
  transition: transform .3s cubic-bezier(.2,1.4,.4,1), box-shadow .3s;
}
.call-island.hover .cis-pill, .cis-pill:focus-visible { transform: scale(1.045); box-shadow: 0 10px 26px -8px rgb(0 0 0 / .8), 0 0 0 3px rgb(52 216 139 / .22); }
.cis-pill:active { transform: scale(.97); }
.call-island.open .cis-pill { box-shadow: 0 0 0 3px rgb(52 216 139 / .3); }
.cis-glyph { position: relative; display: inline-flex; border-radius: 50%; transition: box-shadow .12s; }
.cis-glyph .avatar { width: 24px; height: 24px; font-size: 10px; }
.cis-emoji { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; font-size: 14px; background: rgb(255 255 255 / .1); }
.cis-emoji .ic { width: 14px; height: 14px; color: var(--ok); }
.cis-faces { display: inline-flex; }
.cis-face { display: inline-flex; margin-left: -8px; border-radius: 50%; box-shadow: 0 0 0 2px #07080c; transition: box-shadow .12s; }
.cis-face:first-child { margin-left: 0; }
.cis-face .avatar { width: 22px; height: 22px; font-size: 9px; }
.cis-face.more { width: 22px; height: 22px; display: grid; place-items: center; font-size: 10px; background: #1b1f2b; color: rgb(255 255 255 / .8); }
.cis-face.speaking, .cis-glyph.speaking { box-shadow: 0 0 0 2px #050608, 0 0 0 calc(3px + var(--lvl, 0) * 4px) var(--ok); }
.cis-time { color: var(--ok); font-variant-numeric: tabular-nums; }
.cis-label { color: rgb(255 255 255 / .82); }
.call-island.st-outgoing .cis-label, .call-island.st-joining .cis-label { animation: cis-blink 1.4s ease-in-out infinite; }
@keyframes cis-blink { 50% { opacity: .45; } }
.cis-wave { display: inline-flex; align-items: center; gap: 2px; height: 16px; }
.cis-wave i { width: 3px; border-radius: 2px; background: var(--ok); height: calc(4px + var(--lvl, 0) * 9px); transition: height .12s ease-out; }
.cis-wave i:nth-child(2) { height: calc(4px + var(--lvl, 0) * 14px); }
.cis-wave i:nth-child(3) { height: calc(4px + var(--lvl, 0) * 11px); }
.cis-wave i:nth-child(4) { height: calc(3px + var(--lvl, 0) * 7px); }
.call-island.muted .cis-wave i { background: rgb(255 255 255 / .35); }
.cis-off .ic, .cis-live .ic { width: 14px; height: 14px; }
.cis-off .ic { color: #ff6b6b; }
.cis-live .ic { color: #ff4d5e; animation: cis-blink 1.2s ease-in-out infinite; }
.cis-msg { max-width: 240px; overflow: hidden; text-overflow: ellipsis; animation: cis-msg-in .35s cubic-bezier(.2,1.2,.3,1); }
@keyframes cis-msg-in { from { opacity: 0; transform: translateY(4px); } }
.call-island.notice .cis-pill { padding-right: 14px; background: linear-gradient(90deg, #0b2a1c, #050608 70%); }
.cis-notice-go { height: 30px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700; color: #04140c; background: var(--ok); animation: dmt-pop .35s cubic-bezier(.2,1.5,.4,1); }
.call-island.leaving .cis-pill { animation: cis-out .26s ease-in forwards; }
@keyframes cis-out { to { opacity: 0; transform: scale(.7); } }

/* ---- плеер в капсуле: голосовое или песня ---- */
.call-island.kind-media .cis-pill { gap: 9px; padding: 0 46px 0 5px; max-width: min(320px, 72vw); }
.call-island.kind-media.hover .cis-pill, .call-island.kind-media .cis-pill:focus-visible {
  box-shadow: 0 10px 26px -8px rgb(0 0 0 / .8), 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.call-island.kind-media.open .cis-pill { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 38%, transparent); }
.cis-emoji.media { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.cis-emoji.media .ic { color: #fff; }
.cis-mtitle { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cis-mbar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #ff6fb1);
  transform-origin: left center; transform: scaleX(0); transition: transform .25s linear; will-change: transform; }
/* «эквалайзер»: прыгает, пока играет; на паузе стоит */
.cis-eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 13px; flex: none; }
.cis-eq i { width: 3px; height: 100%; border-radius: 2px; background: color-mix(in srgb, var(--accent) 60%, #fff); transform-origin: bottom;
  transform: scaleY(.3); animation: cis-eq 1s ease-in-out infinite; animation-play-state: paused; }
.cis-eq i:nth-child(2) { animation-delay: -.35s; animation-duration: .8s; }
.cis-eq i:nth-child(3) { animation-delay: -.7s; animation-duration: 1.15s; }
.cis-eq.on i { animation-play-state: running; }
@keyframes cis-eq { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) { .cis-eq i { animation: none; transform: scaleY(.6); } }
/* пауза — внутри той же капсулы, у правого края (капсула одна, а не две рядом);
   ход записи — тонкое колечко вокруг неё, как у плеера в «острове» на iPhone */
@property --p { syntax: '<number>'; inherits: true; initial-value: 0; }   /* inherits: колечко — это ::before */
.cis-mquick { position: absolute; right: 6px; top: 50%; translate: 0 -50%; width: 24px; height: 24px; flex: none; border-radius: 50%; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #ff6fb1));
  box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--accent) 70%, transparent); transition: transform .2s cubic-bezier(.2,1.4,.4,1), --p .25s linear; }
.cis-mquick::before { content: ''; position: absolute; inset: -3px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(color-mix(in srgb, var(--accent) 45%, #fff) calc(var(--p) * 360deg), rgb(255 255 255 / .14) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px)); }
.cis-mquick:hover { transform: scale(1.08); }
.cis-mquick:active { transform: scale(.92); }
.cis-mquick .ic { width: 12px; height: 12px; }
/* во время звонка плеер — часть той же капсулы */
.cis-seg { display: inline-flex; align-items: center; gap: 5px; margin-left: 2px; padding-left: 9px; flex: none;
  border-left: 1px solid rgb(255 255 255 / .14); }
.cis-seg .ic { width: 13px; height: 13px; color: color-mix(in srgb, var(--accent) 55%, #fff); }
.cis-seg:not(.on) .cis-eq i { opacity: .55; }
.cis-seg.new { animation: cis-seg-in .42s cubic-bezier(.2,1.35,.4,1); }
@keyframes cis-seg-in { from { opacity: 0; transform: translateX(-14px) scale(.5); } }
/* карточка плеера */
.cis-mcard.under-call { margin-top: 14px; padding-top: 14px; border-top: 1px solid rgb(255 255 255 / .08); }
.cis-mhead { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cis-mhead .cis-head-ico .cis-emoji { width: 40px; height: 40px; }
.cis-mhead .cis-head-ico .cis-emoji .ic { width: 18px; height: 18px; }
.cis-mbar { height: 6px; border-radius: 3px; background: rgb(255 255 255 / .12); overflow: hidden; cursor: pointer; }
.cis-mbar:hover { height: 8px; margin: -1px 0; }
.cis-mtimes { display: flex; justify-content: space-between; margin-top: 5px; font-size: 11.5px; color: rgb(255 255 255 / .6); font-variant-numeric: tabular-nums; }
.cis-mctl { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0 10px; }
.cis-mspace { width: 42px; }
.cis-mbtn { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: rgb(255 255 255 / .08);
  transition: transform .18s, background .2s; }
.cis-mbtn:hover:not(:disabled) { background: rgb(255 255 255 / .16); transform: translateY(-1px); }
.cis-mbtn:active:not(:disabled) { transform: scale(.93); }
.cis-mbtn:disabled { opacity: .3; }
.cis-mbtn .ic { width: 18px; height: 18px; }
.cis-mbtn.big { width: 54px; height: 54px; background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #ff6fb1));
  box-shadow: 0 10px 24px -10px color-mix(in srgb, var(--accent) 80%, transparent); }
.cis-mbtn.big .ic { width: 22px; height: 22px; }
.cis-mbtn.sm { width: 32px; height: 32px; flex: none; }
.cis-mbtn.sm .ic { width: 16px; height: 16px; }
.cis-mspeed { width: 42px; height: 30px; border-radius: 999px; font-size: 12.5px; font-weight: 700; color: #fff; background: rgb(255 255 255 / .1); }
.cis-mspeed:hover { background: rgb(255 255 255 / .18); }
.cis-mvol { display: flex; align-items: center; gap: 8px; }
.cis-mvol input[type=range] { flex: 1; height: 4px; accent-color: var(--accent); cursor: pointer; }
.cis-mvol small { width: 38px; text-align: right; font-size: 11.5px; color: rgb(255 255 255 / .6); font-variant-numeric: tabular-nums; }
.cis-mnote { display: block; margin-top: 10px; font-size: 11.5px; color: rgb(255 255 255 / .5); text-align: center; }

/* раскрытая капсула */
.cis-card {
  position: fixed; z-index: 93; width: 340px; padding: 14px; border-radius: 24px; color: #fff; white-space: normal;
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 10%, rgb(9 10 14 / .97)), rgb(9 10 14 / .97) 55%);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, rgb(255 255 255 / .08));
  box-shadow: 0 30px 80px -20px rgb(0 0 0 / .85); backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4);
  transform-origin: var(--ox, 50%) -12px;
}
.cis-card.on-phone { border-radius: 28px; transform-origin: 50% -12px; }
.cis-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cis-head-ico { flex: none; display: inline-flex; }
.cis-head-ico .avatar { width: 40px; height: 40px; font-size: 15px; }
.cis-head-ico .cis-emoji { width: 40px; height: 40px; font-size: 21px; }
.cis-head-ico .cis-emoji .ic { width: 20px; height: 20px; }
.cis-head-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.cis-head-text b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cis-head-text small { color: rgb(255 255 255 / .6); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cis-seats { flex: none; display: flex; gap: 3px; }
.cis-seats i { width: 7px; height: 7px; border-radius: 50%; background: rgb(255 255 255 / .16); }
.cis-seats i.on { background: var(--ok, #34d88b); box-shadow: 0 0 6px rgb(52 216 139 / .6); }
/* закреп окна: открепленная булавка лежит наискось, закреплённая — стоит прямо и светится зелёным */
.pin-toggle .ic { transform: rotate(40deg); transition: transform .4s cubic-bezier(.2,1.6,.4,1); }
.pin-toggle.on .ic { transform: none; }
.cis-pin {
  flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  color: rgb(255 255 255 / .72); background: rgb(255 255 255 / .08); transition: background .2s, color .2s, box-shadow .3s;
}
.cis-pin:hover { color: #fff; background: rgb(255 255 255 / .15); }
.cis-pin .ic { width: 16px; height: 16px; }
.cis-pin.on { color: #04140c; background: #34d88b; box-shadow: 0 0 0 4px rgb(52 216 139 / .18); }
.cis-people { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; padding: 4px 0 14px; }
.cis-person { position: relative; width: 58px; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.cis-person .avatar { width: 46px; height: 46px; box-shadow: 0 0 0 2px rgb(255 255 255 / .06); transition: box-shadow .12s ease-out; }
.cis-person.speaking .avatar { box-shadow: 0 0 0 2px #34d88b, 0 0 0 calc(4px + var(--lvl, 0) * 7px) rgb(52 216 139 / .28); }
.cis-person.muted .avatar { filter: saturate(.7); }
.cis-person small { max-width: 58px; font-size: 11px; color: rgb(255 255 255 / .7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cis-person-off { position: absolute; top: 30px; right: 3px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: #e5484d; color: #fff; font-style: normal; box-shadow: 0 0 0 2px #0b0c11; }
.cis-person-off .ic { width: 11px; height: 11px; }
.cis-note { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; padding: 8px 8px 8px 12px; border-radius: 14px; font-size: 13px; background: rgb(124 92 255 / .16); }
.cis-note > .ic { width: 16px; height: 16px; flex: none; }
.cis-note span { flex: 1; min-width: 0; }
.cis-note button { height: 28px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700; color: #0b0c11; background: #fff; }
.cis-main { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 10px; }
.cis-btn { width: 54px; display: flex; flex-direction: column; align-items: center; gap: 5px; color: #fff; }
.cis-btn-ico {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: rgb(255 255 255 / .1);
  transition: transform .18s, background .2s, color .2s;
}
.cis-btn-ico .ic { width: 20px; height: 20px; }
.cis-btn:hover .cis-btn-ico { background: rgb(255 255 255 / .17); transform: translateY(-2px); }
.cis-btn:active .cis-btn-ico { transform: scale(.94); }
.cis-btn.off .cis-btn-ico { background: #fff; color: #e5484d; }
.cis-btn.on .cis-btn-ico { background: #fff; color: #0b0d12; }
.cis-btn.end .cis-btn-ico { background: #e5484d; color: #fff; }
.cis-btn.accept .cis-btn-ico { background: #34d88b; color: #04140c; }
.cis-btn.end:hover .cis-btn-ico { background: #f25c61; }
.cis-btn small { font-size: 10.5px; color: rgb(255 255 255 / .7); white-space: nowrap; }
.cis-more { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid rgb(255 255 255 / .07); }
.cis-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 999px;
  font-size: 12px; font-weight: 600; color: rgb(255 255 255 / .86); background: rgb(255 255 255 / .07); transition: background .2s, transform .15s;
}
.cis-chip:hover { background: rgb(255 255 255 / .13); }
.cis-chip:active { transform: scale(.96); }
.cis-chip .ic { width: 14px; height: 14px; }
.cis-chip.rec { color: #ff9b9e; background: rgb(229 72 77 / .2); }

/* полоса звонка в чате, где он идёт (только на компьютере) */
.call-strip {
  display: flex; align-items: center; gap: 10px; margin: 8px 10px 0; padding: 7px 8px 7px 12px; border-radius: 16px;
  background: linear-gradient(90deg, rgb(52 216 139 / .16), rgb(52 216 139 / .05)); border: 1px solid rgb(52 216 139 / .3);
  animation: cst-in .4s cubic-bezier(.2,1.2,.3,1);
}
@keyframes cst-in { from { opacity: 0; transform: translateY(-6px); } }
.call-strip.st-outgoing, .call-strip.st-joining { background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 20%, transparent), transparent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.cst-pulse { flex: none; width: 10px; height: 10px; border-radius: 50%; background: #34d88b; animation: room-pulse 1.6s ease-in-out infinite; }
.call-strip.st-outgoing .cst-pulse, .call-strip.st-joining .cst-pulse { background: var(--accent); }
.cst-faces { display: inline-flex; }
.cst-faces .cis-face { box-shadow: 0 0 0 2px var(--panel); }
.cst-faces .cis-face .avatar { width: 26px; height: 26px; font-size: 10px; }
.cst-faces .cis-face.speaking { box-shadow: 0 0 0 2px var(--panel), 0 0 0 calc(3px + var(--lvl, 0) * 4px) #34d88b; }
.cst-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.cst-text b { font-size: 14px; }
.cst-text small { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cst-acts { display: flex; gap: 6px; }
.cst-btn { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--text); background: rgb(255 255 255 / .08); transition: background .2s, transform .15s; }
.cst-btn:hover { background: rgb(255 255 255 / .15); transform: translateY(-1px); }
.cst-btn .ic { width: 17px; height: 17px; }
.cst-btn.off { background: #fff; color: #e5484d; }
.cst-btn.on { background: #fff; color: #0b0d12; }
.cst-btn.end { background: #e5484d; color: #fff; }
.cst-btn.go { background: #34d88b; color: #04140c; }
.cst-btn.pin-toggle.on { background: #34d88b; color: #04140c; }

/* окно звонка — только когда нужно: стекло, голоса кольцами, кнопки в два яруса */
.call-panel.cw-panel {
  width: min(380px, calc(100vw - 32px)); padding: 14px 14px 16px; border-radius: 24px; color: #fff;
  background: rgb(11 12 17 / .9); border: 1px solid rgb(255 255 255 / .08);
  box-shadow: 0 34px 90px -24px rgb(0 0 0 / .85), inset 0 1px 0 rgb(255 255 255 / .05);
  backdrop-filter: blur(22px) saturate(1.4); -webkit-backdrop-filter: blur(22px) saturate(1.4);
  animation: cw-in .45s cubic-bezier(.2,1.2,.3,1);
}
@keyframes cw-in { from { opacity: 0; transform: translateY(14px) scale(.94); } }
.call-panel.cw-panel.with-tiles { width: min(480px, calc(100vw - 32px)); }
.call-panel.cw-panel .call-content { display: block; }
.cw { display: flex; flex-direction: column; gap: 12px; }
.cw-head { display: flex; align-items: center; gap: 10px; }
.cw-ico { flex: none; display: inline-flex; }
.cw-ico .avatar { width: 38px; height: 38px; font-size: 14px; }
.cw-ico .cis-emoji { width: 38px; height: 38px; font-size: 20px; }
.cw-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.cw-title b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-title small { color: rgb(255 255 255 / .6); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-tools { display: flex; gap: 2px; }
.cw-tools .icon-btn.sm { width: 30px; height: 30px; border-radius: 9px; color: rgb(255 255 255 / .6); }
.cw-tools .icon-btn.sm:hover { color: #fff; background: rgb(255 255 255 / .1); }
.cw-tools .icon-btn.sm.on { color: #34d88b; background: rgb(52 216 139 / .14); }
.cw-tools .ic { width: 16px; height: 16px; }
.cw-video { display: grid; gap: 6px; grid-template-columns: 1fr; }
.cw-video:has(> .room-tile + .room-tile) { grid-template-columns: 1fr 1fr; }
.cw-video .room-tile { aspect-ratio: 16 / 9; border-radius: 14px; background: #000; }
.cw-video .room-tile.mine:not(:only-child) { aspect-ratio: 16 / 9; }
.cw .cis-people { padding: 2px 0 4px; gap: 14px; }
.cw .cis-person { width: 74px; }
.cw .cis-person .avatar.lg { width: 60px; height: 60px; font-size: 22px; }
.cw .cis-person-off { top: 42px; right: 8px; }
.cw .cis-person small { max-width: 74px; font-size: 12px; }
.cw .cis-main { margin-top: 2px; }
.cw .cis-more { margin-top: 0; padding-top: 10px; }
.cw-rec, .cw-note { text-align: center; font-size: 12px; color: rgb(255 255 255 / .6); }
/* вызов, ожидание, «на другом устройстве»: большая аватарка с волнами */
.cw-call { align-items: center; text-align: center; padding: 8px 0 2px; }
.cw-ring { position: relative; width: 88px; height: 88px; display: grid; place-items: center; }
.cw-ring .avatar.lg, .cw-ring .avatar { width: 88px; height: 88px; font-size: 30px; position: relative; z-index: 1; }
.cw-ring .cis-emoji { width: 88px; height: 88px; font-size: 40px; position: relative; z-index: 1; }
.cw-ring i { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgb(52 216 139 / .55); animation: cw-ripple 2s ease-out infinite; }
.cw-ring i + i { animation-delay: 1s; }
.cw-call.st-outgoing .cw-ring i, .cw-call.st-joining .cw-ring i { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
@keyframes cw-ripple { from { transform: scale(1); opacity: .9; } to { transform: scale(1.7); opacity: 0; } }
.cw-ring-text { display: flex; flex-direction: column; gap: 2px; }
.cw-ring-text b { font-size: 18px; }
.cw-ring-text small { color: rgb(255 255 255 / .65); font-size: 13px; font-variant-numeric: tabular-nums; }
.cw-call .cis-main { gap: 8px 34px; margin-top: 4px; }
.cw-call .cis-btn-ico { width: 54px; height: 54px; }
.cw-call .cis-btn { width: 70px; }

/* телефон: капсула сверху по центру, под неё — своя полоска, как строка состояния */
@media (max-width: 759px) {
  html.call-zone body { background: #000; }
  html.call-zone #app { padding-top: calc(46px + env(safe-area-inset-top)); }
  html.call-zone .space-root, html.call-zone .page { top: calc(46px + env(safe-area-inset-top)); }
  .call-island.floating .cis-pill { height: 36px; padding-right: 14px; }
  .call-island.floating.kind-media .cis-pill { padding-right: 46px; }   /* место под паузу, иначе текст под ней */
}
@media (prefers-reduced-motion: reduce) {
  .cis-pill, .cis-card, .cis-msg, .cis-label, .cis-live .ic, .call-strip, .cst-pulse, .cw-panel, .cw-ring i, .pin-toggle .ic { animation: none !important; transition: none !important; }
}

/* ---------- Изменённый голос: 🎭 у голосовых, кружков и людей в звонке ---------- */
.vfx { flex: none; font-size: 13px; line-height: 1; cursor: help; filter: saturate(.9); }
.round-fx { position: absolute; right: 6px; bottom: 6px; font-size: 16px; filter: drop-shadow(0 1px 3px rgb(0 0 0 / .6)); }
/* блок «Изменение голоса» в «Голосе и звуке» */
.vfx-progress { height: 8px; border-radius: 4px; background: var(--panel-2); overflow: hidden; }
.vfx-progress i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--accent), #ff6fb1); transition: width .25s ease; }
/* двухфакторный вход */
.twofa-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; line-height: 1.45; }
.twofa-qr { align-self: center; width: 180px; padding: 8px; border-radius: 14px; background: #fff; }
.twofa-qr .qr-svg { display: block; width: 100%; height: auto; }
.twofa-secret { text-align: center; }
.twofa-secret b { display: inline-block; margin-top: 4px; font-family: ui-monospace, Consolas, monospace; letter-spacing: .5px;
  cursor: pointer; user-select: all; color: var(--text); }
.twofa-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.twofa-codes code { padding: 8px 10px; border-radius: 10px; text-align: center; font-size: 15px; letter-spacing: 1px;
  font-family: ui-monospace, Consolas, monospace; background: var(--panel-2); }
.code-field { text-align: center; font-size: 20px; letter-spacing: 3px; font-variant-numeric: tabular-nums; }
.code-step { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; margin-bottom: 4px; }
.code-step-ico { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent); }
.code-step-ico .ic { width: 22px; height: 22px; }
.usage-users { display: flex; flex-direction: column; gap: 12px; }
.usage-user { display: flex; flex-direction: column; gap: 4px; }
.usage-user-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.usage-user-head > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usage-user-bar { height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; }
.usage-user-bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.usage-user-bar.over i { background: var(--danger); }
.usage-total { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.vfx-quick[hidden] { display: none; }               /* без этого .icon-btn показывал её везде, и на телефоне */
.vfx-quick { font-size: 17px; line-height: 1; filter: grayscale(1); opacity: .45; }
.vfx-quick.on { filter: none; opacity: 1; background: color-mix(in srgb, var(--accent) 18%, transparent); }
.vfx-quick:hover { opacity: 1; }
.vfx-phrase { padding: 10px 12px; border-radius: 12px; background: var(--panel-2); line-height: 1.6; }
.vfx-cal-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.vfx-cal-facts > div { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 12px; background: var(--panel-2); }
.vfx-cal-facts small { opacity: .75; font-size: 12px; line-height: 1.3; }
.vfx-cal-voice .theme-row { flex: 1; }
@media (max-width: 520px) { .vfx-cal-facts { grid-template-columns: 1fr; } }
/* жалобы, удаление аккаунта, правила */
.report-dialog { max-width: 420px; max-height: calc(100dvh - 24px); overflow-y: auto; }
.report-reasons { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 10px; }
.report-reason { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-radius: 10px; cursor: pointer; font-size: 14.5px; }
.report-reason:hover { background: var(--panel-2); }
.report-reason input { accent-color: var(--accent); margin: 0; }
.report-dialog textarea { width: 100%; height: auto; min-height: 64px; padding: 10px 12px; resize: vertical; margin-bottom: 4px; }
.check-row { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.4; cursor: pointer; }
.check-row input { margin-top: 3px; accent-color: var(--accent); }
.auth-legal { display: block; text-align: center; line-height: 1.4; }
.auth-legal a, .auth-links a { color: var(--accent); }
.auth-links { display: flex; justify-content: center; gap: 16px; margin-top: 14px; font-size: 13px; }
.notice-dialog .dialog-buttons[hidden], .blocked-step [hidden] { display: none; }
.notice-dialog { max-width: 440px; max-height: calc(100dvh - 24px); overflow-y: auto; }
.notice-body p { margin: 6px 0; line-height: 1.45; font-size: 14.5px; }
.notice-body a, .notice-item a { color: var(--accent); }
.notice-quote { margin: 8px 0; padding: 10px 12px; border-radius: 12px; background: var(--panel-2); font-size: 14px;
  white-space: pre-wrap; word-break: break-word; max-height: 160px; overflow: auto; }
.notice-appeal { padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 12%, transparent); }
.notice-appeal.reverted { background: color-mix(in srgb, var(--ok, #2ecc71) 16%, transparent); }
.notice-item { display: flex; flex-direction: column; gap: 2px; }
.notice-item + .notice-item { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
.appeal-form textarea { width: 100%; height: auto; min-height: 76px; padding: 10px 12px; resize: vertical; }
.blocked-step { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.blocked-step > b { font-size: 17px; text-align: center; }
.blocked-step > .code-step-ico { align-self: center; }
.code-step-ico.danger { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.danger-text { color: var(--danger); }
.report-card { display: flex; flex-direction: column; gap: 8px; }
.report-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.report-text { white-space: pre-wrap; word-break: break-word; padding: 10px 12px; border-radius: 12px; background: var(--panel-2); font-size: 14px; max-height: 220px; overflow: auto; }
.report-media { max-width: 100%; max-height: 240px; border-radius: 12px; display: block; }
.report-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* проверка голоса */
.vfx-check { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 14px; background: var(--panel-2); }
.vfx-check-row { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; line-height: 1.4; }
.vfx-check-row > span { flex: none; width: 20px; text-align: center; }
.vfx-check-row small { display: block; margin-top: 2px; color: var(--muted); }
.vfx-check-meter { height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--text) 12%, transparent); overflow: hidden; }
.vfx-check-meter i { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--accent); transition: width .08s linear; }
.vfx-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.vfx-voices { display: flex; flex-direction: column; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.vfx-card .info-ico { font-size: 20px; }
.cis-person-fx { position: absolute; top: -4px; right: 2px; font-size: 14px; font-style: normal; line-height: 1; filter: drop-shadow(0 1px 2px rgb(0 0 0 / .7)); }
.type-round .bubble { position: relative; }

/* ---------- Чат в отдельном окне ---------- */
html.popout .sidebar, html.popout .side-grip { display: none !important; }
html.popout .chat { display: flex; }
html.popout .chat-head { padding-left: 12px; }
.chat-head .icon-btn.pin-toggle.on { color: #34d88b; }
.popout-gone { margin: auto; }

/* ---------- Реакции ---------- */

/* под пузырём — строкой; смайлик для реакции — сбоку, виден при наведении мышью */
.msg:has(> .reacts) { flex-wrap: wrap; }
.reacts { flex: 0 0 100%; display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.msg.mine .reacts { justify-content: flex-end; }
.react-chip {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 8px 0 6px; border-radius: 999px;
  font-size: 14px; color: var(--text); background: var(--panel-2); border: 1px solid var(--line);
  transition: transform .18s cubic-bezier(.2,1.6,.4,1), background .2s, border-color .2s;
}
.react-chip:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.react-chip:active { transform: scale(.94); }
.react-chip.mine { background: color-mix(in srgb, var(--accent) 22%, var(--panel-2)); border-color: color-mix(in srgb, var(--accent) 65%, transparent); }
.react-chip .re { display: inline-block; font-size: 15px; line-height: 1; }
.rc-n { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rc-faces { display: inline-flex; }
.rc-faces .avatar { width: 18px; height: 18px; font-size: 8px; margin-left: -6px; box-shadow: 0 0 0 1.5px var(--panel-2); }
.rc-faces .avatar:first-child { margin-left: 0; }
.react-chip.mine .rc-faces .avatar { box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--accent) 22%, var(--panel-2)); }
.react-chip.fresh { animation: rc-in .5s cubic-bezier(.2,1.6,.4,1); }
@keyframes rc-in { from { transform: scale(.3); opacity: 0; } }

/* живые эмодзи: оживают, когда реакцию поставили, и при наведении */
.react-chip.fresh .re, .react-chip:hover .re { animation: var(--re-anim, re-pop) .9s ease-in-out; }
.re.m-beat  { --re-anim: re-beat; }  .re.m-flame { --re-anim: re-flame; }  .re.m-shake { --re-anim: re-shake; }
.re.m-nod   { --re-anim: re-nod; }   .re.m-pop   { --re-anim: re-pop; }    .re.m-drip  { --re-anim: re-drip; }
.re.m-party { --re-anim: re-party; } .re.m-zap   { --re-anim: re-zap; }    .re.m-stamp { --re-anim: re-stamp; }
.re.m-boom  { --re-anim: re-boom; }  .re.m-clap  { --re-anim: re-clap; }   .re.m-look  { --re-anim: re-look; }
.re.m-tilt  { --re-anim: re-tilt; }  .re.m-break { --re-anim: re-break; }
@keyframes re-beat  { 15%, 45% { transform: scale(1.35); } 30%, 60% { transform: scale(1.05); } }
@keyframes re-flame { 20% { transform: scale(1.1, 1.3) rotate(-6deg); } 45% { transform: scale(.95, 1.15) rotate(5deg); } 70% { transform: scale(1.08, 1.25) rotate(-3deg); } }
@keyframes re-shake { 15%, 45%, 75% { transform: rotate(-14deg) scale(1.15); } 30%, 60%, 90% { transform: rotate(14deg) scale(1.15); } }
@keyframes re-nod   { 25% { transform: translateY(-4px) rotate(-10deg) scale(1.2); } 55% { transform: translateY(1px) rotate(4deg); } }
@keyframes re-pop   { 30% { transform: scale(1.45); } 60% { transform: scale(.9); } }
@keyframes re-drip  { 30% { transform: translateY(2px) scale(1.1, .9); } 60% { transform: translateY(-2px) scale(.95, 1.1); } }
@keyframes re-party { 20% { transform: rotate(-22deg) scale(1.3); } 45% { transform: rotate(18deg) scale(1.2); } 70% { transform: rotate(-8deg) scale(1.1); } }
@keyframes re-zap   { 10%, 40% { transform: scale(1.3); filter: brightness(1.8) drop-shadow(0 0 6px #ffd84d); } 25% { transform: scale(.9); } }
@keyframes re-stamp { 0% { transform: scale(2.2); opacity: .2; } 35% { transform: scale(.9); opacity: 1; } 55% { transform: scale(1.1); } }
@keyframes re-boom  { 30% { transform: scale(1.5); filter: drop-shadow(0 0 6px #ff9a4d); } 50% { transform: scale(.85); } }
@keyframes re-clap  { 15%, 45%, 75% { transform: scale(.85); } 30%, 60%, 90% { transform: scale(1.2); } }
@keyframes re-look  { 25% { transform: translateX(-3px); } 60% { transform: translateX(3px); } }
@keyframes re-tilt  { 30% { transform: rotate(-16deg) scale(1.15); } 65% { transform: rotate(10deg); } }
@keyframes re-break { 30% { transform: scale(1.25) rotate(-8deg); } 55% { transform: scale(.9) rotate(8deg); filter: grayscale(.6); } }

.react-slot { flex: none; width: 0; position: relative; align-self: center; }
.msg.mine .react-slot { order: -1; }
.react-add {
  position: absolute; top: 50%; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  color: var(--muted); background: var(--panel); border: 1px solid var(--line); box-shadow: 0 4px 12px rgb(0 0 0 / .25);
  opacity: 0; pointer-events: none; transform: translateY(-50%) scale(.7);
  transition: opacity .15s, transform .25s cubic-bezier(.2,1.6,.4,1), color .2s;
}
.msg.theirs .react-add { left: 6px; }
.msg.mine .react-add { right: 6px; }
.react-add .ic { width: 17px; height: 17px; }
@media (hover: hover) and (pointer: fine) {
  .msg:hover .react-add, .react-add:focus-visible { opacity: 1; pointer-events: auto; transform: translateY(-50%) scale(1); }
  .msg:hover .react-add:hover { color: var(--text); transform: translateY(-50%) scale(1.1) rotate(-8deg); }
}
#chat.selecting .react-slot, .msg.deleted .react-slot { display: none; }

/* ряд реакций над сообщением */
.react-picker {
  position: fixed; z-index: 120; padding: 6px; border-radius: 26px; background: var(--panel);
  border: 1px solid var(--line); box-shadow: 0 18px 50px -12px rgb(0 0 0 / .6);
  transform-origin: var(--ox, 50%) 100%; animation: rp-in .3s cubic-bezier(.2,1.3,.3,1);
}
.react-picker.expanded { border-radius: 22px; }
.react-picker.leaving { animation: rp-out .16s ease-in forwards; }
@keyframes rp-in { from { opacity: 0; transform: translateY(8px) scale(.6); } }
@keyframes rp-out { to { opacity: 0; transform: translateY(6px) scale(.85); } }
.rp-row { display: flex; gap: 2px; }
.rp-more { display: grid; grid-template-columns: repeat(8, 38px); gap: 2px; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
.rp-more[hidden] { display: none; }
.rp-hint { text-align: center; font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.react-opt {
  position: relative; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; line-height: 1;
  transition: transform .2s cubic-bezier(.2,1.6,.4,1), background .2s;
  animation: ro-in .38s cubic-bezier(.2,1.6,.4,1) backwards; animation-delay: calc(var(--i, 0) * 28ms);
  touch-action: none; user-select: none; -webkit-user-select: none;
}
@keyframes ro-in { from { opacity: 0; transform: translateY(10px) scale(.4); } }
.react-opt:hover { transform: scale(1.3) translateY(-3px); background: var(--panel-2); z-index: 1; }
.react-opt.mine { background: color-mix(in srgb, var(--accent) 26%, transparent); }
.react-opt.more { color: var(--muted); }
.react-opt.more .ic { width: 18px; height: 18px; }
/* удерживают — эмодзи набухает: сейчас будет суперреакция */
.react-opt.charging { transform: scale(1.7) translateY(-8px); transition: transform .45s cubic-bezier(.3,0,.2,1); z-index: 2;
  filter: drop-shadow(0 0 10px color-mix(in srgb, var(--accent) 80%, #fff)); animation: ro-wiggle .15s ease-in-out infinite; }
@keyframes ro-wiggle { 50% { rotate: 6deg; } }

/* тот же ряд в меню сообщения (телефон — долгое нажатие) */
.popover .react-row { display: flex; flex-wrap: nowrap; justify-content: space-between; gap: 2px; padding: 2px 2px 6px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.popover .react-row button { flex: none; width: 34px; height: 34px; padding: 0; gap: 0; justify-content: center; border-radius: 50%; font-size: 20px; }
.popover .react-row .ic { width: 18px; height: 18px; }
.popover.msg-menu { min-width: 300px; }

/* суперреакция: эмодзи на весь чат */
.react-burst { position: fixed; inset: 0; pointer-events: none; z-index: 140; overflow: hidden; }
.rb-hero { position: absolute; font-size: 96px; line-height: 1; filter: drop-shadow(0 10px 30px rgb(0 0 0 / .45)); }
.rb-bit { position: absolute; line-height: 1; }

@media (prefers-reduced-motion: reduce) {
  .react-chip, .react-chip .re, .react-picker, .react-opt, .react-add { animation: none !important; transition: none !important; }
}

/* ================================================================ «Пространство» группы — дашборд ===== */
/* Главный экран группы из карточек. Цвета — из переменных пространства: --sp-accent (акцент),
   --sp-tint (оттенок фона), у карточки — свой --cc (по умолчанию — акцент). */

@property --n { syntax: '<integer>'; inherits: false; initial-value: 0; }
@property --ang { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

.space-root {
  --sp-accent: #7c5cff;
  --sp-tint: #0e1016;
  --sp-text: #f3f4f9;
  --sp-muted: rgb(222 226 242 / .58);
  --sp-line: rgb(255 255 255 / .08);
  --sp-line-2: rgb(255 255 255 / .14);
  --sp-glass: rgb(255 255 255 / .05);
  --sp-glass-2: rgb(255 255 255 / .085);
  --sp-acc-soft: color-mix(in srgb, var(--sp-accent) 18%, transparent);
  --sp-radius: 22px;
  --sp-top: 64px;
  position: fixed; inset: 0; z-index: 35; overflow: hidden; isolation: isolate;
  color: var(--sp-text);
  background:
    radial-gradient(1100px 680px at 12% -12%, color-mix(in srgb, var(--sp-accent) 20%, transparent), transparent 62%),
    linear-gradient(180deg, color-mix(in srgb, var(--sp-tint) 88%, #000), color-mix(in srgb, var(--sp-tint) 50%, #000));
  -webkit-font-smoothing: antialiased;
}
.space-root.entering { animation: sp-enter .6s cubic-bezier(.16,1,.3,1); }
.space-root.leaving { animation: sp-leave .38s ease-in forwards; pointer-events: none; }
@keyframes sp-enter { from { opacity: 0; transform: scale(1.015); } }
@keyframes sp-leave { to { opacity: 0; transform: scale(.985); } }
@keyframes sp-rise { from { opacity: 0; transform: translateY(16px); } }
@keyframes sp-pop { from { transform: scale(.4); opacity: 0; } }
@keyframes sp-fade { from { opacity: 0; } }

/* ---- живой фон */
.sp-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.sp-blob { position: absolute; width: 58vmax; height: 58vmax; border-radius: 50%; filter: blur(90px); opacity: .34; will-change: transform; }
.sp-blob.b1 { background: var(--sp-accent); left: -20vmax; top: -24vmax; animation: sp-drift-1 26s ease-in-out infinite alternate; }
.sp-blob.b2 { background: color-mix(in srgb, var(--sp-accent) 45%, #3b6cff); right: -22vmax; top: 6vmax; opacity: .22; animation: sp-drift-2 34s ease-in-out infinite alternate; }
.sp-blob.b3 { background: color-mix(in srgb, var(--sp-accent) 45%, #19c3d6); left: 18vmax; bottom: -34vmax; opacity: .18; animation: sp-drift-3 40s ease-in-out infinite alternate; }
@keyframes sp-drift-1 { to { transform: translate(16vmax, 10vmax) scale(1.18); } }
@keyframes sp-drift-2 { to { transform: translate(-14vmax, 12vmax) scale(.86); } }
@keyframes sp-drift-3 { to { transform: translate(10vmax, -14vmax) scale(1.12); } }
.sp-mesh {
  position: absolute; inset: -35%; opacity: .5; filter: blur(60px);
  background:
    radial-gradient(30% 35% at 20% 30%, var(--sp-accent), transparent 70%),
    radial-gradient(28% 32% at 80% 25%, color-mix(in srgb, var(--sp-accent) 40%, #2f6bff), transparent 70%),
    radial-gradient(35% 30% at 60% 80%, color-mix(in srgb, var(--sp-accent) 40%, #10c4b0), transparent 70%),
    radial-gradient(25% 25% at 25% 85%, color-mix(in srgb, var(--sp-accent) 60%, #ff7a45), transparent 70%);
  animation: sp-turn 48s linear infinite;
}
@keyframes sp-turn { to { transform: rotate(360deg); } }
.sp-glow {
  position: absolute; left: 50%; top: -38vmax; width: 130vmax; height: 80vmax; transform: translateX(-50%);
  background: radial-gradient(closest-side, color-mix(in srgb, var(--sp-accent) 32%, transparent), transparent); opacity: .75;
}
.sp-gridlines {
  position: absolute; left: -50%; right: -50%; bottom: -12%; height: 78%;
  background-image: linear-gradient(rgb(255 255 255 / .09) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / .09) 1px, transparent 1px);
  background-size: 64px 64px; transform: perspective(520px) rotateX(64deg); transform-origin: 50% 100%;
  -webkit-mask-image: linear-gradient(to top, #000 8%, transparent 78%); mask-image: linear-gradient(to top, #000 8%, transparent 78%);
  animation: sp-grid 5s linear infinite;
}
@keyframes sp-grid { to { background-position: 0 64px; } }
.sp-stars i { position: absolute; width: var(--s); height: var(--s); border-radius: 50%; background: #fff; opacity: .75; box-shadow: 0 0 6px rgb(255 255 255 / .6); animation: sp-twinkle var(--d) ease-in-out infinite; }
@keyframes sp-twinkle { 50% { opacity: .12; transform: scale(.55); } }
.sp-noise {
  position: absolute; inset: 0; opacity: .05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.sp-vignette { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 35%, transparent 55%, rgb(0 0 0 / .5)); }

/* ---- верхняя панель */
.sp-top {
  position: absolute; z-index: 6; top: 0; left: 0; right: 0; height: calc(var(--sp-top) + env(safe-area-inset-top));
  display: flex; align-items: center; gap: 8px; padding: env(safe-area-inset-top) 18px 0;
  background: linear-gradient(to bottom, rgb(7 8 12 / .62), rgb(7 8 12 / .3));
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--sp-line);
  transition: opacity .3s, transform .3s;
}
.sp-tbtn {
  height: 38px; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 12px; flex-shrink: 0;
  color: var(--sp-text); background: var(--sp-glass); border: 1px solid var(--sp-line);
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
  transition: background .2s, border-color .2s, transform .15s, box-shadow .3s;
}
.sp-tbtn:hover { background: var(--sp-glass-2); border-color: var(--sp-line-2); }
.sp-tbtn:active { transform: scale(.97); }
.sp-tbtn .ic { width: 18px; height: 18px; }
.sp-tbtn kbd { font: 650 10.5px/1 system-ui, sans-serif; padding: 4px 6px; border-radius: 6px; background: rgb(255 255 255 / .08); color: var(--sp-muted); }
.sp-brand { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 4px 12px 4px 4px; border-radius: 14px; transition: background .2s; }
.sp-brand:hover { background: var(--sp-glass); }
.sp-brand .avatar { border-radius: 12px; box-shadow: 0 0 0 1px var(--sp-line-2); }
.sp-brand .avatar img, .sp-brand .avatar video { border-radius: 12px; }
.sp-brand-text { display: flex; flex-direction: column; min-width: 0; text-align: left; line-height: 1.2; }
.sp-brand-text b { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 34vw; }
.sp-brand-text small { color: var(--sp-muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 34vw; }
.sp-top-gap { flex: 1; }
.sp-call.live { color: #04140c; background: linear-gradient(180deg, #34d88b, #1db06b); border-color: transparent; animation: sp-live-ring 2s ease-out infinite; }
.sp-call.in { background: var(--sp-acc-soft); border-color: color-mix(in srgb, var(--sp-accent) 50%, transparent); }
@keyframes sp-live-ring { from { box-shadow: 0 0 0 0 rgb(52 216 139 / .55); } to { box-shadow: 0 0 0 12px rgb(52 216 139 / 0); } }
.sp-tune.on { color: #0b0c11; background: var(--sp-accent); border-color: transparent; }
.sp-stack { display: inline-flex; align-items: center; }
.sp-stack .avatar { width: 22px; height: 22px; font-size: 9px; margin-left: -7px; box-shadow: 0 0 0 2px rgb(14 15 21 / .95); }
.sp-stack .avatar:first-child { margin-left: 0; }

/* ---- главный экран */
.sp-scroll {
  position: absolute; inset: 0; z-index: 1; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  padding-top: calc(var(--sp-top) + env(safe-area-inset-top));
  scrollbar-width: thin; scrollbar-color: rgb(255 255 255 / .16) transparent;
  transition: transform .6s cubic-bezier(.16,1,.3,1), filter .5s, opacity .5s;
}
.space-root.detail-open .sp-scroll { transform: scale(.965); filter: blur(10px) brightness(.5); pointer-events: none; }
.sp-home { max-width: 1240px; margin: 0 auto; padding: 22px 28px 130px; }

/* загрузка */
.sk-hero, .sk-card {
  border: 1px solid var(--sp-line);
  background: linear-gradient(100deg, rgb(255 255 255 / .035) 30%, rgb(255 255 255 / .085) 50%, rgb(255 255 255 / .035) 70%);
  background-size: 300% 100%; animation: sp-shimmer 1.5s linear infinite;
}
.sk-hero { height: 220px; border-radius: 28px; margin-bottom: 30px; }
.sk-card { min-height: 196px; border-radius: var(--sp-radius); }
@keyframes sp-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---- шапка пространства */
.sp-hero {
  position: relative; margin-bottom: 32px; padding: 34px 32px 28px; border-radius: 28px; overflow: hidden;
  background: linear-gradient(135deg, rgb(255 255 255 / .075), rgb(255 255 255 / .02));
  border: 1px solid var(--sp-line);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .07), 0 40px 90px -50px rgb(0 0 0 / .9);
}
.sp-hero::before {
  content: ""; position: absolute; right: -12%; top: -60%; width: 70%; height: 200%; pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--sp-accent) 34%, transparent), transparent); opacity: .6;
}
.space-root.first .sp-hero { animation: sp-rise .9s cubic-bezier(.16,1,.3,1) backwards; }
.sp-hero.has-cover { padding-top: 168px; }
.sp-cover { position: absolute; left: 0; right: 0; top: 0; height: 250px; }
.sp-cover img, .sp-cover video { width: 100%; height: 100%; object-fit: cover; display: block; }
.sp-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgb(0 0 0 / .05) 20%, color-mix(in srgb, var(--sp-tint) 75%, #050508) 98%); }
.sp-hero-in { position: relative; display: flex; align-items: flex-end; gap: 22px; flex-wrap: wrap; }
.sp-emblem {
  position: relative; flex: none; width: 88px; height: 88px; border-radius: 26px; display: grid; place-items: center; font-size: 44px;
  background: linear-gradient(145deg, rgb(255 255 255 / .16), rgb(255 255 255 / .04));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .22), 0 22px 50px -18px color-mix(in srgb, var(--sp-accent) 85%, transparent);
}
.sp-emblem::before {
  content: ""; position: absolute; inset: -2px; border-radius: inherit; padding: 2px; pointer-events: none;
  background: conic-gradient(from var(--ang), transparent 0 55%, var(--sp-accent) 72%, #fff 78%, var(--sp-accent) 84%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: sp-spin 6s linear infinite;
}
@keyframes sp-spin { to { --ang: 360deg; } }
.sp-emblem span { filter: drop-shadow(0 6px 14px rgb(0 0 0 / .35)); }
.sp-hero-text { flex: 1; min-width: 260px; }
.sp-title {
  margin: 0; font-size: clamp(28px, 4vw, 46px); font-weight: 800; letter-spacing: -.03em; line-height: 1.06; overflow-wrap: anywhere;
  background: linear-gradient(180deg, #fff 35%, color-mix(in srgb, var(--sp-accent) 45%, #fff));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sp-tagline { margin: 8px 0 0; color: var(--sp-muted); font-size: 15.5px; line-height: 1.5; max-width: 660px; }
.sp-stats-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.sp-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.sp-stat {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 999px;
  background: rgb(255 255 255 / .06); border: 1px solid var(--sp-line); font-size: 13px; color: var(--sp-muted);
}
.sp-stat b { color: var(--sp-text); font-weight: 750; font-variant-numeric: tabular-nums; }
.sp-stat.hot { color: #fff; background: var(--sp-acc-soft); border-color: color-mix(in srgb, var(--sp-accent) 45%, transparent); }
.sp-stat.live { color: #c9ffe1; background: rgb(52 216 139 / .12); border-color: rgb(52 216 139 / .35); }
.sp-num { counter-reset: n var(--n); }
.sp-num::after { content: counter(n); }
.space-root.first .sp-num { animation: sp-count 1.6s cubic-bezier(.16,1,.3,1) .35s backwards; }
@keyframes sp-count { from { --n: 0; } }
.sp-dot { width: 8px; height: 8px; border-radius: 50%; background: #9aa0b4; flex: none; }
.sp-dot.on { background: #3ddc84; animation: sp-pulse-green 2.2s infinite; }
.sp-dot.live { background: #34d88b; animation: sp-pulse-green 1.4s infinite; }
@keyframes sp-pulse-green { from { box-shadow: 0 0 0 0 rgb(61 220 132 / .6); } to { box-shadow: 0 0 0 8px rgb(61 220 132 / 0); } }
.sp-here .sp-who .sp-person .avatar { width: 26px; height: 26px; }
.sp-hero-acts { display: flex; gap: 8px; flex-wrap: wrap; }

/* кнопки пространства */
.sp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 13px;
  font-size: 14px; font-weight: 650; color: var(--sp-text, #f3f4f9); white-space: nowrap;
  background: rgb(255 255 255 / .085); border: 1px solid rgb(255 255 255 / .14);
  transition: transform .18s, background .2s, box-shadow .3s, border-color .2s;
}
.sp-btn:hover { background: rgb(255 255 255 / .12); transform: translateY(-1px); }
.sp-btn:active { transform: translateY(0) scale(.98); }
.sp-btn .ic { width: 18px; height: 18px; }
.sp-btn.primary {
  color: #0b0c11; border-color: transparent;
  background: linear-gradient(180deg, color-mix(in srgb, var(--cc, var(--sp-accent)) 82%, #fff), var(--cc, var(--sp-accent)));
  box-shadow: 0 12px 30px -12px color-mix(in srgb, var(--cc, var(--sp-accent)) 85%, transparent), inset 0 1px 0 rgb(255 255 255 / .4);
}
.sp-btn.primary:hover { box-shadow: 0 16px 38px -12px color-mix(in srgb, var(--cc, var(--sp-accent)) 100%, transparent), inset 0 1px 0 rgb(255 255 255 / .45); }
.sp-btn em { font-style: normal; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center; background: #0b0c11; color: #fff; font-size: 11.5px; font-weight: 800; }
.sp-btn.danger { color: #ffc2c8; background: rgb(255 93 108 / .14); border-color: rgb(255 93 108 / .35); }
.sp-btn.ghost { background: transparent; }
.sp-btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.sp-btn.sm .ic { width: 15px; height: 15px; }
.sp-btn.icon { width: 40px; padding: 0; }
.sp-btn.icon.off { color: #ff9aa4; background: rgb(255 93 108 / .14); }
.sp-btn[disabled] { opacity: .45; pointer-events: none; }

/* идёт созвон группы */
.sp-live {
  position: relative; margin-top: 22px; display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 18px;
  background: linear-gradient(90deg, rgb(52 216 139 / .18), rgb(52 216 139 / .05)); border: 1px solid rgb(52 216 139 / .35);
  animation: sp-rise .6s cubic-bezier(.16,1,.3,1);
}
.sp-live-pulse { position: relative; flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: #04140c; background: #34d88b; }
.sp-live-pulse .ic { width: 19px; height: 19px; }
.sp-live-pulse i { position: absolute; inset: 0; border-radius: 50%; border: 2px solid #34d88b; animation: sp-ripple 1.8s ease-out infinite; }
@keyframes sp-ripple { from { transform: scale(1); opacity: .9; } to { transform: scale(1.9); opacity: 0; } }
.sp-live-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.sp-live-text small { color: var(--sp-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-live .sp-stack .avatar { width: 28px; height: 28px; font-size: 11px; }

/* ---- разделы и сетка карточек */
.sp-section + .sp-section, .sp-hero + .sp-section { margin-top: 0; }
.sp-section { margin-bottom: 34px; }
.sp-sec-head { display: flex; align-items: center; gap: 12px; margin: 0 4px 14px; min-height: 28px; }
.sp-sec-head h2 { margin: 0; font-size: 12px; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; color: var(--sp-muted); }
.sp-sec-line { flex: 1; height: 1px; background: linear-gradient(90deg, var(--sp-line-2), transparent); }
.sp-sec-tools { display: flex; gap: 2px; padding: 2px; border-radius: 10px; background: rgb(0 0 0 / .3); border: 1px solid var(--sp-line); }
.sp-sec-tools .icon-btn { width: 30px; height: 28px; }
.sp-sec-tools .ic { width: 16px; height: 16px; }
.sp-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); grid-auto-flow: row dense; gap: 16px; }
.sp-grid > .z-s { grid-column: span 2; }
.sp-grid > .z-m { grid-column: span 3; }
.sp-grid > .z-l { grid-column: span 4; }
.sp-grid > .z-xl { grid-column: span 6; }

/* ---- карточка */
.sp-card {
  --cc: var(--sp-accent);
  position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 196px; padding: 16px 16px 14px;
  border-radius: var(--sp-radius); cursor: pointer; outline: none; overflow: hidden;
  background:
    linear-gradient(160deg, rgb(255 255 255 / .075), rgb(255 255 255 / .02) 62%),
    color-mix(in srgb, var(--sp-tint) 45%, rgb(9 10 15 / .62));
  border: 1px solid var(--sp-line);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .05), 0 22px 46px -30px rgb(0 0 0 / .95);
  transition: transform .4s cubic-bezier(.2,.9,.3,1.15), border-color .25s, box-shadow .4s, opacity .3s;
}
.sp-card.tinted {
  border-color: color-mix(in srgb, var(--cc) 28%, var(--sp-line));
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--cc) 20%, rgb(255 255 255 / .04)), rgb(255 255 255 / .02) 66%),
    color-mix(in srgb, var(--sp-tint) 45%, rgb(9 10 15 / .62));
}
.sp-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--cc) 42%, var(--sp-line-2)); box-shadow: inset 0 1px 0 rgb(255 255 255 / .08), 0 30px 60px -32px color-mix(in srgb, var(--cc) 60%, rgb(0 0 0 / .95)); }
.sp-card:focus-visible { box-shadow: 0 0 0 2px var(--cc); }
.sp-card.has-new { border-color: color-mix(in srgb, var(--cc) 40%, var(--sp-line)); }
/* свет под курсором: по фону и по рамке */
.sp-shine { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .35s; background: radial-gradient(440px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--cc) 15%, transparent), transparent 45%); }
.sp-card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; opacity: 0; transition: opacity .35s;
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--cc) 90%, #fff), transparent 62%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.sp-card:hover .sp-shine, .sp-card:hover::after { opacity: 1; }
.space-root.first .sp-card { animation: sp-card-in .85s cubic-bezier(.16,1,.3,1) backwards; animation-delay: calc(.14s + var(--i, 0) * 55ms); }
@keyframes sp-card-in { from { opacity: 0; transform: translateY(24px) scale(.97); filter: blur(8px); } }
.sp-card.born { animation: sp-born .9s cubic-bezier(.2,1.35,.3,1); }
@keyframes sp-born { 0% { opacity: 0; transform: scale(.86); } 55% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--cc) 25%, transparent); } }
.sp-card.dying { animation: sp-die .32s ease-in forwards; }
@keyframes sp-die { to { opacity: 0; transform: scale(.9); filter: blur(6px); } }
.sp-card.ping { animation: sp-ping 1.2s ease-out; }
@keyframes sp-ping { from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--cc) 65%, transparent); } to { box-shadow: 0 0 0 18px transparent; } }

.sp-card-head { position: relative; display: flex; align-items: center; gap: 11px; margin-bottom: 12px; }
.sp-card-ico {
  flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 19px; line-height: 1;
  background: color-mix(in srgb, var(--cc) 16%, rgb(255 255 255 / .05));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .1), inset 0 0 0 1px color-mix(in srgb, var(--cc) 26%, transparent);
}
.sp-card-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.sp-card-title b { display: flex; align-items: center; gap: 4px; min-width: 0; font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-hash { font-style: normal; color: color-mix(in srgb, var(--cc) 75%, #fff); }
.sp-card-title small { color: var(--sp-muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-lock { display: inline-flex; }
.sp-lock .ic { width: 13px; height: 13px; color: var(--sp-muted); }
.sp-card-meta { display: flex; align-items: center; gap: 8px; flex: none; }
.sp-badge {
  min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; display: grid; place-items: center;
  font-size: 11.5px; font-weight: 800; color: #0b0c11; background: var(--cc);
  box-shadow: 0 0 18px -2px color-mix(in srgb, var(--cc) 75%, transparent); animation: sp-pop .5s cubic-bezier(.2,1.6,.4,1);
}
.sp-card-body { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.sp-empty-line { color: var(--sp-muted); font-size: 13px; text-align: center; padding: 6px 0; }
.sp-muted { color: var(--sp-muted); font-size: 13px; }

/* кто сейчас в карточке */
.sp-who { display: inline-flex; align-items: center; }
.sp-who:empty { display: none; }
.sp-person { display: inline-flex; margin-left: -6px; border-radius: 50%; box-shadow: 0 0 0 2px rgb(14 15 21); }
.sp-person:first-child { margin-left: 0; }
.sp-person .avatar { width: 22px; height: 22px; font-size: 9px; }
.sp-person.me { box-shadow: 0 0 0 2px var(--cc, var(--sp-accent)); }
.sp-more { margin-left: 4px; font-size: 11px; font-weight: 750; color: var(--sp-muted); }

/* последние сообщения и быстрый ответ */
.sp-feed { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 9px; overflow: hidden; }
.sp-feed-item { display: flex; align-items: flex-start; gap: 9px; font-size: 13.5px; line-height: 1.38; }
.sp-feed-item .avatar { width: 24px; height: 24px; font-size: 10px; margin-top: 1px; }
.sp-feed-text { flex: 1; min-width: 0; color: rgb(236 238 246 / .86); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sp-feed-text b { margin-right: 6px; font-weight: 650; color: hsl(var(--h, 260) 82% 77%); }
.sp-feed-item time { flex: none; padding-top: 2px; font-size: 11px; color: var(--sp-muted); font-variant-numeric: tabular-nums; }
.sp-quick {
  display: flex; align-items: center; gap: 6px; margin-top: auto; padding: 4px 4px 4px 12px; border-radius: 13px;
  background: rgb(0 0 0 / .26); border: 1px solid var(--sp-line); transition: border-color .2s, box-shadow .25s, background .2s;
}
.sp-quick:focus-within { border-color: color-mix(in srgb, var(--cc) 60%, transparent); background: rgb(0 0 0 / .36); box-shadow: 0 0 0 4px color-mix(in srgb, var(--cc) 14%, transparent); }
.sp-quick input { flex: 1; min-width: 0; height: 32px; border: 0; outline: none; background: none; color: inherit; font-size: 13.5px; }
.sp-quick input::placeholder { color: rgb(222 226 242 / .4); }
.sp-quick-send { flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; color: #0b0c11; background: var(--cc); transition: transform .15s, filter .2s; }
.sp-quick-send:hover { filter: brightness(1.1); }
.sp-quick-send .ic { width: 16px; height: 16px; }
.sp-quick.sent .sp-quick-send .ic { animation: sp-send .6s ease; }
@keyframes sp-send { 40% { transform: translate(8px, -8px) scale(.7); opacity: 0; } 41% { transform: translate(-8px, 8px) scale(.7); opacity: 0; } }
.sp-card.k-main { min-height: 320px; }
.sp-card.k-main .sp-card-ico { background: linear-gradient(145deg, var(--cc), color-mix(in srgb, var(--cc) 45%, #000)); box-shadow: 0 10px 24px -10px var(--cc), inset 0 1px 0 rgb(255 255 255 / .3); }

/* голосовая комната */
.sp-voice { flex: 1; display: flex; flex-direction: column; justify-content: space-between; gap: 12px; }
.sp-wave { display: flex; align-items: center; justify-content: center; gap: 4px; height: 36px; opacity: .5; }
.sp-wave i { width: 4px; height: 8px; border-radius: 2px; background: color-mix(in srgb, var(--cc) 70%, #fff); animation: sp-wave 1.8s ease-in-out infinite; }
.sp-wave i:nth-child(2n) { animation-delay: -.3s; }
.sp-wave i:nth-child(3n) { animation-delay: -.7s; }
.sp-wave i:nth-child(4n+1) { animation-delay: -1.1s; }
@keyframes sp-wave { 50% { height: 24px; } }
.sp-voice-people { display: flex; flex-wrap: wrap; gap: 10px; }
.sp-voice-person { position: relative; width: 58px; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.sp-voice-person .avatar { width: 44px; height: 44px; box-shadow: 0 0 0 2px #34d88b, 0 0 14px rgb(52 216 139 / .3); transition: box-shadow .12s ease-out; }
.sp-voice-person.speaking .avatar { box-shadow: 0 0 0 3px #34d88b, 0 0 calc(10px + var(--lvl, 0) * 18px) rgb(52 216 139 / .75); }
.sp-voice-person.muted .avatar { box-shadow: 0 0 0 2px rgb(255 255 255 / .16); animation: none; filter: saturate(.75); }
@keyframes sp-speak { 50% { box-shadow: 0 0 0 3px #34d88b, 0 0 26px rgb(52 216 139 / .55); } }
.sp-voice-person small { max-width: 58px; font-size: 11px; color: var(--sp-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-voice-off { position: absolute; top: 28px; right: 4px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: #ff5d6c; color: #fff; box-shadow: 0 0 0 2px rgb(14 15 21); }
.sp-voice-off .ic { width: 11px; height: 11px; }
.sp-voice-acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sp-card.k-voice.live { border-color: rgb(52 216 139 / .45); }
.sp-card.k-voice.live .sp-card-ico { box-shadow: inset 0 0 0 1px rgb(52 216 139 / .6), 0 0 18px -4px rgb(52 216 139 / .7); }

/* страница, объявление */
.sp-excerpt { flex: 1; min-height: 0; max-height: 176px; overflow: hidden; font-size: 13.5px; line-height: 1.5; color: rgb(236 238 246 / .82);
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent); mask-image: linear-gradient(to bottom, #000 55%, transparent); }
.sp-excerpt.md h2 { font-family: inherit; font-size: 17px; margin: 0 0 6px; color: #fff; }
.sp-excerpt.md h3, .sp-excerpt.md h4 { font-family: inherit; font-size: 14.5px; margin: 8px 0 4px; }
.sp-card.k-note {
  background:
    radial-gradient(120% 90% at 0% 0%, color-mix(in srgb, var(--cc) 24%, transparent), transparent 60%),
    color-mix(in srgb, var(--sp-tint) 45%, rgb(9 10 15 / .62));
  border-color: color-mix(in srgb, var(--cc) 30%, var(--sp-line));
}
.sp-note { font-size: 15px; line-height: 1.55; overflow-wrap: anywhere; }
.sp-note.md p { margin: 0 0 6px; }
.sp-note.md h2, .sp-note.md h3 { font-family: inherit; font-size: 18px; margin: 0 0 6px; }
.sp-note-edit { align-self: flex-start; margin-top: auto; }

/* таблица на карточке */
.sp-mini { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
.sp-mini th { padding: 0 8px 6px 0; text-align: left; font-size: 10.5px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; color: var(--sp-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-mini td { padding: 6px 8px 6px 0; border-top: 1px solid var(--sp-line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-mini td.t-number { font-variant-numeric: tabular-nums; }
.sp-mini .sp-stars i { font-size: 13px; }
.sp-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.sp-stat-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 6px 10px; border-radius: 12px; background: rgb(255 255 255 / .05); border: 1px solid var(--sp-line); font-size: 12px; flex-direction: column; align-items: flex-start; gap: 0; line-height: 1.3; }
.sp-stat-chip b { font-weight: 750; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sp-stat-chip small { max-width: 160px; color: var(--sp-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-stat-chip.ring { flex-direction: row; align-items: center; gap: 8px; }
.sp-stat-chip.ring > span { display: flex; flex-direction: column; min-width: 0; }
.sp-stat-chip.ring svg { width: 30px; height: 30px; flex: none; transform: rotate(-90deg); }
.sp-stat-chip.ring .bg { fill: none; stroke: rgb(255 255 255 / .1); stroke-width: 4; }
.sp-stat-chip.ring .fg { fill: none; stroke: var(--cc); stroke-width: 4; stroke-linecap: round; transition: stroke-dasharray .8s cubic-bezier(.16,1,.3,1); }
.sp-bignum { display: flex; align-items: baseline; gap: 8px; margin-top: auto; }
.sp-bignum b {
  font-size: 46px; font-weight: 800; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #fff, color-mix(in srgb, var(--cc) 60%, #fff)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sp-bignum small { color: var(--sp-muted); font-size: 13px; }

/* обратный отсчёт */
.sp-cd { display: flex; gap: 8px; margin-top: auto; }
.sp-cd-seg {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 11px 4px 8px; border-radius: 14px; overflow: hidden;
  background: linear-gradient(180deg, rgb(0 0 0 / .2), rgb(0 0 0 / .38)); border: 1px solid var(--sp-line); box-shadow: inset 0 1px 0 rgb(255 255 255 / .06);
}
.sp-cd-seg b { display: block; font-size: 30px; font-weight: 800; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.sp-cd-seg b.tick { animation: sp-tick .45s cubic-bezier(.2,1.3,.4,1); }
@keyframes sp-tick { from { transform: translateY(-45%); opacity: 0; filter: blur(2px); } }
.sp-cd-seg small { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--sp-muted); }
.sp-cd-when { margin-top: 8px; text-align: center; font-size: 12.5px; color: var(--sp-muted); }
.sp-cd-done { margin-top: auto; display: flex; flex-direction: column; gap: 2px; font-size: 22px; font-weight: 800; }
.sp-cd-done small { font-size: 12.5px; font-weight: 500; color: var(--sp-muted); }
.sp-cd-empty { margin: auto 0; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--sp-muted); font-size: 13.5px; }
.sp-grid > .z-s .sp-cd { gap: 5px; }
.sp-grid > .z-s .sp-cd-seg { padding: 9px 2px 7px; border-radius: 12px; }
.sp-grid > .z-s .sp-cd-seg b { font-size: 22px; }
.sp-grid > .z-s .sp-cd-seg small { font-size: 9px; letter-spacing: .04em; }

/* ссылка */
.sp-linkcard {
  display: flex; align-items: center; gap: 12px; margin-top: auto; padding: 12px; border-radius: 16px; text-decoration: none; color: inherit;
  background: rgb(255 255 255 / .05); border: 1px solid var(--sp-line); transition: background .2s, border-color .2s;
}
.sp-linkcard:hover { background: rgb(255 255 255 / .09); border-color: var(--sp-line-2); }
.sp-favicon { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 18px; font-weight: 800; background: hsl(var(--h, 260) 60% 45% / .35); color: hsl(var(--h, 260) 85% 82%); }
.sp-link-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.sp-link-text b, .sp-link-text small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-link-text small { color: var(--sp-muted); font-size: 12px; }
.sp-link-go .ic { width: 18px; height: 18px; color: var(--sp-muted); }

/* участники */
.sp-members { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 8px; }
.sp-member { position: relative; border-radius: 50%; transition: transform .2s; }
.sp-member:hover { transform: translateY(-2px) scale(1.06); }
.sp-member:not(.on) .avatar { filter: grayscale(.55) brightness(.72); }
.sp-member.on::after { content: ""; position: absolute; right: 0; bottom: 0; width: 11px; height: 11px; border-radius: 50%; background: #3ddc84; box-shadow: 0 0 0 2px rgb(14 15 21); }
.sp-more.big { width: 38px; height: 38px; margin: 0; border-radius: 50%; display: grid; place-items: center; background: rgb(255 255 255 / .08); }

/* ---- конструктор */
.space-root.editing .sp-card { cursor: default; }
.space-root.editing .sp-card:hover { transform: none; }
.space-root.editing .sp-grid > .sp-card { outline: 1px dashed rgb(255 255 255 / .16); outline-offset: 4px; }
.sp-edit-bar {
  position: absolute; z-index: 3; top: 10px; right: 10px; display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 12px;
  background: rgb(12 13 18 / .86); border: 1px solid var(--sp-line-2); box-shadow: 0 12px 30px -10px rgb(0 0 0 / .85);
  animation: sp-pop .35s cubic-bezier(.2,1.5,.4,1);
}
.sp-grip { width: 30px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--sp-muted); cursor: grab; touch-action: none; }
.sp-grip .ic { width: 18px; height: 18px; }
.sp-grip:hover, .sp-edit-more:hover { background: rgb(255 255 255 / .09); color: #fff; }
.sp-sizes { display: flex; gap: 2px; padding: 0 2px; }
.sp-sizes button { min-width: 26px; height: 28px; padding: 0 4px; border-radius: 8px; font-size: 12.5px; font-weight: 750; color: var(--sp-muted); transition: background .15s, color .15s; }
.sp-sizes button:hover { background: rgb(255 255 255 / .08); color: #fff; }
.sp-sizes button.on { background: var(--sp-accent); color: #0b0c11; }
.sp-edit-more { width: 30px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--sp-muted); }
.sp-edit-more .ic { width: 18px; height: 18px; }
.sp-hidden-tag { position: absolute; left: 14px; bottom: 10px; padding: 3px 8px; border-radius: 8px; font-size: 11px; color: var(--sp-muted); background: rgb(0 0 0 / .55); }
.sp-card.off-home { opacity: .55; }
.sp-add {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 196px; border-radius: var(--sp-radius);
  border: 1.5px dashed rgb(255 255 255 / .18); color: var(--sp-muted); font-weight: 650; transition: border-color .2s, color .2s, background .2s;
}
.sp-add:hover { border-color: var(--sp-accent); color: #fff; background: var(--sp-acc-soft); }
.sp-add .ic { width: 28px; height: 28px; }
.sp-new-section {
  display: flex; align-items: center; gap: 8px; margin: 0 auto; padding: 12px 20px; border-radius: 14px;
  border: 1.5px dashed rgb(255 255 255 / .18); color: var(--sp-muted); font-weight: 650; transition: border-color .2s, color .2s;
}
.sp-new-section:hover { border-color: var(--sp-accent); color: #fff; }
.sp-ghost {
  position: fixed; z-index: 30; margin: 0; pointer-events: none; opacity: .97; transition: none !important; animation: none !important;
  box-shadow: 0 40px 90px -20px rgb(0 0 0 / .95), 0 0 0 1.5px var(--sp-accent);
}
.sp-card.sp-dragging { opacity: .22; outline: 2px dashed var(--sp-accent) !important; }
.space-root.dragging, .space-root.dragging * { cursor: grabbing !important; user-select: none; }
.sp-dock-slot { position: absolute; z-index: 7; left: 0; right: 0; bottom: max(18px, env(safe-area-inset-bottom)); display: flex; justify-content: center; pointer-events: none; }
.sp-dock {
  pointer-events: auto; display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 24px); overflow-x: auto; padding: 8px; border-radius: 18px;
  background: rgb(14 15 21 / .84); border: 1px solid var(--sp-line-2); box-shadow: 0 30px 70px -20px rgb(0 0 0 / .9);
  backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4);
  animation: sp-dock-in .5s cubic-bezier(.16,1,.3,1); scrollbar-width: none;
}
@keyframes sp-dock-in { from { opacity: 0; transform: translateY(30px); } }
.sp-dock-hint { display: flex; align-items: center; gap: 8px; padding: 0 10px 0 6px; font-size: 12.5px; color: var(--sp-muted); white-space: nowrap; }
.sp-dock-hint .ic { width: 16px; height: 16px; }

/* ---- открытая карточка */
.sp-detail { position: absolute; z-index: 5; inset: calc(var(--sp-top) + env(safe-area-inset-top)) 0 0 0; display: flex; padding: 14px; pointer-events: none; }
.space-root.detail-open .sp-detail { pointer-events: auto; }
.sp-detail:empty { display: none; }
.sp-panel {
  --cc: var(--sp-accent);
  position: relative; flex: 1; min-width: 0; max-width: 1240px; margin: 0 auto; display: flex; flex-direction: column; overflow: hidden;
  border-radius: 24px; background: color-mix(in srgb, var(--sp-tint) 55%, rgb(11 12 17 / .94));
  border: 1px solid var(--sp-line-2); box-shadow: 0 50px 120px -30px rgb(0 0 0 / .9), inset 0 1px 0 rgb(255 255 255 / .05);
}
.sp-panel-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--sp-line); background: rgb(255 255 255 / .025); }
.sp-panel-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.sp-panel-title b { display: flex; gap: 4px; font-size: 17px; font-weight: 750; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-panel-title small { color: var(--sp-muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-panel-head .sp-who .avatar { width: 26px; height: 26px; }
.sp-panel-tools { display: flex; align-items: center; gap: 6px; }
.sp-panel-tools .icon-btn { color: var(--sp-muted); }
.sp-panel-tools .icon-btn:hover { background: rgb(255 255 255 / .08); color: #fff; }
.sp-panel-body { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
@media (min-width: 760px) { .sp-panel-head > [data-sp="back"] { display: none; } }

/* общий чат группы внутри пространства — то же окно переписки, что в мессенджере */
.sp-panel-body > .chat.in-space { display: flex !important; flex: 1; min-height: 0; background: transparent; }
.chat.in-space > .chat-head, .chat.in-space > .room-banner-slot, .chat.in-space > .wallpaper { display: none !important; }
.chat.in-space .messages { background: transparent; }
.chat.in-space .composer { background: rgb(255 255 255 / .03); border-top-color: var(--sp-line); }

/* канал-чат */
.sp-posts { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 0 12px; scrollbar-width: thin; scrollbar-color: rgb(255 255 255 / .14) transparent; }
.sp-chat-start { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 26px 22px 12px; }
.sp-chat-start b { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.sp-hero-ico { font-size: 42px; line-height: 1.1; filter: drop-shadow(0 6px 18px color-mix(in srgb, var(--cc, var(--sp-accent)) 45%, transparent)); }
.sp-day { display: flex; align-items: center; gap: 10px; margin: 14px 20px 6px; color: var(--sp-muted); font-size: 12px; font-weight: 650; }
.sp-day::before, .sp-day::after { content: ""; flex: 1; height: 1px; background: var(--sp-line); }
.sp-post { position: relative; display: flex; gap: 12px; padding: 6px 20px 2px; }
.sp-post.grouped { padding-top: 1px; }
.sp-post:hover { background: rgb(255 255 255 / .03); }
.sp-post.flash { animation: sp-flash 1.4s ease-out; }
@keyframes sp-flash { from { background: color-mix(in srgb, var(--cc, var(--sp-accent)) 25%, transparent); } }
.sp-post-side { flex: none; width: 40px; display: flex; justify-content: center; }
.sp-ptime { visibility: hidden; padding-top: 4px; font-size: 10.5px; color: var(--sp-muted); }
.sp-post:hover .sp-ptime { visibility: visible; }
.sp-post-body { flex: 1; min-width: 0; }
.sp-post-head { display: flex; align-items: baseline; gap: 8px; }
.sp-author { padding: 0; font-weight: 700; color: hsl(var(--h, 260) 80% 74%); }
.sp-author:hover { text-decoration: underline; }
.sp-post-head small { color: var(--sp-muted); font-size: 11.5px; }
.sp-text { line-height: 1.45; overflow-wrap: anywhere; white-space: pre-wrap; }
.sp-edited { color: var(--sp-muted); font-size: 11px; }
.sp-quote {
  display: block; max-width: 100%; margin: 2px 0 4px; padding: 3px 10px; border-radius: 8px; text-align: left; font-size: 13px;
  border-left: 3px solid hsl(var(--h, 260) 75% 65%); background: rgb(255 255 255 / .05); color: var(--sp-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sp-quote b { color: hsl(var(--h, 260) 75% 74%); }
.sp-quote.missing { font-style: italic; border-left-color: var(--sp-muted); }
.sp-media { display: block; max-width: min(420px, 100%); max-height: 340px; margin-top: 4px; border-radius: 12px; cursor: zoom-in; background: #000; }
video.sp-media { cursor: default; }
.sp-audio { display: block; margin-top: 4px; max-width: 100%; }
.sp-file { display: inline-flex; align-items: center; gap: 10px; max-width: 100%; margin-top: 4px; padding: 10px 12px; border-radius: 12px; background: rgb(255 255 255 / .06); color: inherit; text-decoration: none; }
.sp-file span { display: flex; flex-direction: column; min-width: 0; }
.sp-file b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-file small { color: var(--sp-muted); }
.sp-post-acts { position: absolute; top: -10px; right: 16px; display: none; gap: 2px; padding: 2px; border-radius: 10px; background: rgb(18 19 26 / .96); border: 1px solid var(--sp-line-2); box-shadow: 0 8px 20px rgb(0 0 0 / .4); }
.sp-post:hover .sp-post-acts { display: flex; }
.sp-post-acts .icon-btn { width: 28px; height: 28px; }
.sp-post-acts .ic { width: 15px; height: 15px; }
.sp-reply { display: flex; align-items: center; gap: 8px; margin: 0 16px; padding: 8px 10px; border-radius: 12px 12px 0 0; font-size: 13px; color: var(--sp-muted); background: rgb(255 255 255 / .06); border: 1px solid var(--sp-line); border-bottom: 0; }
.sp-reply[hidden] { display: none; }
.sp-reply span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-reply b { color: var(--sp-text); }
.sp-reply .ic { width: 15px; height: 15px; flex: none; }
.sp-compose {
  display: flex; align-items: flex-end; gap: 6px; margin: 0 16px 16px; padding: 6px; border-radius: 16px;
  background: rgb(0 0 0 / .3); border: 1px solid var(--sp-line-2); transition: border-color .2s, box-shadow .25s;
}
.sp-compose:focus-within { border-color: color-mix(in srgb, var(--cc, var(--sp-accent)) 60%, transparent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--cc, var(--sp-accent)) 14%, transparent); }
.sp-reply:not([hidden]) + .sp-compose { border-top-left-radius: 0; border-top-right-radius: 0; }
.sp-compose textarea { flex: 1; min-width: 0; max-height: 160px; padding: 9px 4px; resize: none; border: 0; outline: none; background: none; color: inherit; font: inherit; }
.sp-compose .icon-btn.accent { background: var(--cc, var(--sp-accent)); color: #0b0c11; }
.sp-compose.locked { opacity: .6; }
.sp-compose.locked button { pointer-events: none; }

/* страница */
.sp-page, .sp-page-editor { flex: 1; min-height: 0; overflow-y: auto; padding: 28px clamp(18px, 5vw, 64px) 48px; }
.sp-page .md { margin: 0 auto; }
.md { max-width: 760px; line-height: 1.65; font-size: 15.5px; overflow-wrap: anywhere; }
.md h2 { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin: 4px 0 12px; color: #fff; }
.md h3 { font-size: 21px; font-weight: 750; margin: 18px 0 8px; }
.md h4 { font-size: 16px; margin: 14px 0 6px; }
.md p { margin: 0 0 6px; }
.md ul, .md ol { margin: 4px 0 10px; padding-left: 22px; }
.md li { margin: 3px 0; }
.md li::marker { color: var(--cc, var(--accent-hover)); }
.md ul.md-check { list-style: none; padding-left: 4px; }
.md-check li { display: flex; align-items: flex-start; gap: 8px; }
.md-check li.done { color: var(--muted); text-decoration: line-through; }
.md-box { flex: none; width: 18px; height: 18px; margin-top: 3px; display: grid; place-items: center; border-radius: 5px; border: 2px solid var(--muted); font-size: 12px; font-weight: 800; text-decoration: none; }
.md-check li.done .md-box { background: var(--cc, var(--accent)); border-color: var(--cc, var(--accent)); color: #fff; }
.md blockquote { margin: 8px 0; padding: 6px 14px; border-left: 3px solid var(--cc, var(--accent)); background: color-mix(in srgb, var(--cc, var(--accent)) 9%, transparent); border-radius: 0 10px 10px 0; }
.md code { padding: 1px 6px; border-radius: 6px; background: rgb(255 255 255 / .08); font-family: Consolas, monospace; font-size: .92em; }
.md hr { border: 0; border-top: 1px solid rgb(255 255 255 / .1); margin: 18px 0; }
.md-gap { height: 8px; }
.md a { color: var(--accent-hover); }
.sp-page-editor { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto 1fr auto; gap: 10px 18px; }
.sp-md-help { grid-column: 1 / -1; font-size: 12.5px; }
.sp-page-text { min-height: 320px; height: 100%; resize: none; font-family: Consolas, monospace; font-size: 14px; line-height: 1.5; }
.sp-page-preview { overflow-y: auto; padding: 4px 4px 4px 18px; border-left: 1px dashed rgb(255 255 255 / .12); }
.sp-page-buttons { grid-column: 1 / -1; display: flex; gap: 8px; }

/* таблица */
.sp-tablebox { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 18px 30px; }
.sp-table-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.sp-filter { max-width: 280px; }
.sp-add-row { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.sp-table-wrap { overflow-x: auto; border-radius: 16px; border: 1px solid var(--sp-line); background: rgb(255 255 255 / .025); }
.sp-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.sp-table th { position: sticky; top: 0; padding: 11px 12px; text-align: left; font-size: 11.5px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--sp-muted); background: rgb(20 21 28 / .96); cursor: pointer; user-select: none; white-space: nowrap; }
.sp-table th.sorted { color: var(--cc, var(--sp-accent)); }
.sp-table td { padding: 10px 12px; border-top: 1px solid var(--sp-line); vertical-align: middle; max-width: 320px; overflow-wrap: anywhere; }
.sp-table tbody tr { transition: background .15s; }
.sp-table tbody tr[data-sp="edit-row"] { cursor: pointer; }
.sp-table tbody tr:hover { background: rgb(255 255 255 / .04); }
.sp-table tfoot td { background: rgb(255 255 255 / .035); color: var(--cc, var(--sp-accent)); }
.sp-table td.t-number { text-align: right; font-variant-numeric: tabular-nums; }
.sp-empty { color: var(--sp-muted); opacity: .6; }
.sp-person-cell { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.sp-num-cell { font-variant-numeric: tabular-nums; }
.sp-chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 650; background: hsl(var(--h, 260) 55% 45% / .3); color: hsl(var(--h, 260) 80% 80%); }
.sp-check { width: 22px; height: 22px; display: inline-grid; place-items: center; border-radius: 7px; border: 2px solid var(--muted); color: #fff; transition: background .15s, border-color .15s; }
.sp-check.on { background: #34d88b; border-color: #34d88b; color: #04140c; }
.sp-check .ic { width: 14px; height: 14px; stroke-width: 3; }
.sp-stars { display: inline-flex; gap: 1px; white-space: nowrap; }
.sp-stars i, .sp-stars button { padding: 0; font-style: normal; font-size: 17px; line-height: 1; color: rgb(255 255 255 / .18); transition: transform .15s, color .15s; }
.sp-stars .on { color: #ffc93c; text-shadow: 0 0 8px rgb(255 201 60 / .5); }
.sp-stars button:hover { transform: scale(1.25); }
.sp-rcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.sp-rcard {
  display: flex; flex-direction: column; gap: 9px; padding: 16px; border-radius: 18px;
  background: linear-gradient(180deg, rgb(255 255 255 / .06), rgb(255 255 255 / .025)); border: 1px solid var(--sp-line);
  transition: transform .25s cubic-bezier(.2,1.3,.3,1), border-color .2s, box-shadow .2s;
  animation: sp-rise .45s cubic-bezier(.2,1.1,.3,1) backwards; animation-delay: calc(var(--k, 0) * 35ms);
}
.sp-rcard[data-sp="edit-row"] { cursor: pointer; }
.sp-rcard:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--cc, var(--sp-accent)) 50%, transparent); box-shadow: 0 14px 30px rgb(0 0 0 / .35); }
.sp-rcard-title { font-size: 17px; font-weight: 750; overflow-wrap: anywhere; }
.sp-rcard-field { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.sp-rcard-field small { color: var(--sp-muted); }
.sp-empty-table { padding: 50px 10px; text-align: center; }
.sp-view button { padding: 5px 10px; font-size: 12.5px; height: 30px; }

/* ---- быстрый переход (Ctrl+K) */
.sp-palette-wrap {
  position: absolute; z-index: 20; inset: 0; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px;
  background: rgb(4 5 8 / .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: sp-fade .2s ease-out;
}
.sp-palette {
  width: min(620px, 100%); max-height: 70vh; display: flex; flex-direction: column; overflow: hidden; border-radius: 20px;
  background: rgb(18 19 26 / .97); border: 1px solid var(--sp-line-2); box-shadow: 0 50px 120px -20px rgb(0 0 0 / .95);
  animation: sp-pal-in .28s cubic-bezier(.16,1,.3,1);
}
@keyframes sp-pal-in { from { opacity: 0; transform: translateY(-10px) scale(.98); } }
.sp-pal-search { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--sp-line); color: var(--sp-muted); }
.sp-pal-search .ic { width: 20px; height: 20px; }
.sp-pal-search input { flex: 1; min-width: 0; border: 0; outline: none; background: none; color: var(--sp-text); font-size: 16px; }
.sp-pal-search kbd { font: 650 11px/1 system-ui, sans-serif; padding: 4px 6px; border-radius: 6px; background: rgb(255 255 255 / .08); }
.sp-pal-list { overflow-y: auto; padding: 6px; }
.sp-pal-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 12px; text-align: left; }
.sp-pal-item:hover, .sp-pal-item.on { background: rgb(255 255 255 / .07); }
.sp-pal-item.on { box-shadow: inset 3px 0 0 var(--sp-accent); }
.sp-pal-ico { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 17px; background: rgb(255 255 255 / .06); }
.sp-pal-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.sp-pal-text b, .sp-pal-text small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-pal-text small { color: var(--sp-muted); font-size: 12px; }

/* ---- включить пространство */
.sp-found { min-height: calc(100dvh - 160px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 20px 0 60px; text-align: center; }
.sp-found .sp-emblem { animation: sp-rise .8s cubic-bezier(.16,1,.3,1) backwards; }
.sp-found .sp-title { animation: sp-rise .8s cubic-bezier(.16,1,.3,1) .08s backwards; }
.sp-found .sp-tagline { max-width: 640px; animation: sp-rise .8s cubic-bezier(.16,1,.3,1) .16s backwards; }
.sp-templates { width: 100%; max-width: 1080px; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-top: 18px; }
.sp-template {
  --sp-accent: var(--ta); --sp-tint: var(--tt);
  display: flex; flex-direction: column; gap: 6px; padding: 12px 12px 16px; border-radius: 22px; text-align: left;
  background: rgb(255 255 255 / .05); border: 1px solid var(--sp-line);
  transition: transform .35s cubic-bezier(.2,1.2,.3,1), border-color .2s, box-shadow .35s;
  animation: sp-card-in .8s cubic-bezier(.16,1,.3,1) backwards; animation-delay: calc(.25s + var(--i) * 80ms);
}
.sp-template:hover { transform: translateY(-5px); border-color: color-mix(in srgb, var(--ta) 60%, transparent); box-shadow: 0 30px 60px -30px var(--ta); }
.sp-template b { margin-top: 6px; font-size: 16px; }
.sp-template small { color: var(--sp-muted); line-height: 1.4; }
.sp-tpl-preview, .sp-look-preview, .sp-bg-tile {
  position: relative; overflow: hidden; display: block;
  background:
    radial-gradient(80% 90% at 10% 0%, color-mix(in srgb, var(--sp-accent) 45%, transparent), transparent 60%),
    linear-gradient(180deg, color-mix(in srgb, var(--sp-tint) 90%, #000), color-mix(in srgb, var(--sp-tint) 55%, #000));
}
.sp-tpl-preview { height: 132px; padding: 12px; border-radius: 14px; }
.bg-grid::before, [data-bg="grid"]::before {
  content: ""; position: absolute; left: -30%; right: -30%; bottom: -20%; height: 75%;
  background-image: linear-gradient(rgb(255 255 255 / .22) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / .22) 1px, transparent 1px);
  background-size: 18px 18px; transform: perspective(160px) rotateX(60deg); transform-origin: 50% 100%;
  -webkit-mask-image: linear-gradient(to top, #000, transparent); mask-image: linear-gradient(to top, #000, transparent);
}
.bg-stars::before, [data-bg="stars"]::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(1.5px 1.5px at 20% 30%, #fff, transparent), radial-gradient(1px 1px at 70% 20%, #fff, transparent),
    radial-gradient(1.2px 1.2px at 45% 70%, #fff, transparent), radial-gradient(1px 1px at 85% 60%, #fff, transparent),
    radial-gradient(1.3px 1.3px at 10% 80%, #fff, transparent), radial-gradient(1px 1px at 60% 45%, #fff, transparent);
  opacity: .8;
}
.bg-mesh::before, [data-bg="mesh"]::before {
  content: ""; position: absolute; inset: -20%; filter: blur(14px); opacity: .7;
  background: radial-gradient(35% 40% at 25% 30%, var(--sp-accent), transparent 70%), radial-gradient(35% 40% at 75% 70%, color-mix(in srgb, var(--sp-accent) 40%, #2f6bff), transparent 70%);
}
.bg-aurora::before, [data-bg="aurora"]::before {
  content: ""; position: absolute; left: -20%; top: -40%; width: 90%; height: 120%; border-radius: 50%; filter: blur(16px); opacity: .55;
  background: var(--sp-accent);
}
.sp-mini-dash { position: relative; display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.sp-mini-dash i { height: 22px; border-radius: 6px; background: rgb(255 255 255 / .1); border: 1px solid rgb(255 255 255 / .1); }
.sp-mini-dash i:first-child { height: 30px; background: color-mix(in srgb, var(--sp-accent) 45%, rgb(255 255 255 / .1)); }
.sp-mini-dash .z-s { grid-column: span 2; }
.sp-mini-dash .z-m { grid-column: span 3; }
.sp-mini-dash .z-l { grid-column: span 4; }
.sp-mini-dash .z-xl { grid-column: span 6; }

/* ---- окна конструктора (они поверх всего, вне пространства) */
.sp-dialog .form-dialog-body { max-height: min(70vh, 660px); overflow-y: auto; }
.sp-dialog .form-dialog-body > * { flex-shrink: 0; }
.form-dialog.sp-add-dialog, .form-dialog.sp-look-dialog { max-width: 520px; }
.sp-kinds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sp-kind { position: relative; display: block; cursor: pointer; }
.sp-kind input { position: absolute; opacity: 0; pointer-events: none; }
.sp-kind > span { height: 100%; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; border: 1.5px solid var(--line); transition: border-color .2s, background .2s, transform .2s; }
.sp-kind-ico { grid-row: span 2; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; background: var(--panel-2); }
.sp-kind b { font-size: 13.5px; }
.sp-kind small { color: var(--muted); font-size: 11.5px; line-height: 1.3; }
.sp-kind:hover > span { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.sp-kind input:checked + span { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); transform: translateY(-1px); }
.sp-kind.off { opacity: .45; cursor: default; }
.sp-only[hidden], .sp-two[hidden] { display: none; }
.sp-two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sp-icons { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 6px; }
.sp-icon-pick { width: 34px; height: 34px; border-radius: 9px; font-size: 18px; background: var(--panel-2); transition: transform .15s; }
.sp-icon-pick:hover { transform: scale(1.1); }
.sp-icon-pick.on { box-shadow: 0 0 0 2px var(--accent); }
.sp-size-seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 4px; }
.sp-size-seg label { position: relative; cursor: pointer; }
.sp-size-seg input { position: absolute; opacity: 0; pointer-events: none; }
.sp-size-seg span { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 4px; border-radius: 11px; border: 1.5px solid var(--line); text-align: center; transition: border-color .2s, background .2s; }
.sp-size-seg b { font-size: 16px; color: var(--text); }
.sp-size-seg small { font-size: 10.5px; color: var(--muted); line-height: 1.2; }
.sp-size-seg input:checked + span { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.sp-swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.sp-swatch { position: relative; width: 32px; height: 32px; cursor: pointer; }
.sp-swatch input[type=radio] { position: absolute; opacity: 0; pointer-events: none; }
.sp-swatch i { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 2px rgb(255 255 255 / .12); }
.sp-swatch.none i { background: repeating-linear-gradient(135deg, var(--panel-2) 0 5px, var(--line) 5px 7px); }
.sp-swatch.dark i { box-shadow: inset 0 0 0 2px rgb(255 255 255 / .25); }
.sp-swatch input:checked + i { box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px #fff; }
.sp-swatch.custom input { width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.sp-bgs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 6px; }
.sp-bg-pick { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; }
.sp-bg-pick input { position: absolute; opacity: 0; pointer-events: none; }
.sp-bg-tile { width: 100%; aspect-ratio: 4 / 3; border-radius: 11px; border: 1.5px solid var(--line); --sp-accent: var(--accent); --sp-tint: #0e1016; }
.sp-bg-pick input:checked + .sp-bg-tile { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
.sp-bg-pick small { font-size: 11px; color: var(--muted); }
.sp-look-preview { height: 128px; border-radius: 16px; padding: 14px; border: 1px solid var(--line); --sp-accent: var(--accent); --sp-tint: #0e1016; }
.sp-look-title { position: relative; display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 15px; color: #fff; }
.sp-look-title i { font-style: normal; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: rgb(255 255 255 / .12); }
.sp-cover-pick { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.sp-note-text { resize: vertical; min-height: 120px; line-height: 1.5; }
.sp-note-preview { padding: 10px 12px; border-radius: 12px; background: var(--panel-2); font-size: 14px; }
.sp-note-preview:empty { display: none; }
.sp-col-list { display: flex; flex-direction: column; gap: 8px; }
.sp-col-row { display: grid; grid-template-columns: 1fr 150px auto; gap: 6px; align-items: center; }
.sp-col-row .sp-col-options { grid-column: 1 / 3; }
.sp-col-row .sp-col-options[hidden] { display: none; }
.popover.sp-pop { width: 250px; }
.popover.sp-pop .ic:empty { display: inline-block; width: 18px; }
.popover.sp-pop .flip { display: inline-flex; transform: scaleX(-1); }

/* ---- кнопка в шапке группы, значок в списке чатов, кнопка на странице группы */
.space-btn { position: relative; color: var(--accent-hover); }
.space-btn.space-new { color: var(--muted); }
.space-badge { position: absolute; top: 2px; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; display: grid; place-items: center; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; }
.space-pill { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.ci-space { position: relative; display: inline-flex; vertical-align: -2px; margin-right: 5px; color: var(--sa, var(--accent-hover)); }
.ci-space .ic { width: 14px; height: 14px; }
.ci-space.fresh::after { content: ""; position: absolute; top: -2px; right: -3px; width: 7px; height: 7px; border-radius: 50%; background: var(--sa, var(--accent)); box-shadow: 0 0 0 2px var(--panel); }

/* ---- средняя ширина: сетка из четырёх колонок */
@media (max-width: 1080px) {
  .sp-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sp-grid > .z-s, .sp-grid > .z-m { grid-column: span 2; }
  .sp-grid > .z-l, .sp-grid > .z-xl { grid-column: span 4; }
}

/* ---- телефон */
@media (max-width: 759px) {
  .space-root { --sp-top: 56px; }
  .sp-top { gap: 6px; padding-left: 10px; padding-right: 10px; }
  .sp-tbtn { padding: 0 10px; }
  .sp-tbtn > span:not(.sp-stack), .sp-tbtn kbd { display: none; }
  .sp-call.live > span:last-child { display: inline; }
  .sp-people .sp-stack .avatar:nth-child(n+3) { display: none; }
  .sp-brand { padding-right: 6px; }
  .sp-brand-text b, .sp-brand-text small { max-width: 38vw; }
  .sp-home { padding: 14px 12px 110px; }
  .sp-hero { padding: 22px 16px 18px; border-radius: 22px; margin-bottom: 24px; }
  .sp-hero.has-cover { padding-top: 120px; }
  .sp-cover { height: 180px; }
  .sp-hero-in { gap: 14px; }
  .sp-emblem { width: 64px; height: 64px; font-size: 32px; border-radius: 20px; }
  .sp-hero-text { min-width: 0; flex-basis: calc(100% - 80px); }
  .sp-hero-acts { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .sp-live { flex-wrap: wrap; }
  .sp-live .sp-stack { display: none; }
  .sp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .sp-grid > .z-s { grid-column: span 1; }
  .sp-grid > .z-m, .sp-grid > .z-l, .sp-grid > .z-xl { grid-column: span 2; }
  .sp-card { min-height: 168px; padding: 14px 13px 12px; border-radius: 20px; }
  .sp-card.k-main { min-height: 280px; }
  .sp-card-head { gap: 9px; margin-bottom: 10px; }
  .sp-card-ico { width: 34px; height: 34px; font-size: 17px; border-radius: 11px; }
  .sp-grid > .z-s .sp-card-title b { font-size: 14px; }
  .sp-grid > .z-s .sp-card-meta .sp-who { display: none; }
  .sp-grid > .z-s .sp-voice-person { width: 46px; }
  .sp-grid > .z-s .sp-voice-person .avatar { width: 36px; height: 36px; }
  .sp-grid > .z-s .sp-cd-seg b { font-size: 18px; }
  .sp-grid > .z-s .sp-cd-seg small { display: none; }
  .sp-detail { inset: 0; padding: 0; }
  .sp-panel { border-radius: 0; border: 0; }
  .sp-panel-head { padding: calc(8px + env(safe-area-inset-top)) 10px 8px; gap: 8px; }
  .space-root.detail-open .sp-top { opacity: 0; transform: translateY(-10px); pointer-events: none; }
  .sp-panel-tools .sp-btn > span { display: none; }
  .sp-post { padding: 6px 10px 2px; gap: 9px; }
  .sp-post-side { width: 34px; }
  .sp-post-side .avatar.sm { width: 34px; height: 34px; }
  .sp-post-acts { display: flex; position: static; align-self: flex-start; box-shadow: none; background: none; border: 0; }
  .sp-compose { margin: 0 8px calc(8px + env(safe-area-inset-bottom)); }
  .sp-reply { margin: 0 8px; }
  .sp-page-editor { grid-template-columns: 1fr; }
  .sp-page-preview { display: none; }
  .sp-table-bar { flex-wrap: wrap; }
  .sp-filter { max-width: none; flex: 1; }
  .sp-col-row { grid-template-columns: 1fr 120px auto; }
  .sp-dock-hint { display: none; }
  .sp-dock .sp-btn:not(.primary) > span { display: none; }
  .sp-dock .sp-btn { padding: 0 12px; }
  .sp-edit-bar { top: 8px; right: 8px; }
  .sp-sizes button { min-width: 24px; }
  .sp-kinds { grid-template-columns: 1fr; }
  .sp-bgs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sp-palette-wrap { padding-top: 10vh; }
}
@media (pointer: coarse) { .sp-post-acts { display: flex; position: static; box-shadow: none; background: none; border: 0; } }

/* ---- без анимаций (настройка системы «уменьшить движение») */
@media (prefers-reduced-motion: reduce) {
  .space-root *, .space-root *::before, .space-root *::after { animation: none !important; transition: none !important; }
  .space-root.detail-open .sp-scroll { transform: none; }
}

/* ---------- Знак Essence и заставка при запуске ---------- */
/* Цвета — из темы: стандартная — фиолетовый, розовая — розовый (и ползунок насыщенности тоже). Петля 6 секунд:
   точка → облачко → «печатает…» → строки текста; по кромке шестигранника бежит светящийся след. */

.em { display: block; width: 100%; height: auto; overflow: visible; }
.em-s-core1 { stop-color: color-mix(in srgb, var(--accent) 70%, #000); }
.em-s-core2 { stop-color: color-mix(in srgb, var(--accent) 12%, #07080b); }
.em-s-light { stop-color: color-mix(in srgb, var(--accent) 38%, #fff); }
.em-s-accent { stop-color: var(--accent); }
.em-top { fill: #3a3c44; }
.em-left { fill: #2a2c33; }
.em-right { fill: #1f2126; }
.em-window { stroke: color-mix(in srgb, var(--accent) 55%, transparent); stroke-width: .8; }
.em-halo { fill: var(--accent); opacity: .16; filter: blur(14px); animation: em-halo 3s ease-in-out infinite; }
.em-dot, .em-bubble { transform-box: fill-box; transform-origin: center; }
.em-dot { animation: em-dot 6s ease-out infinite; }
.em-bubble { filter: drop-shadow(0 0 5px color-mix(in srgb, var(--accent) 70%, transparent)); animation: em-bubble 6s cubic-bezier(.2,1.3,.4,1) infinite; }
.em-dots circle, .em-lines rect { fill: color-mix(in srgb, var(--accent) 22%, #050507); }
.em-dots { animation: em-dots 6s linear infinite; }
.em-dots circle { animation: em-hop .9s ease-in-out infinite; }
.em-dots circle:nth-child(2) { animation-delay: .15s; }
.em-dots circle:nth-child(3) { animation-delay: .3s; }
.em-lines rect { transform-box: fill-box; transform-origin: left center; transform: scaleX(0); animation: em-line 6s cubic-bezier(.3,.9,.3,1) infinite; }
.em-lines rect:nth-child(2) { animation-name: em-line2; }
.em-lines rect:nth-child(3) { animation-name: em-line3; }
.em-trace { fill: none; stroke: color-mix(in srgb, var(--accent) 60%, #fff); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 16 84; filter: drop-shadow(0 0 3px var(--accent)); animation: em-trace 6s linear infinite; }
.em-badge { fill: var(--accent); stroke: #0b0c10; stroke-width: 2; transform-box: fill-box; transform-origin: center; animation: em-badge 6s ease-out infinite; }

@keyframes em-halo { 50% { opacity: .3; } }
@keyframes em-dot { 0% { transform: scale(.4); opacity: 0; } 4% { opacity: 1; } 9% { transform: scale(1.25); opacity: 1; } 14%, 100% { transform: scale(.2); opacity: 0; } }
@keyframes em-bubble { 0%, 10% { transform: scale(.2); opacity: 0; } 18% { transform: scale(1); opacity: 1; } 90% { transform: scale(1); opacity: 1; } 97%, 100% { transform: scale(.85); opacity: 0; } }
@keyframes em-dots { 0%, 18% { opacity: 0; } 21%, 45% { opacity: 1; } 49%, 100% { opacity: 0; } }
@keyframes em-hop { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-1.6px); } }
@keyframes em-line { 0%, 48% { transform: scaleX(0); } 56%, 100% { transform: scaleX(1); } }
@keyframes em-line2 { 0%, 52% { transform: scaleX(0); } 61%, 100% { transform: scaleX(1); } }
@keyframes em-line3 { 0%, 56% { transform: scaleX(0); } 66%, 100% { transform: scaleX(1); } }
@keyframes em-trace { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes em-badge { 0%, 20% { transform: scale(0); } 25% { transform: scale(1.3); } 29%, 88% { transform: scale(1); } 94%, 100% { transform: scale(0); } }
@media (prefers-reduced-motion: reduce) {
  .em *, .em-halo { animation: none !important; }
  .em-dot, .em-dots, .em-badge { opacity: 0; }
  .em-lines rect { transform: none; }
}

#splash { position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: var(--bg);
  transition: opacity .38s ease, visibility 0s .38s; }
.splash-mark { width: 132px; transition: transform .38s cubic-bezier(.3,.7,.3,1); animation: splash-in .5s cubic-bezier(.2,1.2,.4,1); }
#splash.gone { opacity: 0; visibility: hidden; pointer-events: none; }
#splash.gone .splash-mark { transform: scale(1.12); }
@keyframes splash-in { from { opacity: 0; transform: scale(.86); } }

#splash .wordmark { animation: splash-word .7s .15s cubic-bezier(.2,.9,.3,1) both; }
@keyframes splash-word { from { opacity: 0; transform: translateY(6px); letter-spacing: .5em; } }

/* название под знаком, как на логотипе: ESSENCE крупно и вразрядку, MESSENGER мелко в цвет темы */
.wordmark { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; text-transform: uppercase;
  font-size: 22px; font-weight: 600; letter-spacing: .32em; text-indent: .32em; color: var(--text); line-height: 1; }
.wordmark small { font-size: 9.5px; font-weight: 700; letter-spacing: .42em; text-indent: .42em; color: var(--accent-hover); }
.auth-mark { width: 96px; margin: 0 auto 2px; }
.auth-card .wordmark { margin-bottom: 14px; }

/* пустой экран справа: тот же знак, поменьше */
.empty-mark { width: 96px; margin-bottom: 6px; }
