 :root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #000000;
  color: #f4f7fb;
  --accent: #34d399;
  --accent-soft: #6ee7b7;
  --accent-glow: rgba(52, 211, 153, .12);
  --muted: #7a8a9e;
  --border: rgba(255, 255, 255, .08);
  --surface: rgba(18, 18, 18, .95);
  --surface-hover: rgba(30, 30, 30, .95);
  --ui-surface: #111111;
  --ui-surface-hover: #222625;
  --ui-surface-active: rgba(32, 212, 170, .16);
  --ui-border: rgba(255, 255, 255, .08);
  --ui-text: #f4f7fb;
  --ui-muted: #8a98a5;
  --ui-accent: #20d4aa;
  --ui-accent-ink: #03251c;
  --ui-radius: 16px;
  --ui-font-page: 30px;
  --ui-font-card-title: 22px;
  --ui-font-row: 14px;
  --ui-font-secondary: 12px;
}
html.light {
  --ui-surface: #f2f3f4;
  --ui-surface-hover: #e7ebed;
  --ui-surface-active: rgba(11, 157, 107, .14);
  --ui-border: rgba(15, 40, 32, .12);
  --ui-text: #14221c;
  --ui-muted: #62727d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 24px;
  -webkit-tap-highlight-color: transparent;
  background: #000000;
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(52, 211, 153, .06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(34, 180, 120, .04) 0%, transparent 50%);
}

/* ===== Card ===== */
.card {
  position: relative;
  z-index: 1;
  width: min(100%, 540px);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  --card-pad-x: 36px;
  padding: 0 var(--card-pad-x) 40px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .03),
    0 40px 100px rgba(0, 0, 0, .6),
    0 0 80px rgba(52, 211, 153, .03);
  backdrop-filter: blur(24px);
  transition: box-shadow .3s ease;
  animation: card-in .7s cubic-bezier(.22, 1, .36, 1) both;
}
.card:hover {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .05),
    0 40px 100px rgba(0, 0, 0, .6),
    0 0 120px rgba(52, 211, 153, .06);
}
/* Открыт чат: убираем футер и нижний отступ карточки, чтобы «плавающая»
   панель ввода стояла у самого низа карточки — без «подбородка». */
body.chat-open .card { padding-bottom: 0; }
body.chat-open .site-footer { display: none; }

/* ===== Оболочка: карточка + панель сессии под ней ===== */
/* Панель продления сессии должна стоять за пределами карточки, поэтому
   карточка и панель живут в общем flex-столбце. */
.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(100%, 700px);
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
}
.app-shell > .card {
  width: 100%;
  max-height: none;
  flex: 1 1 auto;
  min-height: 0;
}


/* ===== Каскадное появление карточки ===== */
@keyframes card-in {
  from { opacity: 0; transform: translateY(22px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.card > * { animation: rise .6s cubic-bezier(.22, 1, .36, 1) both; }
.card > .mode-carousel { animation-delay: .08s; }
.card > .title-wrap,
.card > h1 { animation-delay: .14s; }
.card > .subtitle { animation-delay: .18s; }
.card > .qr-view,
.card > .transfer-view { animation-delay: .26s; }
.card > .site-footer { animation-delay: .34s; }

/* ===== Заголовок: в обычном режиме это просто белые буквы ===== */
.card h1 {
  color: #f4f7fb;
  font-size: 20px;
}
/* Во время передачи файлов по заголовку ползёт градиентная волна слева
   направо: класс transfer-active на body ставит app.js, пока в чате есть
   карточки «отправка…»/«получение…». Фон двукратной ширины с двумя
   одинаковыми гребнями — сдвиг ровно на половину даёт бесшовный цикл. */
body.transfer-active .title-shine {
  background-image: linear-gradient(90deg,
    #f4f7fb 0%, #f4f7fb 17%,
    var(--accent-soft) 25%,
    #f4f7fb 33%,
    #f4f7fb 67%,
    var(--accent-soft) 75%,
    #f4f7fb 83%,
    #f4f7fb 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: title-wave 2.4s linear infinite;
}
@keyframes title-wave {
  from { background-position: 100% 0; }
  to { background-position: 0% 0; }
}

/* ===== Уважение к reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  .card,
  .card > * {
    animation: none !important;
  }
  /* Без анимации переезда: метки просто мгновенно меняются местами. */
  .mode-carousel .mode-label { transition: none !important; }
  /* Меню заголовка раскрывается мгновенно, без каскада пунктов. */
  .title-menu,
  .title-menu-item,
  .menu-section,
  .menu-row,
  .switch,
  .switch-knob,
  .seg-btn,
  .radio-option,
  .title-chevron { transition: none !important; }
  /* Без анимации волна не нужна: заголовок остаётся просто белым. */
  body.transfer-active .title-shine {
    animation: none !important;
    background-image: none;
    -webkit-text-fill-color: currentcolor;
  }
}

/* ===== Brand ===== */
.brand {
  text-decoration: none;
  margin-bottom: 16px;
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .22em;
  text-transform: uppercase;
}
.brand span {
  font-size: 18px;
  color: var(--accent-soft);
  opacity: .7;
  line-height: 1;
  transform: translateY(-2px);
}

/* ── Nav: красивая стрелка-разделитель ── */
.about-nav .brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}
.about-nav .brand span {
  font-size: 20px;
  opacity: .8;
  transform: none;
}

/* ── Nav: стрелка-разделитель ── */
.about-nav .brand span {
  display: inline-block;
  font-size: 16px;
  opacity: .55;
  transform: none;
  margin: 0 6px;
}

/* ===== Typography ===== */
h1 {
  margin: 0 0 10px;
  font-size: clamp(24px, 5vw, 30px);
  font-weight: 700;
  letter-spacing: -.03em;
  color: #eef2f7;
}
.subtitle, .hint {
  color: var(--muted);
  line-height: 1.55;
}
.subtitle {
  margin: 0 auto 24px;
  max-width: 380px;
  font-size: 13px;
}

/* ===== QR View ===== */
.qr-view {
  min-height: 320px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 17px;
  color: var(--muted);
}
.qr-view img {
  width: min(260px, 78vw);
  padding: 14px;
  border-radius: 16px;
  background: #ffffff;
  box-shadow:
    0 16px 40px rgba(0, 0, 0, .4),
    0 0 60px rgba(52, 211, 153, .08);
  transition: transform .2s ease;
  /* Белый QR на тёмном фоне появляется плавно — без резкой вспышки. */
  animation: fade-in .35s ease-out;
}
html.light .qr-view img {
  box-shadow: 0 2px 12px rgba(0, 0, 0, .08);
}
.qr-view p { margin: 0; font-size: 14px; }

/* ===== Loader ===== */
.loader {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, .08);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

/* ===== Меню заголовка «Передача файлов» =====
     Клик по заголовку раскрывает меню: «Выйти на главный экран», «Светлая тема»
     и пункт «Сквозное шифрование» с отпечатком ключа — он заменил прежнюю надпись
     у нижнего края экрана. Пункты видны только при активном сеансе (включает
     updateTitleMenu в app.js). Меню выезжает из-под заголовка с пружинным
     масштабированием, пункты появляются каскадом. ===== */
.title-wrap {
  position: relative;
  /* Выше чата и QR-окна: у .transfer-view после каскадной анимации остаётся
     применённый transform, и без явного z-index меню пряталось бы под ним.
     Значение выше z-index нижней панели ввода (.text-compose, 20): на мобильном
     раскрытое меню не должно перекрываться полем сообщения. */
  z-index: 30;
  /* Общие отступы кнопок от верхнего и боковых краёв средней колонки. */
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 12px 0;
  gap: 8px;
}
.title-wrap h1 { flex: 1 1 auto; min-width: 0; margin: 0; }
.title-side-btn {
  align-self: start;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--accent-soft);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .2s ease, border-color .2s ease, transform .15s ease, color .2s ease;
}
.title-side-btn svg { width: 20px; height: 20px; }
.title-side-btn:hover { background: rgba(52, 211, 153, .18); border-color: rgba(52, 211, 153, .4); }
.title-side-btn:active { transform: scale(.94); }
.title-side-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
body.rooms-hidden #rooms-toggle-btn { color: var(--muted); opacity: .72; }
body.settings-open #settings-toggle-btn {
  background: rgba(52, 211, 153, .22);
  border-color: rgba(52, 211, 153, .5);
  color: var(--accent-soft);
}
html.light .title-side-btn { background: rgba(11, 157, 107, .08); border-color: rgba(15, 40, 32, .12); }
html.light .title-side-btn:hover { background: rgba(11, 157, 107, .14); }
.title-menu-btn {
  /* Кнопка во всю строку заголовка: в меню проще попасть и пальцем, и
     мышью — содержимое остаётся по центру строки. */
  display: flex;
  width: 100%;
  justify-content: center;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}
.title-menu-btn.menu-available { cursor: pointer; }
.title-menu-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 8px;
}
.title-chevron {
  width: 20px;
  height: 20px;
  color: var(--muted);
  opacity: .6;
  transition: opacity .2s ease, transform .35s cubic-bezier(.22, 1, .36, 1), color .2s ease;
}
.title-menu-btn.menu-available .title-chevron { opacity: .6; }
.title-menu-btn:hover .title-chevron {
  opacity: 1;
  color: var(--accent-soft);
}
.title-menu-btn.open .title-chevron {
  opacity: 1;
  transform: rotate(180deg);
}
.title-menu {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  z-index: 40;
  min-width: 280px;
  max-width: min(340px, calc(100vw - 32px));
  max-height: min(78vh, 640px);
  overflow-y: auto;
  overscroll-behavior: contain;
  /* Ползунок прокрутки — в акцентном цвете сайта. */
  scrollbar-width: thin;
  scrollbar-color: rgba(52, 211, 153, .4) transparent;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(23, 26, 25, .97);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .04),
    0 24px 70px rgba(0, 0, 0, .65);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  text-align: left;
  transform-origin: top center;
  transform: translateX(-50%) translateY(-10px) scale(.9);
  opacity: 0;
  visibility: hidden;
  transition:
    transform .26s cubic-bezier(.22, 1, .36, 1),
    opacity .16s ease,
    visibility 0s linear .26s;
}
.title-menu::-webkit-scrollbar { width: 8px; }
.title-menu::-webkit-scrollbar-track { background: transparent; }
.title-menu::-webkit-scrollbar-thumb {
  background: rgba(52, 211, 153, .35);
  border-radius: 999px;
}
.title-menu::-webkit-scrollbar-thumb:hover { background: rgba(52, 211, 153, .55); }
.title-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0) scale(1);
  /* Пружинный overshoot: панель слегка «перелетает» и мягко возвращается. */
  transition:
    transform .4s cubic-bezier(.3, 1.36, .44, 1),
    opacity .16s ease,
    visibility 0s;
}

/* Пункты и секции меню появляются каскадом: задержка действует только на
   раскрытие, при закрытии селектор .open уже не матчится — всё гаснет вместе
   с панелью. */
/* Каскад раскрытия: пункты-действия, секции и строки-настройки, стоящие прямо
   в меню (Тема, Шифрование, Больше двух человек, Время жизни, Имя устройства),
   появляются по очереди. Строки внутри секций анимируются вместе с секцией. */
.title-menu-item,
.menu-section,
.title-menu > .menu-row {
  opacity: 0;
  transform: translateY(-6px);
  transition:
    opacity .16s ease,
    transform .26s cubic-bezier(.22, 1, .36, 1),
    background .18s ease;
}
.title-menu.open .title-menu-item,
.title-menu.open .menu-section,
.title-menu.open > .menu-row {
  opacity: 1;
  transform: none;
}
.title-menu.open > *:nth-child(1) { transition-delay: .06s, .06s, 0s; }
.title-menu.open > *:nth-child(2) { transition-delay: .09s, .09s, 0s; }
.title-menu.open > *:nth-child(3) { transition-delay: .12s, .12s, 0s; }
.title-menu.open > *:nth-child(4) { transition-delay: .15s, .15s, 0s; }
.title-menu.open > *:nth-child(5) { transition-delay: .18s, .18s, 0s; }
.title-menu.open > *:nth-child(6) { transition-delay: .21s, .21s, 0s; }
.title-menu.open > *:nth-child(7) { transition-delay: .24s, .24s, 0s; }
.title-menu.open > *:nth-child(8) { transition-delay: .27s, .27s, 0s; }
.title-menu.open > *:nth-child(9) { transition-delay: .30s, .30s, 0s; }
.title-menu.open > *:nth-child(10) { transition-delay: .33s, .33s, 0s; }
.title-menu.open > *:nth-child(11) { transition-delay: .36s, .36s, 0s; }
.title-menu.open > *:nth-child(12) { transition-delay: .39s, .39s, 0s; }
.title-menu.open > *:nth-child(13) { transition-delay: .42s, .42s, 0s; }
.title-menu.open > *:nth-child(14) { transition-delay: .45s, .45s, 0s; }

/* Пункт-действие во всю ширину (скачать, выйти, удалить). */
.title-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: none;
  border-radius: 11px;
  background: none;
  color: #e8edf4;
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.title-menu-item:hover { background: rgba(255, 255, 255, .06); }
.title-menu-item:active { background: rgba(52, 211, 153, .12); }
/* Неактивный пункт (например, «Скачать все файлы», пока идёт загрузка):
   приглушён и не реагирует на наведение. */
.title-menu-item:disabled,
.title-menu-item.disabled {
  opacity: .5;
  cursor: default;
}
.title-menu-item:disabled:hover,
.title-menu-item.disabled:hover,
.title-menu-item:disabled:active,
.title-menu-item.disabled:active { background: none; }
/* Пункт «Отправить текст» во включённом состоянии: поле ввода на экране. */
.title-menu-item.active {
  background: rgba(52, 211, 153, .12);
  color: var(--accent-soft);
}
.title-menu-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* ── Секции меню ─────────────────────────────────────────────────────────── */
.menu-section {
  padding: 4px 0 6px;
  margin-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, .07);
}
.menu-section:first-of-type { border-top: none; margin-top: 0; }
.menu-section-title {
  margin: 6px 12px 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
/* Строка настройки: иконка, подпись и управляющий элемент справа. */
.menu-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border: none;
  border-radius: 11px;
  background: none;
  color: #e8edf4;
  font: inherit;
  font-size: 14px;
  text-align: left;
}
.menu-row .mi-text { flex: 1 1 auto; }
/* Строка с сегментированным контролем под подписью (время жизни комнаты). */
.menu-row-col {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.menu-row-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.menu-ttl-seg {
  display: flex;
  width: 100%;
}
.menu-ttl-seg .seg-btn {
  flex: 1 1 0;
  padding: 6px 4px;
  white-space: nowrap;
}
.menu-row-btn { cursor: pointer; }
.menu-row-btn:hover { background: rgba(255, 255, 255, .06); }
.menu-row-btn:active { background: rgba(52, 211, 153, .12); }
.menu-row-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.row-chevron {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

/* ── Переключатель (switch) ──────────────────────────────────────────────── */
.switch {
  flex: 0 0 auto;
  position: relative;
  width: 42px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease;
}
.switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  /* Ползунок всегда в акцентном цвете сайта. */
  background: var(--accent-soft);
  transition: transform .2s cubic-bezier(.22, 1, .36, 1), background .2s ease;
}
.switch[aria-checked="true"] {
  background: rgba(52, 211, 153, .35);
  border-color: rgba(52, 211, 153, .6);
}
.switch[aria-checked="true"] .switch-knob {
  transform: translateX(18px);
}
.switch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.switch:disabled { opacity: .5; cursor: default; }

/* ── Сегментированный переключатель ──────────────────────────────────────── */
.segmented {
  flex: 0 0 auto;
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(255, 255, 255, .05);
}
.seg-btn {
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: background .18s ease, color .18s ease;
}
.seg-btn.active {
  background: rgba(52, 211, 153, .18);
  color: var(--accent-soft);
}
.seg-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

/* ── Радио-опция режима хранения ─────────────────────────────────────────── */
.radio-option {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 12px;
  border: none;
  border-radius: 11px;
  background: none;
  color: #e8edf4;
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background .18s ease;
}
.radio-option:hover { background: rgba(255, 255, 255, .06); }
.radio-option:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.radio-option .mi-text { flex: 1 1 auto; }
.radio-option .mi-sub { white-space: normal; }
.radio-dot {
  flex: 0 0 auto;
  position: relative;
  width: 18px;
  height: 18px;
  margin-top: 8px;
  border: 2px solid var(--muted);
  border-radius: 50%;
  transition: border-color .18s ease;
}
.radio-option[aria-checked="true"] .radio-dot { border-color: var(--accent-soft); }
.radio-option[aria-checked="true"] .radio-dot::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--accent-soft);
}

/* ── Карточка статуса комнаты ────────────────────────────────────────────── */
.room-card {
  margin: 4px 8px 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, .04);
}
.room-card-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}
.room-card-row + .room-card-row { margin-top: 4px; }
.room-card-meta { color: var(--muted); font-size: 12px; }
.room-card-code { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.room-card-code b {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  letter-spacing: .06em;
  color: var(--accent-soft);
}
.room-members {
  flex: 1 1 auto;
  min-width: 0;
  text-align: right;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.room-key {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, .07);
}
.room-key-label { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.room-key-value {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--accent-soft);
}

/* Зашифрованный файл: имя в акцентном цвете; без ключа — карточка кликабельна
   и просит ввести ключ. */
.file-item.enc-file .file-name { color: var(--accent-soft); }
.file-item.enc-locked { cursor: pointer; }
.file-item.enc-locked .file-note { color: var(--accent-soft); }

/* Предупреждение о шифровании в карточке комнаты. */
.room-enc-note {
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, .07);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

/* ── Список участников комнаты ───────────────────────────────────────────── */
.participants-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 4px 8px 6px;
}
.participant-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  font-size: 13px;
  color: #d0d8e4;
}
.participant-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}
.participant-row.online .participant-dot { background: var(--accent); }
.participant-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.participant-status { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.participant-crown {
  display: inline-flex;
  width: 15px;
  height: 15px;
  margin-left: 6px;
  vertical-align: -2px;
  color: var(--accent);
}
.participant-crown svg {
  display: block;
  width: 100%;
  height: 100%;
}
.participant-badge {
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #0b1f24;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  vertical-align: middle;
}
.participant-empty { margin: 4px 8px; color: var(--muted); font-size: 12px; }

html.light .participant-row { color: #1d2b33; }
html.light .participant-status { color: #6b7a86; }
html.light .participant-empty { color: #6b7a86; }

/* ── Модальное окно с QR-кодом комнаты ───────────────────────────────────── */
.qr-modal { width: min(100%, 360px); }
.qr-lead {
  margin: 8px 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: left;
}
.qr-modal-wrap {
  display: grid;
  place-items: center;
  padding: 16px;
  border-radius: 16px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
}
.qr-modal-img {
  width: min(240px, 66vw);
  height: auto;
  display: block;
  image-rendering: pixelated;
}
.qr-modal-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 16px 0 0;
}
.qr-modal-meta-label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.qr-modal-code {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .34em;
  text-indent: .34em; /* ровно по центру: компенсируем хвостовой отступ букв */
  text-align: center;
  color: var(--accent-soft);
}
.qr-hint {
  margin: 16px 0 18px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, .04);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
  text-align: left;
}
.qr-hint b { color: #dfe6ee; font-weight: 600; }

/* Строка «поле ввода кода + кнопка Перейти в чат»: кнопка-овал стоит справа
   от поля ввода. На узких экранах строка переносится. */
.room-join-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
/* «Перейти в чат» на экране ожидания канала: тихая второстепенная кнопка-овал
   без значка-стрелки, размер по содержимому. Селектор с .qr-view перебивает
   общий .button (он объявлен ниже и иначе вернул бы прямоугольную форму). */
.qr-view .room-send-now {
  margin-top: 0;
  width: auto;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 11px 22px;
  background: transparent;
  border: 1px solid rgba(52, 211, 153, .22);
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
}
.qr-view .room-send-now:hover {
  background: rgba(52, 211, 153, .08);
  border-color: rgba(52, 211, 153, .38);
  box-shadow: none;
}
/* В увеличенном QR-режиме строка с полем и кнопкой скрыта. */
.qr-view.room-zoomed .room-join-row { display: none; }
html.light .qr-view .room-send-now {
  border-color: rgba(11, 157, 107, .28);
  color: #0b7c56;
}
html.light .qr-view .room-send-now:hover { background: rgba(11, 157, 107, .08); }

/* Иконки меню: без цветной подложки — только сам значок. */
.mi-ico {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: var(--accent-soft);
}
.mi-ico svg { width: 19px; height: 19px; }
.mi-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mi-title { font-weight: 600; line-height: 1.3; }
.mi-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}
/* Иконка пункта «Устройство»: показываем только значок реального типа — телефон
   у телефона, монитор у компьютера, планшет у планшета. */
#menu-device .dev-ico { display: none; }
#menu-device[data-dev="desktop"] .dev-desktop { display: block; }
#menu-device[data-dev="mobile"] .dev-mobile { display: block; }
#menu-device[data-dev="tablet"] .dev-tablet { display: block; }

/* ===== Telegram: поясняющее окно «зачем это нужно» ===== */
.tg-modal { width: min(100%, 360px); }
.tg-lead {
  margin: 8px 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  text-align: left;
}
.tg-qr-wrap {
  display: grid;
  place-items: center;
  width: 190px;
  height: 190px;
  margin: 0 auto 14px;
  padding: 12px;
  box-sizing: border-box;
  border-radius: 14px;
  background: #ffffff;
}
.tg-qr { width: 100%; height: 100%; display: block; }
.tg-bot {
  margin: 0 0 4px;
  color: #eef2f7;
  font-size: 14px;
  font-weight: 700;
}
.tg-room {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.tg-warn {
  margin: 0 0 14px;
  padding: 9px 11px;
  border-radius: 10px;
  background: rgba(250, 204, 21, .12);
  color: #fbbf24;
  font-size: 12px;
  line-height: 1.45;
  text-align: left;
}
html.light .tg-bot { color: #14212a; }
html.light .tg-room { color: #6b7a86; }
html.light .tg-warn { background: rgba(180, 120, 0, .12); color: #a16207; }
/* Кнопка окна, пока переход недоступен (включено прямое соединение). */
.button:disabled,
.button.disabled {
  opacity: .55;
  cursor: default;
}
.button:disabled:hover,
.button.disabled:hover {
  background: linear-gradient(135deg, rgba(52, 211, 153, .2), rgba(34, 180, 120, .15));
  border-color: rgba(52, 211, 153, .2);
  box-shadow: none;
}

/* ===== Status ===== */
.status {
  margin: 18px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.status.connected {
  color: #34d399;
}

/* ===== Chat / File List ===== */
.transfer-view {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  /* Лента и панель ввода делят высоту этого блока. */
  position: relative;
}
.chat {
  position: relative;
  /* Единая высота всех карточек чата: миниатюра 56px + паддинги 20px + рамка 2px. */
  --chat-card-h: 78px;
  /* Прокручивается лента; панель ввода занимает место под ней. */
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  margin: 18px 0 0;
  padding: 8px 12px;
  text-align: left;
  scrollbar-width: none;
}
.chat::-webkit-scrollbar { display: none; }
/* Плавное растворение у ВЕРХНЕГО края чата: маска делает сами буквы
   прозрачными у границы, поэтому контент не просвечивает через слой. Снизу
   сообщения уходят под панель ввода чёткой границей, без размытия. */
.chat.has-scroll {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 24px, #000 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 24px, #000 100%);
}

.file-list {
  /* Список растёт по контенту, а прокручивается сам .chat (как на мобильном). */
  flex: 0 0 auto;
  overflow-y: visible;
  padding: 4px 0;
  scrollbar-width: none;
}
.file-list::-webkit-scrollbar { display: none; }

/* Небольшой зазор между последним сообщением и панелью ввода. */
.chat-spacer {
  display: block;
  flex: 0 0 auto;
  height: calc(var(--compose-h, 0px) + 8px);
}

.file-item {
  margin: 8px 0;
  /* min-height вытягивает карточки ошибок (они без миниатюры) до высоты
     обычных карточек. */
  min-height: var(--chat-card-h);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #d0d8e4;
  font-size: 13px;
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 12px;
  background: rgba(255, 255, 255, .04);
  animation: file-in .25s ease-out;
  transition: background .2s ease;
}
.file-item:hover {
  background: rgba(255, 255, 255, .06);
}
/* Файл скачивается кликом по любому месту карточки — курсор-рука. */
.file-item.downloadable {
  cursor: pointer;
}
.file-item::before {
  content: '';
  order: 3;
  flex: 0 0 auto;
  margin-left: auto;
  width: 20px;
  height: 20px;
  background: var(--accent);
  mask: var(--check-svg) center / contain no-repeat;
}
/* Файл готов к скачиванию: стрелочка вниз в кружочке. После клика-скачивания
   карточка получает .downloaded — вместо стрелки появляется галочка ✓. */
.file-item.downloadable::before {
  content: '';
  width: 20px;
  height: 20px;
  background: var(--muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8v7'/%3E%3Cpath d='m8.5 11.5 3.5 3.5 3.5-3.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8v7'/%3E%3Cpath d='m8.5 11.5 3.5 3.5 3.5-3.5'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: background .2s ease;
}
/* Зелёная заливка стрелочки — только пока файл не скачан. Раньше правило
   цеплялось и к скачанным карточкам: у них ::before — текстовая галочка
   с width:auto, и при наведении вокруг ✓ появлялся зелёный прямоугольник. */
.file-item.downloadable:not(.downloaded):hover::before {
  background: var(--accent);
}
.file-item.pending::before,
.file-item.sending::before,
.file-item.receiving::before { content:none; animation:none; }
.file-item.downloaded::before {
  width: 20px;
  height: 20px;
  background: var(--accent);
  -webkit-mask: var(--check-svg) center / contain no-repeat;
  mask: var(--check-svg) center / contain no-repeat;
}
.file-item.downloaded:hover::before {
  background: none;
  color: #6ee7b7;
}
@keyframes file-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.file-item.error {
  color: #f87171;
  border-color: rgba(248, 113, 113, .2);
  background: rgba(248, 113, 113, .08);
}
/* Восклицательный знак в треугольнике вместо крестика-«закрыть». */
.file-item.error::before {
  content: '';
  width: 16px;
  height: 16px;
  background: #f87171;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z'/%3E%3Cline x1='12' y1='9' x2='12' y2='13'/%3E%3Cline x1='12' y1='17' x2='12.01' y2='17'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z'/%3E%3Cline x1='12' y1='9' x2='12' y2='13'/%3E%3Cline x1='12' y1='17' x2='12.01' y2='17'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ===== Thumbnails ===== */
.file-thumb {
  order: 1;
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.file-thumb.photo img {
  display: block;
  max-width: 56px;
  max-height: 56px;
  width: auto;
  height: auto;
  border-radius: 8px;
}
.file-thumb.icon {
  gap: 2px;
  color: var(--accent-soft);
}
.file-thumb.icon svg {
  width: 32px;
  height: 32px;
  opacity: .85;
}
.file-thumb.icon .ext {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
}
.file-body {
  order: 2;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}
.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-item a.file-name {
  color: var(--accent-soft);
  text-decoration: none;
  font-weight: 600;
  transition: color .2s ease;
}
.file-item a.file-name:hover {
  color: #ffffff;
  text-decoration: underline;
}
.file-meta {
  display: flex;
  gap: 10px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  /* Одна строка с многоточием: длинные заметки не вытягивают карточку
     в высоту, все карточки чата остаются одного размера. */
  white-space: nowrap;
}
.file-meta .file-size { flex: 0 0 auto; }
.file-meta .file-note {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-item.error .file-meta {
  color: #f87171;
}

/* ===== Button ===== */
.button {
  border: 0;
  border-radius: 12px;
  padding: 12px 20px;
  color: #ffffff;
  font-weight: 600;
  font-size: 14px;
  background: linear-gradient(135deg, rgba(52, 211, 153, .2), rgba(34, 180, 120, .15));
  border: 1px solid rgba(52, 211, 153, .2);
  cursor: pointer;
  transition: all .2s ease;
}
.button:hover {
  background: linear-gradient(135deg, rgba(52, 211, 153, .3), rgba(34, 180, 120, .25));
  border-color: rgba(52, 211, 153, .35);
  box-shadow: 0 0 20px rgba(52, 211, 153, .1);
}

/* ===== Hint ===== */
.hint {
  margin: 24px 0 0;
  font-size: 12px;
  opacity: .6;
}

/* ===== Site footer ===== */
.site-footer {
  margin-top: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 9px;
  color: var(--muted);
  font-size: 11px;
}
.site-footer:empty { display: none !important; }
.site-footer a { color: var(--accent-soft); text-decoration: none; }
.site-footer a:hover { color: #ffffff; }

/* ===== Панель сессии «сайт → Telegram» ===== */
/* Таймер и кнопка продления под основным блоком. Показывается только в
   telegram-режиме, пока сессия жива. */
.session-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.session-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}
.session-timer {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.session-extend {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--accent-soft);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: border-color .2s ease, color .2s ease;
}
.session-extend:hover { border-color: var(--accent); color: #ffffff; }
.session-extend:disabled { opacity: .5; cursor: default; }
.session-notice {
  color: var(--accent-soft);
  font-size: 12px;
}
html.light .session-timer { color: #5b6b77; }
html.light .session-extend { color: #0b7c56; border-color: rgba(15, 40, 32, .18); }
html.light .session-extend:hover { color: #06120d; border-color: #0b9d6b; }
html.light .session-notice { color: #0b7c56; }

/* ===== About page: полноэкранный лендинг без ограничивающей карточки ===== */
body.about-page {
  display: block;
  min-height: 100vh;
  padding: 0;
  background-image:
    radial-gradient(ellipse 60% 45% at 12% -5%, rgba(52, 211, 153, .1) 0%, transparent 60%),
    radial-gradient(ellipse 45% 35% at 92% 12%, rgba(34, 180, 120, .06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 50% 115%, rgba(52, 211, 153, .07) 0%, transparent 60%);
}
html { scroll-behavior: smooth; }
#how { scroll-margin-top: 90px; }

.about-wrap { width: min(100% - 48px, 1100px); margin-inline: auto; }

/* ── Nav ── */
.about-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
  min-height: 72px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, .7);
  backdrop-filter: blur(18px);
}
.about-nav .brand {
  white-space: nowrap;
  justify-content: flex-start;
}
.about-nav .brand { margin: 0; }
.about-nav { min-height: 64px; }
.nav-cta {
  margin-left: auto;
  padding: 11px 18px;
  border-radius: 11px;
  color: #06120d;
  background: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  transition: background .2s ease, transform .2s ease, box-shadow .2s ease;
}
.nav-cta:hover {
  background: var(--accent-soft);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(52, 211, 153, .28);
}
/* Ссылки-разделы в шапке страницы «О сервисе»: заполняют пустую панель. */
.about-nav-links {
  display: inline-flex;
  align-items: center;
  gap: 22px;
  margin-left: auto;
}
.about-nav-links a {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: color .2s ease;
}
.about-nav-links a:hover { color: #ffffff; }
@media (max-width: 720px) {
  .about-nav-links { display: none; }
}
html.light .about-nav-links a { color: #5b6b77; }
html.light .about-nav-links a:hover { color: #06120d; }

/* ── Hero ── */
.hero { padding: clamp(64px, 11vh, 120px) 0 clamp(40px, 7vh, 80px); max-width: 820px; }
.kicker {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.hero h1 {
  margin: 0;
  font-size: clamp(38px, 6.5vw, 68px);
  line-height: 1.02;
  letter-spacing: -.05em;
  color: #eef2f7;
}
.hero h1 em { color: var(--accent-soft); font-style: normal; }
.hero .lead {
  margin: 24px 0 0;
  max-width: 640px;
  color: #a6b3c1;
  font-size: clamp(16px, 2vw, 18px);
  line-height: 1.65;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.hero-facts {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  margin: 46px 0 0;
  padding: 0;
  border-top: 1px solid var(--border);
}
.hero-facts li { flex: 1 1 auto; padding: 20px 24px 0 0; display: grid; gap: 4px; }
.hero-facts li + li { border-left: 1px solid var(--border); padding-left: 24px; }
.hero-facts strong { color: var(--accent-soft); font-size: 22px; letter-spacing: -.02em; }
.hero-facts span { color: var(--muted); font-size: 12px; }

/* ── Sections ── */
.section { padding: clamp(36px, 6vh, 64px) 0; }
.section h2 {
  margin: 0 0 32px;
  font-size: clamp(26px, 4vw, 36px);
  letter-spacing: -.03em;
  color: #eef2f7;
}
/* Подзаголовки внутри секций (например, «Основные режимы» и «Варианты
   хранения»). Без этого браузерный h3 был бы тёмным и невидимым на тёмном фоне. */
.section h3 {
  margin: 40px 0 16px;
  font-size: 20px;
  letter-spacing: -.02em;
  color: #eef2f7;
}
html.light .section h3 { color: #14212a; }

/* ── Steps ── */
.steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 0;
  padding: 0;
}
.steps li {
  padding: 26px 24px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 18px;
  background: rgba(255, 255, 255, .025);
}
.step-num {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #06120d;
  background: var(--accent);
  font-size: 16px;
  font-weight: 800;
  box-shadow: 0 6px 18px rgba(52, 211, 153, .25);
}
.steps h3 { margin: 20px 0 8px; color: #eef2f7; font-size: 17px; }
.steps p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }

/* ── Features ── */
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.feature-card {
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 18px;
  background: rgba(255, 255, 255, .025);
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}
.feature-card:hover {
  border-color: rgba(52, 211, 153, .3);
  background: rgba(52, 211, 153, .05);
  transform: translateY(-3px);
}
.feature-ico {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(52, 211, 153, .25);
  border-radius: 12px;
  background: rgba(52, 211, 153, .08);
  color: var(--accent-soft);
  font-size: 19px;
}
.feature-card h3 { margin: 18px 0 8px; color: #eef2f7; font-size: 16px; }
.feature-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }

/* ── Privacy checklist ── */
.check-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 32px;
  margin: 0;
  padding: 0;
}
.check-list li {
  position: relative;
  padding-left: 30px;
  color: #a6b3c1;
  font-size: 14px;
  line-height: 1.6;
}
.check-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  font-weight: 800;
}

/* ── FAQ ── */
.faq details {
  padding: 0 22px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 14px;
  background: rgba(255, 255, 255, .02);
}
.faq details + details { margin-top: 10px; }
.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 0;
  cursor: pointer;
  color: #eef2f7;
  font-size: 15px;
  font-weight: 600;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--accent); font-size: 22px; font-weight: 700; line-height: 1; }
.faq details[open] summary::after { content: '–'; }
.faq details p { margin: 0 0 18px; color: var(--muted); font-size: 14px; line-height: 1.65; }

/* ── Final CTA ── */
.final-cta {
  margin-top: clamp(24px, 5vh, 48px);
  padding: clamp(36px, 6vw, 64px) 24px;
  text-align: center;
  border: 1px solid rgba(52, 211, 153, .25);
  border-radius: 28px;
  background:
    radial-gradient(ellipse 60% 80% at 50% 0%, rgba(52, 211, 153, .12) 0%, transparent 70%),
    rgba(255, 255, 255, .02);
  box-shadow: 0 0 90px rgba(52, 211, 153, .06);
}
.final-cta h2 {
  margin: 0 0 10px;
  font-size: clamp(24px, 4vw, 32px);
  letter-spacing: -.03em;
  color: #eef2f7;
}
.final-cta p { margin: 0 auto 28px; max-width: 460px; color: var(--muted); font-size: 15px; line-height: 1.6; }

/* ── Buttons ── */
.about-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 22px;
  border-radius: 12px;
  color: #06120d;
  background: var(--accent);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(52, 211, 153, .2);
  transition: background .2s ease, transform .2s ease, box-shadow .2s ease;
}
.about-button span { font-size: 16px; }
.about-button .btn-arrow {
  width: 16px;
  height: 16px;
  flex: none;
  transition: transform .2s ease;
}
.about-button:hover .btn-arrow { transform: translateX(3px); }
.about-button.big .btn-arrow { width: 17px; height: 17px; }
.about-button:hover {
  background: var(--accent-soft);
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(52, 211, 153, .3);
}
.about-button.big { padding: 16px 30px; font-size: 15px; border-radius: 13px; }
.ghost-button {
  display: inline-flex;
  align-items: center;
  padding: 14px 22px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: #d0d8e4;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: color .2s ease, border-color .2s ease, background .2s ease;
}
.ghost-button:hover {
  color: #ffffff;
  border-color: rgba(52, 211, 153, .4);
  background: rgba(52, 211, 153, .06);
}

/* ── Footer ── */
.about-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: clamp(40px, 8vh, 72px);
  padding: 26px 0 36px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}
.about-footer a { color: var(--accent-soft); text-decoration: none; }
.about-footer a:hover { color: #ffffff; }
.about-footer-links { display: inline-flex; gap: 16px; flex-wrap: wrap; justify-content: flex-end; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .steps, .feature-grid { grid-template-columns: 1fr; }
  .check-list { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .about-wrap { width: min(100% - 32px, 1100px); }
  .about-nav {
    padding: 16px 24px;
    min-height: 64px;
  }
  .about-nav .brand { font-size: 10px; letter-spacing: .16em; }
  .about-button span { display: none; }
  .hero-facts { flex-direction: column; }
  .hero-facts li { padding: 14px 0 0; }
  .hero-facts li + li { border-left: 0; border-top: 1px solid var(--border); padding-left: 0; margin-top: 14px; }
}

/* ===== Modal: подтверждение повторного скачивания ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(8px);
  animation: fade-in .18s ease;
}
.modal {
  width: min(100%, 340px);
  padding: 26px 24px 22px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
  text-align: center;
  animation: pop-in .18s ease;
}
.modal-title {
  margin: 0 0 6px;
  color: #eef2f7;
  font-size: 16px;
  font-weight: 700;
}
.modal-file {
  margin: 0 0 20px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 13px;
}
/* Длинное пояснение подтверждения (например, про удаление комнаты):
   переносим на строки, а не обрезаем многоточием. */
.modal-file.multiline {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.45;
}
.modal-actions {
  display: flex;
  gap: 10px;
}
.modal-actions .button,
.modal-cancel {
  flex: 1;
  padding: 12px 16px;
}
.modal-cancel {
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  background: transparent;
  cursor: pointer;
  transition: all .2s ease;
}
.modal-cancel:hover {
  color: #ffffff;
  border-color: rgba(255, 255, 255, .25);
  background: rgba(255, 255, 255, .04);
}

/* ===== Комментарии: «невидимые» сообщения в отдельном окне ===== */
.comments-modal { width: min(100%, 480px); text-align: left; }
.comments-context {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.comments-list {
  max-height: 46vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.comments-empty { margin: 4px 0; font-size: 13px; color: var(--muted); }
.comment-row {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .06);
}
.comment-row.mine { background: rgba(16, 122, 88, .28); }
.comment-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 3px; }
.comment-who { font-size: 12px; font-weight: 600; color: #eef2f7; }
.comment-when { font-size: 11px; color: var(--muted); }
.comment-text { font-size: 13px; white-space: pre-wrap; word-break: break-word; color: #eef2f7; }
.comments-compose { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 14px; }
.comments-compose textarea {
  flex: 1 1 auto;
  resize: none;
  min-height: 40px;
  max-height: 120px;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, .25);
  color: inherit;
  font: inherit;
}
.comments-compose textarea:focus { outline: none; border-color: var(--accent); }
html.light .comment-who,
html.light .comment-text { color: #1d2b33; }
html.light .comment-row { background: rgba(15, 40, 32, .06); }
html.light .comment-row.mine { background: rgba(11, 157, 107, .18); }
html.light .comments-compose textarea { background: #ffffff; }

/* ===== Drag-to-scroll: листание чата зажатой мышью ===== */
body.dragging-scroll,
body.dragging-scroll * {
  cursor: grabbing !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== Шапка-карусель: режимы вместо статичного бренда ===== */
/* Активная метка («WEB SITE ⇄ TG BOT» / «WEB SITE ⇄ WEB SITE») стоит по центру
   карточки и горит акцентом, вторая серым уходит к краю. Маска на контейнере
   растворяет края, поэтому серая метка «тает» у границы ещё до клипа. Сдвиг
   серой метки (--shift) считает app.js: ширины меток разные и зависят от
   шрифта, чистый CSS их заранее не знает. */
.mode-carousel {
  position: relative;
  height: 24px;
  margin-bottom: 16px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 40px, #000 calc(100% - 40px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 40px, #000 calc(100% - 40px), transparent 100%);
}
.mode-label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  text-decoration: none;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
  transition: transform .5s cubic-bezier(.22, 1, .36, 1), color .35s ease;
}
.mode-label .mode-arrow {
  font-size: 14px;
  opacity: .7;
  line-height: 1;
  transform: translateY(-2px);
}
/* Активная метка — акцентная со светлой стрелкой; серая целиком гаснет. */
.mode-label.active { cursor: default; }
.mode-label.active .mode-arrow {
  color: var(--accent-soft);
  opacity: 1;
}
/* Серая метка уезжает в сторону: telegram — влево, room — вправо, чтобы
   «WEB SITE ⇄ TG BOT» всегда читался первым, а «WEB SITE ⇄ WEB SITE» — вторым.
   --side задаёт направление, --shift — расстояние (считает app.js). */
.mode-label[data-mode="room"] { --side: 1; }
.mode-label[data-mode="telegram"] { --side: -1; }
.mode-label:not(.active) {
  color: var(--muted);
  transform: translate(calc(-50% + var(--side, 1) * var(--shift, 200px)), -50%);
}
.mode-label:not(.active):hover {
  color: #b7c2d0;
  transform: translate(calc(-50% + var(--side, 1) * calc(var(--shift, 200px) - 14px)), -50%);
}
.mode-label:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ===== Room: канал сайт↔сайт ===== */
/* Экран канала по высоте совпадает с QR-экраном Telegram: QR чуть меньше,
   под ним код и поле ввода — всё укладывается в те же 320px. */
.qr-view img.room-qr { width: min(170px, 50vw); }
/* ── Увеличение QR-кода в комнате ──
   При наведении на QR по центру появляется кнопка: она прячет код и поле
   ввода и раздувает QR, чтобы его было проще отсканировать с другого
   устройства. Повторное нажатие возвращает всё обратно. */
.room-qr-wrap {
  position: relative;
  display: inline-grid;
  place-items: center;
}
.room-qr-zoom {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  color: #ffffff;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(.85);
  transition: opacity .2s ease, transform .2s ease, background .2s ease;
}
.room-qr-zoom svg { width: 22px; height: 22px; }
/* Наведение работает только там, где мышь есть: на тач-устройствах :hover
   «залипает» после тапа и кнопка не гасла бы. */
@media (hover: hover) {
  .room-qr-wrap:hover .room-qr-zoom {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
  }
  .room-qr-zoom:hover { background: rgba(0, 0, 0, .72); }
}
.room-qr-zoom:focus-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}
/* На тач-устройствах наведения нет: кнопка скрыта, пока пользователь не
   коснётся QR (класс show-zoom ставит app.js). Так она не заслоняет код
   постоянно и появляется именно по нажатию. */
@media (hover: none) {
  .room-qr-wrap.show-zoom .room-qr-zoom {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
  }
}
/* Увеличенный режим: код и поле ввода скрыты, QR занимает экран. */
.qr-view.room-zoomed .room-code,
.qr-view.room-zoomed .room-code-input { display: none; }
.qr-view.room-zoomed .room-qr { width: min(340px, 82vw); }
html.light .room-qr-zoom { background: rgba(15, 40, 32, .55); }
html.light .room-qr-zoom:hover { background: rgba(15, 40, 32, .72); }
.room-code {
  color: var(--accent-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: .3em;
  margin-right: -.3em; /* компенсация трекинга после последней буквы */
}
.room-code-input {
  width: 210px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, .03);
  color: #f4f7fb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 16px;
  letter-spacing: .3em;
  text-align: center;
  text-transform: uppercase;
  outline: none;
  transition: border-color .2s ease, background .2s ease;
}
.room-code-input:focus {
  border-color: rgba(52, 211, 153, .45);
  background: rgba(52, 211, 153, .05);
}
.room-code-input::placeholder {
  color: var(--muted);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
}
.room-create { margin-top: 4px; }

/* Оформление ограничено экраном QR-кода «Новая комната». */
#qr-view.room-home-screen {
  display: block;
  min-height: 0;
  margin-top: 22px;
  padding: 0;
  color: var(--muted);
}
#qr-view.room-home-screen ~ .site-footer:empty { display: none !important; }
.card:has(#qr-view.room-home-screen:not(.hidden)) > #subtitle { display: none; }
#qr-view.room-home-screen .room-home-layout {
  display: grid;
  width: 100%;
  gap: 12px;
  text-align: left;
}
#qr-view.room-home-screen .room-home-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #111111;
  box-shadow: none;
}
#qr-view.room-home-screen .room-home-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 0;
}
#qr-view.room-home-screen .room-home-intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
#qr-view.room-home-screen .room-home-icon {
  display: grid;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #ffffff;
}
#qr-view.room-home-screen .room-home-icon svg { width: 18px; height: 18px; }
#qr-view.room-home-screen .room-home-header h2 {
  min-width: 0;
  margin: 0;
  color: #f4f7fb;
  font-size: 26px;
  line-height: 1.25;
}
#qr-view.room-home-screen .room-home-hint {
  margin: 0;
  color: var(--muted);
  text-align: center;
  font-size: 16px;
  line-height: 1.45;
}
#qr-view.room-home-screen .room-qr-wrap { align-self: center; justify-self: center; }
#qr-view.room-home-screen.room-zoomed .room-qr-wrap img.room-qr { width: min(340px, 82vw); }
#qr-view.room-home-screen .room-qr-wrap img.room-qr {
  width: min(250px, 64vw);
  padding: 10px;
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(0,0,0,.28);
}
#qr-view.room-home-screen .room-home-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 30px;
}
#qr-view.room-home-screen .room-code {
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  color: #2ce2b3;
  font-size: 18px;
  letter-spacing: .24em;
}
#qr-view.room-home-screen .room-home-separator {
  width: 1px;
  height: 24px;
  background: rgba(255,255,255,.2);
}
#qr-view.room-home-screen .room-home-participants {
  margin: 0;
  color: #c3ced6;
  font-size: 13px;
}
#qr-view.room-home-screen .room-home-go {
  min-height: 34px;
  width: auto;
  margin: 0;
  padding: 0 13px;
  border: 0;
  border-radius: 10px;
  background: #20d4aa;
  color: #03251c;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
}
#qr-view.room-home-screen .room-home-go:hover,
#qr-view.room-home-screen .room-home-submit:hover { filter: brightness(1.08); }
#qr-view.room-home-screen .room-home-find {
  gap: 12px;
  padding: 22px 24px;
}
#qr-view.room-home-screen .room-home-layout { gap: 19px; }
#qr-view.room-home-screen .room-home-find .room-home-header { justify-content: flex-start; }
#qr-view.room-home-screen .room-home-find .room-home-header { gap: 16px; }
#qr-view.room-home-screen .room-home-find .room-home-icon { flex-basis: 44px; }
#qr-view.room-home-screen .room-home-find .room-home-header h2 { font-size: 18px; }
#qr-view.room-home-screen .room-join-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
  margin: 0;
  padding: 4px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px;
  background: #101817;
}
#qr-view.room-home-screen .room-code-input {
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: #f4f7fb;
  text-align: left;
  letter-spacing: .12em;
}
#qr-view.room-home-screen .room-code-input:focus { border: 0; background: transparent; }
#qr-view.room-home-screen .room-code-input::placeholder { font-size: 15px; }
#qr-view.room-home-screen .room-home-submit {
  display: grid;
  flex: 0 0 50px;
  width: 50px;
  height: 50px;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: #20d4aa;
  color: #03251c;
  cursor: pointer;
}
#qr-view.room-home-screen .room-home-submit svg { width: 24px; height: 24px; }
#qr-view.room-home-screen .room-key-hint { margin-top: 0; font-size: 12px; }
html.light #qr-view.room-home-screen .room-home-card { background: #f2f3f4; }
html.light #qr-view.room-home-screen .room-home-header h2 { color: #14221c; }
html.light #qr-view.room-home-screen .room-home-participants { color: #52615c; }
html.light #qr-view.room-home-screen .room-join-row { border-color: rgba(15,40,32,.16); }
html.light #qr-view.room-home-screen .room-code-input { color: #14221c; }
html.light #qr-view.room-home-screen .room-home-go { background: #20d4aa; color: #03251c; }
html.light #qr-view.room-home-screen .room-home-icon { color: #ffffff; }
@media (max-width: 620px) {
  body.new-room-header .title-wrap h1 { transform: translateY(-5px); }
  #qr-view.room-home-screen { flex: 0 1 auto; padding: 0 8px 20px; }
  #qr-view.room-home-screen .room-home-card { gap: 16px; padding: 24px 22px; border-radius: 18px; }
  #qr-view.room-home-screen .room-home-create { padding-bottom: 24px; }
  #qr-view.room-home-screen .room-qr-wrap img.room-qr { width: min(250px, 64vw); }
  #qr-view.room-home-screen .room-home-meta { gap: 12px; }
  #qr-view.room-home-screen .room-home-find { gap: 10px; padding: 22px 21px 26px; }
  #qr-view.room-home-screen .room-home-find .room-home-icon { flex-basis: 20px; width: 20px; height: 20px; }
  #qr-view.room-home-screen .room-home-find .room-home-header { gap: 16px; }
}
.room-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.room-actions .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  text-decoration: none;
}

/* ===== Responsive: удалено — см. блок МОБИЛЬНАЯ ВЕРСИЯ в конце файла ===== */

/* ===== Text compose: текст с сайта уходит сообщением от бота ===== */
.text-compose {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  /* Тянем панель до самых краёв карточки (минуя её боковые отступы), чтобы
     отступ от кнопок до края был таким же, как снизу. */
  flex: 0 0 auto;
  margin-left: calc(-1 * var(--card-pad-x, 36px));
  margin-right: calc(-1 * var(--card-pad-x, 36px));
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 22px 22px;
  background: transparent;
}
/* Строка ввода: вложение + поле + отправка. Полоса ответа стоит над ней. */
.text-compose-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
.text-compose textarea {
  flex: 1 1 auto;
  min-width: 0;
  resize: none;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 23px;
  padding: 12px 18px;
  /* «Матовое стекло»: сообщения, уходящие под поле ввода, размываются. */
  background: rgba(255, 255, 255, .08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #f4f7fb;
  font: inherit;
  font-size: 16px;
  line-height: 1.4;
  max-height: 132px;
  outline: none;
  scrollbar-width: none;
  transition: border-color .2s ease, background .2s ease;
}
.text-compose textarea::-webkit-scrollbar { display: none; }
.text-compose textarea:focus {
  border-color: rgba(52, 211, 153, .4);
  background: rgba(255, 255, 255, .12);
}
.text-compose textarea::placeholder { color: var(--muted); }
/* Кнопка отправки — «тонированное стекло»: полупрозрачная зелёная заливка и
   размытие фона, как у кнопки увеличения QR. */
.text-send {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(52, 211, 153, .35);
  border-radius: 50%;
  color: var(--accent-soft);
  background: rgba(52, 211, 153, .18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  transition: background .2s ease, color .2s ease, transform .15s ease;
}
.text-send:hover {
  color: #ffffff;
  background: rgba(52, 211, 153, .3);
}
.text-send:active { transform: scale(.95); }
.text-send svg { width: 18px; height: 18px; }
/* Десктоп: у кнопки отправки стрелка вверх; «самолётик» остаётся на мобильном */
.text-send .ico-plane { display: none; }

/* ===== Кнопка «Прикрепить файл»: одна и та же на мобильном и на десктопе ===== */
.mobile-file-btn {
  display: grid;
  place-items: center;
  flex: 0 0 84px;
  width: 84px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 23px;
  color: var(--accent-soft);
  background: rgba(255, 255, 255, .08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease, transform .15s ease;
}
.mobile-file-btn:hover { background: rgba(52, 211, 153, .18); border-color: rgba(52, 211, 153, .4); }
.mobile-file-btn:active { transform: scale(.96); }
.mobile-file-btn svg { width: 22px; height: 22px; }
.sticker-open-btn {
  display: grid; place-items: center; gap: 2px; flex: 0 0 84px; width: 84px; height: 46px;
  border: 1px solid rgba(255,255,255,.16); border-radius: 23px; color: var(--accent-soft);
  background: rgba(255,255,255,.08); cursor: pointer; transition: background .2s ease, transform .15s ease;
}
.sticker-open-btn:hover { background: rgba(52,211,153,.18); }
.sticker-open-btn:active { transform: scale(.96); }
.sticker-open-btn svg { width: 20px; height: 20px; }
.sticker-anchor { position:relative; }
.sticker-picker {
  position:absolute; z-index:30; bottom:calc(100% + 8px); left:0;
  width:min(352px, calc(100vw - 28px)); border:1px solid var(--border); border-radius:20px;
  background:rgba(23,26,25,.97); color:var(--text); box-shadow:0 14px 42px #0005;
  backdrop-filter:blur(22px);
}
.sticker-picker { display:flex; flex-direction:column; overflow:hidden; }
.sticker-picker-head {
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  padding:10px; border-bottom:1px solid var(--border); font-size:14px;
}
.sticker-pack-tabs { display:flex; gap:4px; min-width:0; }
.sticker-pack-tabs button, .sticker-add {
  padding:0 10px; border:0; border-radius:999px; background:transparent;
  color:var(--text); font:inherit; font-size:13px; font-weight:600; cursor:pointer;
}
.sticker-pack-tabs button { min-height:36px; }
.sticker-pack-tabs button:hover { background:var(--control-glass-hover); }
.sticker-pack-tabs button[aria-pressed="true"] { background:var(--control-glass); color:var(--accent-soft); }
.sticker-add {
  display:grid; place-items:center; flex:0 0 36px; width:36px; height:36px; padding:0;
  background:var(--control-green); color:var(--control-green-ink);
}
.sticker-add:hover { background:var(--control-green-hover); }
.sticker-add svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; }
.sticker-picker-body { overflow:auto; max-height:min(300px, 42dvh); padding:8px; overscroll-behavior:contain; }
.sticker-grid { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:4px; }
.sticker-tile { display:grid; place-items:center; width:100%; aspect-ratio:1; padding:5px; border:0; border-radius:12px; background:transparent; cursor:pointer; }
.sticker-tile:hover, .sticker-tile:focus-visible { background:var(--control-glass); }
.sticker-tile.pinned { background:var(--control-glass); box-shadow:inset 0 0 0 1px var(--control-green); }
.sticker-tile :is(img, video), .sticker-artwork :is(img, video) {
  display:block; width:100%; height:100%; min-width:0; min-height:0; object-fit:contain; pointer-events:none;
}
.sticker-empty { margin:0; padding:22px 10px; color:var(--muted); font-size:13px; text-align:center; }
.sticker-editor {
  position:fixed; inset:0; margin:auto; width:min(380px, calc(100% - 24px));
  max-height:calc(100svh - max(12px, env(safe-area-inset-top)) - max(12px, env(safe-area-inset-bottom)));
  padding:0 0 12px; overflow:auto; overscroll-behavior:contain;
  border:1px solid var(--border); border-radius:20px; background:#171a19; color:var(--text);
}
.sticker-editor::backdrop { background:rgba(0,0,0,.65); }
.sticker-editor-stage { display:grid; place-items:center; padding:10px; }
.sticker-crop-frame,.sticker-result-preview { width:min(280px, 100%, max(112px, calc(100svh - 225px))); height:auto; aspect-ratio:1; border-radius:10px; background-color:#263238; background-image:linear-gradient(45deg,#344148 25%,transparent 25%),linear-gradient(-45deg,#344148 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#344148 75%),linear-gradient(-45deg,transparent 75%,#344148 75%); background-size:20px 20px; background-position:0 0,0 10px,10px -10px,-10px 0; }
.sticker-crop-frame { position:relative; cursor:grab; touch-action:none; user-select:none; }
.sticker-crop-frame.dragging { cursor:grabbing; }
.sticker-result-preview { object-fit:contain; }
.sticker-zoom-row { display:flex; align-items:center; gap:12px; padding:0 16px; color:var(--muted); font-size:12px; }
.sticker-zoom-row input { flex:1; accent-color:var(--control-green); }
.sticker-editor-status { min-height:18px; margin:8px 16px; color:var(--muted); font-size:12px; text-align:center; }
.sticker-editor-actions { display:flex; align-items:center; justify-content:flex-end; flex-wrap:wrap; gap:8px; padding:0 12px; }
.sticker-editor-actions button { min-height:36px; padding:0 13px; border:0; border-radius:18px; background:transparent; color:var(--text); font:inherit; font-size:13px; }
.sticker-editor-actions button.primary { background:var(--control-green); color:var(--control-green-ink); font-weight:600; }
.sticker-editor-actions button:hover { background:var(--control-glass-hover); }
.sticker-editor-actions button.primary:hover { background:var(--control-green-hover); }
.sticker-editor #sticker-editor-close { font-size:25px; font-weight:500; line-height:1; }
.sticker-editor-actions button:disabled { opacity:.55; cursor:progress; }
html.light :is(.sticker-picker, .sticker-editor) { background:#fff; box-shadow:0 14px 42px #0f282428; }
html.light .sticker-editor-actions button { background:transparent; color:#1d2b33; }
html.light .sticker-editor-actions button:hover { background:rgba(15,40,32,.08); }
html.light .sticker-editor-actions button.primary { background:var(--control-green); color:var(--control-green-ink); }
html.light .sticker-crop-frame,html.light .sticker-result-preview { background-color:#f0f3f4; background-image:linear-gradient(45deg,#dfe4e6 25%,transparent 25%),linear-gradient(-45deg,#dfe4e6 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#dfe4e6 75%),linear-gradient(-45deg,transparent 75%,#dfe4e6 75%); }
@media (max-width:540px) {
  .sticker-anchor { position:static; }
  .sticker-picker { left:14px; }
  .sticker-editor-actions button { min-height:44px; }
}

/* ===== Переключатель темы: солнце/луна — внутри меню заголовка ===== */
.theme-toggle {
  display: none;
}
/* Иконки солнце/луна внутри строки «Тема».
   Значок показывает ТЕКУЩУЮ тему: в тёмной — луна, в светлой — солнце.
   Раньше было наоборот (солнце в тёмной), из-за чего иконка врала.
   Обе иконки живут в одной ячейке грида и меняютсяopacity + поворотом:
   переключение темы выглядит как вращение, а не как смена картинки. */
#menu-theme-row .mi-ico .ico-sun,
#menu-theme-row .mi-ico .ico-moon {
  grid-area: 1 / 1;
  transition: opacity .28s ease, transform .45s cubic-bezier(.22, 1, .36, 1);
}
/* Тёмная тема: луна в центре, солнце повёрнуто и спрятано. */
#menu-theme-row .mi-ico .ico-moon { opacity: 1; transform: rotate(0deg) scale(1); }
#menu-theme-row .mi-ico .ico-sun { opacity: 0; transform: rotate(-120deg) scale(.4); }
/* Светлая тема: солнце в центре, луна уезжает поворотом. */
html.light #menu-theme-row .mi-ico .ico-sun { opacity: 1; transform: rotate(0deg) scale(1); }
html.light #menu-theme-row .mi-ico .ico-moon { opacity: 0; transform: rotate(120deg) scale(.4); }
/* Уважаем системную настройку: без вращения, просто смена значка. */
@media (prefers-reduced-motion: reduce) {
  #menu-theme-row .mi-ico .ico-sun,
  #menu-theme-row .mi-ico .ico-moon { transition: opacity .12s linear; transform: none; }
}

/* ===== Text items: текст из чата на сайте, клик копирует ===== */
.text-item {
  margin: 8px 0;
  /* Фиксированная высота — ровно как у карточек файлов: длинный текст
     обрезается по двум строкам, все карточки чата остаются одного размера. */
  height: var(--chat-card-h);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 12px;
  background: rgba(255, 255, 255, .04);
  cursor: pointer;
  animation: file-in .25s ease-out;
  transition: background .2s ease;
}
.text-item:hover { background: rgba(255, 255, 255, .06); }
.text-body {
  order: 2;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}
.text-content {
  white-space: pre-wrap;
  word-break: break-word;
  color: #d0d8e4;
  font-size: 14px;
  line-height: 1.5;
  display: -webkit-box;
  /* Две строки: карточка текста фиксированной высоты, как у файлов. */
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* Строка заметки карточки текста: заметка + счётчики (глаз/загрузка/реакции)
   в одну линию, поэтому отдельная строка под текстом не появляется. */
.text-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}
.text-note {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Иконка «копировать» справа; при ошибке — восклицательный знак. */
.text-item::before {
  content: '';
  order: 3;
  flex: 0 0 auto;
  margin-left: auto;
  width: 16px;
  height: 16px;
  background: var(--muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='12' height='12' rx='2'/%3E%3Cpath d='M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='12' height='12' rx='2'/%3E%3Cpath d='M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: color .2s ease, transform .15s ease;
}
.text-item:hover::before { background: var(--accent); }
.text-item.sending::before {
  width: 14px;
  height: 14px;
  background: none;
  -webkit-mask: none;
  mask: none;
  border: 2px solid rgba(255, 255, 255, .15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.text-item.error {
  border-color: rgba(248, 113, 113, .2);
  background: rgba(248, 113, 113, .08);
}
.text-item.error .text-content,
.text-item.error .text-meta { color: #f87171; }
.text-item.error::before {
  background: #f87171;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z'/%3E%3Cline x1='12' y1='9' x2='12' y2='13'/%3E%3Cline x1='12' y1='17' x2='12.01' y2='17'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z'/%3E%3Cline x1='12' y1='9' x2='12' y2='13'/%3E%3Cline x1='12' y1='17' x2='12.01' y2='17'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* Отзыв после копирования: галочка вместо иконки «копировать». */
.text-item.copied::before {
  content: '';
  width: 20px;
  height: 20px;
  background: var(--accent);
  -webkit-mask: var(--check-svg) center / contain no-repeat;
  mask: var(--check-svg) center / contain no-repeat;
  transition: none;
}

/* ================================================================
   РЕЖИМ МЕССЕНДЖЕРА: пузыри как в Telegram (хвостик сверху)
   ================================================================ */
/* Хвостик выступает за пузырь — оставляем по краям ленты место, иначе
   список (overflow-y: auto → overflow-x: auto) обрезает хвостики. */
body.messenger-mode .file-list {
  /* Отступ постоянный (не только в режиме выбора) — под хвостик, свечение и
     кружок выделения. Так сообщения не «прыгают» к центру при выделении. */
  padding-left: 22px;
  padding-right: 22px;
  /* Изолируем список: все свечения (z-index:-1) окажутся ПОЗАДИ всех
     сообщений, а не поверх соседних. */
  isolation: isolate;
}
/* В режиме мессенджера горизонтальный отступ даёт .file-list, поэтому у .chat
   его убираем, чтобы не удваивать. */
body.messenger-mode .chat {
  padding-left: 0;
  padding-right: 0;
  /* Длинные имена отправителей могут выступать за ширину ленты. */
  overflow-x: visible;
}
/* Пузырь: полностью скруглён (как в исходном дизайне), отступ между
   сообщениями одной серии — 2px. Рамки нет — как в Telegram, объём даёт
   только тень, поэтому хвостик срастается с пузырём без стыка. */
body.messenger-mode .file-item,
body.messenger-mode .text-item {
  position: relative;
  width: fit-content;
  max-width: min(85%, 560px);
  min-height: 0;
  height: auto;
  margin: 2px 0;
  padding: 8px 12px 10px;
  border: 0;
  /* «Матовое стекло», как у панели ввода: полупрозрачный фон + размытие. */
  background: var(--bubble-bg);
  border-radius: 16px;
  box-shadow: none;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  cursor: default;
  animation: msg-in .24s cubic-bezier(.2, .8, .3, 1);
  transition: background .2s ease, box-shadow .4s ease, filter .45s ease;
}
/* Цвета пузыря и его рамки. */
body.messenger-mode {
  --bubble-bg: #1f4d40;
  --bubble-border: #2b6b58;
}
body.messenger-mode .file-item.theirs,
body.messenger-mode .text-item.theirs {
  --bubble-bg: #202020;
  --bubble-border: #2d2d2d;
}
/* Свои сообщения — справа, чужие — слева. */
body.messenger-mode .file-item.mine,
body.messenger-mode .text-item.mine { margin-left: auto; }
body.messenger-mode .file-item.theirs,
body.messenger-mode .text-item.theirs { margin-right: auto; }
/* Первое сообщение серии: место под имя и хвостик; угол со стороны хвостика
   прямой — хвостик «вытягивает» его. */
body.messenger-mode .file-item.group-first,
body.messenger-mode .text-item.group-first { margin-top: 22px; }
body.messenger-mode .file-item.mine.group-first,
body.messenger-mode .text-item.mine.group-first { border-top-right-radius: 0; }
body.messenger-mode .file-item.theirs.group-first,
body.messenger-mode .text-item.theirs.group-first { border-top-left-radius: 0; }
/* Последнее сообщение серии: увеличенный отступ до следующей группы. */
body.messenger-mode .file-item.group-last,
body.messenger-mode .text-item.group-last { margin-bottom: 8px; }
/* Имя отправителя — НАД хвостиком, вровень с краем пузыря (чтобы не
   обрезалось у края ленты и не вызывало горизонтальную прокрутку). */
body.messenger-mode .msg-author {
  position: absolute;
  top: auto;
  bottom: calc(100% + 2px);
  overflow: visible;
  text-overflow: clip;
  font-size: 13px;
  font-weight: 600;
  line-height: 15px;
  color: var(--accent-soft);
  white-space: nowrap;
}
body.messenger-mode .file-item.mine .msg-author,
body.messenger-mode .text-item.mine .msg-author { right: 0; }
body.messenger-mode .file-item.theirs .msg-author,
body.messenger-mode .text-item.theirs .msg-author { left: 0; color: #7fd8c0; }
/* Хвостик — точная форма из Telegram (viewBox 0 0 11 20), перевёрнутая вверх
   (scaleY(-1)). Заливка совпадает с фоном пузыря, поэтому хвостик срастается
   с ним в единый контур. */
body.messenger-mode .msg-tail {
  position: absolute;
  top: 0;
  width: 8px;
  height: 17px;
  overflow: visible;
  pointer-events: none;
  z-index: 0;
}
body.messenger-mode .file-item.mine .msg-tail,
body.messenger-mode .text-item.mine .msg-tail {
  right: -6px;
  transform: scaleX(-1);
}
body.messenger-mode .file-item.theirs .msg-tail,
body.messenger-mode .text-item.theirs .msg-tail {
  left: -6px;
  transform: none;
}
body.messenger-mode .msg-tail-fill { fill: var(--bubble-bg); }
/* Иконки скачивания/копирования в этом режиме не нужны (спиннеры
   отправки/приёма и значки ошибок оставляем). */
body.messenger-mode .file-item:not(.sending):not(.pending):not(.receiving):not(.error)::before,
body.messenger-mode .text-item:not(.sending):not(.error)::before {
  display: none;
}
/* Подписи-подсказки и служебные статусы («нажмите, чтобы скопировать»,
   «сохранено в канале», «отправлено», проценты передачи и т.п.) в режиме
   мессенджера не показываем — пузырь остаётся чистым, как в чате. Текст
   ошибок оставляем: без него непонятно, что пошло не так. */
body.messenger-mode .file-item:not(.error) .file-note,
body.messenger-mode .text-item:not(.error) .text-note {
  display: none;
}
/* Если в строке заметки не осталось видимого содержимого (ни размера файла,
   ни счётчиков), убираем и её — пустой блок добавлял бы лишний отступ. */
body.messenger-mode .file-item:not(.error) .file-meta:not(:has(.file-size, .msg-stats, .msg-time)),
body.messenger-mode .text-item:not(.error) .text-meta:not(:has(.msg-stats, .msg-time)) {
  display: none;
}
/* Текст в пузыре не обрезаем по двум строкам. */
body.messenger-mode .text-content {
  display: inline;
  overflow: visible;
  -webkit-line-clamp: unset;
}
body.messenger-mode .text-body { display: block; }
body.messenger-mode .text-meta {
  float: right;
  margin: 6px 0 0 8px;
}
/* Светлая тема. */
html.light body.messenger-mode {
  --bubble-bg: #ddf1ea;
  --bubble-border: #9ed8c4;
}
html.light body.messenger-mode .file-item.theirs,
html.light body.messenger-mode .text-item.theirs {
  --bubble-bg: #ffffff;
  --bubble-border: #e7eae9;
}
html.light body.messenger-mode .msg-author { color: #0b7c56; }

/* ── Разделитель дат: липкая пилюля по центру, как в Telegram ── */
body.messenger-mode .date-sep {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: center;
  padding: 6px 0 4px;
  pointer-events: none;
}

body.messenger-mode .date-sep.date-past { visibility: hidden; }
@media (min-width: 701px) {
  /* Keep bubble edges aligned with the narrow layout as the viewport grows. */
  body.messenger-mode .chat { margin-left: -24px; margin-right: -24px; }
  body.messenger-mode .file-list { padding-left: 34px; padding-right: 34px; }
}
body.messenger-mode .date-sep-pill {
  padding: 3px 10px;
  border-radius: 15px;
  background: rgba(0, 0, 0, .45);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

/* ── Появление сообщения (как bubble-transition-in в Telegram) ── */
@keyframes msg-in {
  from { opacity: 0; transform: translateY(10px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
/* ── Свечение сообщения: размытая копия пузыря ПОЗАДИ него (.msg-glow,
   добавляется в JS). По умолчанию прозрачно; включается у выделенных и у
   сообщения, к которому перешли по цитате ответа. Список изолирован, поэтому
   все свечения лежат под всеми сообщениями: у соседних выделенных они
   накладываются и сливаются в одно сплошное свечение, но не заезжают на
   содержимое соседей. ── */
body.messenger-mode .msg-glow {
  position: absolute;
  inset: -6px;
  border-radius: 22px;
  background: rgba(52, 211, 153, .55);
  filter: blur(10px);
  z-index: -1;
  opacity: 0;
  pointer-events: none;
  transition: opacity .45s ease;
}
body.messenger-mode .file-item.msg-flash .msg-glow,
body.messenger-mode .text-item.msg-flash .msg-glow {
  opacity: 1;
}

/* Светлая тема: разделители. */
html.light body.messenger-mode .date-sep-pill { background: rgba(0, 0, 0, .28); }

/* ================================================================
   МОБИЛЬНАЯ ВЕРСИЯ — мессенджер: полноэкранный экран, ввод внизу
   ================================================================ */
@media (max-width: 540px) {
  body.mobile-rooms,
  body.mobile-rooms .chat {
    touch-action: pan-y pinch-zoom;
    overscroll-behavior-x: contain;
  }
  /* ── Подложка: убираем фон, градиенты, сетку-центрирование ── */
  body {
    display: block;
    background: #000000;
    background-image: none;
    padding: 0;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }
  /* Страница-«приложение» не скроллится целиком: скролл-рестор Chrome больше
     не уводит шапку под адресную строку. About-страница скроллится как обычно. */
  body:not(.about-page) {
    position: fixed;
    inset: var(--viewport-top, 0px) 0 auto;
    height: var(--viewport-height, 100dvh);
    min-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
    overscroll-behavior: none;
  }

  /* Точки-частицы невидимы на мобильном */

  /* ── Карточка → полноэкранный flex-контейнер ── */
  .card {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
    border: none;
    border-radius: 0;
    /* Верх страницы — ровный чёрный: зелёное свечение убрано, чтобы
       карточка совпадала с фоном body и системными панелями Android.
       Светлая тема перекрывает это правило ниже (html.light .card). */
    background: #000000;
    background-image: none;
    box-shadow: none;
    backdrop-filter: none;
    padding: 0;
    text-align: left;
    animation: none;
    overflow: hidden;
  }
  .card:hover { box-shadow: none; }
  .card > * { animation: none !important; }

  /* ── Оболочка: карточка + панель сессии внизу экрана ── */
  .app-shell {
    width: 100%;
    max-height: none;
    /* 100% от content-box body (уже учитывает safe-area padding) */
    height: 100%;
    gap: 0;
  }
  .app-shell > .card {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    max-height: none;
  }
  .session-bar {
    flex: 0 0 auto;
    padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
    background: #000000;
    border-top: 1px solid var(--border);
  }

  /* ── Шапка: компактная + отступ от адресной строки Chrome ── */
  .brand {
    margin: 0;
    padding: max(10px, env(safe-area-inset-top)) 16px 10px;
    justify-content: center;
    font-size: 10px;
    letter-spacing: .18em;
  }
  .brand span { font-size: 14px; transform: none; }

  h1 {
    margin: 0;
    padding: 6px 16px 0;
    font-size: 20px;
  }
  /* Шапку страницы передачи центрируем; about-страница (.card там нет)
     остаётся с прежним левым выравниванием. Боковой паддинг убираем: его
     теперь даёт .title-wrap (12px), а лишние 16px заставляли заголовок
     переноситься на две строки при трёх кнопках в шапке. */
  .card h1 { text-align: center; padding-left: 0; padding-right: 0; }
  .card .title-menu-btn { gap: 6px; }
  .card .title-chevron { width: 18px; height: 18px; }
  .card .subtitle { text-align: center; }
  .subtitle {
    margin: 0 auto;
    padding: 2px 16px 6px;
  }

  /* ── Карусель режимов в шапке: активная метка по центру, вторая серым
     уходит к краю экрана и растворяется (маска уже в базовых стилях, здесь
     только компактные размеры и отступ от адресной строки Chrome). ── */
  .mode-carousel {
    height: 22px;
    /* Отступ сверху увеличивает зазор от верхней границы до меток режимов:
       теперь он такой же, как от меток до заголовка под ними. */
    margin: 10px 0 0;
    padding: max(16px, env(safe-area-inset-top)) 0 8px;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 26px, #000 calc(100% - 26px), transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, #000 26px, #000 calc(100% - 26px), transparent 100%);
  }
  /* ── Меню заголовка: на мобильном почти на всю ширину экрана ── */
  .title-menu {
    top: calc(100% + 10px);
    width: calc(100% - 24px);
    min-width: 0;
    max-width: none;
  }
  .title-menu-item,
  .menu-row,
  .radio-option { padding: 11px 12px; }

  /* ── QR ── */
  .qr-view {
    flex: 1 1 auto;
    min-height: 0;
    padding: 0 16px;
  }
  .qr-view img {
    width: min(200px, 65vw);
    padding: 10px;
    border-radius: 14px;
  }

  /* ── Transfer view: растягивается на остаток высоты ── */
  .transfer-view {
    flex: 1 1 0%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .status {
    margin: 6px 16px;
  }

  /* ── Drop zone: скрыт на мобильном (загрузка через 📎 внизу) ── */

  /* ── Чат: заполняет пространство над панелью ввода ── */
  .chat {
    flex: 1 1 0%;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    margin: 0;
    padding: 8px 12px;
    scrollbar-width: none;
  }
  .chat::-webkit-scrollbar { display: none; }
  /* В режиме мессенджера горизонтальный отступ даёт .file-list (место под
     хвостики), поэтому у .chat его убираем, чтобы не удваивать. */
  body.messenger-mode .chat {
    padding-left: 0;
    padding-right: 0;
  }

  /* Зазор одинаков при любой высоте панели ввода. */
  .chat-spacer {
    display: block;
    flex: 0 0 auto;
    height: calc(var(--compose-h, 0px) + 8px);
  }

  .chat.has-scroll .file-list {
    -webkit-mask-image: none;
    mask-image: none;
    padding-right: 0;
  }
  /* На мобильном пузыри стоят почти у самого края (как в Telegram:
     --chat-bubbles-padding ≈ 8px). */
  body.messenger-mode .file-list {
    padding-left: 10px;
    padding-right: 10px;
  }
  /* В режиме мессенджера хвостик выступает вправо — не обнуляем отступ,
     иначе правый хвостик обрезается краем списка. */
  body.messenger-mode .chat.has-scroll .file-list {
    padding-left: 10px;
    padding-right: 10px;
  }

  .file-list {
    scrollbar-width: none;
    overflow-y: visible;
    /* Не даём списку сжиматься под высоту чата: иначе его содержимое
       вылезает за собственную рамку. Список растёт по контенту, а
       прокручивается сам .chat. */
    flex: 0 0 auto;
  }
  .file-list::-webkit-scrollbar { display: none; }

  /* ── Растворение карточек только у ВЕРХНЕГО края чата ──
     На мобильном скроллится сам .chat, поэтому маска вешается на него:
     она стоит на месте, пока карточки прокручиваются под ней. Снизу
     градиента больше нет — карточки уходят под панель ввода чёткой
     границей, без размытого «тумана» над ней. */
  .chat.has-scroll {
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 24px, #000 100%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 24px, #000 100%);
  }

  .file-item {
    margin: 6px 0;
    min-height: 64px;
    padding: 8px 12px;
    border-radius: 10px;
  }
  .file-thumb { width: 48px; height: 48px; }
  .file-thumb.photo img { max-width: 48px; max-height: 48px; }
  .file-thumb.icon svg { width: 26px; height: 26px; }

  .text-item {
    height: auto;
    min-height: 64px;
    padding: 8px 12px;
    margin: 6px 0;
    border-radius: 10px;
  }

  /* ══════════════════════════════════════════════════════════════
     НИЖНЯЯ ПАНЕЛЬ ВВОДА занимает место под прокручиваемой лентой.
     ══════════════════════════════════════════════════════════════ */
  .text-compose {
    position: absolute;
    flex: 0 0 auto;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    /* Панель прозрачная: никакого «бокса» снизу — видны только сами поле и
       кнопки, а фон чата просвечивает. */
    border-top: none;
    background: transparent;
    margin: 0;
  }
  .text-compose-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
  }

  /* Кнопка «Прикрепить файл» — слева, широкая «пилюля»: как два круга кнопки
     отправки в ширину; высота — та же, что у кнопки отправки. Оформление —
     «тонированное стекло»: полупрозрачный градиент, размытие и светлая кромка. */
  .mobile-file-btn {
    display: grid !important;
    place-items: center;
    flex: 0 0 84px;
    width: 84px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 21px;
    color: var(--accent-soft);
    background: rgba(255, 255, 255, .08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background .2s ease, border-color .2s ease, transform .15s ease;
  }
  .mobile-file-btn:active {
    background: rgba(52, 211, 153, .24);
    border-color: rgba(52, 211, 153, .4);
    transform: scale(.96);
  }
  .mobile-file-btn svg { width: 22px; height: 22px; }

  /* Текстовое поле: скруглённый «пузырь», растягивается вверх */
  .text-compose textarea {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 42px;
    max-height: 120px;
    height: 42px;
    padding: 10px 14px;
    border-radius: 21px;
    border: 1px solid rgba(255, 255, 255, .16);
    background: rgba(255, 255, 255, .08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #f4f7fb;
    resize: none;
    overflow-y: hidden;
    -webkit-appearance: none;
    appearance: none;
    field-sizing: content;
  }
  .text-compose textarea::-webkit-scrollbar { display: none; }
  .text-compose textarea::placeholder { color: var(--muted); opacity: .7; }
  .text-compose textarea:focus {
    border-color: rgba(52, 211, 153, .4);
    background: rgba(255, 255, 255, .12);
  }

  /* Кнопка «Отправить» — круглая, «тонированное стекло» */
  .text-send {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid rgba(52, 211, 153, .4);
    background: rgba(52, 211, 153, .22);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--accent-soft);
  }
  .text-send:active {
    background: rgba(52, 211, 153, .34);
    transform: scale(.95);
  }
  .text-send svg { width: 18px; height: 18px; }
  /* На мобильном — та же стрелка вверх, что и на десктопе */
  .text-send .ico-plane { display: none; }
  .text-send .ico-arrow { display: block; }

  /* Footer: скрыт */
  .site-footer { display: none !important; }

}

/* ================================================================
   СВЕТЛАЯ ТЕМА (html.light)
   Летящие зелёные точки в ней не летают вовсе: их гасит и CSS
   (правило ниже), и app.js (backgroundDots.setLight).
   ================================================================ */
html.light {
  color-scheme: light;
}
html.light body {
  background: #eef0f2;
  background-image: none;
  color: #17232b;
}
/* Рой в светлой теме выключен */

/* ── Карточка и типографика ── */
html.light .card {
  border-color: rgba(15, 40, 32, .08);
  background: #ffffff;
  box-shadow: none;
}
html.light .card:hover {
  box-shadow: none;
}
html.light h1,
html.light .card h1 { color: #14212a; }
html.light .subtitle,
html.light .hint { color: #5b6b77; }
html.light .status { color: #5b6b77; }
html.light .status.connected { color: #0b9d6b; }
html.light .brand { color: #0b9d6b; }
html.light .brand span { color: #0b7c56; }

/* ── Карусель режимов ── */
html.light .mode-label { color: #0b9d6b; }
html.light .mode-label.active .mode-arrow { color: #0b7c56; }
html.light .mode-label:not(.active) { color: #93a1ac; }
html.light .mode-label:not(.active):hover { color: #5b6b77; }

/* ── Меню заголовка ── */
html.light .title-menu {
  border-color: rgba(15, 40, 32, .1);
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 0 0 1px rgba(15, 40, 32, .03), 0 24px 70px rgba(23, 42, 36, .28);
}
html.light .title-menu-item,
html.light .menu-row,
html.light .radio-option { color: #1d2b33; }
html.light .title-menu-item:hover,
html.light .menu-row-btn:hover,
html.light .radio-option:hover { background: rgba(11, 157, 107, .08); }
html.light .title-menu-item:active,
html.light .menu-row-btn:active { background: rgba(11, 157, 107, .14); }
html.light .title-menu-item.active { background: rgba(11, 157, 107, .14); color: #0b7c56; }
html.light .mi-ico { color: #0b7c56; }
html.light .mi-sub { color: #6b7a86; }
html.light .menu-section { border-top-color: rgba(11, 157, 107, .14); }
html.light .menu-section-title { color: #6b7a86; }
html.light .switch { background: rgba(11, 157, 107, .12); border-color: rgba(11, 157, 107, .25); }
html.light .switch[aria-checked="true"] { background: rgba(11, 157, 107, .3); border-color: rgba(11, 157, 107, .55); }
html.light .switch-knob { background: #0b7c56; }
html.light .segmented { background: rgba(11, 157, 107, .06); border-color: rgba(11, 157, 107, .2); }
html.light .seg-btn.active { background: rgba(11, 157, 107, .16); color: #0b7c56; }
html.light .radio-dot { border-color: #9aa7b1; }
html.light .radio-option[aria-checked="true"] .radio-dot { border-color: #0b7c56; }
html.light .radio-option[aria-checked="true"] .radio-dot::after { background: #0b7c56; }
html.light .room-card { background: rgba(11, 157, 107, .05); border-color: rgba(11, 157, 107, .18); }
html.light .room-enc-note { border-top-color: rgba(11, 157, 107, .14); }
html.light .qr-modal-code { color: #0b7c56; }
html.light .qr-hint { border-color: rgba(15, 40, 32, .12); background: rgba(15, 40, 32, .03); }
html.light .qr-hint b { color: #14212a; }
html.light .room-card-code b,
html.light .room-key-value { color: #0b7c56; }
html.light .room-key { border-top-color: rgba(11, 157, 107, .14); }
html.light .row-chevron { color: #9aa7b1; }

/* ── Карточки чата ── */
html.light .file-item,
html.light .text-item {
  border-color: rgba(15, 40, 32, .1);
  background: rgba(255, 255, 255, .72);
  color: #1d2b33;
}
html.light .file-item:hover,
html.light .text-item:hover { background: #ffffff; }
html.light .file-item a.file-name { color: #0b7c56; }
html.light .file-item a.file-name:hover { color: #06120d; }
html.light .file-meta { color: #6b7a86; }
html.light .file-thumb.icon { color: #0b7c56; }
html.light .file-thumb.icon .ext { color: #6b7a86; }
html.light .text-item.sending::before {
  border-color: rgba(15, 40, 32, .15);
  border-top-color: #0b9d6b;
}
html.light .file-item.downloaded::before { color: #0b9d6b; }
html.light .file-item.downloaded:hover::before { color: #0b7c56; }
html.light .file-item.error {
  color: #c2373c;
  border-color: rgba(194, 55, 60, .25);
  background: rgba(194, 55, 60, .06);
}
html.light .file-item.error .file-meta { color: #c2373c; }
html.light .text-content { color: #1d2b33; }
html.light .text-meta { color: #6b7a86; }
html.light .text-item.error .text-content,
html.light .text-item.error .text-meta { color: #c2373c; }
html.light .text-item.copied::before { color: #0b9d6b; }

/* ── Кнопки, модалка, подвал ── */
html.light .button {
  color: #ffffff;
  background: #10b981;
  border-color: rgba(11, 157, 107, .5);
}
html.light .button:hover {
  background: #0ea974;
  border-color: rgba(11, 157, 107, .65);
  box-shadow: 0 0 20px rgba(11, 157, 107, .18);
}
html.light .modal {
  border-color: rgba(15, 40, 32, .1);
  background: #ffffff;
  box-shadow: 0 30px 80px rgba(23, 42, 36, .3);
}
html.light .modal-title { color: #14212a; }
html.light .modal-cancel {
  color: #5b6b77;
  border-color: rgba(15, 40, 32, .16);
}
html.light .modal-cancel:hover {
  color: #14212a;
  border-color: rgba(15, 40, 32, .3);
  background: rgba(15, 40, 32, .04);
}
html.light .site-footer { color: #6b7a86; }
html.light .site-footer a { color: #0b7c56; }
html.light .site-footer a:hover { color: #06120d; }

/* ── Комната: код и поле ввода ── */
html.light .room-code { color: #0b7c56; }
html.light .room-code-input {
  border-color: rgba(15, 40, 32, .16);
  background: rgba(255, 255, 255, .8);
  color: #14212a;
}
html.light .room-code-input:focus {
  border-color: rgba(11, 157, 107, .55);
  background: #ffffff;
}
html.light .loader {
  border-color: rgba(15, 40, 32, .12);
  border-top-color: #0b9d6b;
}

/* ── Композер текста ── */
html.light .text-compose textarea {
  border: none;
  background: #f1f3f5;
  color: #14212a;
}
html.light .text-compose textarea:focus {
  border: none;
  background: #eceff2;
}
html.light .text-send {
  color: #0b7c56;
  border-color: rgba(11, 157, 107, .3);
  background: rgba(11, 157, 107, .14);
}
html.light .text-send:hover {
  color: #0b7c56;
  background: rgba(11, 157, 107, .24);
}

/* ── Мобильная версия ── */
html.light .card {
  background: #ffffff;
}
html.light .text-compose {
  border-top: none;
  background: rgba(255, 255, 255, .97);
}
html.light .mobile-file-btn {
  border-color: rgba(15, 40, 32, .14);
  color: #0b7c56;
  background: rgba(11, 157, 107, .08);
}
html.light .mobile-file-btn:active {
  background: rgba(11, 157, 107, .18);
  border-color: rgba(11, 157, 107, .35);
}
/* ── Страницы about / privacy / terms ── */
html.light .about-nav {
  border-bottom-color: rgba(15, 40, 32, .1);
  background: rgba(255, 255, 255, .82);
}
html.light .hero h1,
html.light .section h2,
html.light .final-cta h2 { color: #14212a; }
html.light .hero .lead,
html.light .check-list li { color: #3d4c58; }
html.light .steps li,
html.light .feature-card,
html.light .faq details {
  border-color: rgba(15, 40, 32, .1);
  background: rgba(255, 255, 255, .75);
}
html.light .steps h3,
html.light .feature-card h3,
html.light .faq summary { color: #14212a; }
html.light .feature-card:hover {
  border-color: rgba(11, 157, 107, .35);
  background: rgba(11, 157, 107, .05);
}
html.light .ghost-button { color: #2a3944; }
html.light .ghost-button:hover { color: #06120d; }
html.light .final-cta {
  border-color: rgba(11, 157, 107, .3);
  background: rgba(11, 157, 107, .04);
  box-shadow: none;
}
html.light .about-footer a { color: #0b7c56; }
html.light .about-footer a:hover { color: #06120d; }

/* ===== About page: логотип FileQR в шапке ===== */
.about-nav .brand .logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  object-fit: cover;
}
.about-nav .brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: none;
}
.about-nav .brand span {
  font-size: 15px;
  color: var(--accent-soft);
  opacity: 1;
  line-height: 1;
  transform: none;
}

/* ===== About page: сравнение режимов (веб-сайт / Telegram-бот) ===== */
.mode-comparison {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 28px 0 0;
}
.mode-card {
  padding: 26px 24px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 18px;
  background: rgba(255, 255, 255, .025);
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}
.mode-card:hover {
  border-color: rgba(52, 211, 153, .3);
  background: rgba(52, 211, 153, .05);
  transform: translateY(-3px);
}
.mode-ico {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(52, 211, 153, .25);
  border-radius: 12px;
  background: rgba(52, 211, 153, .08);
  font-size: 22px;
}
.mode-card h3 { margin: 18px 0 8px; color: #eef2f7; font-size: 17px; }
.mode-card > p { margin: 0 0 18px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.mode-card .check-list { grid-template-columns: 1fr; gap: 8px; }
.mode-card .check-list li { font-size: 13px; }

/* ===== About page: вкладки безопасности (веб-сайт / Telegram-бот) ===== */
.security-tabs {
  display: flex;
  gap: 8px;
  margin: 24px 0 0;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, .02);
}
.tab-button {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color .2s ease, background .2s ease;
}
.tab-button:hover { color: var(--accent-soft); }
.tab-button.active {
  color: #06120d;
  background: var(--accent);
}
.tab-content {
  display: none;
  margin-top: 16px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 18px;
  background: rgba(255, 255, 255, .025);
}
.tab-content.active { display: block; animation: pop-in .25s ease; }
.tab-content h3 { margin: 0 0 10px; color: #eef2f7; font-size: 17px; }
.tab-content > p { margin: 0 0 18px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.tab-content .check-list { grid-template-columns: 1fr; gap: 10px; }
.tab-content .check-list li strong { color: #eef2f7; }

/* ===== About page: адаптив новых блоков ===== */
@media (max-width: 900px) {
  .mode-comparison { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .about-nav .brand { font-size: 13px; }
  .about-nav .brand .logo { width: 26px; height: 26px; }
  .security-tabs { flex-direction: column; }
  .tab-content { padding: 18px; }
}

/* ===== About page: светлая тема для новых блоков ===== */
html.light .about-nav .brand { color: #0b9d6b; }
html.light .about-nav .brand span { color: #0b7c56; }
html.light .mode-card {
  border-color: rgba(15, 40, 32, .1);
  background: rgba(255, 255, 255, .75);
}
html.light .mode-card:hover {
  border-color: rgba(11, 157, 107, .35);
  background: rgba(11, 157, 107, .05);
}
html.light .mode-card h3 { color: #14212a; }
html.light .mode-card > p { color: #3d4c58; }
html.light .mode-ico {
  border-color: rgba(11, 157, 107, .3);
  background: rgba(11, 157, 107, .08);
}
html.light .security-tabs {
  border-color: rgba(15, 40, 32, .1);
  background: rgba(255, 255, 255, .6);
}
html.light .tab-button { color: #5b6b77; }
html.light .tab-button:hover { color: #0b7c56; }
html.light .tab-button.active { color: #ffffff; background: #0b9d6b; }
html.light .tab-content {
  border-color: rgba(15, 40, 32, .1);
  background: rgba(255, 255, 255, .75);
}
html.light .tab-content h3 { color: #14212a; }
html.light .tab-content > p { color: #3d4c58; }
html.light .tab-content .check-list li strong { color: #14212a; }

/* ===== Комната: диалог ввода (меню) ===== */
.file-item[data-direct-placeholder] { cursor: default; }

.prompt-input {
  width: 100%;
  box-sizing: border-box;
  margin: 6px 0 16px;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .05);
  color: inherit;
  font: inherit;
  font-size: 15px;
}
.prompt-input:focus {
  outline: none;
  border-color: var(--accent);
}
html.light .prompt-input {
  border-color: rgba(15, 40, 32, .16);
  background: rgba(15, 40, 32, .04);
}

/* ================================================================
   МЕНЮ СООБЩЕНИЯ: правая кнопка / длинное нажатие
   ================================================================ */
/* Карточки чата — позиционирующий контекст для значков (закреп/реакции). */
.file-item,
.text-item { position: relative; }

/* Значки в правом верхнем углу карточки: закрепление и реакции. */
.msg-flags {
  position: absolute;
  top: 6px;
  right: 8px;
  display: flex;
  gap: 3px;
  pointer-events: none;
}
.msg-flag {
  font-size: 11px;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 8px;
  background: rgba(0, 0, 0, .42);
  color: #fff;
}
.msg-flag.reaction.mine { background: rgba(26, 188, 156, .42); }
/* Закреплённое сообщение подсвечиваем рамкой — его всегда видно сверху. */
.file-item.pinned,
.text-item.pinned { border-color: rgba(26, 188, 156, .45); }

/* Счётчики карточки: «глаз» — сколько устройств открыло сообщение, стрелка
   вниз — сколько раз скачали; рядом закрепка и реакции. Живут в строке
   заметки (file-meta / text-meta): отдельная строка растянула бы карточки. */
.msg-stats {
  margin-left: auto;
  padding-left: 8px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}
.msg-stat {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.msg-stat svg { width: 12px; height: 12px; opacity: .8; }
.msg-stat-n { font-variant-numeric: tabular-nums; }
/* Внутри строки счётчиков значки идут без «пилюли» — иначе строка разрастается. */
.msg-stats .msg-flag {
  padding: 0;
  background: none;
  font-size: 11px;
}
.msg-stats .msg-flag.reaction.mine { background: none; color: var(--accent-soft); }

/* Режим «Переместить»: у каждой карточки справа — «три полоски»; держим за них
   и двигаем карточку. Тап вне полосок выходит из режима. */
.msg-drag {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: none;      /* без чёрного квадратика */
  cursor: grab;
  touch-action: none;
  z-index: 3;
  -webkit-tap-highlight-color: transparent;
}
.msg-drag svg { width: 24px; height: 24px; }
.msg-drag:active { cursor: grabbing; color: var(--accent-soft); }
/* Штатная иконка карточки уступает место полоскам, чтобы не перекрывались. */
body.reorder-mode .file-item,
body.reorder-mode .text-item {
  padding-right: 48px;
  animation: none;                 /* без анимации появления — меньше нагрузки */
  transition: transform .14s ease; /* плавный «зазор» для соседей */
}
body.reorder-mode .file-item::before,
body.reorder-mode .text-item::before { display: none; }
.file-item.dragging,
.text-item.dragging {
  opacity: .92;
  border-color: var(--accent);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
  transition: none;                /* едет строго за пальцем, без инерции */
  will-change: transform;
  z-index: 5;
}
html.light .msg-drag { color: #6b7a86; }

/* Сообщение-ссылка: клик открывает сайт, а не копирует. */
.text-item.is-link .text-content { color: var(--accent-soft); }
.text-item.is-link:hover .text-content { text-decoration: underline; }
.text-item.is-link:not(.sending):not(.error)::before {
  background: var(--accent-soft);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 4h6v6'/%3E%3Cpath d='M20 4 10 14'/%3E%3Cpath d='M19 14v4a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 4h6v6'/%3E%3Cpath d='M20 4 10 14'/%3E%3Cpath d='M19 14v4a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4'/%3E%3C/svg%3E") center / contain no-repeat;
}

.msg-menu {
  position: fixed;
  z-index: 1200;
  min-width: 214px;
  padding: 6px;
  border-radius: 16px;
  /* То же матовое стекло, что и у меню заголовка (.title-menu). */
  border: 1px solid var(--border);
  background: rgba(23, 26, 25, .97);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .04),
    0 24px 70px rgba(0, 0, 0, .65);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  animation: msg-menu-in .12s ease-out;
}
.msg-menu.hidden { display: none; }
#msg-menu {
  animation-name: message-menu-fade;
  max-height: var(--menu-available-height, calc(100dvh - 16px));
  overflow-y: auto;
  overscroll-behavior: contain;
}
@keyframes message-menu-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
/* Меню комнаты длиннее меню сообщения (девять пунктов): на низких экранах
   разрешаем прокрутку вместо вылезания за край. */
.room-menu { max-height: min(78vh, 540px); overflow-y: auto; }
@keyframes msg-menu-in {
  from { opacity: 0; transform: scale(.96); }
  to { opacity: 1; transform: none; }
}
.msg-menu-reactions { display: flex; gap: 4px; padding: 3px; border-radius: 999px; background: #8882; }
#msg-menu .msg-react { border-radius: 999px; background: transparent; }
#msg-menu .msg-react[aria-pressed='true'] { background: #1abc9c40; }
.msg-menu-reactions.hidden { display: none; }
/* Реакции не должны «подсвечиваться» при длинном нажатии: гасим системный
   tap-highlight и выделение текста; ховер включаем только на устройствах с
   настоящим курсором (на тач-экране он «залипает» после долгого тапа). */
.msg-menu,
.msg-react,
.msg-menu-item {
  -webkit-tap-highlight-color: transparent;
}
.msg-react,
.msg-menu-item {
  -webkit-user-select: none;
  user-select: none;
}
.msg-react {
  flex: 1 1 0;
  border: 0;
  background: rgba(255, 255, 255, .05);
  border-radius: 10px;
  padding: 8px 0;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.msg-menu-sep { height: 1px; margin: 6px 4px; background: rgba(255, 255, 255, .08); }
.msg-menu-sep.hidden { display: none; }
.msg-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: none;
  color: #d0d8e4;
  font: inherit;
  font-size: 14px;
  text-align: left;
  padding: 9px 10px;
  border-radius: 9px;
  cursor: pointer;
}
@media (hover: hover) {
  .msg-menu-item:hover { background: rgba(255, 255, 255, .08); }
  .msg-react:hover { background: rgba(255, 255, 255, .12); }
}
.msg-menu-item.hidden { display: none; }
.msg-menu-item[data-act="delete"] { color: #f87171; }
.msg-menu-ico {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  display: inline-flex;
  color: var(--muted);
}
.msg-menu-ico svg { width: 18px; height: 18px; }
.msg-menu-item[data-act="delete"] .msg-menu-ico { color: #f87171; }
.msg-menu-label { flex: 1 1 auto; }

/* Окно «Информация о сообщении». */
.msg-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 4px 0 18px;
}
.msg-info-row { display: flex; gap: 12px; align-items: baseline; }
.msg-info-key { flex: 0 0 108px; color: var(--muted); font-size: 13px; }
.msg-info-value { flex: 1 1 auto; font-size: 14px; color: #d0d8e4; word-break: break-word; }

/* Светлая тема. */
html.light .msg-menu {
  background: #ffffff;
  border-color: rgba(15, 40, 32, .1);
  box-shadow: 0 18px 48px rgba(15, 40, 32, .18);
}
html.light .msg-menu-item { color: #1d2b33; }
html.light .msg-menu-item:hover { background: rgba(15, 40, 32, .06); }
html.light .msg-react { background: rgba(15, 40, 32, .05); }
html.light .msg-react:hover { background: rgba(15, 40, 32, .1); }
html.light .msg-menu-ico { color: #6b7a86; }
html.light .msg-info-value { color: #1d2b33; }
html.light .msg-info-key { color: #6b7a86; }
html.light .msg-flag { background: rgba(15, 40, 32, .12); color: #1d2b33; }
html.light .msg-flag.reaction.mine { background: rgba(11, 157, 107, .22); }
html.light .text-item.is-link .text-content { color: #0b7c56; }
html.light .file-item.pinned,
html.light .text-item.pinned { border-color: rgba(11, 157, 107, .5); }

/* ── «Мои комнаты»: панель слева от карточки ─────────────────────────────── */
/* Панель вынесена влево от карточки: absolute относительно .card (position:
   relative). На узких экранах (см. медиа-запрос ниже) возвращается в поток. */
.my-rooms {
  position: absolute;
  right: calc(100% + 16px);
  top: 0;
  width: 320px;
  margin-top: 0;
  text-align: left;
  z-index: 3;
  perspective: 1300px;
}
/* Заголовок и лента — один блок под лёгким 3D-наклоном; при наведении плавно
   выпрямляется целиком. Наклон мягкий (11°), без свечения и mask-image — так
   нет артефактов и карточки не выглядят «уже». */
.my-rooms-tilt {
  transform: rotateY(11deg);
  /* Опора — правый край (у самой карточки): при наведении панель
     распрямляется, и опускается именно ЛЕВЫЙ край, а не поднимается правый. */
  transform-origin: right center;
  transition: transform .5s cubic-bezier(.22, 1, .36, 1);
}
.my-rooms:hover .my-rooms-tilt { transform: rotateY(0deg); }
.my-rooms-title {
  margin: 0 0 8px;
}
/* Заголовок панели комнат. */
.my-rooms-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 8px;
  padding: 0 4px;
}
.my-rooms-head .my-rooms-title { margin: 0; }
/* Крестик панели комнат — только в мобильной выезжающей шторке. */
.my-rooms-scroll { position: relative; }
.my-rooms-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 70vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 4px;
  scrollbar-width: none;
}
.my-rooms-list::-webkit-scrollbar { width: 0; height: 0; }
.my-rooms-list > .room-pinned + .my-room:not(.room-pinned) {
  position: relative;
  margin-top: 24px;
}
.my-rooms-list > .room-pinned + .my-room:not(.room-pinned)::before {
  content: '';
  position: absolute;
  top: -16px;
  left: 24px;
  right: 24px;
  height: 1px;
  background: var(--border);
}

/* Карточка комнаты: то же «матовое стекло», что у кнопки увеличения QR —
   полупрозрачный тёмный фон и мягкое размытие, без рамок и свечения. */
.my-room,
.my-room-new {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  box-sizing: border-box;
  padding: 12px 14px;
  /* То же матовое стекло, что и у меню заголовка (.title-menu). */
  border: 1px solid var(--border);
  border-radius: 13px;
  color: #ffffff;
  background: rgba(23, 26, 25, .97);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .04),
    0 10px 26px rgba(0, 0, 0, .45);
  -webkit-backdrop-filter: blur(22px);
  backdrop-filter: blur(22px);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .18s ease, box-shadow .18s ease;
}
.my-room:hover,
.my-room:focus-visible,
.my-room-new:hover,
.my-room-new:focus-visible { background: rgba(38, 43, 41, .98); }
.my-room:focus-visible,
.my-room-new:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.my-room.missing { opacity: .5; }
.my-room-main,
.my-room-new-main { flex: 1 1 auto; min-width: 0; }
.my-room-code,
.my-room-new-title { display: block; font-weight: 600; font-size: 14px; }
.my-room-new-sub {
  display: block;
  font-size: 12px;
  color: rgba(255, 255, 255, .62);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Код комнаты — тем же моноширинным шрифтом, что и на экране QR. */
.my-room-code--mono,
.my-room-code-sub,
.my-room-new-sub.is-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
/* Пятибуквенный код комнаты под названием. */
.my-room-code-sub,
.my-room-new-sub.is-code {
  display: block;
  font-size: 11px;
  letter-spacing: .14em;
  color: rgba(255, 255, 255, .5);
}
.my-room-time { display: block; font-size: 11px; }
/* Стрелки ручного порядка комнат (режим «Переместить»). */
.my-room-move {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 6px;
  background: none;
  color: rgba(255, 255, 255, .7);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}
.my-room-move:hover { background: rgba(255, 255, 255, .14); }
html.light .my-room-code-sub,
html.light .my-room-new-sub.is-code { color: rgba(29, 43, 51, .5); }
html.light .my-room-move { color: rgba(29, 43, 51, .7); }
.my-room-meta { flex: 0 0 auto; text-align: right; font-size: 11px; color: rgba(255, 255, 255, .6); }
.my-room-badge {
  display: inline-block;
  min-width: 18px;
  padding: 1px 6px;
  border-radius: 9px;
  background: var(--accent);
  color: #04120c;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}
/* Текущая комната — зелёное матовое стекло; остальные — чёрное. */
.my-room.active,
.my-room-new.active { background: rgba(16, 122, 88, .62); }
.my-room-go {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 600;
  color: #c6f7e2;
  white-space: nowrap;
}

html.light .my-room,
html.light .my-room-new {
  background: #ffffff;
  border-color: rgba(15, 40, 32, .1);
  box-shadow: 0 10px 26px rgba(15, 40, 32, .14);
  color: #1d2b33;
}
html.light .my-room:hover,
html.light .my-room:focus-visible,
html.light .my-room-new:hover,
html.light .my-room-new:focus-visible {
  background: #ffffff;
  box-shadow: 0 14px 32px rgba(15, 40, 32, .2);
}
html.light .my-room.active,
html.light .my-room-new.active { background: rgba(11, 157, 107, .38); }
html.light .my-room-new-sub,
html.light .my-room-meta { color: rgba(29, 43, 51, .62); }
html.light .my-room-go { color: #0b7c56; }
html.light .my-room-badge { color: #ffffff; }

/* На узких экранах панель слева не помещается: возвращаем её в поток карточки. */
@media (width < 1404px) {
  .my-rooms {
    position: static;
    width: 100%;
    margin-top: 16px;
    perspective: 1100px;
  }
  .my-rooms-tilt { transform: rotateY(8deg); }
  .my-rooms-list { max-height: 320px; }
}

/* На телефоне «Мои комнаты» — полноэкранный список: 3D-наклон убираем
   (на тач-экране нет наведения, и панель оставалась наклонённой), а ленту
   растягиваем до низа экрана. */
@media (width < 1404px) {
  .my-rooms {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin-top: 0;
    perspective: none;
  }
  .my-rooms-tilt {
    transform: none;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  .my-rooms-scroll {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  .my-rooms-list {
    max-height: none;
    flex: 1 1 auto;
    min-height: 0;
  }

  /* В режиме комнаты «Мои комнаты» — выезжающая слева панель поверх контента
     (зеркало панели настроек справа). Доступна и на вкладке QR, и в чате;
     открывается кнопкой слева от заголовка (body.rooms-open). Фон — плотный,
     без просвета контента и без тени. */
  body.mobile-rooms #my-rooms:not(.hidden) {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(340px, calc(100vw - 40px));
    z-index: 70;
    margin: 0;
    padding: 0;
    display: flex !important;
    flex-direction: column;
    background: #171a19;
    border-right: 1px solid var(--border);
    box-shadow: none;
    transform: translateX(-103%);
    will-change: transform;
    /* Анимацию включаем отдельным классом (rooms-drawer, ставит app.js после
       первого кадра): иначе при входе панель «уезжала» бы за экран
       с анимацией прямо из потока. */
    transition: none;
    perspective: none;
    /* Вертикальную прокрутку ленты комнат отдаём браузеру, горизонтальный
       свайп (закрытие шторки) обрабатывает app.js. */
    touch-action: pan-y;
  }
  body.mobile-rooms.rooms-drawer #my-rooms {
    transition: transform .4s cubic-bezier(.22, 1, .36, 1);
  }
  body.mobile-rooms.rooms-open #my-rooms { transform: translateX(0); }
  body.mobile-rooms .my-rooms-tilt {
    padding: max(16px, env(safe-area-inset-top)) 12px calc(16px + env(safe-area-inset-bottom));
  }
  /* Крестик «закрыть» виден только в мобильной шторке. */
  html.light body.mobile-rooms #my-rooms { background: #fafcfb; }
  /* Карточки комнат: без размытия — фон панели и так почти непрозрачный, а
     blur на каждой карточке грузит GPU (лаги в Яндекс.Браузере при
     энергосбережении). */
  .my-room,
  .my-room-new {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* Круглая кнопка «показать QR-код» убрана: на мобильном список комнат —
   единственное меню (выезжающая панель), а QR виден сразу. */

/* ================================================================
   ТЕЛЕФОН: долгое нажатие не выделяет текст
   ================================================================ */
/* На тач-устройствах системное выделение при зажатии мешает: карточка чата
   по долгому нажатию открывает меню, а не подсвечивается текстом. Поля ввода
   оставляем выделяемыми — иначе нельзя было бы поправить набранное. */
@media (hover: none) and (pointer: coarse) {
  .app-shell,
  .card,
  .file-list,
  .file-item,
  .text-item,
  .title-menu,
  .msg-menu,
  .modal,
  .site-footer,
  .mode-carousel {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }
  input,
  textarea,
  [contenteditable] {
    -webkit-touch-callout: default;
    -webkit-user-select: text;
    user-select: text;
  }
}

/* ================================================================
   НОВЫЕ ЭЛЕМЕНТЫ: панель настроек, карусель типов, ответ,
   выбор сообщений, поиск, лайтбокс, расширение средней колонки
   ================================================================ */

/* ── Панель настроек справа: ЗЕРКАЛО «Моих комнат» — вынесена вправо от
   карточки (как чаты слева) и с той же анимацией 3D-наклона, только
   отражённой. Внутри — прежнее меню заголовка (#title-menu). ── */
.settings-panel {
  position: absolute;
  left: calc(100% + 16px);
  top: 0;
  width: 320px;
  z-index: 3;
  perspective: 1300px;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  transition: opacity .28s ease, visibility 0s linear .28s;
}
.settings-panel.open {
  opacity: 1;
  visibility: visible;
  transition: opacity .28s ease, visibility 0s;
}
/* Зеркало «Моих комнат»: заголовок и «плашка» настроек — один наклонённый
   блок. Опора — ЛЕВЫЙ край (у карточки): распрямляется внешний край, как у
   левой панели, только отражённо. */
.settings-panel-tilt {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  transform: none;
  transform-origin: left center;
  transition: transform .5s cubic-bezier(.22, 1, .36, 1);
}
.settings-panel:hover .settings-panel-tilt { transform: rotateY(0deg); }
/* Заголовок «Настройки» летает отдельно от «плашек» — как «Мои комнаты». */
.settings-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 8px;
  padding: 0 4px;
}
.settings-title {
  margin: 0;
}
.my-rooms-title, .settings-title {
  color: var(--text, #fff);
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -.035em;
}
html.light :is(.my-rooms-title, .settings-title) { color: #1d2b33; }
/* «Плашка» настроек: то же матовое стекло, что у карточек комнат слева. */
.settings-panel-inner {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(23, 26, 25, .97);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .04), 0 24px 70px rgba(0, 0, 0, .6);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  overflow-y: auto;
  scrollbar-width: none;
}
.settings-panel-inner::-webkit-scrollbar { width: 0; height: 0; }
.settings-panel .title-menu,
html.light .settings-panel .title-menu {
  position: static;
  transform: none !important;
  opacity: 1 !important;
  visibility: visible !important;
  width: 100%;
  max-width: none;
  min-width: 0;
  max-height: none;
  /* Не делаем отдельный скролл-контейнер: базовый .title-menu имеет
     overflow-y: auto и overscroll-behavior: contain, из-за чего колесо
     «залипало» на меню и «плашка» настроек не листалась. */
  overflow: visible;
  overscroll-behavior: auto;
  flex: 0 0 auto;
  min-height: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
html.light .settings-panel-inner { background: rgba(250, 252, 251, .98); }
html.light .settings-panel .title-menu-item,
html.light .settings-panel .menu-row,
html.light .settings-panel .radio-option { color: #1d2b33; }
/* На узких экранах зеркальная колонка не помещается — возвращаем выезжающую
   справа панель поверх контента. */
@media (width < 1404px) {
  .settings-panel {
    position: fixed;
    left: auto;
    right: 0;
    top: 0;
    width: min(360px, calc(100vw - 24px));
    height: 100dvh;
    max-height: none;
    z-index: 60;
    perspective: none;
    box-shadow: none;
    transform: translateX(103%);
    transition: transform .4s cubic-bezier(.22, 1, .36, 1), visibility 0s linear .4s;
    /* Вертикальная прокрутка — браузеру, горизонтальный свайп (закрытие) — app.js. */
    touch-action: pan-y;
  }
  .settings-panel.open { transform: translateX(0); transition: transform .4s cubic-bezier(.22, 1, .36, 1), visibility 0s; }
  /* На мобильном «плашка» — вся панель: заголовок и контент на одном фоне,
     наклон и отдельный заголовок здесь не нужны. Фон плотный, без тени. */
  .settings-panel-tilt {
    height: 100%;
    max-height: none;
    transform: none;
    background: #171a19;
    border-left: 1px solid var(--border);
    box-shadow: none;
  }
  html.light .settings-panel-tilt { background: #fafcfb; }
  .settings-head { padding: 12px 12px 4px; margin: 0; }
  .settings-panel-inner,
  html.light .settings-panel-inner {
    flex: 1 1 auto;
    min-height: 0;
    background: none;
    box-shadow: none;
    border: none;
    border-radius: 0;
    padding: 8px 12px calc(16px + env(safe-area-inset-bottom));
    /* Фон панели и так почти непрозрачный (см. .settings-panel-tilt), поэтому
       размытие здесь ничего не даёт, но на мобильном (особенно в Яндекс.Браузере
       с включённым энергосбережением) сильно грузит GPU и вызывает лаги. */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* ── Карусель типов файлов: открывается нажатием на «Передача файлов». ── */
.file-type-carousel {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  z-index: 36;
  display: flex;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(23, 26, 25, .97);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .6);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  transform: translateX(-50%) translateY(-8px) scale(.94);
  transform-origin: top center;
  opacity: 0;
  visibility: hidden;
  transition: transform .3s cubic-bezier(.22, 1, .36, 1), opacity .16s ease, visibility 0s linear .3s;
}
.file-type-carousel.open {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0) scale(1);
  transition: transform .38s cubic-bezier(.3, 1.3, .44, 1), opacity .16s ease, visibility 0s;
}
.ftc-chip {
  padding: 8px 16px;
  border: none;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background .18s ease, color .18s ease;
}
.ftc-chip:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.ftc-chip.active { color: #04120c; background: var(--accent-soft, #34d399); }
html.light .file-type-carousel { background: rgba(255, 255, 255, .98); }
html.light .ftc-chip { color: #6b7a86; }
html.light .ftc-chip:hover { color: #0b7c56; background: rgba(11, 157, 107, .08); }
html.light .ftc-chip.active { color: #ffffff; background: #0b9d6b; }

/* ── Полоса ответа над полем ввода и цитата внутри пузыря. ── */
.reply-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(52, 211, 153, .08);
  border: 1px solid rgba(52, 211, 153, .22);
  text-align: left;
}
.reply-bar-accent {
  flex: 0 0 auto;
  width: 3px;
  align-self: stretch;
  border-radius: 3px;
  background: var(--accent-soft, #34d399);
}
.reply-bar-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.reply-bar-author { font-size: 12px; font-weight: 700; color: var(--accent-soft, #34d399); }
.reply-bar-text { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-bar-cancel {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.reply-bar-cancel:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.reply-bar-cancel svg { width: 16px; height: 16px; }
.msg-quote {
  position: relative;
  overflow: hidden;
  display: block;
  margin: 0 0 6px;
  padding: 6px 10px;
  border-left: 3px solid var(--accent-soft, #34d399);
  border-radius: 6px;
  background: rgba(255, 255, 255, .05);
  font-size: 12.5px;
  line-height: 1.3;
  text-align: left;
  max-width: 100%;
}
.msg-quote-link { cursor: pointer; transition: transform 180ms ease, background-color 180ms ease; animation: quote-breathe 5s ease-in-out infinite; }
.msg-quote-link:hover, .msg-quote-link:focus-visible { background-color: rgba(255, 255, 255, .09); }
.msg-quote-link:active { transform: scale(.975); }
.quote-wave { position: absolute; pointer-events: none; border-radius: 50%; background: rgba(255, 255, 255, .13); animation: quote-wave 650ms ease-out forwards; }
.msg-quote.quote-missing { animation: quote-missing 700ms ease-out; }
@keyframes quote-breathe { 50% { background-color: rgba(255, 255, 255, .075); } }
@keyframes quote-wave { from { transform: scale(0); opacity: 1; } to { transform: scale(1); opacity: 0; } }
@keyframes quote-missing { 15%, 40% { background-color: rgba(239, 68, 68, .22); border-left-color: #ef7373; } }
@media (prefers-reduced-motion: reduce) {
  .msg-quote-link { animation: none; transition: none; }
  .msg-quote-link:active { transform: none; }
  .quote-wave { animation-duration: 1ms; }
}
.msg-quote-author { display: block; font-weight: 700; color: var(--accent-soft, #34d399); }
.msg-quote-text { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.light .reply-bar { background: rgba(11, 157, 107, .06); border-color: rgba(11, 157, 107, .22); }
html.light .msg-quote { background: rgba(15, 40, 32, .05); color: #1d2b33; }

/* ── Выбор сообщений: множественное выделение и панель действий. ── */
body.select-mode .file-item,
body.select-mode .text-item { cursor: pointer; }
/* В режиме выбора штатная иконка карточки не нужна. */
body.select-mode .file-item::before,
body.select-mode .text-item::before {
  content: none;
  display: none;
}
/* Выделение включает свечение .msg-glow (см. выше). */
body.select-mode .file-item.selected .msg-glow,
body.select-mode .text-item.selected .msg-glow {
  opacity: 1;
}
/* Кружок-галочка — со стороны центра чата. */
body.select-mode .file-item::after,
body.select-mode .text-item::after {
  content: '';
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, .4);
  border-radius: 50%;
  background: rgba(0, 0, 0, .3);
  z-index: 2;
}
body.select-mode :is(.file-item, .text-item, .attachment-message).mine::after { right: calc(100% + 6px); }
body.select-mode :is(.file-item, .text-item, .attachment-message).theirs::after { left: calc(100% + 6px); }
/* В режиме выбора панель ввода уступает место панели действий — та же
   геометрия и «тонированное стекло», что у поля ввода. */
body.select-mode .text-compose { display: none !important; }
.select-toolbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  overflow-x: auto;
  scrollbar-width: none;
  gap: 8px;
  padding: 10px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: transparent;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity .18s ease, transform .28s cubic-bezier(.22, 1, .36, 1), visibility 0s linear .28s;
}
.select-toolbar::-webkit-scrollbar { display: none; }
.select-toolbar.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity .18s ease, transform .3s cubic-bezier(.3, 1.3, .44, 1), visibility 0s;
}
.select-toolbar .st-count {
  position: absolute;
  left: 12px;
  flex: 0 0 92px;
  width: 92px;
  padding: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
/* Кнопки — значки в «тонированном стекле», как поле ввода и кнопка отправки. */
.select-toolbar button {
  flex: 0 0 42px;
  width: 42px;
  display: grid;
  place-items: center;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 13px;
  background: rgba(255, 255, 255, .08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .2s ease, border-color .2s ease, transform .15s ease;
}
.select-toolbar button:hover { background: rgba(255, 255, 255, .14); }
.select-toolbar button:active { transform: scale(.96); }
.select-toolbar button svg { width: 20px; height: 20px; }
.select-toolbar button[hidden] { display: none !important; }
.select-toolbar button[data-act="delete"] { color: #f87171; border-color: rgba(248, 113, 113, .3); }
@media (max-width: 480px) {
  .select-toolbar { gap: 6px; padding-inline: 8px; }
  .select-toolbar .st-count { left: 8px; flex-basis: 84px; width: 84px; font-size: 12px; }
}
html.light .select-toolbar button { color: #fff; background: rgba(15, 40, 32, .05); border-color: rgba(15, 40, 32, .12); }
html.light .select-toolbar button:hover { background: rgba(15, 40, 32, .1); }
html.light .select-toolbar button[data-act="delete"] { color: #c2373c; }

/* ── Поиск по чату. ── */
.chat-search-bar {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  z-index: 34;
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(440px, calc(100% - 24px));
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(23, 26, 25, .97);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .55);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .18s ease, transform .28s cubic-bezier(.22, 1, .36, 1), visibility 0s linear .28s;
}
.chat-search-bar.open {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  transition: opacity .18s ease, transform .3s cubic-bezier(.3, 1.3, .44, 1), visibility 0s;
}
.chat-search-bar > svg { width: 18px; height: 18px; color: var(--muted); flex: 0 0 auto; }
.chat-search-input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  background: none;
  color: #f4f7fb;
  font: inherit;
  font-size: 14px;
  outline: none;
}
.chat-search-input::placeholder { color: var(--muted); }
.chat-search-count { flex: 0 0 auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.chat-search-nav,
.chat-search-close {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.chat-search-nav:hover,
.chat-search-close:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.chat-search-nav svg,
.chat-search-close svg { width: 16px; height: 16px; }
.file-item.search-hit,
.text-item.search-hit { outline: 2px solid rgba(52, 211, 153, .55); outline-offset: 2px; }
.file-item.search-hit.search-current,
.text-item.search-hit.search-current { outline-color: var(--accent-soft); }
html.light .chat-search-bar { background: rgba(255, 255, 255, .98); }
html.light .chat-search-input { color: #14212a; }

/* ── Лайтбокс: просмотр изображений. ── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, .9);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.lightbox-img {
  max-width: min(100vw, 1400px);
  max-height: 100dvh;
  border-radius: 0;
  box-shadow: none;
  object-fit: contain;
}
.lightbox.image-mode { overflow:hidden; padding:0; touch-action:none; cursor:zoom-in; background:#000; backdrop-filter:none; -webkit-backdrop-filter:none; }
.lightbox.image-mode .lightbox-img { touch-action:none; user-select:none; -webkit-user-select:none; -webkit-user-drag:none; cursor:zoom-in; }
.lightbox.image-mode.zoomed { cursor:grab; }
.lightbox.image-mode.zoomed .lightbox-img { cursor:grab; }
.lightbox.image-mode.zoomed.dragging { cursor:grabbing; }
.lightbox.image-mode.zoomed.dragging .lightbox-img { cursor:grabbing; }

#lightbox-video-wrap {
  --video-ratio: 1.777778;
  width: min(96vw, 1100px, calc(82dvh * var(--video-ratio)));
  aspect-ratio: var(--video-ratio);
  max-height: 82dvh;
}
#lightbox-video-wrap .video-js {
  width: 100%;
  height: 100%;
  border-radius: 16px;
  overflow: hidden;
  font-family: inherit;
  background: #101713;
  --vjs-icon-color: white;
}
#lightbox-video-wrap .vjs-tech { object-fit: contain; }
#lightbox-video-wrap .vjs-control-bar {
  height: 44px;
  background: linear-gradient(transparent, rgba(9, 20, 16, .94));
  padding: 4px 8px;
}
#lightbox-video-wrap .vjs-play-progress,
#lightbox-video-wrap .vjs-volume-level { background: #65e0b4; }
#lightbox-video-wrap .vjs-big-play-button {
  width: 68px;
  height: 68px;
  line-height: 68px;
  border: 0;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(12, 39, 30, .8);
}
#lightbox-video-wrap .vjs-time-control { line-height: 36px; }
#lightbox-video-wrap .vjs-current-time,
#lightbox-video-wrap .vjs-duration { display: block; }
@media (max-width: 540px) {
  #lightbox-video-wrap .vjs-volume-panel,
  #lightbox-video-wrap .vjs-duration,
  #lightbox-video-wrap .vjs-time-divider { display: none; }
  #lightbox-video-wrap .vjs-progress-control { min-width: 40px; }
  #lightbox-video-wrap .vjs-control-bar { padding: 4px; }
}
.lightbox-status {
  position: absolute;
  bottom: 15%;
  max-width: 85%;
  padding: 12px 18px;
  border-radius: 16px;
  background: rgba(12, 30, 24, .9);
  color: white;
  text-align: center;
  z-index: 2;
}

/* Фото и видео занимают пузырь целиком; документы остаются компактной строкой. */
body.messenger-mode .file-item.media-message {
  width: min(var(--media-width, 320px), 85%);
  padding: 0;
  gap: 0;
  flex-direction: column;
}
body.messenger-mode .file-item.media-message.mine.group-first { border-top-right-radius: 0; }
body.messenger-mode .file-item.media-message.theirs.group-first { border-top-left-radius: 0; }
body.messenger-mode .media-message.group-first .msg-tail { display: block; }
body.messenger-mode .media-message::before { display: none !important; }
body.messenger-mode .media-message .file-thumb:not(.has-poster) {
  aspect-ratio: 16 / 9;
  background: rgba(0, 0, 0, .12);
}
body.messenger-mode .media-message .file-thumb img:not([src]) { display: none; }
body.messenger-mode .media-message .file-thumb.has-blur-preview::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: -14px;
  background-image: var(--blur-preview);
  background-size: cover;
  background-position: center;
  filter: blur(14px);
  opacity: .82;
  transform: scale(1.08);
  pointer-events: none;
}
body.messenger-mode .media-message .file-thumb {
  position: relative;
  width: 100%;
  height: auto;
  min-height: 0;
  border-radius: inherit;
  overflow: hidden;
  cursor: pointer;
}
body.messenger-mode .media-message .file-thumb img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  border-radius: inherit;
}
body.messenger-mode .media-message .file-body {
  position: absolute;
  z-index: 1;
  bottom: 4px;
  right: 4px;
  width: calc(100% - 8px);
  max-width: calc(100% - 8px);
  padding: 0;
}
body.messenger-mode .media-message .file-meta {
  justify-content: flex-end;
  gap: 4px;
  overflow: visible;
  color: white;
}
body.messenger-mode .media-message .msg-time,
body.messenger-mode .media-message .msg-stats {
  padding: 3px 5px;
  border-radius: 8px;
  background: rgba(0, 0, 0, .45);
  color: white;
}
body.messenger-mode .media-message .msg-stats,
body.messenger-mode .media-message .msg-time { margin-left: 0; }
body.messenger-mode .media-message.sending .file-note,
body.messenger-mode .media-message.receiving .file-note,
body.messenger-mode .media-message.error .file-note {
  display: block;
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  max-width: 100%;
  padding: 5px 8px;
  border-radius: 10px;
  background: rgba(0, 0, 0, .7);
  color: white;
  white-space: normal;
}
body.messenger-mode .media-message.error .file-note { color: #fca5a5; }
body.messenger-mode .file-item.sending .file-note,
body.messenger-mode .file-item.receiving .file-note {
  display: block;
  white-space: pre-line;
  line-height: 1.45;
  font-size: 11px;
}
body.messenger-mode .file-item.sending:not(.media-message) .file-meta,
body.messenger-mode .file-item.receiving:not(.media-message) .file-meta {
  flex-wrap: wrap;
  overflow: visible;
  gap: 4px 8px;
}
body.messenger-mode .file-item.sending:not(.media-message) .file-note,
body.messenger-mode .file-item.receiving:not(.media-message) .file-note {
  flex: 1 0 100%;
  order: 2;
}
body.messenger-mode .file-item.error:not(.media-message) .file-note { white-space: normal; }
body.messenger-mode .file-item.error:not(.media-message) .file-meta {
  flex-wrap: wrap;
  overflow: visible;
  white-space: normal;
}
body.messenger-mode .file-item.error:not(.media-message) .file-note {
  flex: 1 0 100%;
  order: 2;
}
body.messenger-mode .file-item.error { background: var(--bubble-bg); }
body.messenger-mode .file-item.error .file-name { color: inherit; }
.msg-time { display: none; }
body.messenger-mode .msg-time {
  display: inline-block;
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
body.messenger-mode .media-message .file-name,
body.messenger-mode .media-message .file-size { display: none; }
.media-video { position: relative; cursor: pointer; }
.media-play {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .55);
  color: white;
  pointer-events: none;
}
body.messenger-mode .file-item:not(.media-message) { cursor: pointer; flex-wrap: nowrap; }
body.messenger-mode .file-item:not(.media-message) .file-thumb {
  position: relative;
  border-radius: 8px;
  background: rgba(52, 211, 153, .16);
}
/* Файлы скачиваются только кнопкой в карточке или просмотрщике, без второй
   стрелки, появляющейся поверх значка формата при наведении. */
body.messenger-mode .file-item.downloadable:not(.media-message) .file-thumb::after { display: none; }
.lightbox-btn {
  position: absolute;
  z-index: 3;
  top: max(16px, env(safe-area-inset-top));
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 50%;
  background: rgba(20, 24, 23, .8);
  color: #fff;
  cursor: pointer;
  transition: background .18s ease, transform .15s ease, opacity .2s ease;
}
.lightbox-btn:hover { background: rgba(52, 211, 153, .3); }
.lightbox-btn:active { transform: scale(.94); }
.lightbox-btn svg { width: 22px; height: 22px; }
.lightbox-close { right: max(16px, env(safe-area-inset-right)); }
.lightbox-download { right: calc(max(16px, env(safe-area-inset-right)) + 56px); }

/* Fullscreen chat media: one gesture surface, with controls above it. */
.lightbox.media-feed { --feed-actions-right: max(12px, env(safe-area-inset-right)); --feed-caption-bottom: max(100px, calc(env(safe-area-inset-bottom) + 88px)); --feed-bottom: max(20px, env(safe-area-inset-bottom)); padding: 0; overflow: hidden; background: #030706; touch-action: pan-y; overscroll-behavior: none; backdrop-filter: none; -webkit-backdrop-filter: none; color: #fff; isolation: isolate; outline: none; animation: feed-open .28s cubic-bezier(.2,.75,.2,1) both; }
.media-feed::before, .media-feed::after { content: ''; position: absolute; left: 0; right: 0; pointer-events: none; z-index: 1; transition: opacity .25s; }
.media-feed::before { top: 0; height: 170px; background: linear-gradient(#0009, transparent); }
.media-feed::after { bottom: 0; height: 240px; background: linear-gradient(transparent, #000b); }
.feed-swiper { position: absolute; inset: 0; width: 100%; height: 100%; touch-action:none; }
.feed-swiper .swiper-wrapper { will-change: transform; }
.feed-page { position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; background: #000; contain: layout paint; }
.feed-content, .feed-arrival { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.feed-neighbor > video { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.feed-neighbor { pointer-events: none; }
.feed-page > img { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; }
/* Per-item UI rides inside the active slide: caption, author, position and the
   action panel are children of the same slide as the media, so they move and
   snap with it instead of staying pinned to the viewport. See renderFeedNeighbors. */
.feed-ui-layer { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.feed-ui-layer .feed-actions, .feed-ui-layer .feed-playback { pointer-events: auto; }
/* Neighbour slides show a read-only copy of the per-item panel: same layout,
   no pointer targets, so a drag previews what the next item brings. */
.feed-chrome-preview { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.feed-preview-actions { position: absolute; right: var(--feed-actions-right); bottom: max(100px, calc(env(safe-area-inset-bottom) + 84px)); display: flex; flex-direction: column; align-items: center; gap: 14px; }
.feed-preview-action { display: flex; align-items: center; justify-content: center; width: 52px; min-height: 52px; color: #fff; filter: drop-shadow(0 2px 4px #0007); }
.feed-preview-action svg { width: 30px; height: 30px; flex-shrink: 0; }
.feed-preview-caption { position: absolute; left: max(24px, env(safe-area-inset-left)); right: 96px; bottom: var(--feed-caption-bottom); display: flex; flex-direction: column; gap: 7px; text-shadow: 0 1px 10px #0009; }
.feed-preview-caption strong { font-size: 16px; font-weight: 600; }
.feed-preview-caption span { font-size: 12px; line-height: 1.45; color: #e2ebe6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* While zoomed keep one promoted plane and a single clip: nested paint
   containment around a scaled photo produced black raster chunks on phones. */
.media-feed.zoomed .feed-page { contain: layout style; }
.media-feed.zoomed .feed-content { overflow: visible; }
.feed-arrival { z-index: 1; pointer-events: none; }
.media-feed .lightbox-img { display: block; max-width: 100%; max-height: 100%; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; cursor: default; }
.media-feed.image-mode .lightbox-img { cursor: default; }
.media-feed.zoomed .lightbox-img, .media-feed.zoomed #lightbox-video-wrap { cursor: grab; }
.media-feed #lightbox-video-wrap { width: 100%; height: 100%; max-height: none; aspect-ratio: auto; }
.media-feed #lightbox-video-wrap > video { display: block; width: 100%; height: 100%; object-fit: contain; background: transparent; pointer-events: none; }
.feed-ui, .media-feed .lightbox-close { z-index: 3; transition: opacity .23s, transform .28s, visibility .23s; }
.feed-heading { position: absolute; top: max(24px, env(safe-area-inset-top)); left: max(24px, env(safe-area-inset-left)); right: 88px; display: flex; align-items: center; gap: 20px; text-align: left; pointer-events: none; }
#feed-position { font-size: 12px; color: #fff; text-shadow: 0 2px 8px #000b; }
.media-feed .lightbox-btn { position: static; width: 52px; height: auto; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 6px 0; background: transparent; border: 0; border-radius: 0; color: #fff; backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none; filter: drop-shadow(0 2px 4px #0007); cursor: pointer; }
.media-feed .lightbox-btn svg { width: 30px; height: 30px; flex-shrink: 0; }
.media-feed .lightbox-btn span { font: 500 9px/1.2 Inter, sans-serif; }
.media-feed .lightbox-btn:hover { background: transparent; color: #b5f6db; }
.media-feed .lightbox-btn:active { transform: scale(.92); }
.media-feed .lightbox-btn:disabled { opacity: .4; cursor: default; }
.media-feed .lightbox-btn:focus-visible, .feed-playback button:focus-visible { outline: 2px solid #6ee7b7; outline-offset: 4px; }
.media-feed .lightbox-close { position: absolute; top: max(20px, env(safe-area-inset-top)); right: var(--feed-actions-right); width: 52px; height: 44px; min-height: 44px; border-radius: 0; background: transparent; border: 0; box-shadow: none; }
.media-feed .lightbox-close svg { width: 24px; height: 24px; }
.feed-actions { position: absolute; right: var(--feed-actions-right); bottom: max(100px, calc(env(safe-area-inset-bottom) + 84px)); display: flex; flex-direction: column; align-items: center; gap: 14px; }
.media-feed #feed-play { position: absolute; top: auto; right: auto; left: 50%; bottom: calc((var(--feed-caption-bottom) - var(--feed-bottom) + 12px) / 2 - 22px); transform: translateX(-50%); min-height: 44px; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; filter: none; color: #fff; transition: color .18s, transform .18s; }
.media-feed #feed-play svg { width: 28px; height: 28px; }
.media-feed #feed-play:hover { background: transparent; color: #fff; }
.media-feed #feed-play:active { transform: translateX(-50%) scale(.92); }
.media-feed.image-mode #feed-mute { visibility: hidden; pointer-events: none; }
#feed-like[aria-pressed="true"] { color: #6ee7b7; border-color: #6ee7b766; }
#feed-like[aria-pressed="true"] svg { fill: #34d399; }
.feed-caption { position: absolute; left: max(24px, env(safe-area-inset-left)); right: 96px; bottom: var(--feed-caption-bottom); display: flex; flex-direction: column; gap: 7px; text-align: left; text-shadow: 0 1px 10px #0009; pointer-events: none; }
.feed-caption strong { font-size: 16px; font-weight: 600; }
.feed-caption > span { font-size: 12px; line-height: 1.45; color: #e2ebe6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-playback { position: absolute; bottom: var(--feed-bottom); left: max(24px, env(safe-area-inset-left)); right: max(24px, env(safe-area-inset-right)); display: flex; align-items: center; gap: 14px; padding-bottom: 24px; }
.feed-playback button { border: 0; background: transparent; color: #fff; min-width: 36px; min-height: 36px; padding: 0 6px; font: 500 12px Inter, sans-serif; cursor: pointer; }
#feed-clock { margin-left: auto; font-size: 11px; font-variant-numeric: tabular-nums; color: #d4e5db; }
#feed-seek { --progress: 0%; position: absolute; bottom: 0; left: 0; width: 100%; height: 24px; margin: 0; padding: 0; cursor: pointer; appearance: none; -webkit-appearance: none; background: transparent; touch-action: none; }
#feed-seek::-webkit-slider-runnable-track { height: 3px; border-radius: 8px; background: linear-gradient(to right, #fff var(--progress), #ffffff4d var(--progress)); transition: height .15s; }
#feed-seek::-moz-range-track { height: 3px; border-radius: 8px; background: #ffffff4d; }
#feed-seek::-moz-range-progress { background: #fff; height: 3px; }
#feed-seek::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; height: 10px; width: 10px; margin-top: -3.5px; border-radius: 50%; background: #fff; box-shadow: 0 0 10px #ffffff4d; }
#feed-seek::-moz-range-thumb { height: 10px; width: 10px; border: 0; border-radius: 50%; background: #fff; }
.feed-scrubbing #feed-seek::-webkit-slider-runnable-track, #feed-seek:hover::-webkit-slider-runnable-track { height: 6px; }
.feed-scrubbing #feed-seek::-webkit-slider-thumb, #feed-seek:hover::-webkit-slider-thumb { margin-top: -2px; }
.feed-scrub-time { position: absolute; left: 0; right: 0; bottom: max(130px, calc(env(safe-area-inset-bottom) + 110px)); z-index: 4; text-align: center; pointer-events: none; color: #fff; font-size: 32px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.04em; text-shadow: 0 2px 30px #0007; }
.feed-speed { position: absolute; top: max(100px, calc(env(safe-area-inset-top) + 80px)); left: 50%; transform: translateX(-50%); z-index: 4; padding: 10px 18px; border: 1px solid #6ee7b744; border-radius: 30px; background: #092318cc; color: #a7f3d0; font-size: 13px; pointer-events: none; animation: feed-speed-in .2s ease-out; }
.media-feed .lightbox-status { z-index: 4; bottom: max(78px, calc(env(safe-area-inset-bottom) + 72px)); max-width: calc(100% - 48px); pointer-events: none; }
.media-feed.feed-clean #feed-ui, .media-feed.feed-clean .feed-ui, .media-feed.feed-clean .lightbox-close { opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(8px); }
.media-feed.feed-clean::before, .media-feed.feed-clean::after { opacity: 0; }
.media-feed.feed-scrubbing .feed-actions, .media-feed.feed-scrubbing .feed-caption { opacity: 0; pointer-events: none; }
.media-feed.feed-closing { pointer-events: none; animation: feed-close .23s ease-in both; }
.lightbox.media-feed.feed-dismissing { background: transparent; }
.media-feed.feed-dismissing::before, .media-feed.feed-dismissing::after { opacity: 0; transition: none; }
.media-feed.feed-dismissing #feed-ui, .media-feed.feed-dismissing .feed-ui, .media-feed.feed-dismissing .lightbox-status, .media-feed.feed-dismissing .feed-speed { opacity: clamp(0, calc(1 - var(--feed-dismiss-progress, 0) * 5), 1); pointer-events: none; transition: none; }
.media-feed.feed-dismissing.feed-closing { animation: none; }
.media-feed.feed-dismissing.feed-closing #feed-ui, .media-feed.feed-dismissing.feed-closing .feed-ui, .media-feed.feed-dismissing.feed-closing .lightbox-status, .media-feed.feed-dismissing.feed-closing .feed-speed { opacity: 0; }
@keyframes feed-open { from { opacity: 0; } to { opacity: 1; } }
@keyframes feed-close { to { opacity: 0; transform: translateX(12%) scale(.94); } }
@keyframes feed-speed-in { from { opacity: 0; top: 90px; } to { opacity: 1; } }
@media (min-width: 900px) {
  .media-feed { --feed-actions-right: 36px; }
  .feed-actions { right: var(--feed-actions-right); bottom: 150px; }
  .feed-caption { left: 36px; }
  .feed-playback { left: 36px; right: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .lightbox.media-feed, .media-feed.feed-closing, .feed-speed { animation: none; }
  .media-feed *, .media-feed::before, .media-feed::after { transition: none !important; }
}

/* ── Служебные стили механик чата: фильтр, поиск, пересылка, картинки ── */
/* Панель настроек не участвует в каскадной анимации карточки: иначе её
   transform «залипал» бы на translateY(0) и слайд был бы сломан. */
.card > .settings-panel { animation: none; }
/* Кнопка слева от заголовка прячет панель «Мои комнаты». */
body.rooms-hidden .my-rooms { display: none !important; }
.transfer-view { position: relative; }

/* На десктопе чат растягивается, а панель ввода прижата к низу — как на
   мобильном. */
@media (width > 540px) {
  .transfer-view .chat { flex: 1 1 auto; }
  .transfer-view .text-compose { flex: 0 0 auto; margin-top: 0; }
}
.filtered-out { display: none !important; }

.chat-search-toggle {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 33;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(23, 26, 25, .9);
  color: var(--accent-soft);
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background .18s ease, transform .15s ease;
}
.chat-search-toggle:hover { background: rgba(52, 211, 153, .16); }
.chat-search-toggle:active { transform: scale(.94); }
.chat-search-toggle svg { width: 18px; height: 18px; }


/* Окно пересылки раскрывается под названием комнаты в заголовке. */
.forward-overlay {
  position: absolute;
  inset: 0;
  z-index: 39;
  display: block;
  padding: 0;
  background: none;
  pointer-events: none;
  animation: none;
}
.forward-modal {
  position: absolute;
  left: 50%;
  box-sizing: border-box;
  width: min(380px, calc(100% - 32px));
  max-height: calc(100dvh - 120px);
  overflow: hidden;
  margin: 0;
  padding: 20px;
  transform: translateX(-50%);
  border: 0;
  border-radius: 12px;
  background: var(--surface, #151515);
  box-shadow: 0 12px 40px rgba(0,0,0,.3);
  text-align: left;
  pointer-events: auto;
}
.forward-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: min(46vh, 420px);
  overflow-y: auto;
  margin: 4px 0 12px;
  scrollbar-width: thin;
}
.forward-room-row { flex: 0 0 auto; }
.forward-empty { color: var(--muted); font-size: 14px; text-align: center; padding: 16px; }
html.light .forward-modal { background: #fafcfb; }
html.light .chat-search-toggle { background: rgba(255, 255, 255, .95); color: #0b7c56; }

/* ================================================================
   БЕЗ АНИМАЦИЙ ПОЯВЛЕНИЯ КНОПОК: пункты меню и дети карточки
   показываются сразу, без каскадных «взмываний». Выезжающие панели
   и карусель при этом сохраняют плавный слайд.
   ================================================================ */
/* Дети карточки не «взмывают» каскадом при загрузке. Сама карточка
   (card-in) остаётся — она лишь мягко проявляет окно. */
.card > * { animation: none !important; }
/* Пункты меню заголовка и секции показываются сразу — без каскадной
   задержки и сдвига. */
.title-menu-item,
.menu-section,
.title-menu > .menu-row {
  opacity: 1 !important;
  transform: none !important;
  transition: background .18s ease !important;
}

/* Изменения механики сохраняются поверх прежнего оформления. */
.room-heading { display: flex; flex-direction: column; min-width: 0; gap: 5px; }
.title-menu-btn { min-width: 0; }
.room-heading .title-shine { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.header-room-code { color: var(--muted); font-size: 12px; line-height: 1.3; font-weight: 500; letter-spacing: .12em; }
.title-chevron { display: none; }
.title-wrap .title-side-btn, html.light .title-wrap .title-side-btn { border: none; border-radius: 9px; }
body.chat-open #subtitle { display: none; }
button, input, textarea { font-family: inherit; }
.ico-search, .ico-search-close { display: none; }
body.search-mode #text-send .ico-search, body.search-mode #mobile-file-btn .ico-search-close { display: block; }
body.search-mode #text-send .ico-arrow, body.search-mode #text-send .ico-plane, body.search-mode #mobile-file-btn svg:not(.ico-search-close) { display: none; }
body.search-mode #reply-bar { display: none; }
.compose-search-tools { display: none; align-items: center; gap: 8px; padding: 0 4px; margin-bottom: 8px; }
body.search-mode .compose-search-tools { display: flex; }
.compose-search-tools .chat-search-count { margin-right: auto; color: var(--muted); font-size: 12px; }
.compose-search-tools button { width: 30px; height: 30px; border: none; border-radius: 9px; background: rgba(255,255,255,.05); color: var(--muted); font: inherit; cursor: pointer; }
.settings-head { justify-content: flex-start; }
.settings-section { border: none; padding: 0; margin: 0 0 8px; border-radius: 12px; background: rgba(128,128,128,.12); overflow: hidden; transition: background .2s ease; }
.settings-panel .settings-section { opacity: 1; transform: none; transition-delay: 0s; }
.settings-section-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 54px; padding: 12px 14px; border: 0; border-radius: 12px; color: inherit; background: none; font: inherit; font-size: 14px; font-weight: 600; text-align: left; cursor: pointer; }
.settings-section-icon { flex: 0 0 22px; width: 22px; height: 22px; display: grid; place-items: center; }
.settings-section-icon svg { display: block; width: 20px; height: 20px; }
.settings-section-label { flex: 1 1 auto; min-width: 0; }
.settings-section:hover { background: rgba(128,128,128,.18); }
.settings-section.expanded { background: rgba(128,128,128,.12); }
.settings-panel :is(.settings-section-icon, .mi-ico, .row-chevron) { color: #fff; }
html.light .settings-panel :is(.settings-section-icon, .mi-ico, .row-chevron) { color: #fff; }
html.light .settings-panel :is(.settings-section-icon, .mi-ico) { background: #5d6366; border-radius: 5px; }
html.light .settings-panel .row-chevron { text-shadow: 0 0 2px #303538, 0 0 1px #303538; }
.settings-panel :is(.title-menu-item, .radio-option):hover,
.settings-panel .title-menu-item:active,
.settings-panel .title-menu-item.active,
html.light .settings-panel :is(.title-menu-item, .radio-option):hover,
html.light .settings-panel .title-menu-item:active,
html.light .settings-panel .title-menu-item.active { background: rgba(128,128,128,.12); color: inherit; }
.settings-section-toggle::after { content: ''; width: 7px; height: 7px; border-right: 1.5px solid #fff; border-bottom: 1.5px solid #fff; transform: rotate(45deg); transition: transform .24s ease; margin-right: 5px; }
html.light .settings-panel .settings-section-toggle::after { box-shadow: 1px 1px #5d6366; }
.settings-section-toggle[aria-expanded="true"]::after { transform: rotate(225deg); }
.settings-section-body {
  display: grid;
  grid-template-rows: minmax(0, 0fr);
  overflow: hidden;
  transition: grid-template-rows .28s cubic-bezier(.22,1,.36,1);
}
.settings-section.expanded > .settings-section-body { grid-template-rows: minmax(0, 1fr); }
.settings-section-content { min-height: 0; overflow: hidden; contain: layout style; }
.settings-section-content::after { content: ''; display: block; height: 8px; }
.settings-panel .settings-section .menu-row,
.settings-panel .settings-section .title-menu-item { opacity: 1; transform: none; transition-delay: 0s; }
.settings-text-field { position: relative; display: block; flex: 1; min-width: 0; margin: 0; padding: 23px 0 9px; color: inherit; }
.settings-text-field > span { position: absolute; top: 18px; left: 0; color: var(--muted); font-size: 14px; transform-origin: left top; transition: transform .22s ease, color .22s ease; pointer-events: none; }
.prompt-editor.editing > span,
.prompt-editor:focus-within > span,
.prompt-editor:has(input:not(:placeholder-shown)) > span { transform: translateY(-12px) scale(.8); }
.prompt-editor.editing > span, .prompt-editor:focus-within > span { color: var(--accent); }
.settings-text-field :is(input, textarea) { display: block; width: 100%; min-width: 0; height: 28px; padding: 0; border: 0; border-radius: 0; outline: none; box-shadow: none; background: transparent; color: inherit; font: inherit; font-size: 16px; caret-color: var(--accent); box-sizing: border-box; }
.settings-text-field :is(input, textarea)::placeholder { color: transparent; }
.settings-text-field.editing :is(input, textarea)::placeholder, .settings-text-field:focus-within :is(input, textarea)::placeholder { color: var(--muted); }
.settings-text-field::after { content: ''; position: absolute; left: 0; right: 0; bottom: 4px; height: 2px; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .22s ease; }
.settings-text-field.editing::after, .settings-text-field:focus-within::after { transform: scaleX(1); }
#prompt-overlay .modal { position: relative; padding-top: 64px; }
#prompt-overlay { z-index: 70; }
.prompt-confirm { position: absolute; right: 20px; top: 16px; }
.prompt-editor { margin: 0 0 16px; }
.settings-panel [hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  .settings-panel, .settings-section-body, .settings-section-toggle::after,
  .settings-text-field > span, .settings-text-field::after { transition: none !important; }
}
/* Шапка и раскрытие приглашения по нажатию на название комнаты. */
.room-heading { flex: 1 1 auto; width: 100%; }
.room-heading .title-shine { display: block; text-overflow: clip; }
.header-room-code { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; letter-spacing: .04em; }
.title-wrap .title-side-btn, html.light .title-wrap .title-side-btn,
body.settings-open #settings-toggle-btn, body.rooms-open #rooms-toggle-btn { color: var(--muted); background: rgba(128,128,128,.16); border: none; }
.title-wrap .title-side-btn:hover, body.settings-open #settings-toggle-btn:hover { color: #eef2f7; background: rgba(128,128,128,.24); }
#status { display: none; }
.room-heading { opacity: 1; transform: translateY(0); transition: opacity 240ms ease-out, transform 240ms cubic-bezier(.4,0,.2,1); }
body.room-share-open .room-heading { visibility: hidden; opacity: 0; transform: translateY(12px); }
body.room-share-open.room-share-closing .room-heading { visibility: visible; opacity: 1; transform: translateY(0); transition-delay: 100ms; }
@media (prefers-reduced-motion: reduce) { .room-heading { transition: none; } }
body.room-share-open .title-chevron { display: block; position: absolute; left: 50%; top: calc(50% + 4px); transform: translate(-50%,-50%) rotate(180deg); color: var(--accent-soft); opacity: 1; }
body.room-share-open.room-share-closing .title-chevron { animation: share-caret-dismiss 200ms ease-out both; }
@keyframes share-caret-dismiss { 0%, 40% { opacity: 1; } 100% { opacity: 0; } }
@media (max-width: 540px) { body.room-share-open .title-chevron { top: calc(50% + 8px); } }
body.room-share-open #title-menu-btn { position: static; }
body.room-share-open .title-chevron { width: 48px; height: 20px; }
#title-menu-btn { position: relative; }
body.new-room-header #title-menu-btn:disabled { opacity: 1; color: inherit; cursor: default; }
#qr-overlay.room-share-popover { position: absolute; inset: auto; left: 50%; transform: translateX(-50%); width: min(380px, calc(100% - 32px)); z-index: 39; padding: 0; background: none; backdrop-filter: none; animation: none; }
#qr-overlay.room-share-popover .qr-modal { position: relative; isolation: isolate; box-sizing: border-box; width: 100%; max-height: none; overflow: visible; margin: 0; padding: 20px; border: none; border-radius: 12px; background: none; box-shadow: none; animation: none; }
#qr-overlay.room-share-popover .qr-modal::before { content: ''; position: absolute; inset: 0; z-index: -1; border-radius: 12px; background: #151515; box-shadow: 0 12px 40px rgba(0,0,0,.25); animation: share-background 360ms cubic-bezier(.22,1,.36,1) both; }
html.light #qr-overlay.room-share-popover .qr-modal::before { background: #fafcfb; }
#qr-title { text-align: center; font-size: 20px; line-height: 1.3; margin: 0 0 18px; overflow-wrap: anywhere; }
#qr-overlay .qr-modal-wrap { margin: 0 auto; width: min(var(--share-qr-size, 240px), 100%); }
#qr-overlay .qr-modal-img { box-sizing: border-box; display: block; width: 100%; padding: 12px; border-radius: 9px; box-shadow: none; }
#qr-overlay .qr-modal-meta { margin: 16px 0; text-align: center; }
#qr-overlay .qr-modal-code { font-family: inherit; font-size: 20px; letter-spacing: .16em; color: var(--text, #eef2f7); }
#qr-overlay .modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; }
#qr-overlay .modal-actions button { box-sizing: border-box; width: 100%; height: 44px; padding: 8px; border: none; border-radius: 9px; background: rgba(128,128,128,.16); color: var(--text, #eef2f7); font: inherit; font-size: 14px; cursor: pointer; }
#qr-overlay .modal-actions button:hover { background: rgba(128,128,128,.24); }
@keyframes share-background { from { opacity: 0; clip-path: inset(0 0 100% 0 round 12px); } to { opacity: 1; clip-path: inset(0 round 12px); } }
#qr-overlay .qr-modal-wrap, #qr-overlay .qr-modal-meta, #qr-overlay .modal-actions { animation: share-content 270ms 90ms ease-out both; }
@keyframes share-content { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { #qr-overlay .qr-modal::before, #qr-overlay .qr-modal-wrap, #qr-overlay .qr-modal-meta, #qr-overlay .modal-actions { animation: none; } }

.room-share-title-flight { position: fixed; z-index: 80; display: block; text-align: center; white-space: nowrap; color: #eef2f7; pointer-events: none; margin: 0; }
html.light .room-share-title-flight { color: #1d2b33; }
#qr-overlay .qr-modal { touch-action: pan-x; }
@media (width > 540px) {
  .title-wrap {
    display: grid;
    grid-template-columns: 38px 38px minmax(0, 1fr) 38px 38px;
    margin-inline: calc(-1 * var(--card-pad-x));
  }
  .title-wrap h1 { grid-column: 3; grid-row: 1; }
  #rooms-toggle-btn { grid-column: 1; grid-row: 1; }
  #search-toggle-btn { grid-column: 4; grid-row: 1; }
  #settings-toggle-btn { grid-column: 5; grid-row: 1; }
}
/* Shared rounded tiles for chat navigation and expandable settings. */
:root { --navigation-radius: 16px; }
.title-wrap .title-side-btn, html.light .title-wrap .title-side-btn,
.settings-section, .settings-section-toggle { border-radius: var(--navigation-radius); }
.my-room, .my-room-new,
html.light .my-room, html.light .my-room-new {
  border: none;
  border-radius: var(--navigation-radius);
  background: rgba(128,128,128,.12);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.my-room:hover, .my-room-new:hover,
html.light .my-room:hover, html.light .my-room-new:hover,
html.light .my-room:focus-visible, html.light .my-room-new:focus-visible {
  background: rgba(128,128,128,.18);
  box-shadow: none;
}
.my-room.active, .my-room-new.active,
html.light .my-room.active, html.light .my-room-new.active { background: rgba(52,211,153,.18); }
.settings-panel-inner, html.light .settings-panel-inner { border: none; background: none; box-shadow: none; padding: 0; backdrop-filter: none; -webkit-backdrop-filter: none; }

/* The mini-app host owns this frame and chrome; app CSS remains inside the frame. */
#mini-app-view { display:flex; flex:1 1 auto; min-height:0; position:relative; overflow:hidden; border-radius:0; }
#mini-app-view.hidden { display:none; }
.mini-app-frame { display:block; width:100%; height:100%; min-height:0; flex:1 1 auto; border:0; background:transparent; }
body.mini-app-fullscreen .app-shell,body.mini-app-fullscreen .card { overflow:visible!important; transform:none!important; backdrop-filter:none!important; -webkit-backdrop-filter:none!important; }
body.mini-app-fullscreen { overflow:hidden!important; }
body.mini-app-fullscreen #mini-app-view { position:fixed!important; inset:auto!important; top:var(--mini-screen-top,0px)!important; left:var(--mini-screen-left,0px)!important; width:100vw!important; height:100dvh!important; min-height:0!important; max-height:none!important; margin:0!important; padding:0!important; z-index:80; background:#000; mask-image:none!important; -webkit-mask-image:none!important; }
html.light body.mini-app-fullscreen #mini-app-view { background:#f5f5f5; }
body.mini-app-fullscreen .mini-app-frame { height:100%!important; min-height:0!important; }
.mini-app-error { position:absolute; inset:0; padding:24px; background:var(--card-bg,#151515); text-align:center; z-index:1; }
.mini-app-error[hidden] {display:none;}
/* A full-width content slot never changes its parent's header or settings. */
.card > .embedded-view { width:calc(100% + 2 * var(--card-pad-x)); margin-inline:calc(-1 * var(--card-pad-x)); margin-bottom:-40px; border-radius:0 0 24px 24px; }
@media(max-width:540px) {
  .card > .embedded-view { width:100%; margin:0; border-radius:0; }
}
@media (width < 1404px) {
  .settings-panel-inner, html.light .settings-panel-inner { padding: 8px 12px calc(16px + env(safe-area-inset-bottom)); }
}
@media (width > 540px) {
  .card, .card:hover { border: none; box-shadow: 0 16px 48px rgba(0,0,0,.18); }
}
.settings-panel .title-menu { overflow-anchor: none; }
@media (width > 540px) {
  .transfer-view .text-compose { position:absolute; left:0; right:0; bottom:0; margin-top:0; background:transparent; }
}
@media (width > 540px) {
  .transfer-view .chat { padding-bottom: 0; }
  .transfer-view .file-list { padding-bottom: 8px; }
}
@media (width > 540px) { .transfer-view .chat-spacer { height:calc(var(--compose-h, 0px) + 8px); } }
@media (width > 540px) { .transfer-view .text-compose { margin-top: 0; } }
/* Profile rows use the same two-line spacing as the other settings. */
/* Animate the text itself; the settings tile keeps its neutral background. */
.settings-panel .settings-section:hover { background: rgba(128,128,128,.12); }
.settings-panel .menu-row-btn:hover,
.settings-panel .menu-row-btn:active,
html.light .settings-panel .menu-row-btn:hover,
html.light .settings-panel .menu-row-btn:active { background: none; }
.settings-panel .menu-row-btn:focus-visible { outline: none; }
.settings-panel .menu-row-btn:focus-visible .mi-title { text-decoration: underline; text-underline-offset: 3px; }
.settings-panel .settings-inline-editor { padding: 0; }
.settings-panel .settings-inline-editor textarea { resize: none; overflow: hidden; }
.settings-panel .settings-inline-editor > span { top: 0; line-height: 1.3; color: inherit; font-weight: 600; transform: none; transition: transform .36s cubic-bezier(.4,0,.2,1); }
.settings-panel .settings-inline-editor :is(input, textarea) { position: absolute; left: 0; bottom: 0; height: var(--subtitle-height); line-height: var(--subtitle-height); font-size: 12px; color: var(--muted); transition: font-size .36s cubic-bezier(.4,0,.2,1), height .36s cubic-bezier(.4,0,.2,1), line-height .36s cubic-bezier(.4,0,.2,1), color .36s ease; }
.settings-panel .settings-inline-editor :is(input, textarea)::placeholder { color: var(--muted); }
.settings-panel .settings-inline-editor::after { bottom: -3px; transform: scaleX(0); transition: transform .42s cubic-bezier(.4,0,.2,1); }
.settings-panel .settings-inline-editor.editing > span { transform: translateY(-2px) scale(.85); }
.settings-panel .settings-inline-editor.editing :is(input, textarea) { height: 20px; line-height: 20px; font-size: 16px; color: inherit; }
.settings-panel .settings-inline-editor.editing::after { transform: scaleX(1); transition-delay: .06s; }

@media (prefers-reduced-motion: reduce) { .settings-panel .settings-inline-editor :is(input, textarea) { transition: none; } }

@media (hover: hover) {
  .settings-panel .menu-row-btn:hover { background: rgba(255,255,255,.06); }
  html.light .settings-panel .menu-row-btn:hover { background: rgba(15,40,32,.06); }
}

.settings-panel .row-chevron { transition: opacity .36s ease; }

/* Mobile room drawer: floating heading, quiet rows and a fixed create action. */
@media (max-width: 540px) {
  body.mini-app-open .card > .title-wrap { z-index: 25; pointer-events: none; }
  body.mini-app-open .card > .title-wrap > * { pointer-events: auto; }
  body.mini-app-open .card > #mini-app-view { position: absolute; inset: 0; height: auto; -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 calc(var(--chat-heading-h, 74px) + 20px), #000 100%); mask-image: linear-gradient(to bottom, transparent 0, #000 calc(var(--chat-heading-h, 74px) + 20px), #000 100%); }
}
/* Shared full-height chat with floating controls. */
  body.chat-open .card > .title-wrap { z-index: 25; pointer-events: none; }
  body.chat-open .card > .title-wrap > * { pointer-events: auto; }
  body.chat-open .card > .transfer-view { position: absolute; inset: 0; }
  body.chat-open .transfer-view .chat,
  body.chat-open .transfer-view .chat.has-scroll {
    padding-top: calc(var(--chat-heading-h, 74px) + 20px);
    padding-bottom: 0;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 calc(var(--chat-heading-h, 74px) + 16px), #000 calc(100% - var(--compose-h, 70px) - 20px), transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 calc(var(--chat-heading-h, 74px) + 16px), #000 calc(100% - var(--compose-h, 70px) - 20px), transparent 100%);
  }
  body.chat-open .transfer-view .chat-spacer { height: calc(var(--compose-h, 70px) + 28px); }
.my-rooms-footer { display: none; }
#my-rooms .my-room-code { font-size: 16px; font-weight: 400; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#my-rooms .room-pinned .my-room-code { font-weight: 600; }
.my-rooms, .settings-panel {
  --panel-heading-top: max(28px, env(safe-area-inset-top));
  --panel-heading-mask: linear-gradient(to bottom,
    rgba(0, 0, 0, .16), rgba(0, 0, 0, .3) calc(var(--panel-heading-top) + 15px),
    #000 calc(var(--panel-heading-top) + 48px));
  --drawer-bg: 23 26 25;
}
html.light .my-rooms, html.light .settings-panel { --drawer-bg: 250 252 251; }
.settings-panel,
.settings-panel-tilt,
.settings-panel-inner,
#settings-panel .title-menu {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
@media (width < 1404px) {
  body.mobile-rooms #my-rooms:not(.hidden) { width: min(340px, 80vw); }
  /* Переменные шторки: отступ заголовка и цвет фона для градиента под ним. */
  body #my-rooms { --drawer-bg: 23 26 25; }
  html.light body #my-rooms { --drawer-bg: 250 252 251; }
  body #my-rooms .my-rooms-tilt { position: relative; z-index: 0; padding: 0; overflow: hidden; }
  /* Заголовок — отдельный слой над лентой (z-index 3): текст «Комнаты» и поиск
     всегда видны, лента прокручивается под ними. */
  body #my-rooms .my-rooms-head { position: absolute; z-index: 3; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 10px; margin: 0; padding: var(--panel-heading-top) 24px 18px; min-height: 58px; pointer-events: none; }
  body #my-rooms .my-rooms-head button { pointer-events: auto; flex: 0 0 auto; }
  body #my-rooms .my-rooms-scroll { position: absolute; inset: 0; z-index: 1; }
  /* Комнатам оставляем мобильный градиент-оверлей: он затемняет карточки
     под закреплённым заголовком, пока лента прокручивается. */
  body #my-rooms .my-rooms-scroll::before {
    content: '';
    position: absolute;
    z-index: 2;
    inset: 0 0 auto;
    height: calc(var(--panel-heading-top) + 48px);
    background: linear-gradient(to bottom, rgb(var(--drawer-bg) / .84),
      rgb(var(--drawer-bg) / .7) calc(var(--panel-heading-top) + 15px), rgb(var(--drawer-bg) / 0));
    pointer-events: none;
  }
  body #my-rooms .my-rooms-list { height: 100%; max-height: none; gap: 0; box-sizing: border-box; padding: calc(var(--panel-heading-top) + 80px) 0 calc(100px + env(safe-area-inset-bottom)); }
  body #my-rooms .my-room-new { display: none; }
  body #my-rooms .my-room { flex: 0 0 auto; min-height: 52px; padding: 14px 24px; border: 0; border-radius: 0; background: transparent; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
  body #my-rooms .my-room.active { background: rgba(128, 128, 128, .23); }
  body #my-rooms .my-room:hover { background: rgba(128, 128, 128, .12); }
  body #my-rooms .my-room-code-sub { display: none; }
  body #my-rooms .room-pinned + .my-room:not(.room-pinned) { margin-top: 24px; position: relative; }
  body #my-rooms .room-pinned + .my-room:not(.room-pinned)::before { content: ''; position: absolute; top: -12px; left: 24px; right: 24px; height: 1px; background: var(--border); }
  body #my-rooms .my-rooms-footer { position: absolute; z-index: 2; bottom: 0; left: 0; right: 0; display: flex; padding: 12px 24px calc(20px + env(safe-area-inset-bottom)); pointer-events: none; }
  body #my-rooms .rooms-create { pointer-events: auto; }
  .rooms-create { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 50px; padding: 0 22px; border: 0; border-radius: 999px; background: var(--accent); color: #04120c; font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; }
  .rooms-create > span { font-size: 25px; font-weight: 400; line-height: 1; }
  .rooms-create:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 4px; }
}

/* Mobile settings share the room drawer's slide. */
@media (width < 1404px) {
  .settings-panel,
  .settings-panel.open {
    width: min(340px, 80vw);
    z-index: 60;
    opacity: 1;
    will-change: transform;
  }
  .settings-panel { pointer-events: none; }
  .settings-panel.open { pointer-events: auto; }
  .settings-panel-tilt { position: relative; overflow: hidden; }
  .settings-head {
    position: absolute;
    z-index: 3;
    top: 0;
    left: 0;
    right: 0;
    min-height: 58px;
    margin: 0;
    padding: var(--panel-heading-top) 24px 18px;
    pointer-events: none;
  }
  .settings-head button { pointer-events: auto; }
  .settings-panel-inner,
  html.light .settings-panel-inner {
    position: absolute;
    inset: 0;
    padding: 0;
    overflow: hidden;
  }
  /* У настроек на мобильном тот же неподвижный оверлей, что у списка комнат. */
  body #settings-panel .settings-panel-inner::before {
    content: '';
    position: absolute;
    z-index: 2;
    inset: 0 0 auto;
    height: calc(var(--panel-heading-top) + 48px);
    background: linear-gradient(to bottom, rgb(var(--drawer-bg) / .84),
      rgb(var(--drawer-bg) / .7) calc(var(--panel-heading-top) + 15px), rgb(var(--drawer-bg) / 0));
    pointer-events: none;
  }
  .settings-panel .title-menu,
  html.light .settings-panel .title-menu {
    position: relative;
    top: 0;
    left: 0;
    z-index: 0;
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
  }
  .settings-panel .title-menu::-webkit-scrollbar { width: 0; }
  body #settings-panel .title-menu {
    padding: calc(var(--panel-heading-top) + 80px) 0 max(8px, env(safe-area-inset-bottom));
    -webkit-mask-image: none;
    mask-image: none;
  }
  .settings-panel.open .title-menu,
  .settings-panel.open .title-menu > * {
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
  }
  .settings-panel .settings-section,
  .settings-panel .settings-section:hover {
    margin: 0 8px 2px;
    border-radius: 14px;
    background: transparent;
  }
  .settings-panel .settings-section.expanded,
  .settings-panel .settings-section.expanded:hover {
    background: rgba(128, 128, 128, .16);
  }
  .settings-panel .settings-section-toggle {
    min-height: 54px;
    padding: 12px;
    border-radius: 14px;
  }
  .settings-panel .settings-section-icon { flex-basis: 22px; }
  .settings-panel .settings-section-toggle[aria-expanded="true"],
  .settings-panel .settings-section-toggle[aria-expanded="true"]:hover,
  .settings-panel .settings-section-toggle:hover { background: transparent; }
  .settings-panel .settings-section-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
  .settings-panel .settings-section-content { padding: 4px 4px 12px; }
  .settings-panel .settings-section-content::after { display: none; }
  .settings-panel .settings-section-content .menu-row,
  .settings-panel .settings-section-content .title-menu-item,
  .settings-panel .settings-section-content .radio-option { padding: 10px 8px; gap: 10px; }
  .settings-panel .settings-section-content .mi-ico { width: 20px; height: 20px; }
  .settings-panel .settings-section-content .mi-ico svg { width: 18px; height: 18px; }
  .settings-panel .settings-section-content .radio-option .mi-ico { display: none; }
  .settings-panel .settings-section-content .menu-row:has(> .switch) {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr) 42px;
    column-gap: 10px;
    row-gap: 3px;
    align-items: center;
  }
  .settings-panel .settings-section-content .menu-row:has(> .switch) > .mi-ico { grid-column: 1; grid-row: 1; }
  .settings-panel .settings-section-content .menu-row:has(> .switch) > .mi-text { display: contents; }
  .settings-panel .settings-section-content .menu-row:has(> .switch) .mi-title { grid-column: 2; grid-row: 1; }
  .settings-panel .settings-section-content .menu-row:has(> .switch) .mi-sub { grid-column: 2 / 4; grid-row: 2; }
  .settings-panel .settings-section-content .menu-row:has(> .switch) > .switch { grid-column: 3; grid-row: 1; justify-self: end; }
}
.settings-panel .settings-section-content .mi-sub {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.4;
}
.settings-panel .settings-section-content .mi-title { overflow-wrap: anywhere; }
/* Drawer search and composer share the navigation tile treatment. */
.drawer-search-hidden { display: none !important; }
.drawer-search-slot {
  display: grid;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
}
.drawer-search-slot > * { grid-area: 1 / 1; min-width: 0; }
.drawer-search-slot > :is(.my-rooms-title, .settings-title) {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.searching .drawer-search-slot > :is(.my-rooms-title, .settings-title) { visibility: hidden; }
.drawer-search {
  box-sizing: border-box;
  width: 100%;
  height: 34px;
  padding: 4px 8px;
  border: 0;
  border-radius: var(--control-radius);
  background: var(--control-glass);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease;
}
.searching .drawer-search {
  opacity: 1;
  pointer-events: auto;
}
.drawer-search:focus, .drawer-search:focus-visible { outline: none; border: none; box-shadow: none; }

.sticky-date-overlay { position: absolute; z-index: 5; display: flex; justify-content: center; padding: 6px 0 4px; pointer-events: none; box-sizing: border-box; transition: opacity .2s ease; }
.sticky-date-overlay[hidden] { display: none; }
.sticky-date-overlay.scroll-idle { opacity: 0; }

.sticky-date-overlay { display: grid; justify-items: center; }
.sticky-date-overlay > .date-sep-pill { grid-area: 1 / 1; }

/* The shared player uses the same translucent navigation treatment as the composer. */
.music-bar { display:flex; align-items:center; gap:10px; flex-shrink:0; position:sticky; top:8px; z-index:20; margin:6px 14px 10px; padding:6px 8px; border:0; border-radius:var(--navigation-radius); background:rgba(128,128,128,.16); backdrop-filter:blur(22px); -webkit-backdrop-filter:blur(22px); color:var(--text); min-width:0; }
.music-bar.hidden { display:none; }
.music-bar button { display:grid; place-items:center; flex:0 0 34px; width:34px; height:34px; padding:6px; background:transparent; color:var(--muted); border:0; border-radius:10px; cursor:pointer; }
.music-bar button:hover { color:var(--accent-soft); background:rgba(128,128,128,.16); }
.music-bar button svg { width:21px; height:21px; }
.music-title { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:13px; font-weight:500; }
.music-time { flex-shrink:0; font-size:11px; font-variant-numeric:tabular-nums; color:var(--muted); }
.file-access { display:none; }
body.messenger-mode .file-access { position:relative; isolation:isolate; display:inline-flex; align-items:center; justify-content:center; gap:7px; align-self:flex-start; border:0; border-radius:999px; background:var(--control-glass); color:var(--text); font:inherit; font-size:12px; min-height:34px; padding:6px 12px; margin:2px 4px 2px 0; cursor:pointer; text-align:left; overflow:hidden; transition:width .45s cubic-bezier(.22,1,.36,1),flex-basis .45s cubic-bezier(.22,1,.36,1),min-width .45s cubic-bezier(.22,1,.36,1),min-height .45s cubic-bezier(.22,1,.36,1),height .45s cubic-bezier(.22,1,.36,1),padding .45s cubic-bezier(.22,1,.36,1),gap .45s cubic-bezier(.22,1,.36,1),opacity .28s ease,transform .45s cubic-bezier(.22,1,.36,1); }
body.messenger-mode .file-access:hover { background:rgba(255,255,255,.16); }
.file-access svg { width:18px; height:18px; flex-shrink:0; }
.file-access:disabled { opacity:.55; cursor:default; }
body.messenger-mode .file-item.music-message.downloadable .file-thumb::after,
body.messenger-mode .file-item.music-message .file-thumb::after { display:none; }
/* Keep metadata in the bubble's layout so even a one-letter message reserves its width. */
body.messenger-mode .text-body { display:flex; flex-direction:column; min-width:0; padding:0; }
body.messenger-mode .text-meta { position:static; display:flex; align-items:center; justify-content:flex-end; align-self:flex-end; flex-wrap:wrap; gap:5px; margin:3px 0 0; float:none; max-width:100%; }
body.messenger-mode .file-item:not(.media-message) .file-body { padding:0; }
body.messenger-mode .file-item:not(.media-message) .file-meta { position:static; order:3; display:flex; align-items:center; justify-content:flex-end; flex-wrap:wrap; gap:5px; overflow:visible; white-space:normal; margin-top:2px; }
body.messenger-mode .file-item:not(.media-message) .file-access { order:2; }
body.messenger-mode .file-item:not(.media-message) .file-size { margin-right:auto; }

html body .file-list .file-item.sticker-message {
  position:relative; display:flex; flex-direction:column; align-items:flex-start; gap:3px;
  width:min(176px, 58%); min-height:0; height:auto; padding:0; overflow:visible;
  border:0; border-radius:0; background:transparent; box-shadow:none;
}
html body .file-list .file-item.sticker-message.mine { margin-inline:auto 0; align-items:flex-end; }
html body .file-list .file-item.sticker-message.theirs { margin-inline:0 auto; }
body .file-item.sticker-message::before,
body:not(.select-mode) .file-item.sticker-message::after,
body .file-item.sticker-message > :is(.msg-tail, .msg-glow) { display:none!important; }
.sticker-artwork {
  display:grid; place-items:center; width:100%; aspect-ratio:1; padding:0; border:0;
  border-radius:12px; background:transparent; color:var(--muted); font:inherit; cursor:default;
}
.sticker-message.mine .sticker-artwork :is(img, video) { object-position:right center; }
.sticker-message.theirs .sticker-artwork :is(img, video) { object-position:left center; }
body.select-mode :is(.sticker-message.selected, .attachment-message.selected .sticker-message)
  > .sticker-artwork > :is(img, video) {
  filter:drop-shadow(0 0 5px rgba(52, 211, 153, .85)) drop-shadow(0 0 10px rgba(52, 211, 153, .55));
}
.sticker-message > .msg-status {
  padding:3px 6px; border-radius:8px; background:var(--control-glass); color:var(--text);
}
.sticker-message:not(.error) > .file-body { display:none; }
.sticker-message.error > .sticker-artwork { opacity:.55; }
body.messenger-mode .msg-stats { margin-left:0; padding-left:0; flex-wrap:wrap; max-width:100%; gap:5px; }
body.messenger-mode .msg-time { margin-left:0; flex-shrink:0; }
body.messenger-mode .media-message .file-body { box-sizing:border-box; min-width:0; }
body.messenger-mode .media-message .file-meta { flex-wrap:wrap; max-width:100%; }
body.messenger-mode .media-message.device-ready .file-access { display:none; }
body.messenger-mode .media-message.has-media-access .file-body { left:12px; right:6px; bottom:5px; width:auto; max-width:none; display:flex; flex-direction:row; flex-wrap:wrap; align-items:center; gap:8px; }
body.messenger-mode .media-message.has-media-access .file-access { order:1; color:#fff; flex-shrink:0; align-self:center; }
body.messenger-mode .media-message.has-media-access .file-meta { order:2; margin-left:auto; min-width:0; flex:0 1 auto; align-items:center; }
.file-caption { white-space:pre-wrap; overflow-wrap:anywhere; font-size:14px; line-height:1.45; user-select:text; cursor:text; margin:4px 0; }
body.messenger-mode .media-message.has-caption .file-thumb { border-bottom-left-radius:0; border-bottom-right-radius:0; }
body.messenger-mode .media-message.has-caption .file-caption { order:2; width:100%; padding:10px 12px 3px; margin:0; }
body.messenger-mode .media-message.has-caption .file-body { position:relative; order:3; inset:auto; width:100%; max-width:100%; min-height:30px; padding:0 6px 5px 12px; display:flex; flex-direction:row; align-items:center; gap:8px; }
body.messenger-mode .media-message.has-caption.has-media-access .file-body { position:absolute; z-index:2; left:12px; right:6px; bottom:5px; inset:auto 6px 5px 12px; width:auto; max-width:none; min-height:0; padding:0; display:flex; flex-direction:row; flex-wrap:wrap; align-items:center; gap:8px; }
body.messenger-mode .media-message.has-caption .file-meta { order:2; margin-left:auto; min-width:0; justify-content:flex-end; }
body.messenger-mode .media-message.has-caption .file-access { order:1; flex-shrink:0; color:#fff; }
.draft-attachments { display:flex; gap:8px; padding:10px 12px 4px; overflow-x:auto; overscroll-behavior-x:contain; max-width:100%; }
.draft-attachment { position:relative; flex:0 0 80px; width:80px; min-width:0; }
.draft-attachment-preview { display:grid; place-items:center; height:64px; border-radius:10px; background:#8882; overflow:hidden; }
.draft-attachment-preview > img { width:100%; height:100%; object-fit:cover; }
.draft-attachment-preview > svg { width:28px; height:28px; }
.draft-attachment-name { display:block; font-size:10px; line-height:18px; white-space:nowrap; text-overflow:ellipsis; overflow:hidden; color:var(--muted); }
.draft-attachment-remove { position:absolute; top:-5px; right:-5px; width:28px; height:28px; border:2px solid var(--bg,#171717); border-radius:50%; background:#333; color:#fff; font-size:21px; line-height:20px; cursor:pointer; }
.caption-edit-bar { display:flex; align-items:center; justify-content:space-between; gap:12px; margin:8px 12px 0; padding-left:10px; border-left:2px solid var(--accent); color:var(--muted); font-size:13px; }
.caption-edit-bar button { border:0; background:none; color:inherit; width:32px; height:32px; font-size:24px; cursor:pointer; }
/* One message bubble for an album of attachments. */
body.messenger-mode .attachment-message { position:relative; min-width:0; max-width:100%; width:min(85%,420px); margin:2px 0 8px; border-radius:16px; background:var(--bubble-bg); transition:box-shadow .2s; }
body.messenger-mode .attachment-message.mine { margin-left:auto; --bubble-bg:#1f4d40; }
body.messenger-mode .attachment-message.theirs { margin-right:auto; --bubble-bg:#202020; }
body.messenger-mode .attachment-message.group-first { margin-top:22px; }
body.messenger-mode .attachment-message::before { content:attr(data-author); position:absolute; top:auto; bottom:calc(100% + 2px); left:0; overflow:visible; text-overflow:clip; white-space:nowrap; font-size:12px; line-height:15px; font-weight:600; color:var(--accent-soft); }
body.messenger-mode .attachment-message:not(.group-first)::before { display:none; }
body.messenger-mode .attachment-message.mine::before { left:auto; right:0; }
body.messenger-mode .attachment-message > .msg-tail { display:none; }
body.messenger-mode .attachment-message.group-first > .msg-tail { display:block; }
body.messenger-mode .attachment-message.theirs > .msg-tail { left:-6px; transform:none; }
body.messenger-mode .attachment-message.mine > .msg-tail { right:-6px; transform:scaleX(-1); }
body.messenger-mode .attachment-message .file-item { position:relative; box-sizing:border-box; min-height:0; margin:0; padding:8px 12px; border-radius:0; background:transparent; animation:none; flex-wrap:nowrap; }
body.messenger-mode .attachment-message .file-item > .msg-author,
body.messenger-mode .attachment-message .file-item > .msg-tail,
body.messenger-mode .attachment-message .file-item > .msg-glow,
body.messenger-mode .attachment-message .file-caption { display:none; }
body.messenger-mode .attachment-message .file-item:not(.media-message) { align-items:center; }
body.messenger-mode .attachment-message .file-item:not(.media-message) .file-thumb { width:52px; height:58px; flex:0 0 52px; }
body.messenger-mode .attachment-message .file-item:not(.media-message) .file-body { min-width:0; flex:1; }
body.messenger-mode .attachment-message .file-item:not(.media-message) .file-name { font-size:14px; line-height:21px; white-space:normal; overflow-wrap:anywhere; }
body.messenger-mode .attachment-message .file-item:not(.media-message) .file-access { min-height:34px; padding:6px 12px; font-size:12px; }
.attachment-caption { white-space:pre-wrap; overflow-wrap:anywhere; font-size:14px; line-height:1.45; color:var(--text,#e9edef); user-select:text; cursor:text; }
.attachment-caption:empty { display:none; }
html.light body.messenger-mode .attachment-message.mine { --bubble-bg:#d8f5e6; }
html.light body.messenger-mode .attachment-message.theirs { --bubble-bg:#fff; }
body.messenger-mode .file-access.access-compact { flex:0 1 auto; width:auto; height:auto; min-height:32px; max-width:100%; gap:6px; padding:4px 10px; border-radius:999px!important; }
body.messenger-mode .file-access.access-compact.file-access-loading { display:grid; grid-template-columns:16px max-content; grid-template-rows:auto auto; align-items:center; column-gap:6px; row-gap:1px; width:max-content; max-width:none!important; min-height:42px; flex:0 0 auto; padding:5px 10px; }
body.messenger-mode .file-access.access-compact.file-access-loading > svg { grid-column:1; grid-row:1 / span 2; width:16px; height:16px; }
body.messenger-mode .file-access.access-compact.file-access-loading > .file-access-label { grid-column:2; grid-row:1; font-size:11px; line-height:1.15; }
body.messenger-mode .file-access.access-compact.file-access-loading > .file-access-size { grid-column:2; grid-row:2; font-size:10px; line-height:1.1; opacity:.82; }
body.messenger-mode .media-message.device-ready .file-access,
body.messenger-mode .music-message.device-ready .file-access { display:inline-flex; }
body.messenger-mode .attachment-message.reply-target > .msg-glow,
body.messenger-mode .attachment-message.msg-flash > .msg-glow,
body.messenger-mode .file-item.reply-target > .msg-glow,
body.messenger-mode .text-item.reply-target > .msg-glow { opacity:1; }
.media-feed .lightbox-download > span { display:none; }
.reply-attachment-fill,.reply-jump-fill { position:absolute; inset:0; z-index:4; pointer-events:none; background:rgba(255,255,255,.08); }

.media-feed .feed-caption > span { white-space:pre-wrap; overflow-wrap:anywhere; max-height:25vh; overflow:auto; pointer-events:auto; }
.auto-download-row { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:14px 12px; cursor:pointer; }
.auto-download-row input { width:20px; height:20px; accent-color:var(--accent-soft); }
.music-bar button:focus-visible, .music-seek:focus-visible, .file-access:focus-visible { outline:2px solid var(--accent-soft); outline-offset:2px; }
@media(max-width:540px) { .music-bar { gap:6px; margin:4px 12px 8px; padding:4px 6px; } }
body.messenger-mode .msg-time { order:2; }
body.messenger-mode .msg-stats { order:1; }
/* Soft cover-colored spots remain visible across the whole frosted surface. */
.music-bar { --music-progress:0%; --music-energy:0; --music-color-0:#21b97d; --music-color-1:#42e0a4; --music-color-2:#137859; isolation:isolate; overflow:hidden; touch-action:none; user-select:none; -webkit-user-select:none; cursor:pointer; }
.music-glow { position:absolute; inset:-25%; z-index:-2; pointer-events:none; opacity:.85; filter:blur(14px) saturate(1.35); }
.music-glow i { position:absolute; width:50%; height:180%; top:-40%; border-radius:50%; background:radial-gradient(ellipse,var(--music-color-0),transparent 68%); transform:translate(var(--music-sway,0%),var(--music-sway-y,0%)) scale(calc(.9 + var(--music-energy,0)*.55)); animation:music-drift 12s ease-in-out infinite alternate paused; }
.music-glow i:nth-child(1) { left:-4%; }
.music-glow i:nth-child(2) { left:28%; top:-80%; background:radial-gradient(ellipse,var(--music-color-1),transparent 68%); animation-delay:-4s; animation-direction:alternate-reverse; }
.music-glow i:nth-child(3) { left:63%; top:-20%; background:radial-gradient(ellipse,var(--music-color-2),transparent 68%); animation-delay:-8s; }
.music-bar.playing .music-glow i { animation-play-state:running; }
.music-glass { position:absolute; inset:0; z-index:-1; pointer-events:none; background:rgba(13,23,20,.23); box-shadow:inset 0 1px 0 rgba(255,255,255,.08); }
.music-progress-fill { position:absolute; inset:0; z-index:-1; pointer-events:none; background:rgba(255,255,255,.1); clip-path:inset(0 calc(100% - var(--music-progress)) 0 0); border-right:1px solid rgba(255,255,255,.2); }
.music-bar.scrubbing { cursor:ew-resize; box-shadow:0 0 0 1px rgba(128,128,128,.3); }
.music-bar .music-title, .music-bar .music-time { pointer-events:none; }
.music-bar .music-time { min-width:30px; text-align:right; }
.music-bar .music-previous, .music-bar .music-next { display:none; }
.music-bar .music-seek { position:absolute; width:1px; height:1px; opacity:0; pointer-events:none; }
.music-bar:focus-visible, .music-bar:has(.music-seek:focus-visible) { outline:2px solid var(--accent-soft); outline-offset:2px; }
html.light .music-glass { background:rgba(245,250,247,.3); }
@keyframes music-drift { from { margin-left:-8%; margin-top:-10%; } to { margin-left:12%; margin-top:14%; } }
@media(prefers-reduced-motion:reduce) { .music-bar .music-glow i { animation:none; transform:none; } }
/* A compact panel opens directly beneath the mini-player, keeping the chat visible. */
.music-dock { position:sticky; top:8px; z-index:20; flex-shrink:0; margin:6px 14px 10px; min-width:0; }
.music-dock>.music-bar { position:relative; top:auto; margin:0; }
.music-player { position:absolute; inset:calc(100% + 6px) 0 auto; box-sizing:border-box; width:100%; max-width:none; margin:0; padding:16px 14px 12px; border:1px solid rgba(128,128,128,.16); border-radius:20px; color:var(--text); background:rgba(24,33,29,.94); backdrop-filter:blur(24px); -webkit-backdrop-filter:blur(24px); box-shadow:0 12px 36px rgba(0,0,0,.26); transform-origin:top center; }
.music-player[open] { display:grid; grid-template-columns:76px minmax(0,1fr) 24px; column-gap:12px; row-gap:3px; animation:music-panel-in .24s cubic-bezier(.2,.8,.2,1); }
.music-player::backdrop { background:transparent; }
.music-player button { display:grid; place-items:center; width:36px; height:36px; padding:7px; border:0; border-radius:10px; background:transparent; color:var(--muted); cursor:pointer; }
.music-player button svg { width:21px; height:21px; }
.music-player button:disabled { opacity:.3; cursor:default; }
.music-player button:focus-visible { outline:2px solid var(--accent-soft); outline-offset:2px; }
.music-player .player-dismiss { grid-column:3; grid-row:1/3; width:28px; height:28px; padding:4px; }
.player-cover { grid-column:1; grid-row:1/4; width:76px; height:76px; align-self:center; display:grid; place-items:center; overflow:hidden; border-radius:12px; background:rgba(128,128,128,.14); }
.player-cover img { display:block; width:100%; height:100%; object-fit:cover; }
.player-cover>svg { width:36px; height:36px; color:var(--accent-soft); }
.music-player h2 { grid-column:2; grid-row:1; align-self:end; margin:0; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:15px; line-height:20px; font-weight:600; }
.player-artist { grid-column:2; grid-row:2; margin:0; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:12px; line-height:18px; color:var(--muted); }
.player-controls { grid-column:2/4; grid-row:3; display:flex; align-items:center; justify-content:flex-start; gap:10px; }
.music-player .player-toggle { color:var(--text); background:rgba(128,128,128,.12); border-radius:50%; }
.player-shuffle[aria-pressed="true"] { color:#fff; background:rgba(255,255,255,.14); }
.player-progress { grid-column:1/-1; grid-row:4; isolation:isolate; position:relative; overflow:hidden; margin-top:12px; height:36px; border-radius:12px; background:rgba(128,128,128,.13); }
.player-progress .music-glow, .music-bar .music-glow { inset:0; filter:none; clip-path:inset(0 calc(100% - var(--music-progress)) 0 0); opacity:1; }
.player-progress .music-glow i, .music-bar .music-glow i { filter:blur(10px) saturate(1.35); }
.music-player.playing .music-glow i { animation-play-state:running; }
.player-progress .music-glass { background:rgba(13,23,20,.15); }
.player-seek { position:absolute; inset:0; width:100%; height:100%; margin:0; opacity:0; cursor:ew-resize; z-index:2; }
.player-progress:has(.player-seek:focus-visible) { outline:2px solid var(--accent-soft); outline-offset:-2px; }
.player-times { display:flex; position:absolute; inset:0; align-items:center; justify-content:space-between; padding:0 10px; pointer-events:none; font-size:11px; font-variant-numeric:tabular-nums; color:var(--text); }
.music-track-artist { order:0; color:var(--muted); font-size:12px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
html.light .music-player { background:rgba(244,249,246,.95); }
@keyframes music-panel-in { from { opacity:0; transform:translateY(-10px) scale(.97); } to { opacity:1; transform:translateY(0) scale(1); } }
@media(max-width:540px) { .music-dock { margin:4px 12px 8px; } }
@media(prefers-reduced-motion:reduce) { .music-player[open] { animation:none; } }
.music-dock:has(>.music-bar.hidden) { display:none; }

.music-dock.player-expanded>.music-bar { display:none; }
.music-dock.player-expanded>.music-player { position:relative; inset:auto; }
.music-player .player-cover, .music-player h2, .music-player .player-artist { cursor:pointer; }
.player-repeat[aria-pressed="true"] { color:#fff; background:rgba(255,255,255,.14); }
.music-player .player-controls { gap:4px; }
.music-player .player-controls button { flex-shrink:0; width:32px; height:36px; padding:5px; }
/* The currently playing message uses the same outer halo as message selection. */
body.messenger-mode .music-aura { position:absolute;inset:-6px;border-radius:22px;filter:blur(10px);z-index:-1;pointer-events:none;opacity:0;transition:opacity .25s ease; background:linear-gradient(115deg,var(--music-color-0,#21b97d),var(--music-color-1,#42e0a4),var(--music-color-2,#137859),var(--music-color-0,#21b97d)); background-size:220% 180%; background-position:var(--music-sway,0%) 50%; }
body.messenger-mode .file-item.music-playing .music-aura { opacity:calc(.4 + var(--music-energy,0)*.6); transform:scale(calc(1 + var(--music-energy,0)*.02)); transition:opacity .12s ease,transform .12s ease; }

.music-player h2, .music-player .player-artist { text-align:left; }
.music-player .player-controls button:hover:not(:disabled), .music-player .player-controls button:active:not(:disabled), .music-bar button:hover, .music-bar button:active { color:#fff; background:rgba(255,255,255,.14); }
.music-player button:focus-visible, .music-bar button:focus-visible, .music-bar:focus-visible, .music-bar:has(.music-seek:focus-visible), .player-progress:has(.player-seek:focus-visible) { outline-color:rgba(255,255,255,.9); }
@media(min-width:700px) {
  .music-player { padding:20px; border-radius:22px; }
  .music-player[open] { grid-template-columns:116px minmax(0,1fr) 28px; column-gap:22px; row-gap:7px; }
  .player-cover { width:116px; height:116px; border-radius:14px; }
  .music-player .player-controls { justify-content:flex-start; gap:12px; }
  .music-player .player-controls button { width:40px; height:40px; padding:8px; }
  .music-player .player-toggle { width:44px; height:44px; }
  .music-player .player-dismiss { width:30px; height:30px; }
  .player-progress { margin-top:14px; height:40px; }
}
@media(prefers-reduced-motion:reduce) { body.messenger-mode .file-item.music-playing .music-aura { transform:none; opacity:.55; } }
body.messenger-mode .file-item.music-message:focus,
body.messenger-mode .file-item.music-message:focus-visible { outline:none; }

.media-feed.feed-album-mode .feed-heading { left:auto; right:80px; padding:4px 10px; border-radius:15px; background:#0007; }
#feed-album-dots { margin:0 -72px 7px 0; padding:0; height:24px; pointer-events:auto; }
#feed-album-dots button::before { color:#b3beb9; }
#feed-album-dots button.active::before { color:white; }
.feed-file { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; }
.feed-file-card { display:flex; flex-direction:column; align-items:center; gap:16px; width:min(70vw,420px); padding:24px; text-align:center; color:#fff; }
.feed-file-icon { display:grid; place-items:center; width:86px; height:86px; background:#ffffff12; border-radius:22px; }
.feed-file-icon svg { width:46px; height:46px; }
.feed-file-card strong { max-width:100%; font-size:18px; overflow-wrap:anywhere; }
.feed-file-card > span:not(.feed-file-icon) { color:#a8b4ae; font-size:13px; }
.feed-file-action { display:flex; align-items:center; gap:8px; padding:10px 16px; margin-top:10px; border:0; border-radius:24px; color:white; background:#ffffff1c; font:inherit; cursor:pointer; }
.feed-file-action svg { width:21px; height:21px; }
.media-feed.file-mode { cursor:default; }

/* Do not let the intrinsic width of a horizontal track size the page's grid. */
.app-shell,.card,.transfer-view,.chat,.file-list { min-width:0; }
body.select-mode .attachment-message > .msg-glow { opacity:0; }
body.select-mode .attachment-message.selected > .msg-glow { opacity:1; }
body.select-mode .attachment-message .file-item::after { display:none; }
body.select-mode .attachment-message { cursor:pointer; }
body.select-mode .attachment-message::after { content:''; position:absolute; top:50%; transform:translateY(-50%); width:22px; height:22px; border:2px solid rgba(255,255,255,.4); border-radius:50%; background:rgba(0,0,0,.3); z-index:2; }
body.select-mode .attachment-message.selected::after { border-color:var(--accent-soft); }

/* Shared messenger controls */
:root {
  --control-glass: rgba(128,128,128,.19);
  --control-glass-hover: rgba(128,128,128,.28);
  --control-green: #32c790;
  --control-green-ink: #08251a;
  --control-green-hover: #4bd5a1;
  --control-icon: 20px;
  --control-radius: 14px;
  --control-blur: blur(12px);
  --media-control-glass: rgba(16,22,21,.68);
  --check-svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m5 12 4.5 4.5L19 7' fill='none' stroke='%2308251a' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --download-svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3v12m-5-5 5 5 5-5M5 20h14' fill='none' stroke='%236ee7b7' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.rooms-create svg { width: 21px; height: 21px; }
.msg-menu, html.light .msg-menu, .file-type-carousel { border: 0; box-shadow: 0 14px 42px #0004; }
.msg-menu-item { min-height: 40px; gap: 12px; padding: 8px 12px; border-radius: var(--control-radius); }
.msg-menu-ico, .msg-menu-ico svg { width: var(--control-icon); height: var(--control-icon); }
#msg-info-overlay .modal { width: min(100%, 460px); max-height: 85dvh; overflow: auto; border: 0; border-radius: 24px; }
.msg-info-head { display: flex; align-items: center; gap: 12px; justify-content: space-between; margin-bottom: 14px; text-align: left; }
.msg-info-head .modal-title { margin: 0; }
#msg-info-close { display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 14px; color: var(--text); background: var(--control-glass); }
#msg-info-close:hover { background: var(--control-glass-hover); }
.msg-info { gap: 4px; margin: 0; }
.msg-info-row { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(0, 2fr); padding: 10px; border-radius: 12px; background: var(--control-glass); }
.msg-info-value { white-space: pre-wrap; overflow-wrap: anywhere; }
#search-toggle-btn { position: relative; }
:is(#search-toggle-btn, .drawer-search-toggle) > svg { grid-area: 1 / 1; transition: opacity .23s, transform .3s cubic-bezier(.22,1,.36,1); }
:is(#search-toggle-btn, .drawer-search-toggle) .search-dismiss-icon { opacity: 0; transform: rotate(-90deg) scale(.6); }
:is(#search-toggle-btn, .drawer-search-toggle)[aria-pressed="true"] .search-open-icon { opacity: 0; transform: rotate(90deg) scale(.6); }
:is(#search-toggle-btn, .drawer-search-toggle)[aria-pressed="true"] .search-dismiss-icon { opacity: 1; transform: rotate(0) scale(1); }
@media (prefers-reduced-motion: reduce) {
  .drawer-search, .drawer-search-toggle > svg { transition: none; }
}
.compose-search-tools button { display: grid; place-items: center; padding: 0; }
.compose-search-tools svg { width: 18px; height: 18px; }
.title-wrap .title-side-btn, html.light .title-wrap .title-side-btn,
body.settings-open #settings-toggle-btn, body.rooms-open #rooms-toggle-btn {
  border: 0;
  border-radius: var(--control-radius);
  background: var(--control-glass);
  color: var(--text);
  -webkit-backdrop-filter: var(--control-blur);
  backdrop-filter: var(--control-blur);
}
.title-wrap .title-side-btn:hover, html.light .title-wrap .title-side-btn:hover { background: var(--control-glass-hover); }
.title-wrap .title-side-btn svg { width: var(--control-icon); height: var(--control-icon); }

.text-compose-row { flex-direction: column; align-items: stretch; gap: 8px; }
.compose-field {
  display: flex;
  align-items: flex-end;
  min-width: 0;
  min-height: 48px;
  padding: 4px;
  border-radius: 24px;
  background: var(--control-glass);
  -webkit-backdrop-filter: var(--control-blur);
  backdrop-filter: var(--control-blur);
}
.text-compose #text-input, html.light .text-compose #text-input,
.text-compose #text-input:focus, html.light .text-compose #text-input:focus {
  box-sizing: border-box;
  align-self: center;
  min-height: 40px;
  padding: 9px 10px 9px 14px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.text-compose #text-input::placeholder { font: inherit; }
.compose-field:has(#text-input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.text-compose #mobile-file-btn, html.light .text-compose #mobile-file-btn {
  display: inline-flex !important;
  align-self: flex-start;
  align-items: center;
  justify-content: center;
  flex: none;
  width: auto;
  height: 40px;
  gap: 8px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  color: var(--control-green-ink);
  background: var(--control-green);
  font-size: 14px;
  line-height: 1;
  font-weight: 600;
}
.text-compose #mobile-file-btn svg, .text-compose #text-send svg { width: var(--control-icon); height: var(--control-icon); flex: none; }
body.search-mode .text-compose #mobile-file-btn { display: none !important; }
.text-compose #text-send, html.light .text-compose #text-send {
  box-sizing: border-box;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 20px;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  color: var(--control-green-ink);
  background: var(--control-green);
}
.text-compose #text-send .ico-arrow { display: block; }
body.search-mode .text-compose #text-send .ico-arrow { display: none; }
.text-compose :is(#mobile-file-btn, #text-send):is(:hover,:active),
html.light .text-compose :is(#mobile-file-btn, #text-send):is(:hover,:active) {
  background: var(--control-green-hover);
  color: var(--control-green-ink);
}
.compose-attach-actions { display:flex; flex:0 0 auto; align-items:center; gap:8px; }
.text-compose .compose-attach-actions #mobile-file-btn,
.text-compose .compose-attach-actions #sticker-open {
  align-self:center; flex:0 0 auto; width:auto; min-width:76px; height:40px; padding:0 14px;
  display:inline-flex; flex-direction:row; align-items:center; justify-content:center; gap:7px;
  border:0; border-radius:999px; color:var(--control-green-ink); background:var(--control-green);
  font:inherit; font-size:13px; white-space:nowrap;
}
.text-compose .compose-attach-actions #sticker-open {
  border:0; color:var(--text); background:rgba(128,128,128,.16);
  -webkit-backdrop-filter:blur(14px) saturate(140%); backdrop-filter:blur(14px) saturate(140%);
}
.text-compose .compose-attach-actions #mobile-file-btn {
  border:0;
  color:var(--accent-soft);
  background:rgba(52,211,153,.16);
  -webkit-backdrop-filter:blur(14px) saturate(140%); backdrop-filter:blur(14px) saturate(140%);
}
.text-compose .compose-attach-actions #sticker-open:hover { background:var(--control-glass-hover); }
.text-compose .compose-attach-actions #mobile-file-btn:hover,
.text-compose .compose-attach-actions #mobile-file-btn:active {
  background:rgba(52,211,153,.24);
}
.text-compose .compose-attach-actions :is(#mobile-file-btn,#sticker-open) svg { width:18px; height:18px; }

body.select-mode :is(.file-item, .text-item, .attachment-message).selected::after {
  content: "";
  background: var(--check-svg) center / 17px 17px no-repeat var(--accent-soft);
  border-color: var(--accent-soft);
}
.select-toolbar button, html.light .select-toolbar button {
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: var(--navigation-radius);
  background: var(--control-glass);
}
.select-toolbar button:hover, html.light .select-toolbar button:hover { background: var(--control-glass-hover); }

.settings-panel .settings-section-toggle {
  gap: 12px;
  padding-inline: 12px;
  font-size: 15px;
  font-weight: 500;
}
.settings-panel .settings-section-content { padding-inline: 4px; }
.settings-panel .settings-section-content :is(.menu-row, .title-menu-item, .radio-option) { gap: 10px; padding-inline: 8px; }
.settings-panel :is(.settings-section-icon, .mi-ico), html.light .settings-panel :is(.settings-section-icon, .mi-ico) {
  background: transparent;
  color: var(--text);
}
.settings-panel .room-card, html.light .settings-panel .room-card { border: 0; border-radius: var(--control-radius); background: var(--control-glass); }
.drawer-search, .drawer-search-toggle {
  -webkit-backdrop-filter: var(--control-blur);
  backdrop-filter: var(--control-blur);
}
.drawer-search-toggle {
  display: grid;
  place-items: center;
  box-sizing: border-box;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: var(--control-radius);
  background: var(--control-glass);
  color: var(--text);
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}
.drawer-search-toggle:hover { background: var(--control-glass-hover); }
.drawer-search-toggle:active {
  background: #73777a;
}
.drawer-search-toggle svg, #msg-info-close svg { width: var(--control-icon); height: var(--control-icon); }
.settings-panel .switch, html.light .settings-panel .switch {
  width: 42px;
  height: 24px;
  border: 0;
  background: var(--control-glass);
}
.settings-panel .switch-knob, html.light .settings-panel .switch-knob { top: 3px; left: 3px; background: var(--muted); }
.settings-panel .switch[aria-checked="true"], html.light .settings-panel .switch[aria-checked="true"] { background: var(--control-green); }
.settings-panel .switch[aria-checked="true"] .switch-knob { background: var(--control-green-ink); }
.settings-panel .settings-section-toggle::after { display: none; }
.settings-section-chevron, .settings-panel .row-chevron { display: grid; place-items: center; color: var(--text); }
.settings-section-chevron svg, .settings-panel .row-chevron svg { width: 18px; height: 18px; }
.settings-section-chevron { transition: transform .24s ease; }
.settings-section-toggle[aria-expanded="true"] .settings-section-chevron { transform: rotate(180deg); }

/* Stop momentum scrolling as soon as a mobile drawer starts closing. */
@media (width < 1404px) {
  body:not(.rooms-open) #my-rooms { pointer-events: none; }
  body:not(.rooms-open) #my-rooms .my-rooms-list { overflow-y: hidden; }
  body.rooms-open #my-rooms { pointer-events: auto; }
  body.rooms-open #my-rooms .my-rooms-list { overflow-y: auto; }

  .settings-panel:not(.open) { pointer-events: none; }
  .settings-panel:not(.open) .title-menu { overflow-y: hidden !important; }
  .settings-panel.open { pointer-events: auto; }
  .settings-panel.open .title-menu { overflow-y: auto; }
}
.drawer-swiping,
.drawer-swiping * {
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}
.drawer-swiping .pressed { background: transparent !important; }
#my-rooms[inert] .my-room:not(.active):hover,
.settings-panel[inert] :is(.settings-section-toggle, .menu-row-btn, .title-menu-item:not(.active), .radio-option):hover {
  background: transparent !important;
}
#settings-auto-download-content > .settings-section-content > p { margin: 4px 12px 12px; line-height: 1.45; }
.auto-download-row { min-height: 48px; padding: 10px 8px; gap: 10px; border-radius: 12px; font-size: 14px; }
.auto-download-row .mi-ico { flex: 0 0 20px; width: 20px; height: 20px; }
.auto-download-row .mi-ico svg { width: 18px; height: 18px; }
.auto-download-label { flex: 1 1 auto; min-width: 0; }
.mi-usage-icon { align-self: center; }
.mi-usage-icon svg { display: block; width: 19px; height: 19px; overflow: visible; transform: none; }
.mi-usage-icon .usage-ring-bg { color: var(--control-glass); }
.mi-usage-icon .usage-ring-value { stroke-dasharray: 0 100; color: var(--accent-soft); stroke-linecap: round; }
.auto-download-row:hover { background: var(--control-glass); }
.auto-download-row input {
  appearance: none;
  flex: 0 0 40px;
  width: 40px;
  height: 24px;
  margin: 0;
  border: 0;
  border-radius: 999px;
  background: var(--control-glass);
  cursor: pointer;
}
.auto-download-row input::before {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  margin: 3px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .2s ease;
}
.auto-download-row input:checked { background: var(--control-green); }
.auto-download-row input:checked::before { transform: translateX(16px); background: var(--control-green-ink); }
:is(.draft-attachment-remove, .caption-edit-bar button, .my-room-move) svg { width: 18px; height: 18px; vertical-align: middle; }
.draft-attachment-remove { display: grid; place-items: center; padding: 0; border: 0; }

.music-player .player-dismiss {
  position: absolute;
  grid-area: auto;
  inset: 8px 8px auto auto;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border-radius: 11px;
  background: var(--control-glass);
  color: var(--text);
}
.music-player .player-dismiss:hover { background: var(--control-glass-hover); }
.music-player h2, .music-player .player-artist { padding-right: 6px; }
.music-player .player-controls button { height: auto; min-width: 0; aspect-ratio: 1; flex-shrink: 1; padding: 0; }
.music-player button svg, .music-bar button svg { display: block; width: var(--control-icon); height: var(--control-icon); }
.music-bar button { padding: 0; }
.music-player .player-controls button[aria-pressed="true"] { background: var(--control-green); color: var(--control-green-ink); }
@media (prefers-reduced-motion: reduce) {
  #search-toggle-btn svg, .settings-section-chevron, .auto-download-row input::before { transition: none; }
}

/* Admission requests keep the confirmation below the message on every screen. */
.text-item.room-system-event,
body.messenger-mode .text-item.room-system-event {
  height: auto;
  min-height: var(--chat-card-h);
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  cursor: default;
}
.room-system-event .text-body { order: 0; flex: none; width: 100%; }
.room-system-event .text-content { display: block; -webkit-line-clamp: unset; overflow: visible; }
.room-system-event .room-join-confirm {
  order: 1;
  width: auto;
  min-height: 40px;
  padding: 9px 16px;
  margin: 0;
  font: inherit;
  font-size: 13px;
  border-radius: 10px;
  cursor: pointer;
}
.room-system-event .room-join-confirm:disabled { opacity: .6; cursor: default; }

.settings-panel .settings-section.pressed,
.settings-panel .settings-section.pressed:hover,
.settings-panel :is(.menu-row-btn, .title-menu-item, .radio-option).pressed,
html.light .settings-panel :is(.menu-row-btn, .title-menu-item, .radio-option).pressed {
  background: rgba(128, 128, 128, .3);
  transition: none;
}
.settings-panel .settings-head button.pressed,
html.light .settings-panel .settings-head button.pressed { background: #73777a; transition: none; }

/* The composer field stays calm when focused; center the send control against
   both single and multi-line messages. */
.compose-field { align-items: center; }
.compose-field:has(#text-input:focus-visible) { outline: none; }

.text-compose #text-send .ico-mic { display: none; }
.text-compose #text-send.voice-mic .ico-mic { display: block; }
.text-compose #text-send.voice-mic .ico-arrow { display: none; }
.text-compose #text-send:is(.voice-mic, .voice-recording) {
  touch-action: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.voice-status {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: center;
  gap: 8px;
  padding: 0 4px 0 10px;
  font-size: 13px;
}
#voice-timer { font-variant-numeric: tabular-nums; }
#voice-timer:empty { display: none; }
.voice-status:has(+ .voice-recording) #voice-timer::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: #df4b52;
  content: '';
}
#voice-label { overflow-wrap: anywhere; }
#voice-cancel {
  margin-left: auto;
  padding: 4px 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.voice-message .file-thumb, .voice-message .file-name { display: none; }
.voice-player {
  display: flex;
  width: min(260px, 62vw);
  max-width: 100%;
  min-width: 0;
  align-items: center;
  gap: 10px;
}
.voice-player audio { display: none; }
.voice-controls { flex: 1; min-width: 0; }
.voice-track { position: relative; height: 26px; }
.voice-waveform {
  display: grid;
  grid-template-columns: repeat(48, minmax(0, 1fr));
  align-items: center;
  justify-items: center;
  height: 100%;
}
.voice-waveform i {
  width: 60%;
  max-width: 3px;
  height: 3px;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 36%, transparent);
}
.voice-waveform i.played { background: var(--control-green); }
.voice-seek {
  position: absolute;
  inset: 0;
  appearance: none;
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}
.voice-seek:disabled { cursor: default; }
.voice-seek::-webkit-slider-runnable-track {
  height: 100%;
  background: transparent;
}
.voice-seek::-moz-range-track {
  height: 100%;
  background: transparent;
}
.voice-seek::-webkit-slider-thumb {
  appearance: none;
  width: 1px;
  height: 100%;
  background: transparent;
}
.voice-seek::-moz-range-thumb {
  width: 1px;
  height: 100%;
  border: 0;
  background: transparent;
}
.voice-play-time { display: block; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.voice-play {
  display: inline-grid;
  flex: 0 0 36px;
  height: 36px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--control-green);
  color: var(--control-green-ink);
  cursor: pointer;
}
.voice-play svg { width: 17px; height: 17px; }
.voice-play:disabled { opacity: .6; cursor: wait; }
.voice-message .file-caption { max-width: 44ch; overflow-wrap: anywhere; }
.voice-transcript-status { color: var(--muted); font-size: 12px; }

/* ================================================================
   АЛЬБОМ ВЛОЖЕНИЙ: сетка плиток и общая строка метаданных
   ================================================================ */
/* .attachment-grid напрямую содержит .file-item. Число плиток в ряду приходит
   атрибутом data-album-columns (1|2|3); строки без медиа остаются во всю
   ширину. Родитель может переопределить ширину и пропорцию плитки через
   --album-tile-width / --album-tile-ratio — они важнее простого фолбэка. */
body.messenger-mode .attachment-grid {
  --album-gap: 2px;
  display: flex;
  flex-wrap: wrap;
  gap: var(--album-gap);
  min-width: 0;
  max-width: 100%;
  border-radius: 16px 16px 0 0;
  overflow: hidden;
  background: var(--bubble-bg);
}
body.messenger-mode .attachment-message.group-first.theirs .attachment-grid { border-top-left-radius: 0; }
body.messenger-mode .attachment-message.group-first.mine .attachment-grid { border-top-right-radius: 0; }

body.messenger-mode .attachment-grid > .file-item {
  --album-cols: 1;
  flex: 1 1 var(--album-tile-width, calc((100% - (var(--album-cols) - 1) * var(--album-gap)) / var(--album-cols)));
  min-width: 0;
  max-width: 100%;
  height: auto;
  margin: 0;
}
body.messenger-mode .attachment-grid > .file-item[data-album-columns='2'] { --album-cols: 2; }
body.messenger-mode .attachment-grid > .file-item[data-album-columns='3'] { --album-cols: 3; }

/* Плитка медиа резервирует пропорцию ещё до загрузки картинки: сетка не
   прыгает, а сама картинка обрезается по object-fit: cover. */
body.messenger-mode .attachment-grid > .file-item.media-message {
  align-self: start;
  width: var(--album-tile-width, auto);
  aspect-ratio: var(--album-tile-ratio, 1);
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 0;
  background: rgba(0, 0, 0, .12);
}
body.messenger-mode .attachment-grid > .file-item.media-message .file-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  aspect-ratio: auto;
  border-radius: 0;
  background: rgba(0, 0, 0, .12);
}
body.messenger-mode .attachment-grid > .file-item.media-message .file-thumb img[src] {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  border-radius: 0;
}
/* Кнопка доступа остаётся на плитке, но компактнее — плитки узкие. */
body.messenger-mode .attachment-grid > .file-item.media-message .file-body {
  position: absolute;
  inset: auto 6px 6px;
  width: auto;
  max-width: none;
  min-height: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  pointer-events: none;
}
body.messenger-mode .attachment-grid > .file-item.media-message .file-access {
  min-width: 28px;
  max-width: 100%;
  pointer-events: auto;
  color: #fff;
  background: #0008;
  min-height: 26px;
  padding: 3px 6px;
  font-size: 11px;
  border-radius: 8px;
}
body.messenger-mode .attachment-grid .file-access > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Внутри альбома метаданные общие — на плитках их не дублируем. */
body.messenger-mode .attachment-grid .file-item .msg-status,
body.messenger-mode .attachment-grid .file-item .msg-reaction-list { display: none; }

/* Общий футер альбома: подпись сверху, реакции слева, метаданные справа. */
body.messenger-mode .attachment-footer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  min-width: 0;
  padding: 6px 12px 8px;
}
body.messenger-mode .attachment-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  margin-top: 2px;
}
body.messenger-mode .attachment-meta > .msg-reaction-list { margin-right: auto; }

/* Message actions use the same pills over photos, videos and documents. */
.media-play {
  width: 44px;
  height: 44px;
  border-radius: var(--control-radius);
  background: var(--media-control-glass);
  -webkit-backdrop-filter: var(--control-blur);
  backdrop-filter: var(--control-blur);
}
.media-play svg { display: block; width: 24px; height: 24px; }
body.messenger-mode .file-item .file-access,
body.messenger-mode .attachment-grid > .file-item.media-message .file-access {
  min-height: 32px;
  max-width: 100%;
  gap: 6px;
  padding: 4px 10px;
  border: 0;
  border-radius: 999px;
  background: var(--control-glass);
  color: var(--text);
}
body.messenger-mode .file-item.media-message .file-access,
body.messenger-mode .attachment-grid > .file-item.media-message .file-access {
  color: #fff;
  background: var(--media-control-glass);
}
body.messenger-mode .attachment-message .file-item:not(.media-message) .file-access {
  min-height: 34px;
  margin: 2px 4px 2px 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--control-glass);
  color: var(--text);
}
body.messenger-mode .file-item .file-access > svg,
body.messenger-mode .file-item .file-access > .file-access-label,
body.messenger-mode .file-item .file-access > .file-access-size { position:relative; z-index:2; }
body.messenger-mode .file-item .file-access > .file-access-label { min-width:max-content; overflow:visible; text-overflow:clip; white-space:nowrap; }
body.messenger-mode .file-item .file-access > .file-access-size { flex:0 0 auto; font-size:11px; opacity:.78; white-space:nowrap; }
body.messenger-mode .file-access.access-compact:not(.file-access-loading) > .file-access-label { display:none; }
body.messenger-mode .file-item .file-access { border-radius:999px!important; }
body.messenger-mode .file-item .file-access.file-access-determinate { width:max-content; max-width:none!important; flex:0 0 auto; }
.file-access-progress-fill,
.file-access-progress-glass { position:absolute; inset:0; pointer-events:none; opacity:0; }
.file-access-progress-fill { z-index:0; background:rgba(255,255,255,.1); clip-path:inset(0 calc(100% - var(--file-access-progress,0%)) 0 0); border-right:1px solid rgba(255,255,255,.2); transition:clip-path 120ms linear; }
.file-access-progress-glass { z-index:1; background:rgba(13,23,20,.23); box-shadow:inset 0 1px 0 rgba(255,255,255,.08); }
.file-access-loading .file-access-progress-fill,
.file-access-loading .file-access-progress-glass { opacity:1; }
.file-access-indeterminate .file-access-progress-fill { clip-path:inset(0 82% 0 0); animation:file-access-progress-sweep 1s ease-in-out infinite alternate; }
.file-access:disabled.file-access-loading { opacity:1; }
@keyframes file-access-progress-sweep {
  0% { clip-path:inset(0 82% 0 0); }
  50% { clip-path:inset(0 38% 0 0); }
  100% { clip-path:inset(0 0 0 72%); }
}
.file-access-success-check-icon { position:absolute!important; z-index:3!important; inset:0; width:18px!important; height:18px!important; margin:auto; opacity:0; transform:rotate(120deg) scale(.4); transition:opacity .28s ease,transform .45s cubic-bezier(.22,1,.36,1); pointer-events:none; }
body.messenger-mode .file-item .file-access.file-access-success { box-sizing:border-box; max-width:none!important; pointer-events:none; cursor:default; }
body.messenger-mode .file-item .file-access.file-access-success > svg:first-of-type { opacity:0; transform:rotate(-120deg) scale(.4); transition:opacity .28s ease,transform .45s cubic-bezier(.22,1,.36,1); }
body.messenger-mode .file-item .file-access.file-access-success > .file-access-label,
body.messenger-mode .file-item .file-access.file-access-success > .file-access-size { opacity:0; transform:translateX(-6px) scale(.92); transition:opacity .2s ease,transform .3s cubic-bezier(.22,1,.36,1); }
body.messenger-mode .file-item .file-access.file-access-success-shrinking { width:32px!important; height:32px!important; min-width:32px!important; min-height:32px!important; flex:0 0 32px!important; gap:0!important; padding:0!important; border-radius:50%!important; }
body.messenger-mode .file-item .file-access.file-access-success-check > .file-access-success-check-icon { opacity:1; transform:rotate(0deg) scale(1); }
body.messenger-mode .file-item .file-access.file-access-success-dismiss { width:0!important; height:0!important; min-width:0!important; min-height:0!important; flex:0 0 0!important; margin:0!important; padding:0!important; opacity:0; transform:scale(.55); }
body.messenger-mode .file-item:not(.media-message) .file-size { display:none!important; }
body.messenger-mode .file-item.file-transfer-active .file-note { display:none!important; }

/* ===== Реакции и метаданные сообщения ===== */
/* Реакции — отдельные скруглённые кнопки; нажатая подсвечена акцентом. */
.msg-reaction-list {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
  flex: 0 1 auto;
}
.msg-reaction-list:empty, .msg-status:empty { display: none; }
.msg-reaction-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 22px;
  padding: 2px 7px;
  border: 0;
  border-radius: 11px;
  background: rgba(128, 128, 128, .18);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s ease, color .15s ease;
}
.msg-reaction-chip:hover { background: rgba(128, 128, 128, .28); }
.msg-reaction-chip[aria-pressed='true'] {
  background: rgba(26, 188, 156, .22);
  color: var(--accent-soft);
}
.msg-reaction-chip:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 2px; }

/* Метаданные — одна компактная строка справа: счётчики и время вместе. */
.msg-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  min-width: 0;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}
.msg-status > .msg-stats { margin-left: 0; padding-left: 0; }
body.messenger-mode .msg-status > .msg-stats { flex-wrap: nowrap; }
body.messenger-mode .text-meta { align-self: stretch; }
body.messenger-mode .msg-status > .msg-time { margin-left: 0; }
.file-meta > .msg-status,
.text-meta > .msg-status { margin-left: auto; }
.file-meta > .msg-reaction-list,
.text-meta > .msg-reaction-list { flex: 0 1 auto; min-width: 0; }

/* На медиа поверх фото — одна общая «пилюля» вместо двух отдельных. */
body.messenger-mode .media-message:not(.has-caption) .msg-status {
  padding: 3px 6px;
  border-radius: 8px;
  background: rgba(0, 0, 0, .45);
  color: #fff;
}
body.messenger-mode .media-message .msg-status > .msg-stats,
body.messenger-mode .media-message .msg-status > .msg-time {
  padding: 0;
  border-radius: 0;
  background: none;
  color: inherit;
}
body.messenger-mode .media-message .msg-reaction-chip {
  background: rgba(0, 0, 0, .45);
  color: #fff;
}
body.messenger-mode .media-message .msg-reaction-chip[aria-pressed='true'] {
  background: rgba(26, 188, 156, .55);
  color: #fff;
}

/* Светлая тема: те же формы, но контраст под светлый фон. */
html.light .msg-reaction-chip { background: rgba(15, 40, 32, .07); color: #6b7a86; }
html.light .msg-reaction-chip:hover { background: rgba(15, 40, 32, .12); }
html.light .msg-reaction-chip[aria-pressed='true'] { background: rgba(11, 124, 86, .14); color: #0b7c56; }
html.light body.messenger-mode .media-message .msg-reaction-chip { background: rgba(0, 0, 0, .45); color: #fff; }
html.light body.messenger-mode .media-message .msg-reaction-chip[aria-pressed='true'] { background: rgba(11, 124, 86, .7); color: #fff; }

/* Desktop browser view follows the phone layout without changing phone CSS. */
@media (width > 540px) {
  body:not(.about-page) .card,
  body:not(.about-page) .card:hover,
  html.light body:not(.about-page) .card {
    border-color: transparent;
    border-radius: 0;
    background: transparent;
    background-image: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .chat { overflow-x: hidden; overflow-y: auto; }
  body.messenger-mode .file-list {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    overflow: visible;
  }
}

@media (width > 540px) {
  body:not(.about-page) {
    height: 100dvh;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    background: #000;
  }
  html.light body:not(.about-page) { background: #fff; }

  /* Keep the original chat width, but use the whole viewport height like the
     phone layout so history scrolls between the header and composer. */
  body:not(.about-page) .app-shell {
    height: 100%;
    max-height: none;
  }
  body:not(.about-page) .app-shell > .card {
    height: 100%;
    animation: none;
  }
  #qr-view.room-home-screen { overflow-y: auto; }
}

@media (width >= 1404px) {
  .my-rooms { width: 320px; min-width: 320px; }
  .my-rooms {
    display: none;
    opacity: 1;
    visibility: visible;
    pointer-events: none;
    transform: none;
    transition: none;
  }
  body.rooms-open #my-rooms:not(.hidden) {
    display: flex;
    pointer-events: auto;
  }
  .my-rooms-tilt {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transform: none;
  }
  .my-rooms:hover .my-rooms-tilt { transform: none; }
  .my-rooms :not(.drawer-search, .drawer-search-toggle, .drawer-search-toggle *),
  .my-rooms *::before, .my-rooms *::after {
    animation: none !important;
    transition: none !important;
  }
  .settings-panel,
  .settings-panel.open { transform: none; }
}

@media (width >= 1404px) {
  /* Match the rooms' actual row width to each settings tile. */
  .my-rooms,
  .my-rooms-tilt,
  .my-rooms-scroll,
  .my-rooms-list { box-sizing: border-box; width: 320px; min-width: 320px; }
  .my-rooms-tilt { align-items: stretch; padding: 0 !important; }
  .my-rooms-scroll,
  .my-rooms-list { align-self: stretch; }
  .my-rooms-list { padding-inline: 0; }
  .my-rooms-list > .my-room,
  .my-rooms-list > .my-room-new {
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    flex: 0 0 auto;
  }
}

/* Let desktop history reach the viewport edges behind the chat controls. */
@media (width > 540px) {
  body.chat-open .transfer-view .chat {
    flex: 1 1 0;
    margin-block: 0;
    scroll-padding-top: var(--chat-heading-h, 74px);
    scroll-padding-bottom: var(--compose-h, 0px);
  }
  body.chat-open .transfer-view .text-compose {
    margin-inline: 0;
    padding: 10px 12px;
  }
}

/* Keep the same translucent glass treatment across browser viewport sizes. */
@media (width > 540px) {
  .title-wrap .title-side-btn,
  html.light .title-wrap .title-side-btn { background: var(--control-glass); }
  .title-wrap .title-side-btn:hover,
  html.light .title-wrap .title-side-btn:hover { background: var(--control-glass-hover); }
}

@media (width >= 1404px) {
  .settings-section,
  .settings-section.expanded { background: #151716; }
  .settings-section:hover { background: #1c201e; }
  .my-room,
  .my-room-new,
  html.light .my-room,
  html.light .my-room-new {
    border: 0;
    border-radius: var(--navigation-radius);
    background: #151716;
    box-shadow: none;
  }
  .my-room:hover,
  .my-room-new:hover { background: #1c201e; }
  .my-room.active,
  .my-room-new.active { background: #0e3b2d; }
  html.light .my-room,
  html.light .my-room-new,
  html.light .settings-section,
  html.light .settings-section.expanded { background: #fff; }
  html.light .my-room:hover,
  html.light .my-room-new:hover,
  html.light .settings-section:hover { background: #f1f4f2; }
}

@media (width < 1404px) {
  body.mobile-rooms #my-rooms:not(.hidden) {
    border: 0;
    border-radius: 0;
    box-shadow: 16px 0 48px rgba(0,0,0,.24);
    overflow: hidden;
  }
  .settings-panel,
  .settings-panel.open,
  .settings-panel-tilt,
  .settings-panel-inner,
  .my-rooms,
  .my-rooms-tilt { border-radius: 0; }
}

.settings-panel-inner { border-radius: 0; }

@media (prefers-reduced-motion: reduce) {
  .my-rooms, .settings-panel { transition: none !important; }
}

/* The same panels dock when 700px of chat, two 320px panels and four
   16px gaps fit. The drawer media query in app.js uses the same boundary. */
@media (width >= 1404px) {
  /* Keep the settings heading above the overlapping chat header layer. */
  .settings-panel.open { z-index: 40; }
  .settings-panel.open .settings-head {
    position: relative;
    z-index: 50;
    pointer-events: auto;
  }
  .settings-panel.open .settings-head > button {
    position: relative;
    z-index: 51;
    pointer-events: auto !important;
    cursor: pointer !important;
  }
  .my-rooms, .settings-panel { top: 0; bottom: 0; }
  .settings-panel:not(.open) { pointer-events: none; }
  .settings-panel-tilt { height: 100%; max-height: none; overflow: hidden; }

  /* Заголовки закреплены над списками, которые прокручиваются до краёв окна. */
  .my-rooms-head, .settings-head {
    position: absolute;
    z-index: 2;
    inset: 0 0 auto;
    margin: 0;
    padding: var(--panel-heading-top) 4px 0;
    pointer-events: none;
  }
  :is(.my-rooms-head, .settings-head) button { pointer-events: auto; }
  .my-rooms-scroll, .settings-panel-inner {
    position: absolute;
    inset: 0;
    overflow: hidden;
  }
  .my-rooms-list,
  #settings-panel .title-menu {
    height: 100%;
    max-height: none;
    padding: calc(var(--panel-heading-top) + 44px) 0 max(8px, env(safe-area-inset-bottom));
    overflow: hidden auto;
    overscroll-behavior: contain;
    scroll-padding-top: calc(var(--panel-heading-top) + 44px);
    scrollbar-width: none;
    -webkit-mask-image: var(--panel-heading-mask);
    mask-image: var(--panel-heading-mask);
  }
}

/* Keep the desktop settings title above the scrolling menu, like the rooms title. */
@media (width >= 1404px) {
  .settings-panel .settings-head {
    position: relative;
    z-index: 3;
  }
}

@media (width < 1404px) {
  html { overflow-x: clip; }
  body.mobile-rooms:not(.rooms-open) #my-rooms { visibility: hidden; }
  body.mobile-rooms.rooms-drawer #my-rooms {
    transition: transform .4s cubic-bezier(.22, 1, .36, 1), visibility 0s linear .4s;
  }
  body.mobile-rooms.rooms-open #my-rooms { transition-delay: 0s; }
  body.mobile-rooms:not(.rooms-open) #my-rooms.rooms-swipe-opening { visibility: visible; }
}

@media (prefers-reduced-motion: reduce) {
  body.mobile-rooms.rooms-drawer #my-rooms { transition: none; }
}

/* Shared room and settings visual system. */
#qr-view.room-home-screen .room-home-card {
  border-color: var(--ui-border);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
}
#qr-view.room-home-screen .room-home-header h2 {
  color: var(--ui-text);
  font-size: var(--ui-font-card-title);
}
#qr-view.room-home-screen .room-home-find .room-home-header h2 { font-size: var(--ui-font-card-title); }
#qr-view.room-home-screen .room-home-hint,
#qr-view.room-home-screen .room-home-participants { color: var(--ui-muted); }
#qr-view.room-home-screen .room-home-icon { background: transparent; color: #fff; }
#qr-view.room-home-screen .room-home-go {
  border: 0;
  border-radius: 10px;
  background: var(--ui-accent);
  color: var(--ui-accent-ink);
  font-size: var(--ui-font-row);
}
#qr-view.room-home-screen .room-join-row {
  width: 100%;
  min-height: 54px;
  padding: 5px 14px;
  border-color: var(--ui-border);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
}
#qr-view.room-home-screen .room-code-input { font-size: 16px; color: var(--ui-text); }
#qr-view.room-home-screen .room-code-input::placeholder { font-size: 16px; }
html.light #qr-view.room-home-screen .room-home-icon { color: #fff; }

.my-room,
.my-room-new,
.my-room.active,
.my-room-new.active,
html.light .my-room,
html.light .my-room-new,
html.light .my-room.active,
html.light .my-room-new.active {
  border: 0;
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
  box-shadow: none;
  color: var(--ui-text);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.my-room:hover,
.my-room:focus-visible,
.my-room-new:hover,
.my-room-new:focus-visible,
html.light .my-room:hover,
html.light .my-room:focus-visible,
html.light .my-room-new:hover,
html.light .my-room-new:focus-visible {
  background: var(--ui-surface-hover);
  box-shadow: none;
}
.my-room.active,
.my-room-new.active,
html.light .my-room.active,
html.light .my-room-new.active { background: var(--ui-surface-active); }
.my-room-new-title { font-size: var(--ui-font-row); }
.my-room-time,
.my-room-meta,
.my-room-code-sub,
.my-room-new-sub.is-code { font-size: var(--ui-font-secondary); }
body.new-room-header .title-wrap h1 { font-size: var(--ui-font-page); line-height: 1.2; }
@media (min-width: 1404px) {
  .settings-panel .settings-section,
  .settings-panel .settings-section.expanded,
  html.light .settings-panel .settings-section,
  html.light .settings-panel .settings-section.expanded {
    border-radius: var(--ui-radius);
    background: var(--ui-surface);
  }
  .settings-panel .settings-section:hover,
  .settings-panel .settings-section.expanded:hover,
  html.light .settings-panel .settings-section:hover,
  html.light .settings-panel .settings-section.expanded:hover { background: var(--ui-surface-hover); }
  .settings-panel .settings-section-toggle { border-radius: var(--ui-radius); }
  .settings-panel .settings-section.expanded .settings-section-toggle { background: transparent; }
}




#qr-view .room-unavailable {
  display: grid;
  justify-items: center;
  gap: 1rem;
  max-width: 30rem;
  margin: clamp(1.5rem, 6vh, 4rem) auto;
  padding-inline: 1rem;
  text-align: center;
}
#qr-view .room-unavailable .subtitle,
#qr-view .room-unavailable .room-actions { margin: 0; text-align: center; }
