/* ============================================
   Mini-app Comments — светлая / тёмная тема, mobile-first
   ============================================ */

:root {
  color-scheme: light;
  /* Плавные кривые для 60fps-анимаций (композитор) */
  --ease-out-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in-smooth: cubic-bezier(0.4, 0, 1, 1);
  --ease-in-out-smooth: cubic-bezier(0.45, 0, 0.55, 1);
  --bg: #f5f5f5;
  --surface: #fff;
  --text: #1a1a1a;
  --text-muted: #666;
  --border: #e0e0e0;
  --primary: #007aff;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  /* Теневой бан / модерация в ленте комментариев */
  --comment-shadow-ban-bg: rgba(109, 40, 217, 0.1);
  --comment-shadow-ban-border: rgba(109, 40, 217, 0.42);
  --comment-shadow-ban-text: #4c1d95;
  --comment-shadow-ban-accent: #6d28d9;
  --comment-stopwords-bg: rgba(180, 83, 9, 0.1);
  --comment-stopwords-border: rgba(217, 119, 6, 0.45);
  --comment-stopwords-text: #92400e;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-elevation-3-primary: #00000014;
  --shadow-elevation-3-secondary: #00000014;
  --radius: 8px;
  --radius-sm: 6px;
  --chat-background-background-step-1: #99d5d7;
  --chat-background-background-step-2: #80bcff;
  --chat-background-additional-step-1: #00000000;
  --chat-background-additional-step-2: #00000000;
  --chat-background-additional-step-3: #00000000;
  --chat-background-additional-step-4: #00000000;
  --chat-background-additional-step-5: #00000000;
  --chat-background-additional-step-6: #00000000;
  --chat-background-pattern-gradient-step-1: #007aff38;
  --chat-background-pattern-gradient-step-2: #007aff26;
  --chat-background-pattern-step-1: #00000000;
  --chat-background-pattern-step-2: #00000000;
  --chat-background-pattern-step-3: #00000000;
  --chat-background-pattern-step-4: #00000000;
  --chat-background-pattern-step-5: #00000000;
  --chat-background-pattern-step-6: #00000000;
  /* Паттерн фона (SVG 280×280, в маске — белая заливка). Абсолютный путь, чтобы грузился при любом base. */
  --pattern-url: url("./bg-pattern.svg");
  --bubbles-background-bubble-gradient-step-1: #e9fdff;
  --bubbles-background-bubble-gradient-step-2: #e9fdff;
  --bubbles-background-bubble-gradient-step-3: #e9fdff;
  /* Пустое состояние «Комментариев пока нет...» (капсула) */
  --capsule-outside: #0f8ec285;
  --border-radius-common-m-half: 10px;
  --size-1: 1px;
  --spacing-common-2xs-half: var(--size-1);
  --size-6: 6px;
  --font-bubble-description-size: 14px;
  --font-bubble-description-line-height: 18px;
  --font: -apple-system, BlinkMacSystemFont, "Roboto", system-ui, Avenir, Helvetica, Arial, sans-serif;
  --font-bubble-description-letter-spacing: 0.15px;
  --text-primary-inverse-static: #ffffff;
  /* Время рядом с текстом комментария (тег) */
  --font-bubble-tag-size: 12px;
  --font-bubble-tag-line-height: 14px;
  --font-bubble-tag-letter-spacing: 0.3px;
  --bubbles-text-time: #0f8ec2;
  --header-blur-bg: linear-gradient(to bottom, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.55) 40%, rgba(255, 255, 255, 0.2) 75%, rgba(255, 255, 255, 0.05) 95%, transparent 100%);
  --footer-blur-bg: linear-gradient(to top, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.55) 40%, rgba(255, 255, 255, 0.2) 75%, rgba(255, 255, 255, 0.05) 95%, transparent 100%);
  --comment-other-text: #0c0d0e;
  --comment-mine-text: #052b3c;
  --reply-preview-hover: #e5e7eb;
  --hover-overlay: rgba(0, 0, 0, 0.06);
  --pro-badge-bg: #dbeafe;
  --modal-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  --surface-muted: #f0f0f0;
  --neutral-fill: #e5e7eb;
  /* Чужие пузыри и время (светлая тема) */
  --comment-time-other: #0c0d0e85;
  --comment-bubble-other-bg: var(--surface);
}

/* Явная светлая тема при тёмной системе: иначе Android WebView применяет forced dark и «ломает» палитру */
html.theme-light-explicit {
  color-scheme: only light;
}

/* Тёмная тема: класс .theme-dark на <html> (localStorage max-comments-theme + настройки) */
html.theme-dark {
  color-scheme: dark;
  /* Чуть светлее базовых значений: на Android WebView низкий серый выглядит как #000 */
  --bg: #121214;
  --surface: #2c2d33;
  --text: #ececf1;
  --text-muted: #8e8e93;
  --border: #434448;
  --primary: #5ac8fa;
  --primary-hover: #7dd3fc;
  --danger: #ff453a;
  --success: #32d74b;
  --comment-shadow-ban-bg: rgba(167, 139, 250, 0.14);
  --comment-shadow-ban-border: rgba(196, 181, 253, 0.45);
  --comment-shadow-ban-text: #e9d5ff;
  --comment-shadow-ban-accent: #c4b5fd;
  --comment-stopwords-bg: rgba(251, 191, 36, 0.12);
  --comment-stopwords-border: rgba(252, 211, 77, 0.4);
  --comment-stopwords-text: #fde68a;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  --shadow-elevation-3-primary: #00000055;
  --shadow-elevation-3-secondary: #00000044;
  --chat-background-background-step-1: #1a3d42;
  --chat-background-background-step-2: #243a55;
  --chat-background-pattern-gradient-step-1: #5ac8fa38;
  --chat-background-pattern-gradient-step-2: #5ac8fa28;
  --bubbles-background-bubble-gradient-step-1: #1a3f4a;
  --bubbles-background-bubble-gradient-step-2: #163a45;
  --bubbles-background-bubble-gradient-step-3: #122f38;
  --capsule-outside: rgba(90, 200, 250, 0.35);
  --bubbles-text-time: #6ec4e8;
  --text-primary-inverse-static: #ffffff;
  --comment-other-text: #e8e8ed;
  --comment-mine-text: #c8eef8;
  --header-blur-bg: linear-gradient(to bottom, rgba(38, 40, 46, 0.94) 0%, rgba(38, 40, 46, 0.6) 40%, rgba(38, 40, 46, 0.22) 75%, rgba(38, 40, 46, 0.06) 95%, transparent 100%);
  --footer-blur-bg: linear-gradient(to top, rgba(38, 40, 46, 0.94) 0%, rgba(38, 40, 46, 0.6) 40%, rgba(38, 40, 46, 0.22) 75%, rgba(38, 40, 46, 0.06) 95%, transparent 100%);
  --reply-preview-hover: #404045;
  --hover-overlay: rgba(255, 255, 255, 0.08);
  --pro-badge-bg: rgba(90, 200, 250, 0.18);
  --modal-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
  --surface-muted: #383940;
  --neutral-fill: #45464c;
  /* Чужие пузыри чуть светлее фона; время — как тег в пузыре */
  --comment-bubble-other-bg: #3a404a;
  --comment-time-other: var(--bubbles-text-time);
}

html.theme-dark .banner {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.45);
}

html.theme-dark .banner__text {
  color: #fbbf24;
}

html.theme-dark .reaction-users-backdrop {
  background: rgba(0, 0, 0, 0.35);
}

/* Реакции под чужими сообщениями: не яркий #0f8ec2, а приглушённый акцент */
html.theme-dark .comment.msg--other .reaction-btn {
  background: rgba(90, 200, 250, 0.22);
  color: rgba(255, 255, 255, 0.96);
}

@media (hover: hover) {
  html.theme-dark .comment.msg--other .reaction-btn:hover:not(:disabled) {
    background: rgba(90, 200, 250, 0.32);
  }
}

html.theme-dark .comment.msg--mine .reaction-btn {
  background: rgba(90, 200, 250, 0.22);
  color: #fff;
}

@media (hover: hover) {
  html.theme-dark .comment.msg--mine .reaction-btn:hover:not(:disabled) {
    background: rgba(90, 200, 250, 0.32);
  }
}

html.theme-dark .comment-wrapper--mine .comment__text-row > .comment__time,
html.theme-dark .comment-wrapper--mine .comment__reactions .comment__time {
  color: var(--bubbles-text-time);
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  overscroll-behavior-x: none;
  /* Под overscroll в WebView — не чёрный canvas, а цвет фона чата */
  background-color: var(--chat-background-background-step-2);
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Roboto", system-ui, Avenir, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  position: relative;
  background-color: transparent;
}

/* Фон чата — fixed, не тянется при rubber-band scroll в начале/конце ленты */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  background:
    radial-gradient(57.57% 53.61% at 94.4% 14.38%, var(--chat-background-additional-step-1) 0%, var(--chat-background-additional-step-2) 50%, var(--chat-background-additional-step-3) 100%),
    radial-gradient(140.37% 51.38% at 0% 80.05%, var(--chat-background-additional-step-4) 0%, var(--chat-background-additional-step-5) 50%, var(--chat-background-additional-step-6) 100%),
    linear-gradient(28deg, var(--chat-background-background-step-1) 8.03%, var(--chat-background-background-step-2) 91.51%);
  transform: translateZ(0);
}

/* Слой 3: паттерн с маской (.layer-pattern) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  transform: translateZ(0);
  background: radial-gradient(57.57% 53.61% at 94.4% 14.38%, var(--chat-background-pattern-step-1) 0%, var(--chat-background-pattern-step-2) 50%, var(--chat-background-pattern-step-3) 100%), radial-gradient(140.37% 51.38% at 0% 80.05%, var(--chat-background-pattern-step-4) 0%, var(--chat-background-pattern-step-5) 50%, var(--chat-background-pattern-step-6) 100%), linear-gradient(28deg, var(--chat-background-pattern-gradient-step-1) 8.03%, var(--chat-background-pattern-gradient-step-2) 91.51%);
  mask-image: var(--pattern-url);
  mask-repeat: repeat;
  mask-size: 280px 280px;
  mask-position: 0 0;
  mask-type: luminance;
  -webkit-mask-image: var(--pattern-url);
  -webkit-mask-repeat: repeat;
  -webkit-mask-size: 280px 280px;
  -webkit-mask-position: 0 0;
}

#app {
  max-width: 640px;
  margin: 0 auto;
  padding: 8px;
  padding-top: 75px; /* место под фиксированный header с плавным размытием */
  padding-bottom: 100px; /* место под фиксированную форму ввода */
}

body.app--loading {
  background: linear-gradient(28deg, var(--chat-background-background-step-1) 8.03%, var(--chat-background-background-step-2) 91.51%);
}

/* Контент рисуется под splash (layout/scroll без рывков), взаимодействие выключено */
body.app--loading #app,
body.app--loading #admin-app {
  pointer-events: none;
}

body.app--ready {
  background: transparent;
}

.app-boot-splash {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: linear-gradient(28deg, var(--chat-background-background-step-1) 8.03%, var(--chat-background-background-step-2) 91.51%);
  opacity: 1;
  transition: opacity 0.42s var(--ease-out-smooth);
  will-change: opacity;
  overflow: hidden;
}

/* Тот же паттерн чата, что на body::before — чтобы загрузка не была «плоским» градиентом */
.app-boot-splash::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(57.57% 53.61% at 94.4% 14.38%, var(--chat-background-pattern-step-1) 0%, var(--chat-background-pattern-step-2) 50%, var(--chat-background-pattern-step-3) 100%), radial-gradient(140.37% 51.38% at 0% 80.05%, var(--chat-background-pattern-step-4) 0%, var(--chat-background-pattern-step-5) 50%, var(--chat-background-pattern-step-6) 100%), linear-gradient(28deg, var(--chat-background-pattern-gradient-step-1) 8.03%, var(--chat-background-pattern-gradient-step-2) 91.51%);
  mask-image: var(--pattern-url);
  mask-repeat: repeat;
  mask-size: 280px 280px;
  mask-position: 0 0;
  mask-type: luminance;
  -webkit-mask-image: var(--pattern-url);
  -webkit-mask-repeat: repeat;
  -webkit-mask-size: 280px 280px;
  -webkit-mask-position: 0 0;
}

.app-boot-splash__spinner,
.app-boot-splash__label {
  position: relative;
  z-index: 1;
}

body:not(.app--loading) .app-boot-splash {
  opacity: 0;
  pointer-events: none;
}

.app-boot-splash.is-gone {
  display: none !important;
}

.app-boot-splash__spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spinner-rotate 0.8s linear infinite;
  box-sizing: border-box;
}

.theme-dark .app-boot-splash__spinner {
  border-color: rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
}

.app-boot-splash__label {
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: 0.01em;
}

/* ---- Header: всегда сверху, закреплён, кнопки нажимаются поверх контента ---- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  background: var(--header-blur-bg);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  mask-image: linear-gradient(to bottom, black 0%, black 70%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 0%, black 80%, transparent 100%);
  mask-size: 100% 100%;
  mask-position: 0 0;
  -webkit-mask-size: 100% 100%;
  -webkit-mask-position: 0 0;
}
.header .top-blocks,
.header .below-header-bar {
  pointer-events: auto;
}

.header .top-blocks {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 14px;
  box-sizing: border-box;
}

/* ---- Блоки в хедере (3 карточки + поиск) ---- */
.top-blocks {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  align-items: center;
  width: 100%;
  gap: 8px;
}

/* Анимация появления при закрытии поиска (крестик): блоки плавно появляются, 60fps */
.top-blocks--reappear {
  will-change: opacity;
  transform: translateZ(0);
  animation: top-blocks-reappear 0.28s var(--ease-out-smooth) forwards;
}

@keyframes top-blocks-reappear {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Первый блок — стрелка «назад» (ссылка на google.ru) */
.top-blocks__item--first {
  justify-self: start;
  grid-column: 1;
}

.top-blocks__item--back-link {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.2s var(--ease-out-smooth), transform 0.2s var(--ease-out-smooth);
}

.top-blocks__item--back-link:hover {
  opacity: 0.85;
  transform: scale(0.96);
}

.top-blocks__item--back-link:active {
  transform: scale(0.92);
}

.top-blocks__item--back-link .top-blocks__icon {
  display: block;
  line-height: 0;
}

.top-blocks__item--back-link .top-blocks__icon svg {
  width: 21px;
  height: 21px;
}

/* Второй блок (комментарии + поиск) — по центру */
.top-blocks__item--second {
  justify-self: center;
  grid-column: 2;
}

.top-blocks__comments-head {
  min-width: 0;
}

.top-blocks__comments-head-default {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-blocks__comments-label {
  white-space: nowrap;
}

.top-blocks__comments-search-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 0;
  flex-shrink: 0;
  transition: opacity 0.2s var(--ease-out-smooth), transform 0.2s var(--ease-out-smooth);
}

.top-blocks__comments-search-btn:hover {
  opacity: 0.75;
}

.top-blocks__comments-search-btn:active {
  transform: scale(0.92);
}

.top-blocks__comments-search-btn svg {
  width: 18px;
  height: 18px;
}

/* Обёртка поиска: внутри блока «Комментарии», по умолчанию скрыта */
.top-blocks__search-wrap {
  display: none;
  width: 100%;
  min-width: 0;
  opacity: 0;
  overflow: hidden;
}

@keyframes search-wrap-appear {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes search-wrap-disappear {
  from { opacity: 1; }
  to { opacity: 0; }
}

.top-blocks__search-wrap--closing {
  will-change: opacity;
  transform: translateZ(0);
  animation: search-wrap-disappear 0.25s var(--ease-in-smooth) forwards;
}

.top-blocks.search-active .top-blocks__search-wrap.top-blocks__search-wrap--closing {
  animation: search-wrap-disappear 0.25s var(--ease-in-smooth) forwards;
}

/* Общий блок: поиск + настройки (три точки) в одном фоне */
.top-blocks__actions-group {
  grid-column: 3 / -1;
  grid-row: 1;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-radius: 50px;
  padding: 9px;
  color: var(--text);
}

.top-blocks__actions-group .top-blocks__item--btn {
  background: transparent;
  border-radius: 0;
  flex-shrink: 0;
}

.top-blocks__actions-group .top-blocks__icon svg {
  width: 21px;
  height: 21px;
}

/* Кнопка «Уведомления» (колокольчик) — внутри группы */
.top-blocks__item--notifications {
  /* размещение задаёт родитель */
}

.top-blocks__item--notifications.notif-onboarding-spotlight {
  position: relative;
  z-index: 2;
  background: var(--surface, #fff);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(47, 128, 237, 0.55);
  animation: notif-onboarding-pulse 1.4s ease-out infinite;
}

@keyframes notif-onboarding-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(47, 128, 237, 0.55);
    transform: scale(1);
  }
  55% {
    box-shadow: 0 0 0 12px rgba(47, 128, 237, 0);
    transform: scale(1.08);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(47, 128, 237, 0);
    transform: scale(1);
  }
}

html.theme-dark .top-blocks__item--notifications.notif-onboarding-spotlight {
  box-shadow: 0 0 0 0 rgba(47, 128, 237, 0.65);
}

body.notif-onboarding-step1 .header {
  z-index: 10021;
  /* иначе mask обрезает пульсацию колокольчика */
  mask-image: none;
  -webkit-mask-image: none;
  overflow: visible;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  /* прозрачный: снизу уже оверлей — без второго слоя затемнения */
  background: transparent;
}

body.notif-onboarding-step1 .header .top-blocks,
body.notif-onboarding-step1 .top-blocks {
  overflow: visible;
}

/* без ::after — он давал второе затемнение поверх оверлея */

body.notif-onboarding-step1 .top-blocks__actions-group {
  position: relative;
  z-index: 2;
  overflow: visible;
}

/* остальной хедер визуально «под оверлеем», колокольчик яркий */
body.notif-onboarding-step1 .top-blocks__item--settings,
body.notif-onboarding-step1 .top-blocks__item--back-link,
body.notif-onboarding-step1 .top-blocks__item--first,
body.notif-onboarding-step1 .top-blocks__comments-head,
body.notif-onboarding-step1 .top-blocks__comments-search-btn,
body.notif-onboarding-step1 .top-blocks__search-wrap,
body.notif-onboarding-step1 .top-blocks__item--search-close,
body.notif-onboarding-step1 .top-blocks__item--cancel {
  pointer-events: none;
  opacity: 0.55;
  filter: brightness(0.72);
}

/* Онбординг: шаг 1 — затемнение + тултип у колокольчика */
.notif-onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 10020;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: auto;
}

.notif-onboarding-overlay.hidden,
.notif-onboarding-tooltip.hidden {
  display: none;
}

.notif-onboarding-tooltip {
  position: fixed;
  z-index: 10050;
  width: min(240px, calc(100vw - 24px));
  padding: 14px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  overflow: visible;
  animation: notif-onboarding-tooltip-in 0.28s var(--ease-out-smooth, ease-out) both;
}

.notif-onboarding-tooltip__arrow {
  position: absolute;
  top: -7px;
  left: var(--arrow-left, 50%);
  width: 14px;
  height: 14px;
  margin-left: -7px;
  background: #fff;
  border-radius: 2px;
  transform: rotate(45deg);
  box-shadow: -2px -2px 4px rgba(0, 0, 0, 0.06);
  pointer-events: none;
  z-index: 0;
}

@keyframes notif-onboarding-tooltip-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.notif-onboarding-tooltip__text {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: #111;
  position: relative;
  z-index: 1;
}

.notif-onboarding-tooltip__hint {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.3;
  color: #9ca3af;
  position: relative;
  z-index: 1;
}

html.theme-dark .notif-onboarding-tooltip {
  background: #2c2c2e;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

html.theme-dark .notif-onboarding-tooltip__arrow {
  background: #2c2c2e;
  box-shadow: -2px -2px 4px rgba(0, 0, 0, 0.25);
}

html.theme-dark .notif-onboarding-tooltip__text {
  color: rgba(236, 236, 241, 0.95);
}

html.theme-dark .notif-onboarding-tooltip__hint {
  color: rgba(236, 236, 241, 0.5);
}

.top-blocks__icon--notifications {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.top-blocks__actions-group .top-blocks__item--notifications {
  overflow: visible;
}

.notifications-bell-badge {
  position: absolute;
  top: -7px;
  right: -10px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #007AFF;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-sizing: border-box;
  pointer-events: none;
  z-index: 2;
  box-shadow: 0 0 0 1.5px var(--surface, #fff);
}

.notifications-bell-badge.hidden {
  display: none;
}

.notifications-bell-badge--pop {
  animation: notifications-badge-pop 0.38s var(--ease-out-smooth);
}

@keyframes notifications-badge-pop {
  0% { transform: scale(0.6); }
  55% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* Кнопка «Настройки» — внутри группы */
.top-blocks__item--settings {
  /* размещение задаёт родитель */
}

/* Кнопка "Отменить" — только в режиме выделения для удаления */
.top-blocks__item--cancel {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
}

/* РЕЖИМ ПОИСКА: поле поиска слева, иконка закрытия (крестик) справа */
.top-blocks.search-active {
  grid-template-columns: 1fr auto;
  gap: 16px;
}

.top-blocks.search-active .top-blocks__item--first,
.top-blocks.search-active .top-blocks__actions-group {
  display: none;
}

.top-blocks.search-active .top-blocks__comments-head {
  grid-column: 1;
  justify-self: stretch;
  width: 100%;
  padding: 9px 14px 9px 16px;
}

.top-blocks.search-active .top-blocks__comments-head-default {
  display: none;
}

.top-blocks.search-active .top-blocks__search-wrap {
  display: block;
  width: 100%;
  min-width: 0;
  will-change: opacity;
  transform: translateZ(0);
  animation: search-wrap-appear 0.25s var(--ease-out-smooth) forwards;
}

.top-blocks__comments-head .search-input {
  background-color: transparent;
  border-radius: 50px;
}

.top-blocks__comments-head .search-input__input {
  padding: 0 8px 0 28px;
  min-height: 0;
  line-height: 1.4;
  font-weight: 400;
}

.top-blocks__comments-head .search-input__icon {
  left: 0;
}

.top-blocks__comments-head .search-input__clear {
  margin: 0;
  padding: 2px;
}

.top-blocks.search-active #top-blocks-search-close {
  display: flex !important;
  grid-column: 2;
  justify-self: end;
  padding: 9px;
}

/* Анимация крестика при нажатии: масштаб 1.5 и обратно, 60fps */
@keyframes cross-scale-pop {
  0% { transform: scale(1) translateZ(0); }
  50% { transform: scale(1.5) translateZ(0); }
  100% { transform: scale(1) translateZ(0); }
}

#top-blocks-search-close:active {
  animation: cross-scale-pop 0.35s var(--ease-out-smooth);
}

.top-blocks__item {
  background: var(--surface);
  color: var(--text);
  padding: 9px 9px;
  border-radius: 50px;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  transition: opacity 0.2s var(--ease-out-smooth), transform 0.2s var(--ease-out-smooth);
}
.top-blocks__item--second { 
  padding: 9px 25px;  
}

.top-blocks__plan-btn {
  height: 45px;
  cursor: pointer;
  border: none;
  font: inherit;
  text-align: center;
  font-weight: 600;
  font-size: 13px;
}

.top-blocks__plan-btn:hover {
  opacity: 0.9;
}

.top-blocks__plan-btn--pro {
  background: var(--pro-badge-bg);
  color: var(--primary);
}

/* Полоска под шапкой: кнопка «назад» (модалка-заглушка) */
.below-header-bar {
  display: flex;
  align-items: center;
  padding: 8px 12px 12px;
  max-width: 640px;
  margin: 0 auto;
}
.below-header-bar.hidden {
  display: none;
}
.below-header-bar__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: var(--capsule-outside);
  color: var(--text);
  cursor: pointer;
  -webkit-backdrop-filter: blur(25px);
  backdrop-filter: blur(25px);
}
.below-header-bar__btn:hover {
  opacity: 0.9;
}
.below-header-bar__icon {
  display: block;
  line-height: 0;
}
.below-header-bar__icon svg {
  display: block;
  width: 24px;
  height: 24px;
}
.below-header-bar__btn.top-blocks__plan-btn--pro .below-header-bar__icon {
  color: var(--primary);
}

.top-blocks__item--btn {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  padding: 0; 
  transition: opacity 0.2s var(--ease-out-smooth), transform 0.2s var(--ease-out-smooth);
}

.top-blocks__item--btn:hover {
  opacity: 0.85;
  transform: scale(0.96);
}

.top-blocks__item--btn:active {
  transform: scale(0.92);
}

.top-blocks__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.top-blocks__icon svg {
  width: 21px;
  height: 21px;
}

.top-blocks__icon.hidden {
  display: none !important;
}

/* Поле поиска в стиле MAX UI SearchInput (doc/max-ui SearchInput) */
.search-input {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  background-color: var(--surface);
  border-radius: var(--radius);
  position: relative;
  box-sizing: border-box;
}

@media (hover: hover) and (pointer: fine) {
  .search-input:hover {
    background-color: var(--surface);
  }
}

.search-input:active {
  background-color: var(--surface);
}

.search-input__icon {
  position: absolute;
  left: 12px;
  top: 0;
  bottom: 0;
  margin: auto 0;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
  pointer-events: none;
}

.search-input__body {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

.search-input__input {
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  width: 100%;
  padding: 9px 12px 9px 40px;
  border: none;
  background: transparent;
  font: inherit;
  font-weight: 400;
  color: var(--text);
  font-size: 15px;
  line-height: 1.4;
  outline: none;
  appearance: none;
}

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

.search-input__clear {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  margin: 0 4px 0 0;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
}

.search-input__clear:hover {
  color: var(--text);
}

.search-input__clear:active {
  animation: cross-scale-pop 0.35s var(--ease-out-smooth);
}

.search-input__clear.hidden {
  display: none !important;
}

/* Режим выделения: вместо кнопки поиска показываем «Отменить» */
.top-blocks--selection .top-blocks__search-wrap,
.top-blocks--selection .top-blocks__comments-search-btn,
.top-blocks--selection .top-blocks__actions-group,
.top-blocks--selection #top-blocks-search-close {
  display: none;
}

.top-blocks__item--cancel {
  display: none;
  min-width: auto;
  padding-left: 14px;
  padding-right: 14px;
  font-size: 15px;
}

.top-blocks--selection .top-blocks__item--cancel {
  display: flex !important;
  font-family: -apple-system, BlinkMacSystemFont, "Roboto", system-ui, Avenir, Helvetica, Arial, sans-serif;
    padding: 9px 12px;
}


.header__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.header__title-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.header__name {
  font-weight: 600;
  margin: 0;
}

.header__badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--neutral-fill);
  color: var(--text-muted);
}

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

.header__count-wrap {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.header__count-wrap .header__comments-count {
  color: var(--text-muted);
  font-weight: 500;
}

.header__count-wrap.hidden {
  display: none;
}

.header__badge--pro {
  background: var(--pro-badge-bg);
  color: var(--primary);
}

/* ---- Banner уведомлений ---- */
.banner {
  padding: 12px 14px;
  margin-bottom: 12px;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: var(--radius);
}

.banner--hidden {
  display: none;
}

.banner__text {
  margin: 0 0 10px 0;
  font-size: 14px;
  color: #92400e;
}

.banner__text.hidden {
  display: none;
}

.banner__btn {
  width: 100%;
  box-sizing: border-box;
}

/* ---- Заглушка для забаненных (глобально или в канале): на весь экран, без элементов управления, не скрывается ---- */
.banned-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg, #f5f5f5);
  padding: 24px;
  box-sizing: border-box;
}

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

.banned-overlay__inner {
  max-width: 320px;
  text-align: center;
}

.banned-overlay__text {
  margin: 0;
  font-size: 17px;
  line-height: 1.4;
  color: var(--text, #1a1a1a);
}

/* ---- Гейт: защита от скриншотов на web/desktop (MAX Bridge platform) ---- */
.screenshot-platform-gate {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg, #f5f5f5);
  padding: 24px 20px;
  box-sizing: border-box;
}

.screenshot-platform-gate.hidden {
  display: none;
}

.screenshot-platform-gate__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 340px;
  text-align: center;
}

.screenshot-platform-gate__anim {
  width: 220px;
  height: 220px;
  margin: 0 auto 20px;
  flex-shrink: 0;
}

.screenshot-platform-gate__anim canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.screenshot-platform-gate__title {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text, #1a1a1a);
  letter-spacing: -0.02em;
}

.screenshot-platform-gate__text {
  margin: 0 0 28px;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--text, #1a1a1a);
  max-width: 280px;
}

.screenshot-platform-gate__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 12px 20px;
  border: none;
  border-radius: 12px;
  background: var(--primary, #007aff);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}

.screenshot-platform-gate__btn:hover {
  background: var(--primary-hover, #1d4ed8);
}

.screenshot-platform-gate__btn:active {
  transform: scale(0.98);
}

body.screenshot-platform-gated #app {
  visibility: hidden;
  pointer-events: none;
}

/* ---- Пост в начале страницы комментариев (текст из session) ---- */
.post-preview {
  max-width: 85%;
  margin-left: 0;
  margin-right: 0;
  margin-bottom: 16px;
  background: var(--surface);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.post-preview.hidden {
  display: none;
}

.post-preview--enter {
  will-change: transform, opacity;
  transform: translateZ(0);
  animation: post-preview-enter 0.3s var(--ease-out-smooth) forwards;
}

@keyframes post-preview-enter {
  from { opacity: 0; transform: scale(0.96) translateZ(0); }
  to { opacity: 1; transform: scale(1) translateZ(0); }
}

/* Галерея поста: сетка превью; по клику на картинку открывается слайдер */
.post-preview__gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1px;
  margin-bottom: 12px;
}

/* Одна картинка/видео — без сетки, на всю ширину */
.post-preview__gallery:has(> *:only-child) {
  display: block;
}

/* Один .post-preview__media-link — скругление только сверху */
.post-preview__gallery:has(> .post-preview__media-link:only-child) > .post-preview__media-link {
  border-radius: 10px 10px 0 0;
}

/* Два элемента — скругление слева сверху у первого, справа сверху у второго */
.post-preview__gallery:has(> *:nth-child(2)):not(:has(> *:nth-child(3))) > *:first-child {
  border-radius: 10px 0 0 0;
  overflow: hidden;
}
.post-preview__gallery:has(> *:nth-child(2)):not(:has(> *:nth-child(3))) > *:last-child {
  border-radius: 0 10px 0 0;
  overflow: hidden;
}

.post-preview__gallery.hidden {
  display: none;
}

.post-preview__gallery:last-child {
  margin-bottom: 0;
}

.post-preview__slide {
  /* обёртка только для видео в сетке */
}

.post-preview__media-link {
  display: block;
  overflow: hidden;
}

.post-preview__media {
  display: block;
  width: 100%;
  background: var(--border);
  cursor: pointer;
}

.post-preview__media--img {
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  vertical-align: top;
}

.post-preview__media--video {
  aspect-ratio: 16 / 9;
  object-fit: contain;
  max-height: 240px;
}

.post-preview__text {
  font: 400 15px / 1.45 var(--font);
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  padding: 0 0 10px 16px;
}

/* ---- Слайдер галереи (открывается по клику на картинку в посте) ---- */
.gallery-slider {
  position: absolute;
  inset: 0;
  z-index: 2300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.95);
}

.gallery-slider.hidden {
  display: none;
}

.gallery-slider__backdrop {
  position: absolute;
  inset: 0;
  cursor: pointer;
}

.gallery-slider__close,
.gallery-slider__download {
  position: absolute;
  top: 12px;
  z-index: 2003;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s var(--ease-out-smooth), opacity 0.15s var(--ease-out-smooth);
}

.gallery-slider__close:active,
.gallery-slider__download:active {
  background: rgba(255, 255, 255, 0.32);
}

.gallery-slider__close {
  right: 12px;
}

.gallery-slider__download {
  left: 12px;
}

.gallery-slider__close-icon,
.gallery-slider__download-icon {
  display: block;
  flex-shrink: 0;
}

.gallery-slider__track {
  position: relative;
  z-index: 2001;
  width: 100%;
  height: 100%;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.gallery-slider__track::-webkit-scrollbar {
  display: none;
}

.gallery-slider__slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  padding: 50px 16px 60px;
  box-sizing: border-box;
}

/* Обёртка для жестов увеличения картинки (pinch, double-tap). touch-action задаётся из JS: pan-x при scale 1 (свайп влево/вправо — смена слайда), none при zoom. */
.gallery-slider__slide-zoom {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: pan-x;
  -webkit-user-select: none;
  user-select: none;
}

.gallery-slider__slide-zoom img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transform-origin: center center;
}

.gallery-slider__slide img,
.gallery-slider__slide video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.gallery-slider__slide video {
  width: 100%;
}

.gallery-slider__counter {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2002;
  font: 500 14px / 1.2 var(--font);
  color: rgba(255, 255, 255, 0.9);
}

/* Кнопка FREE/PRO перед «Начало обсуждения» — открывает модалку тарифов */
.plan-btn-block {
  margin-bottom: 12px;
  text-align: center;
}

.plan-btn-block.hidden {
  display: none;
}

.plan-btn-block__btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 10px;
}

/* ---- Начало обсуждения (капсула как у «Комментариев пока нет») ---- */
.post-block {
  margin-bottom: 12px;
  text-align: center;
}

.post-block__capsule {
  display: block;
  width: fit-content;
  margin: 0 auto;
  padding: var(--size-1) 8px;
  background: var(--capsule-outside);
  border-radius: var(--border-radius-common-m-half);
  font: 400 var(--font-bubble-description-size) / var(--font-bubble-description-line-height) var(--font);
  letter-spacing: var(--font-bubble-description-letter-spacing);
  color: var(--text-primary-inverse-static);
  -webkit-backdrop-filter: blur(25px);
  backdrop-filter: blur(25px);
  margin-bottom: 0;
}

/* Разделители дат в ленте комментариев (тот же стиль, что «Начало обсуждения»). В контейнере с align-items: flex-start растягиваем на всю ширину, чтобы капсула центрировалась. */
.post-block.comments-date-separator {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  align-self: stretch;
}
.comments-date-separator {
  margin-top: 12px;
}
.comments-date-separator:first-child {
  margin-top: 0;
}

/* Блок «Закреплённое» над закреплённым комментарием — визуально отделён от дат */
.comments-date-separator--pinned .post-block__capsule {
 
}

/* Анимация закрепления: комментарий исчезает на месте и появляется сверху */
.comment-wrapper--pin-leave {
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.2s var(--ease-out-smooth), transform 0.2s var(--ease-out-smooth);
}

.comment-wrapper--pin-leave-active {
  opacity: 0;
  transform: scale(0.96);
}

.comment-wrapper--pin-enter {
  opacity: 0;
  transform: translateY(-12px);
}

.comment-wrapper--pin-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.25s var(--ease-out-smooth), transform 0.25s var(--ease-out-smooth);
}

/* Анимация открепления: комментарий исчезает сверху и появляется на своём месте в ленте */
.comment-wrapper--unpin-leave {
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.2s var(--ease-out-smooth), transform 0.2s var(--ease-out-smooth);
}

.comment-wrapper--unpin-leave-active {
  opacity: 0;
  transform: scale(0.96);
}

.comment-wrapper--unpin-enter {
  opacity: 0;
  transform: translateY(-12px);
}

.comment-wrapper--unpin-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.25s var(--ease-out-smooth), transform 0.25s var(--ease-out-smooth);
}

/* ---- Размытие под футером: как у хедера (градиент + лёгкий blur), маска только внизу — выше футера теней нет ---- */
.footer-blur {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(12px + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
  z-index: 45;
  background: var(--footer-blur-bg);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  mask-image: linear-gradient(to top, black 0%, black 70%, transparent 100%);
  -webkit-mask-image: linear-gradient(to top, black 0%, black 70%, transparent 100%);
  mask-size: 100% 100%;
  mask-position: 0 0;
  -webkit-mask-size: 100% 100%;
  -webkit-mask-position: 0 0;
}

/* ---- Форма ввода: всегда снизу, закреплена, кнопки нажимаются поверх контента ---- */
.tg-composer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 14px;
  /* Меньший базовый отступ — на Android (safe-area 0) поле ближе к низу; на iOS safe-area добавляется */
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  max-width: 640px;
  margin: 0 auto;
  z-index: 9998;
  transition: padding 0.28s var(--ease-out-smooth);
  --composer-padding-r: 14px;
}

/* Курсор в textarea: меньше боковые отступы */
.tg-composer.tg-composer--focused {
  padding-left: 8px;
  padding-right: 8px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  --composer-padding-r: 8px;
}

/* Зажатие: scale всего блока; у input обратный scale, чтобы курсор не дёргался */
.tg-composer__author-input-wrap {
  transform-origin: center center;
  transition: transform 0.35s cubic-bezier(0.34, 1.2, 0.64, 1),
              box-shadow 0.35s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.tg-composer__author-input-wrap--pressed {
  transform: scale(1.015);
  box-shadow: 0 6px 20px 0 var(--shadow-elevation-3-primary, rgba(0, 0, 0, 0.12)), 0 0 2px 0 var(--shadow-elevation-3-secondary, rgba(0, 0, 0, 0.08));
}

.tg-composer__author-input-wrap--pressed .tg-composer__input {
  transform: scale(0.985); /* 1/1.015 — компенсация, чтобы курсор не дёргался */
}

.tg-composer.hidden {
  display: none !important;
}

/* Ширина как у tg-composer__author-input-wrap: тот же слот (attach 40 + gap 4 | flex:1 | gap 4 + send 40) */
.tg-composer__reply {
  display: flex;
  align-items: center;
  padding: 6px 10px 6px 12px;
  margin-left: 44px;
  margin-right: 44px;
  width: calc(100% - 88px);
  box-sizing: border-box;
  border-radius: 12px;
  position: relative;
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
  background: var(--surface);
}

.tg-composer__reply-inner {
  display: flex;
  flex: 1;
  min-width: 0;
  position: relative;
  border-left: 2px solid #007aff;
  padding-left: 5px;
  padding-top: 1px;
  padding-bottom: 1px;
  flex-direction: column;
}

.tg-composer__reply.hidden {
  display: none !important;
}

.tg-composer__reply-author {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  flex-shrink: 0;
}

.tg-composer__reply-snippet {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.tg-composer__reply-close {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tg-composer__reply-close svg {
  display: block;
}

.tg-composer__reply-close:active {
  animation: cross-scale-pop 0.35s var(--ease-out-smooth);
}

.tg-composer__reply-close:hover {
  background: var(--hover-overlay);
  color: var(--text);
}

/* Когда блок ответа виден над полем ввода — у поля убираем верхние скругления
   (между превью ответа и строкой ввода — превью вложений / уведомление, не сосед) */
.tg-composer__reply:not(.hidden) ~ .tg-composer__row .tg-composer__author-input-wrap {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.tg-composer__row {
  display: flex;
  gap: 4px;
  border-radius: 16px;
  overflow: hidden;
  align-items: center;
}

.tg-composer__row.hidden {
  display: none;
}

.tg-composer__admin-only-notice {
  margin: 0;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.35;
  color: var(--text-secondary, #6b7280);
  text-align: center;
}

.tg-composer__admin-only-notice.hidden {
  display: none;
}

.tg-composer__attach {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  box-shadow: 0 4px 16px 0 var(--shadow-elevation-3-primary), 0 0 2px 0 var(--shadow-elevation-3-secondary);
  background: var(--surface);
  border-radius: 50%;
  cursor: pointer;
}

.tg-composer__sticker {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  color: var(--text-muted);
  background: var(--surface);
  box-shadow: 0 4px 16px 0 var(--shadow-elevation-3-primary), 0 0 2px 0 var(--shadow-elevation-3-secondary);
  cursor: pointer;
  transition: color .18s ease, transform .18s ease, background .18s ease;
}

.tg-composer__sticker:hover,
.tg-composer__sticker.is-active {
  color: var(--primary);
  background: var(--surface);
}

.tg-composer__sticker:active {
  transform: scale(.94);
}

.tg-composer--selection-mode .tg-composer__sticker {
  display: none !important;
}

.sticker-picker {
  margin: 0 0 8px;
  padding: 10px 10px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: 0 12px 36px rgba(15, 23, 42, .18);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  transform-origin: bottom center;
  animation: sticker-picker-in .2s var(--ease-out-smooth);
}

.sticker-picker.hidden {
  display: none !important;
}

.sticker-picker__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
  padding: 0 4px 6px 8px;
}

.sticker-picker__title {
  font: 600 14px/1.2 var(--font);
  color: var(--text);
}

.sticker-picker__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
}

.sticker-picker__close:active {
  transform: scale(.92);
}

.sticker-picker__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  max-height: min(42vh, 320px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px;
}

.sticker-picker__item {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  padding: 4px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  cursor: pointer;
  transition: background .16s ease, transform .16s ease;
}

.sticker-picker__item:hover {
  background: var(--hover-overlay);
}

.sticker-picker__item:active {
  transform: scale(.88);
}

.sticker-picker__emoji {
  font-size: 50px;
  line-height: 1;
  filter: drop-shadow(0 3px 4px rgba(15, 23, 42, .12));
}

.sticker-picker__image {
  display: block;
  width: 68px;
  height: 68px;
  object-fit: contain;
}

.sticker-picker__empty {
  margin: 16px 0;
  color: var(--text-muted);
  text-align: center;
  font-size: 14px;
}

@keyframes sticker-picker-in {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.comment__sticker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 128px;
  min-height: 112px;
  margin: 2px auto 0;
}

.comment__sticker-image {
  display: block;
  width: 128px;
  height: 128px;
  object-fit: contain;
}

.comment__sticker-emoji {
  font-size: 86px;
  line-height: 1.18;
  filter: drop-shadow(0 4px 6px rgba(15, 23, 42, .16));
}

.comment-wrapper--sticker .comment__text:empty {
  display: none;
}

.tg-composer__attach-icon {
  display: block;
  width: 30px;
  height: 30px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.tg-composer__attach-icon--dark {
  display: none;
}

html.theme-dark .tg-composer__attach-icon--light {
  display: none;
}

html.theme-dark .tg-composer__attach-icon--dark {
  display: block;
}

.tg-composer__file-preview-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  margin-top: 6px;
  border-radius: 8px;
  background: var(--surface);
  font-size: 13px;
  max-width: 100%;
}

.tg-composer__file-preview-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: block;
  object-fit: contain;
}

.tg-composer__file-preview-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Режим выделения: корзина в том же слоте, что и скрепка (скрепка скрыта) */
.tg-composer--selection-mode .tg-composer__attach {
  display: none !important;
}

.tg-composer__selection-delete {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 4px 16px 0 var(--shadow-elevation-3-primary), 0 0 2px 0 var(--shadow-elevation-3-secondary);
  color: var(--text-muted);
  cursor: pointer;
}

.tg-composer__selection-delete:hover:not(:disabled) {
  background: var(--hover-overlay);
  color: var(--text);
}

.tg-composer__selection-delete:active:not(:disabled) {
  transform: scale(0.95);
}

.tg-composer__selection-delete:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.tg-composer__selection-delete svg {
  display: block;
}

.tg-composer__author-input-wrap {
  position: relative;
  display: flex;
  flex: 1;
  gap: 4px;
  align-items: center;
  min-width: 0;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 4px 16px 0 var(--shadow-elevation-3-primary), 0 0 2px 0 var(--shadow-elevation-3-secondary);
}

.tg-composer__author {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 40px;
  height: 40px;
}

.tg-composer__author-avatar-btn,
.tg-composer__author-close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-sizing: border-box;
}

.tg-composer__author-avatar-btn {
  /* Один фон с полем ввода (родитель .tg-composer__author-input-wrap), без второй тени и слоя surface */
  background: transparent;
  box-shadow: none;
  overflow: hidden;
  padding: 4px;
  position: relative;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.tg-composer__author-avatar {
  position: absolute;
  inset: 4px;
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  pointer-events: none;
  z-index: 1;
}

.tg-composer__author-avatar.hidden {
  display: none !important;
}

.tg-composer__author-avatar-placeholder {
  position: absolute;
  inset: 4px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-muted);
  pointer-events: none;
  z-index: 0;
}

.tg-composer__author-avatar-placeholder.hidden {
  display: none !important;
}

.tg-composer__author-close {
  background: var(--primary);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  position: absolute;
  inset: 0;
}

.tg-composer__author-avatar-btn.hidden,
.tg-composer__author-close.hidden {
  display: none !important;
}

.tg-composer__input {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  padding: 10px 2px;
  border: none;
  border-radius: 20px;
  font-size: 17px;
  color: var(--text);
  background: transparent;
  resize: none;
  margin: 0;
  appearance: none;
  outline: none;
  transform-origin: center center;
  transition: transform 0.35s cubic-bezier(0.34, 1.2, 0.64, 1);
  /* iOS WebView: не гасим системное меню "Вставить" по long-press */
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

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

.tg-composer__input:focus {
  outline: none;
}

.tg-composer__input--reset-height {
  transition: height 0.28s var(--ease-out-smooth);
}

.tg-composer__send-wrap {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  background: var(--surface);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  justify-content: center;
  box-shadow: 0 4px 16px 0 var(--shadow-elevation-3-primary), 0 0 2px 0 var(--shadow-elevation-3-secondary);
}

.tg-composer__send {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.tg-composer__send:hover:not(:disabled) {
  background: var(--primary-hover);
}

.tg-composer__send:active:not(:disabled) {
  transform: scale(0.95);
}

.tg-composer__send:disabled,
.tg-composer__send--busy {
  cursor: default;
  opacity: 0.92;
}

.tg-composer__send--busy:active {
  transform: none;
}

.tg-composer__send--busy > svg:first-of-type,
.tg-composer__send--slow > svg:first-of-type {
  visibility: hidden;
}

.tg-composer__send--slow {
  cursor: default;
}

.tg-composer__send--slow:active {
  transform: none;
}

.tg-composer__send-timer {
  position: absolute;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.tg-composer__send-timer.hidden {
  display: none;
}

.tg-composer__send-spinner {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  box-sizing: border-box;
  animation: tg-composer-send-spin 0.65s linear infinite;
}

.tg-composer__send-spinner.hidden {
  display: none;
}

@keyframes tg-composer-send-spin {
  to {
    transform: rotate(360deg);
  }
}

.tg-composer__send svg {
  color: #fff;
}

.tg-composer__attach-hidden {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

/* Предпросмотр вложения над полем ввода */
.tg-composer__attachment-preview {
  display: none;
  margin: 0 8px 8px 8px;
}

.tg-composer__attachment-preview--visible {
  display: block;
}

.tg-composer__attachment-preview--visible.tg-composer__attachment-preview--grid .tg-composer__attachment-preview-inner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  max-width: 100%;
}

.tg-composer__attachment-preview-item {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 2px 8px 0 var(--shadow-elevation-3-primary, rgba(0,0,0,0.08)), 0 0 1px 0 var(--shadow-elevation-3-secondary, rgba(0,0,0,0.04));
  aspect-ratio: 1;
}

.tg-composer__attachment-preview-item .tg-composer__attachment-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.tg-composer__attachment-preview-item .tg-composer__attachment-img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
}

.tg-composer__attachment-preview-item .tg-composer__attachment-img--video {
  object-fit: contain;
  background: rgba(0, 0, 0, 0.06);
}

.tg-composer__attachment-preview-item .tg-composer__attachment-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.3);
}

.tg-composer__attachment-preview-inner {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 4px 16px 0 var(--shadow-elevation-3-primary), 0 0 2px 0 var(--shadow-elevation-3-secondary);
}

.tg-composer__attachment-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.tg-composer__attachment-remove:hover {
  background: rgba(0,0,0,0.75);
}

.tg-composer__attachment-remove:active {
  transform: scale(0.95);
}

.tg-composer__attachment-remove svg {
  display: block;
}

.tg-composer__attachment-img {
  display: block;
  max-width: 72px;
  max-height: 72px;
  object-fit: cover;
}

.tg-composer__attachment-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.3);
}

.comment__attachment-files {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
  /* В сетке превью фото блок файлов иначе занимает только одну колонку (~половина 280px) */
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
}

/* Только файлы (без превью картинок) — ширина как у текста пузыря, не 280px-сетка превью */
.comment__attachments:has(.comment__attachment-files):not(:has(.comment__attachment-link)) {
  max-width: 100%;
}

.comment__file-link {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.35);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 15px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: normal;
}

html.theme-dark .comment__file-link {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
}

.comment__file-link--with-icon {
  align-items: flex-start;
  gap: 10px;
}

.comment__file-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: block;
  object-fit: contain;
}

.comment__file-link-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.comment__file-name {
  font-weight: 500;
  overflow-wrap: anywhere;
  word-break: normal;
}

.comment__file-meta {
  opacity: 0.7;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.comment__file-link:hover {
  text-decoration: underline;
}

.comment__file-link--pending {
  pointer-events: none;
  text-decoration: none;
  opacity: 0.9;
}

.comment__file-link .comment__attachment-spinner {
  position: relative;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.comment__file-link .comment__attachment-spinner::after {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.12);
  border-top-color: var(--color-primary, #2481cc);
  animation: spinner-rotate 1s linear infinite;
}

.tg-composer__attachment-spinner::after {
  content: "";
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.5);
  border-top-color: #fff;
  animation: spinner-rotate 1s linear infinite;
}

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

/* ---- Comments list ---- */
/* Поиск по комментариям (показывается когда есть комментарии). Стиль как в TG: сначала иконка, по нажатию — строка поиска */
.comments-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 0 4px;
}

.comments-search.hidden {
  display: none;
}

/* Кнопка-иконка поиска (как в Telegram) */
.comments-search__trigger {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--bg);
  color: var(--primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.1s;
}

.comments-search__trigger:hover {
  background: rgba(0, 0, 0, 0.06);
}

.comments-search__trigger:active {
  transform: scale(0.96);
}

.comments-search__trigger-icon {
  display: block;
}

/* Панель с полем ввода (показывается после нажатия на иконку) */
.comments-search__panel {
  display: none;
  flex: 1;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.comments-search--open .comments-search__panel {
  display: flex;
}

.comments-search__input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  font: 400 15px / 1.3 var(--font);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--border-radius-common-m-half);
  box-shadow: var(--shadow);
  -webkit-appearance: none;
  appearance: none;
}

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

.comments-search__input:focus {
  outline: none;
  border-color: var(--primary);
}

.comments-search__clear {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}

.comments-search__clear:hover {
  color: var(--text);
  background: var(--surface-muted);
}

.comments-search__clear.hidden {
  display: none;
}

.comments__container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* На время backfill-перерисовки: холст прежней высоты, без мигания пустого DOM */
.comments__container--reflow {
  visibility: hidden;
}

/* Режим выделения: чекбоксы слева. Чужие — отъезжают вправо (padding-left), свои — без сдвига */
.comments__container--selection .comment-wrapper {
  margin-left: -12px;
  padding-left: 48px;
}

.comments__container--selection .comment-wrapper--other {
  margin-left: 0;
  padding-left: 48px;
}

/* Свои комментарии в режиме выбора: чекбокс слева, пузырь справа; блок тоже отъезжает вправо (padding-left), при отмене/удалении заезжает обратно */
.comments__container--selection .comment-wrapper--mine {
  width: 100%;
  max-width: 100%;
  margin-left: auto;
  margin-right: 0;
  padding-left: 48px;
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
}

.comments__container--selection .comment-wrapper--mine .comment {
  width: auto;
  max-width: 100%;
}

/* Стрелка ответа у своих в режиме выбора — спрятана, но место сохраняется, пузырь (msg--mine) не сдвигается */
.comments__container--selection .comment-wrapper--mine .comment__swipe-icon-wrap {
  top: auto;
  bottom: auto;
  flex-shrink: 0;
  margin-left: 7px;
  visibility: hidden;
  pointer-events: none;
}

/* Выбранные в режиме выделения — дополнительный класс для подсветки */
.comments__container--selection .comment-wrapper--selection-selected {
  
}

.comment-selection-checkbox-wrap {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  height: 26px;
  transition: transform 0.25s var(--ease-out-smooth), opacity 0.25s var(--ease-out-smooth);
}

/* Свои комментарии в режиме выбора — чекбокс слева от пузыря */
.comments__container--selection .comment-wrapper--mine .comment-selection-checkbox-wrap {
  left: 3px;
}

/* Чужие комментарии в режиме выбора — чекбокс с отступом (выравнивание по контенту) */
.comments__container--selection .comment-wrapper--other .comment-selection-checkbox-wrap {
  left: 3px;
}

/* При выходе из режима выбора — чекбокс уезжает влево вместе с блоком (тот же 48px, 0.25s) */
.comments__container--selection-exiting .comment-selection-checkbox-wrap {
  transform: translateY(-50%) translateX(-48px);
  opacity: 0;
}

.comment-selection-checkbox {
  width: 26px;
  height: 26px;
  margin: 0;
  padding: 0;
  cursor: pointer;
  accent-color: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--surface);
  appearance: none;
  -webkit-appearance: none;
  border: none;
  flex-shrink: 0;
  display: block;
}

.comment-selection-checkbox:checked {
  background: var(--primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E");
  background-size: 14px 14px;
  background-position: center;
  background-repeat: no-repeat;
}

.comment-selection-checkbox::-webkit-list-marker,
.comment-selection-checkbox::marker {
  display: none;
}

/* Панель выделения: снизу слева Удалить + Отмена (выше липкого composer) */
.selection-bar {
  position: absolute;
  bottom: 72px;
  left: 12px;
  right: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 100;
}

.selection-bar.hidden {
  display: none;
}

.selection-bar__btn {
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.selection-bar__btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.selection-bar__btn--danger {
  background: var(--danger);
  color: #fff;
}

.selection-bar__btn--secondary {
  background: var(--surface);
  color: var(--text-muted);
}

/* Обёртка: 100% ширины, внутри — контент 80% и стрелка за краем */
.comment-wrapper {
  width: 100%;
  position: relative;
  overflow: visible;
  margin: var(--spacing-common-2xs-half) 0;
}
/* Внутренний блок: аватарка + пузырь по ширине контента, макс. 80% */
.comment-wrapper__inner {
  width: fit-content;
  max-width: 80%;
}
.comment-wrapper--mine .comment-wrapper__inner {
  margin-left: auto;
  margin-right: 0;
}
.comment-wrapper--other .comment-wrapper__inner {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  margin-right: auto;
  margin-left: 0;
}
.comment-wrapper--mine {
  transition: margin-left 0.25s var(--ease-out-smooth, ease-out), padding-left 0.25s var(--ease-out-smooth, ease-out);
}

/* Между своим и чужим комментарием — 4px сверху и снизу */
.comment-wrapper--other + .comment-wrapper--mine,
.comment-wrapper--mine + .comment-wrapper--other {
  margin-top: 4px;
}
.comment-wrapper--other:has(+ .comment-wrapper--mine),
.comment-wrapper--mine:has(+ .comment-wrapper--other) {
  margin-bottom: 4px;
}

/* Между комментариями от разных людей (чужие): отступ перед первым комментарием новой цепочки автора */
.comment-wrapper--group-first:not(:first-child) {
  margin-top: 8px;
}

/* Начальное состояние до анимации появления: без этого был бы мерцание (сначала полный размер, потом анимация). */
.comment-wrapper--enter-from {
  opacity: 0;
  transform: scale(0.97);
}
.comment-wrapper--enter-from.comment-wrapper--other {
  transform-origin: 0 100%;
}
.comment-wrapper--enter-from.comment-wrapper--mine {
  transform-origin: 100% 100%;
}

/* Общая анимация появления: свой комментарий после отправки, чужой при опросе. 60fps. */
.comment-wrapper--enter {
  will-change: transform, opacity;
  transform: translateZ(0);
  animation: comment-wrapper-enter 0.25s var(--ease-out-smooth) forwards;
}
.comment-wrapper--enter.comment-wrapper--other {
  transform-origin: 0 100%;
}
.comment-wrapper--enter.comment-wrapper--mine {
  transform-origin: 100% 100%;
}

/* Удаление = реверс появления + схлопывание высоты, 60fps */
.comment-wrapper--exit {
  will-change: transform, opacity;
  transform: translateZ(0);
  animation: comment-wrapper-enter 0.25s var(--ease-out-smooth) reverse forwards;
  transition: height 0.25s var(--ease-out-smooth), margin-top 0.25s var(--ease-out-smooth), margin-bottom 0.25s var(--ease-out-smooth);
  overflow: hidden;
}
.comment-wrapper--exit.comment-wrapper--other {
  transform-origin: 0 100%;
}
.comment-wrapper--exit.comment-wrapper--mine {
  transform-origin: 100% 100%;
}

@keyframes comment-wrapper-enter {
  from {
    opacity: 0;
    transform: scale(0.97) translateZ(0);
  }
  to {
    opacity: 1;
    transform: scale(1) translateZ(0);
  }
}

/* Теневой бан / скрытие по стоп-словам — плашка над телом комментария */
.comment__mod-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin: 0 0 8px 0;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.35;
  letter-spacing: 0.02em;
}
.comment__mod-banner-text {
  flex: 1 1 160px;
  color: var(--text);
  min-width: 0;
}
.comment__mod-banner-text strong {
  font-weight: 600;
  color: inherit;
}
.comment__mod-banner--shadow {
  background: var(--comment-shadow-ban-bg);
  border-color: var(--comment-shadow-ban-border);
  color: var(--comment-shadow-ban-text);
}
.comment__mod-banner--shadow .comment__mod-banner-text {
  color: var(--comment-shadow-ban-text);
}
.comment__mod-banner--stopwords {
  background: var(--comment-stopwords-bg);
  border-color: var(--comment-stopwords-border);
  color: var(--comment-stopwords-text);
}
.comment__mod-banner--stopwords .comment__mod-banner-text {
  color: var(--comment-stopwords-text);
}
.comment__mod-banner-action {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--comment-shadow-ban-border);
  background: var(--surface);
  color: var(--comment-shadow-ban-accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.comment__mod-banner-action:hover {
  filter: brightness(1.03);
}
.comment__mod-banner-action:active {
  transform: scale(0.98);
}
html.theme-dark .comment__mod-banner-action {
  background: var(--surface-muted);
  color: var(--comment-shadow-ban-accent);
}
.comment-wrapper--shadow-ban .comment {
  box-shadow: inset 0 0 0 1px var(--comment-shadow-ban-border);
  border-radius: var(--radius);
}
.comment-wrapper--hidden-stopwords .comment {
  box-shadow: inset 0 0 0 1px var(--comment-stopwords-border);
  border-radius: var(--radius);
}

.comment-wrapper--edited {
  animation: comment-wrapper-edited 0.5s var(--ease-out-smooth) forwards;
}

@keyframes comment-wrapper-edited {
  0%, 100% { opacity: 1; }
  25% { background: rgba(15, 142, 194, 0.08); border-radius: 16px; }
  100% { background: transparent; }
}

.comment-wrapper .comment {
  margin: 0;
  width: 100%;
}
/* Стрелка: рядом с блоком (7px отступ), при свайпе въезжает; z-index поверх body/контента */
.comment__swipe-icon-wrap {
  position: absolute;
  right: -67px;
  top: 0;
  bottom: 0;
  width: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  pointer-events: none;
  overflow: hidden;
  z-index: 2;
}
/* Стрелка ответа у чужих комментариев — чуть приглушённый цвет */
.comment__swipe-icon-wrap--other {
  color: var(--primary);
  opacity: 0.85;
}
/* Ripple вокруг блока со стрелкой при срабатывании репоста (MAX UI–подобная анимация) */
.comment__swipe-ripple {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 50%;
  overflow: hidden;
}
.comment__swipe-ripple__wave {
  position: absolute;
  width: 24px;
  height: 24px;
  margin-top: -12px;
  margin-left: -12px;
  opacity: 0;
  border-radius: 50%;
  background: var(--Ripple_backgroundColor, rgba(0, 0, 0, 0.08));
}
.comment__swipe-ripple__wave--active {
  will-change: transform, opacity;
  transform: translateZ(0);
  animation: comment-ripple-wave 0.3s var(--ease-out-smooth) forwards;
}
@keyframes comment-ripple-wave {
  0% { transform: scale(1) translateZ(0); opacity: 1; }
  30% { opacity: 1; }
  100% { transform: scale(8) translateZ(0); opacity: 0; }
}
.comment__swipe-reply-icon {
  display: inline-flex;
  line-height: 1;
  opacity: 1;
  transform: scale(1);
  transform-origin: center;
  pointer-events: none;
  transition: none;
}

.comment__swipe-reply-icon--triggered {
  will-change: transform;
  transform: translateZ(0);
  animation: swipe-reply-icon-pop 0.35s var(--ease-out-smooth) forwards;
}

@keyframes swipe-reply-icon-pop {
  0% { transform: scale(1) translateZ(0); }
  35% { transform: scale(1.3) translateZ(0); }
  100% { transform: scale(1) translateZ(0); }
}

.comment__swipe-reply-icon-bg {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #0f8ec2a3;
  border-radius: 50%;
  padding: 8px;
}
.comment__swipe-reply-icon-bg svg {
  display: block;
  width: 16px;
  height: 16px;
  transform: scaleX(-1);
}

/* Пузырь комментария: градиент фона, border-radius 6px, шрифт и отступы */
.comment {
  --comment-r: 16px;
  --comment-r-sm: 6px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: linear-gradient(239deg, var(--bubbles-background-bubble-gradient-step-1) 0%, var(--bubbles-background-bubble-gradient-step-2) 50%, var(--bubbles-background-bubble-gradient-step-3) 100%);
  border-radius: var(--comment-r);
  box-shadow: var(--shadow);
  padding: 5px 8px 6px;
  border: 2px solid transparent;
  font-weight: 400;
  font-size: 17px;
  line-height: 17px;
  letter-spacing: 0.15px;
  color: #052b3c;
  transition: border-color 0.2s var(--ease-out-smooth), background 0.2s var(--ease-out-smooth), transform 0.12s var(--ease-out-smooth);
  width: 100%;
  max-width: 100%;
  flex: 0 1 auto;
  min-width: 0;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* При зажатии — без мигания/сужения, меню просто открывается */
.comment--long-press {
  /* без визуального эффекта */
}

/* Чужой комментарий: контент (аватар + пузырь) в .comment-wrapper__inner слева */
.comment-wrapper--other {
  margin-right: auto;
  margin-left: 0;
  transition: margin-left 0.25s var(--ease-out-smooth, ease-out), padding-left 0.25s var(--ease-out-smooth, ease-out);
}

.comment-wrapper--other .comment__left--outside {
  flex-shrink: 0;
  width: 36px;
}

/* Комментарии от канала: аватар всегда виден (в т.ч. в цепочке); для «своих» от канала — flex-раскладка как у чужих */
.comment-wrapper--author-channel .comment__left--outside .comment__avatar,
.comment-wrapper--author-channel .comment__left--outside .comment__avatar--placeholder,
.comment-wrapper--author-channel .comment__left--outside .comment__avatar-wrap {
  visibility: visible !important;
}
.comment-wrapper--mine.comment-wrapper--author-channel .comment-wrapper__inner {
  display: flex;
  align-items: flex-end;
  gap: 4px;
}
.comment-wrapper--mine.comment-wrapper--author-channel .comment__left--outside {
  flex-shrink: 0;
  width: 36px;
}
.comment-wrapper--mine.comment-wrapper--author-channel .comment {
  flex: 0 1 auto;
  min-width: 0;
}

.comment-wrapper--other .comment {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  background: var(--comment-bubble-other-bg);
  color: var(--comment-other-text);
}

/* Каскад от одного автора (чужие): имя только в первом; аватарку только у последнего в цепочке (group-last). Одна цепочка = несколько комментариев подряд от одного автора без чужих между ними. */
.comment-wrapper--other:not(.comment-wrapper--group-first) .comment__top {
  display: none;
}
/* Аватарка: у последнего в цепочке автора (group-last) или у первого в цепочке с репостом/ответом (reply-or-repost). */
.comment-wrapper--other:not(.comment-wrapper--group-last):not(.comment-wrapper--reply-or-repost) .comment__left--outside .comment__avatar,
.comment-wrapper--other:not(.comment-wrapper--group-last):not(.comment-wrapper--reply-or-repost) .comment__left--outside .comment__avatar--placeholder,
.comment-wrapper--other:not(.comment-wrapper--group-last):not(.comment-wrapper--reply-or-repost) .comment__left--outside .comment__avatar-wrap {
  visibility: hidden;
}
/* Каскад пузырей: скругление 6px только когда есть сосед того же автора (цепочка). Классы group-first/group-last из JS. */
/* Средний в цепочке (3+): чужие — левые углы 6px, свои — правые */
.comment-wrapper--other:not(.comment-wrapper--group-first):not(.comment-wrapper--group-last) .comment {
  border-top-left-radius: var(--comment-r-sm);
  border-bottom-left-radius: var(--comment-r-sm);
}
.comment-wrapper--mine:not(.comment-wrapper--group-first):not(.comment-wrapper--group-last) .comment {
  border-top-right-radius: var(--comment-r-sm);
  border-bottom-right-radius: var(--comment-r-sm);
}
/* Первый в группе: один угол 6px только если есть следующий того же автора (не одиночный) */
.comment-wrapper--group-first:not(.comment-wrapper--group-last).comment-wrapper--other .comment,
.comment-wrapper--repost-group-first.comment-wrapper--other .comment {
  border-bottom-left-radius: var(--comment-r-sm);
}
.comment-wrapper--group-first:not(.comment-wrapper--group-last).comment-wrapper--mine .comment,
.comment-wrapper--repost-group-first.comment-wrapper--mine .comment {
  border-bottom-right-radius: var(--comment-r-sm);
}
/* Последний в группе: один угол 6px только если есть предыдущий того же автора (не одиночный) */
.comment-wrapper--other:not(.comment-wrapper--group-first).comment-wrapper--group-last .comment,
.comment-wrapper--repost-group-last.comment-wrapper--other .comment {
  border-top-left-radius: var(--comment-r-sm);
}
.comment-wrapper--mine:not(.comment-wrapper--group-first).comment-wrapper--group-last .comment,
.comment-wrapper--repost-group-last.comment-wrapper--mine .comment {
  border-top-right-radius: var(--comment-r-sm);
}

/* Мой комментарий — справа, тот же градиент, цвет текста #052b3c */
.comment.msg--mine {
  margin-left: auto;
  margin-right: 0;
  color: var(--comment-mine-text);
  background: linear-gradient(239deg, var(--bubbles-background-bubble-gradient-step-1) 0%, var(--bubbles-background-bubble-gradient-step-2) 50%, var(--bubbles-background-bubble-gradient-step-3) 100%);
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.15);
}

.comment__left {
  flex-shrink: 0;
  width: 36px;
}

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

/* Подсветка при переходе по reply-preview (fade-out ~1.2s), 60fps */
.comment-wrapper--highlight {
  animation: highlight-wrapper 1.2s var(--ease-out-smooth) forwards;
}

.comment--highlight {
  border-color: transparent;
  animation: highlight 1.2s var(--ease-out-smooth);
}

.comment.msg--mine.comment--highlight {
  animation: highlight-mine 1.2s var(--ease-out-smooth);
}

/* При открытом контекстном меню — только выбранный комментарий выделен, остальные приглушены */
.comment.msg--other.comment--selected {
  position: relative;
  z-index: 10;
}

body.context-menu-open .comment:not(.comment--selected) {
  opacity: 0.5;
  pointer-events: none;
}

.comment--selected {
  /* выбранный — полная яркость, без лишнего оформления */
}

/* При долгом нажатии на чужой комментарий аватарка заблюрена */
.comment-wrapper--context-selected.comment-wrapper--other .comment__left--outside .comment__avatar,
.comment-wrapper--context-selected.comment-wrapper--other .comment__left--outside .comment__avatar--placeholder,
.comment-wrapper--context-selected.comment-wrapper--other .comment__left--outside .comment__avatar-wrap {
  filter: blur(6px);
  opacity: 0.85;
}

.comment.msg--mine.comment--selected {
  position: relative;
  z-index: 10;
}

@keyframes highlight {
  0% { box-shadow: 0 1px 3px rgba(0,0,0,0.08); background: #f0f9f9; }
  100% { box-shadow: 0 1px 3px rgba(0,0,0,0.08); background: linear-gradient(239deg, var(--bubbles-background-bubble-gradient-step-1) 0%, var(--bubbles-background-bubble-gradient-step-2) 50%, var(--bubbles-background-bubble-gradient-step-3) 100%); }
}

@keyframes highlight-mine {
  0% { box-shadow: 0 1px 2px rgba(0,0,0,0.08); background: #e8f4f4; }
  100% { box-shadow: 0 1px 2px rgba(0,0,0,0.08); background: linear-gradient(239deg, var(--bubbles-background-bubble-gradient-step-1) 0%, var(--bubbles-background-bubble-gradient-step-2) 50%, var(--bubbles-background-bubble-gradient-step-3) 100%); }
}

@keyframes highlight-wrapper {
  0% { background: rgba(0, 0, 0, 0.04); border-radius: 12px; }
  100% { background: transparent; }
}

/* Спокойное двойное мигание при переходе по ссылке из сообщения бота («вам ответили») — comment_id в URL, 60fps */
.comment--highlight-deeplink {
  animation: highlight-deeplink 1.8s var(--ease-in-out-smooth) forwards;
}

.comment.msg--mine.comment--highlight-deeplink {
  animation: highlight-deeplink-mine 1.8s var(--ease-in-out-smooth) forwards;
}

.comment-wrapper--highlight-deeplink {
  animation: highlight-wrapper-deeplink 1.8s var(--ease-in-out-smooth) forwards;
}

@keyframes highlight-deeplink {
  0%, 100% {
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    background: linear-gradient(239deg, var(--bubbles-background-bubble-gradient-step-1) 0%, var(--bubbles-background-bubble-gradient-step-2) 50%, var(--bubbles-background-bubble-gradient-step-3) 100%);
  }
  25% {
    box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 0 0 1px rgba(37, 99, 235, 0.12);
    background: #f5f9fc;
  }
  50% {
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    background: linear-gradient(239deg, var(--bubbles-background-bubble-gradient-step-1) 0%, var(--bubbles-background-bubble-gradient-step-2) 50%, var(--bubbles-background-bubble-gradient-step-3) 100%);
  }
  75% {
    box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 0 0 1px rgba(37, 99, 235, 0.12);
    background: #f5f9fc;
  }
}

@keyframes highlight-deeplink-mine {
  0%, 100% {
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.15);
    background: linear-gradient(239deg, var(--bubbles-background-bubble-gradient-step-1) 0%, var(--bubbles-background-bubble-gradient-step-2) 50%, var(--bubbles-background-bubble-gradient-step-3) 100%);
  }
  25% {
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.15), 0 0 0 1px rgba(37, 99, 235, 0.18);
    background: #f0f6fc;
  }
  50% {
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.15);
    background: linear-gradient(239deg, var(--bubbles-background-bubble-gradient-step-1) 0%, var(--bubbles-background-bubble-gradient-step-2) 50%, var(--bubbles-background-bubble-gradient-step-3) 100%);
  }
  75% {
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.15), 0 0 0 1px rgba(37, 99, 235, 0.18);
    background: #f0f6fc;
  }
}

@keyframes highlight-wrapper-deeplink {
  0%, 100%, 50% { background: transparent; }
  25%, 75% { background: rgba(37, 99, 235, 0.03); border-radius: 12px; }
}

/* Двойное мигание при переходе по ссылке «Вернуться в комментарии» (comment_id в URL), 60fps */
.comment--blink {
  animation: blink-twice 1.6s var(--ease-in-out-smooth) 1;
}

@keyframes blink-twice {
  0%, 40%, 80%, 100% {
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    background: linear-gradient(239deg, var(--bubbles-background-bubble-gradient-step-1) 0%, var(--bubbles-background-bubble-gradient-step-2) 50%, var(--bubbles-background-bubble-gradient-step-3) 100%);
  }
  20%, 60% {
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    background: #f0f9f9;
  }
}

/* Блок «Закреплён» над закреплённым комментарием — иконка булавки */
.comment__pinned-badge {
  display: inline-flex;
  align-items: center;
  margin-bottom: 6px;
  padding: 4px 6px;
  color: var(--text-muted);
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.comment__pinned-badge-icon {
  display: block;
  flex-shrink: 0;
}

/* Reply-preview внутри комментария (блок «Ответ @Имя» + сниппет, кликабельно) */
.comment__reply-preview-block {
  margin-bottom: 8px;
  padding: 6px 10px;
  background: var(--surface-muted);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.comment__reply-preview-block:hover {
  background: var(--reply-preview-hover);
}

.comment__reply-preview-block .reply-to-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
}

.comment__reply-preview-block .reply-to-snippet {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  margin-top: 2px;
}

.comment__reply-preview-block--deleted {
  cursor: default;
}

.comment__reply-preview-block--deleted:hover {
  background: var(--surface-muted);
}

.comment__reply-preview-block--deleted .reply-to-snippet {
  font-style: italic;
}

.comment__top {
  margin-bottom: 2px;
}

/* У своих комментариев не показываем аватар и имя */
.comment.msg--mine .comment__left {
  display: none !important;
}

.comment.msg--mine .comment__author:empty {
  display: none;
}

.comment.msg--mine .comment__top {
  display: none;
}

/* Меню «Ответить / Пожаловаться / Удалить» только из контекстного меню при зажатии, в самом комментарии скрыто */
.comment__actions {
  display: none !important;
}

.comment__avatar-wrap {
  position: relative;
  display: block;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.comment__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.comment__avatar--letter {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  color: var(--text-muted);
  background: var(--surface-muted);
  user-select: none;
}

.comment__avatar--photo {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.15s var(--ease-out-smooth);
}

.comment__avatar--photo.is-loaded {
  opacity: 1;
}

.comment__avatar--placeholder {
  display: block;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
}

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

.comment__author {
  font-weight: 600;
  margin: 0;
  font-size: 14px;
  line-height: 1.25;
  display: block;
  min-width: 0;
}

.comment__author-name {
  display: inline-block;
  vertical-align: top;
}

/* Строка автора с бейджем справа (Канал / Админ / про): одинаковый зазор между ником и бейджем */
.comment__author-name--channel,
.comment__author-name--admin,
.comment__author-name--pro {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.comment__author-channel-trigger {
  cursor: pointer;
  color: var(--text);
  text-decoration: none;
  border-radius: 4px;
  padding: 0 2px;
  margin: 0 -2px;
}

.comment__author-channel-trigger:hover {
  background: rgba(0, 0, 0, 0.06);
}

.comment__author-channel-trigger--avatar {
  display: inline-block;
  padding: 0;
  margin: 0;
  border-radius: 50%;
}

.comment__author-channel-trigger--avatar:hover {
  background: transparent;
  opacity: 0.9;
}

.comment__author-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  padding: 2px 6px;
  border-radius: 6px;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.06);
}

.comment__author-badge--channel {
  font-variant-caps: all-small-caps;
  letter-spacing: 0.02em;
}

.comment__author-badge--admin {
  font-variant-caps: all-small-caps;
  letter-spacing: 0.02em;
}

.comment__author-badge--pro {
  font-variant-caps: all-small-caps;
  letter-spacing: 0.02em;
}

/* Подсветка комментариев авторов с подпиской (PRO), в т.ч. комментарии от канала при подписке у админа — обводка всего пузыря */
.comment-wrapper--author-pro .comment {
  border-color: #a855f7;
}

.comment__author-link {
  color: var(--color-primary, #2481cc);
  text-decoration: none;
}

.comment__content {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  width: 100%;
  min-width: 0;
}

.comment__attachments {
  margin-top: 8px;
  margin-bottom: 8px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  width: 100%;
  max-width: 280px;
}
/* Одно фото — на всю ширину блока, как раньше */
.comment__attachments:has(.comment__attachment-link:only-child) .comment__attachment-link {
  grid-column: 1 / -1;
}
.comment__attachment-link {
  display: block;
  border-radius: 12px;
  overflow: hidden;
  max-width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  font: inherit;
}
.comment__attachment-img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 200px;
  object-fit: cover;
  vertical-align: top;
}

.comment__attachment-loading {
  display: block;
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.06);
}

.comment__attachment-loading .comment__attachment-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.comment__attachment-loading .comment__attachment-spinner::after {
  content: "";
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.12);
  border-top-color: var(--color-primary, #2481cc);
  animation: spinner-rotate 1s linear infinite;
}

.comment__text-row {
  display: block;
  width: 100%;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 17px;
  line-height: 22px;
}

.comment__text-row .comment__link {
  color: var(--color-primary, #2481cc);
  text-decoration: none;
  word-break: break-all;
}
.comment__text-row .comment__link:active {
  opacity: 0.8;
}

/* Время и реакции — прямые дети comment__text-row (обёртка comment__footer убрана) */
.comment__text-row > .comment__time {
  position: relative;
  top: 6px;
  float: right;
  margin-right: .25rem;
  margin-left: .4375rem;
  margin-top: 0;
  margin-bottom: 0;
  line-height: 1.35;
  height: 21px;
  display: flex;
  align-items: center;
  border-radius: 10px;
  padding: 0 4px;
  font: 400 var(--font-bubble-tag-size) / var(--font-bubble-tag-line-height) var(--font);
  letter-spacing: var(--font-bubble-tag-letter-spacing);
}
.comment__time {
  margin-right: 4px;
}

.comment-wrapper--mine .comment__text-row > .comment__time {
  color: #0f8ec2;
}

.comment-wrapper--other .comment__text-row > .comment__time {
  color: var(--comment-time-other);
}

.comment__text-row > .comment__reactions {
  margin-top: 4px;
  margin-bottom: 3px;
  overflow: visible;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px;
  width: max-content;
  max-width: 100%;
}


.comment__reactions .comment__time {
  margin-left: auto;
  flex-shrink: 0;
  font: 400 var(--font-bubble-tag-size) / var(--font-bubble-tag-line-height) var(--font);
  letter-spacing: var(--font-bubble-tag-letter-spacing);
}

.comment-wrapper--mine .comment__reactions .comment__time,
.comment-wrapper--other .comment__reactions .comment__time {
  position: relative;
  top: .375rem;
  bottom: auto !important;
  float: right;
  align-self: flex-end;
  height: 21px;
  margin-top: -6px;
  margin-right: -6px;
  margin-left: auto;
  line-height: 1;
  align-items: center;
  display: flex;
  border-radius: 10px;
}

.comment-wrapper--mine .comment__reactions .comment__time {
  color: #0f8ec2;
}

.comment-wrapper--other .comment__reactions .comment__time {
  color: var(--comment-time-other);
}

.comment__edited-label {
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
}

/* Реакции слева, дата справа — под текстом */
.comment__reactions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-bottom: 0;
}

.comment-wrapper--mine .comment__reactions {
  justify-content: flex-start;
}

.comment-wrapper--other .comment__reactions {
  justify-content: flex-start;
}

/* Плавное появление блока реакций (первая реакция), 60fps */
.comment__reactions--enter {
  overflow: hidden;
  will-change: max-height, opacity;
  transform: translateZ(0);
  animation: comment-reactions-enter 0.26s var(--ease-out-smooth) forwards;
}

@keyframes comment-reactions-enter {
  from { max-height: 0; opacity: 0; }
  to { max-height: 120px; opacity: 1; }
}

/* Плавное схлопывание блока реакций при снятии последней реакции, 60fps */
.comment__reactions--exit {
  overflow: hidden;
  will-change: max-height, opacity;
  transform: translateZ(0);
  transition: max-height 0.26s var(--ease-in-smooth), opacity 0.26s var(--ease-in-smooth);
}

/* Плавное сужение блока реакций при снятии реакции */
.comment__reactions--shrink {
  transition: max-height 0.26s var(--ease-in-smooth);
  overflow: hidden;
}

/* Растягивание блока реакций при добавлении второй/третьей реакции */
.comment__reactions--expand {
  transition: max-height 0.26s var(--ease-out-smooth);
  overflow: hidden;
}

.reaction-btn {
  border: none;
  background: #0f8ec2;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s;
  position: relative;
  z-index: 1;
  overflow: visible;
  display: flex;
  flex-direction: row;
  gap: 2px;
  width: auto;
  height: 30px;
  padding: 0 6px 0 4px;
  border-radius: 28px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 28px;
  text-transform: none;
  white-space: nowrap;
  font-size: 14px;
  align-items: center;
}

/* Кнопки реакций в своих комментариях */
.comment.msg--mine .reaction-btn {
  background: rgba(15, 142, 194, 0.45);
  color: #fff;
}
@media (hover: hover) {
  .comment.msg--mine .reaction-btn:hover:not(:disabled) {
    background: rgba(15, 142, 194, 0.22);
  }
  .comment.msg--other .reaction-btn:hover:not(:disabled) {
    background: rgba(12, 13, 14, 0.14);
  }
}
.comment.msg--mine .reaction-btn__count,
.comment.msg--mine .reaction-btn--active .reaction-btn__count {
  color: #fff;
}

.reaction-btn--enter {
  will-change: transform, opacity;
  transform: translateZ(0);
  animation: reaction-enter 0.22s var(--ease-out-smooth) forwards;
}

.reaction-btn--exit {
  will-change: transform, opacity;
  transform: translateZ(0);
  animation: reaction-exit 0.2s var(--ease-in-smooth) forwards;
  pointer-events: none;
}

@keyframes reaction-enter {
  from {
    opacity: 0;
    transform: scale(0.6) translateZ(0);
  }
  to {
    opacity: 1;
    transform: scale(1) translateZ(0);
  }
}

@keyframes reaction-exit {
  to {
    opacity: 0;
    transform: scale(0.6) translateZ(0);
  }
}

/* До 3 аватарок слева от реакции: стопка с наложением (второй накладывается слева) */
.reaction-btn__avatars {
  display: inline-flex;
  flex-direction: row-reverse;
  align-items: center;
}
.reaction-btn__avatar-wrap {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  overflow: hidden;
  box-sizing: border-box;
  margin-right: -6px;
  flex-shrink: 0;
}
.reaction-btn__avatar-wrap:first-child {
  margin-right: 0;
}

/* Появление аватарки в пилюле (я поставил реакцию — появилась моя аватарка) */
.reaction-btn__avatar-wrap--enter {
  will-change: transform, opacity;
  transform: translateZ(0);
  animation: reaction-avatar-enter 0.28s var(--ease-out-smooth) forwards;
}

@keyframes reaction-avatar-enter {
  from {
    opacity: 0;
    transform: scale(0.4) translateZ(0);
  }
  to {
    opacity: 1;
    transform: scale(1) translateZ(0);
  }
}

.reaction-btn__avatar {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reaction-btn__emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-size: 16px;
  line-height: 1;
  margin: 4px;
}

.reaction-btn:active:not(:disabled) {
  transform: scale(1.08);
}

.reaction-btn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.reaction-btn__count {
  font: 500 var(--font-bubble-description-size) / var(--font-bubble-description-line-height) var(--font);
  letter-spacing: var(--font-bubble-description-letter-spacing);
  color: #fff;
  transition: color 0.15s var(--ease-in-smooth);
  margin-inline-end: 2px;
}

/* Появление цифры в пилюле (режим 4+ реакций — показываем счётчик) */
.reaction-btn__count--enter {
  display: inline-block;
  transform-origin: center center;
  will-change: transform, opacity;
  opacity: 0;
  transform: scale(0.3);
  animation: reaction-count-enter 0.32s 0.05s var(--ease-out-smooth) forwards;
}

@keyframes reaction-count-enter {
  from {
    opacity: 0;
    transform: scale(0.3);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.reaction-btn:has(.reaction-btn__avatar) .reaction-btn__count {
  display: none;
}

.comment__action-link {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
}

.comment__action-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* В одноуровневой ленте replies не вложены — скрываем старый блок вложенных ответов */
.comment__replies {
  display: none;
}

.reply-composer {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.reply-composer textarea {
  width: 100%;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 14px;
  resize: vertical;
}

/* Репост: цитата сообщения, на которое отвечаем */
.reply-composer--repost .reply-composer__quote {
  padding: 10px 12px;
  background: var(--bg);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
}

.reply-composer__quote-author {
  margin: 0 0 4px 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.reply-composer__quote-text {
  margin: 0;
  font-size: 13px;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Форма ответа внизу списка: полная карточка цитаты */
.reply-composer--bottom {
  margin-top: 16px;
  padding: 14px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 2px solid var(--primary);
}

.reply-composer__label {
  margin: 0 0 10px 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
}

.reply-composer__quote-full {
  padding: 10px 12px;
  background: var(--bg);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.reply-composer__quote-full .comment__top {
  margin-bottom: 6px;
}

.reply-composer__quote-full .comment__text {
  margin: 0;
  font-size: 14px;
}

.reply-composer__buttons {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}

.empty-state {
  display: block;
  width: fit-content;
  margin: 24px auto 0;
  text-align: center;
  background: var(--capsule-outside);
  border-radius: var(--border-radius-common-m-half);
  padding: var(--size-1) var(--size-6);
  font: 400 var(--font-bubble-description-size) / var(--font-bubble-description-line-height) var(--font);
  letter-spacing: var(--font-bubble-description-letter-spacing);
  color: var(--text-primary-inverse-static);
  -webkit-backdrop-filter: blur(25px);
  backdrop-filter: blur(25px);
}

.hidden {
  display: none !important;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--primary);
  color: #fff;
}

.btn--primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

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

.btn--secondary:hover:not(:disabled) {
  background: #f0f0f0;
}

.btn--danger {
  background: transparent;
  color: var(--danger);
}

.btn--danger:hover:not(:disabled) {
  background: #fef2f2;
}

/* ---- Единый слой оверлеев: один fixed к viewport, внутри — absolute (чтобы не «уезжали» при скролле) ---- */
#overlay-root {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
}

/* ---- Toast (по центру экрана, выше формы ввода) ---- */
.toast-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 90vw;
  width: 320px;
  pointer-events: none;
}

.toast {
  padding: 12px 16px;
  border-radius: var(--border-radius-common-m-half);
  font-size: 15px;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  will-change: transform, opacity;
  transform: translateZ(0);
  animation: toast-in 0.25s var(--ease-out-smooth);
}

@keyframes toast-in {
  from { opacity: 0; transform: scale(0.96) translateZ(0); }
  to { opacity: 1; transform: scale(1) translateZ(0); }
}

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

.toast--error {
  border-left: 4px solid var(--danger);
}

.toast--info {
  border-left: 4px solid var(--primary);
}

/* ---- Show replies button ---- */
.show-replies-btn {
  margin-top: 6px;
  font-size: 13px;
  color: var(--primary);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.show-replies-btn:hover {
  text-decoration: underline;
}

/* ---- Модал (выше формы ввода и тостов) ---- */
.modal {
  /* fixed: модалка должна центрироваться относительно видимого viewport,
     а не относительно body (который на mobile может зависеть от 100vh) */
  position: fixed;
  inset: 0;
  z-index: 2200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal.hidden {
  display: none !important;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
}

.modal__box {
  position: relative;
  background: var(--surface);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--modal-shadow);
  max-width: 360px;
  width: 100%;
}

.modal__title {
  margin: 0 0 10px 0;
  font-weight: 600;
  font-size: 16px;
}

.modal__snippet {
  margin: 0 0 16px 0;
  font-size: 14px;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-word;
}

.modal__close {
  margin-left: 8px;
}

.edit-comment-textarea {
  display: block;
  width: 100%;
  min-height: 80px;
  max-height: 200px;
  padding: 10px 12px;
  margin: 0 0 16px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 15px;
  line-height: 1.4;
  color: var(--text);
  resize: vertical;
  box-sizing: border-box;
}

.edit-comment-textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

/* Модал «Настройки» на весь экран (вёрстка/стили — docs/new settings) */
.settings-modal.settings-modal--fullscreen.modal {
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
}

.settings-modal.settings-modal--fullscreen,
.settings-modal.settings-modal--fullscreen .settings-modal__backdrop,
.settings-modal.settings-modal--fullscreen .settings-modal__content,
.settings-modal.settings-modal--fullscreen .settings-modal__header,
.settings-modal.settings-modal--fullscreen .settings-modal__body {
  background-color: #edeef2;
}

html.theme-dark .settings-modal.settings-modal--fullscreen,
html.theme-dark .settings-modal.settings-modal--fullscreen .settings-modal__backdrop,
html.theme-dark .settings-modal.settings-modal--fullscreen .settings-modal__content,
html.theme-dark .settings-modal.settings-modal--fullscreen .settings-modal__header,
html.theme-dark .settings-modal.settings-modal--fullscreen .settings-modal__body {
  background-color: var(--bg);
}

/* Центр уведомлений — тот же фон чата, что у ленты комментариев */
#notifications-modal.settings-modal.settings-modal--fullscreen,
#notifications-modal.settings-modal.settings-modal--fullscreen .settings-modal__backdrop,
#notifications-modal.settings-modal.settings-modal--fullscreen .settings-modal__content,
#notifications-modal.settings-modal.settings-modal--fullscreen .settings-modal__header,
#notifications-modal.settings-modal.settings-modal--fullscreen .settings-modal__body {
  background-color: transparent;
}

html.theme-dark #notifications-modal.settings-modal.settings-modal--fullscreen,
html.theme-dark #notifications-modal.settings-modal.settings-modal--fullscreen .settings-modal__backdrop,
html.theme-dark #notifications-modal.settings-modal.settings-modal--fullscreen .settings-modal__content,
html.theme-dark #notifications-modal.settings-modal.settings-modal--fullscreen .settings-modal__header,
html.theme-dark #notifications-modal.settings-modal.settings-modal--fullscreen .settings-modal__body {
  background-color: transparent;
}

#notifications-modal .settings-modal__content {
  background:
    radial-gradient(57.57% 53.61% at 94.4% 14.38%, var(--chat-background-additional-step-1) 0%, var(--chat-background-additional-step-2) 50%, var(--chat-background-additional-step-3) 100%),
    radial-gradient(140.37% 51.38% at 0% 80.05%, var(--chat-background-additional-step-4) 0%, var(--chat-background-additional-step-5) 50%, var(--chat-background-additional-step-6) 100%),
    linear-gradient(28deg, var(--chat-background-background-step-1) 8.03%, var(--chat-background-background-step-2) 91.51%);
  opacity: 0;
  transform: translateY(16px) scale(0.985);
  transition:
    opacity 0.28s var(--ease-out-smooth),
    transform 0.32s var(--ease-out-smooth);
}

#notifications-modal.is-open .settings-modal__content {
  opacity: 1;
  transform: none;
}

#notifications-modal.is-closing .settings-modal__content {
  opacity: 0;
  transform: translateY(10px) scale(0.99);
  transition:
    opacity 0.2s var(--ease-in-smooth),
    transform 0.22s var(--ease-in-smooth);
}

#notifications-modal .settings-modal__content::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(57.57% 53.61% at 94.4% 14.38%, var(--chat-background-pattern-step-1) 0%, var(--chat-background-pattern-step-2) 50%, var(--chat-background-pattern-step-3) 100%), radial-gradient(140.37% 51.38% at 0% 80.05%, var(--chat-background-pattern-step-4) 0%, var(--chat-background-pattern-step-5) 50%, var(--chat-background-pattern-step-6) 100%), linear-gradient(28deg, var(--chat-background-pattern-gradient-step-1) 8.03%, var(--chat-background-pattern-gradient-step-2) 91.51%);
  mask-image: var(--pattern-url);
  mask-repeat: repeat;
  mask-size: 280px 280px;
  mask-position: 0 0;
  mask-type: luminance;
  -webkit-mask-image: var(--pattern-url);
  -webkit-mask-repeat: repeat;
  -webkit-mask-size: 280px 280px;
  -webkit-mask-position: 0 0;
}

#notifications-modal .settings-modal__header,
#notifications-modal .settings-modal__body {
  position: relative;
  z-index: 1;
}

#notifications-modal .settings-modal__header {
  background: var(--header-blur-bg);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

#notifications-modal .settings-modal__title {
  color: var(--text-muted);
}

#notifications-modal .notifications-center__tab.is-active {
  background: rgba(255, 255, 255, 0.55);
}

html.theme-dark #notifications-modal .notifications-center__tab.is-active {
  background: rgba(255, 255, 255, 0.1);
}

#notifications-modal .notifications-center__tabs {
  border-bottom-color: transparent;
}

#notifications-modal .notifications-center,
#notifications-modal .settings-modal__body.notifications-center {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

#notifications-modal .notifications-center::-webkit-scrollbar,
#notifications-modal .settings-modal__body.notifications-center::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

#notifications-modal .notifications-center__item {
  margin: 0 10px 8px;
  padding: 12px;
  width: auto;
  border-radius: 16px;
  background: var(--comment-bubble-other-bg);
  box-sizing: border-box;
}

#notifications-modal .notifications-center__item:active {
  background: var(--comment-bubble-other-bg);
  filter: brightness(0.97);
}

html.theme-dark #notifications-modal .notifications-center__item:active {
  background: var(--comment-bubble-other-bg);
  filter: brightness(1.08);
}

#notifications-modal .notifications-center__section-title {
  color: rgba(12, 13, 14, 0.55);
}

html.theme-dark #notifications-modal .notifications-center__section-title {
  color: rgba(236, 236, 241, 0.55);
}

#notifications-modal .notifications-center__empty {
  color: rgba(12, 13, 14, 0.6);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
}

html.theme-dark #notifications-modal .notifications-center__empty {
  color: rgba(236, 236, 241, 0.65);
  text-shadow: none;
}

#notifications-modal .notifications-center__footer {
  background: #fff;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.14), 0 2px 8px rgba(15, 23, 42, 0.06);
  color: inherit;
  text-shadow: none;
}

html.theme-dark #notifications-modal .notifications-center__footer {
  background: var(--surface, #1c1c1e);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.2);
  color: inherit;
  text-shadow: none;
}

html.theme-dark #notifications-modal .notifications-center__footer-title {
  color: rgba(236, 236, 241, 0.95);
}

html.theme-dark #notifications-modal .notifications-center__footer-sub {
  color: rgba(236, 236, 241, 0.55);
}

#notifications-modal .notifications-center__item-menu {
  background: var(--surface);
}

@media (prefers-reduced-motion: reduce) {
  #notifications-modal .settings-modal__content,
  #notifications-modal.is-open .settings-modal__content,
  #notifications-modal.is-closing .settings-modal__content,
  .notifications-center__item,
  .notifications-center__item--leaving,
  .notifications-center__section-title,
  .notifications-bell-badge--pop,
  .notifications-center__dot {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  #notifications-modal .notifications-center__item--read {
    opacity: 0.8 !important;
  }
}

.settings-modal--fullscreen .settings-modal__content {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  max-width: none;
  display: flex;
  flex-direction: column;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
}

.settings-modal__backdrop {
  position: absolute;
  inset: 0;
  background: transparent;
}

.settings-modal__header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 12px 12px 0;
  padding-top: max(12px, env(safe-area-inset-top));
  border-bottom: none;
  flex-shrink: 0;
}

.settings-modal__header-inner {
  display: flex;
  width: 100%;
  min-width: 0;
  position: relative;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  color: #78797c;
  text-transform: uppercase;
}

#notifications-modal .settings-modal__header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

html.theme-dark .settings-modal__header-inner {
  color: var(--text-muted);
}

.settings-modal__title {
  margin: 0;
  font-weight: 700;
  font-size: 14px;
  color: rgba(12, 13, 14, 0.52);
}

html.theme-dark .settings-modal__title {
  color: rgba(236, 236, 241, 0.52);
}

/* Крестик компактный (как в docs/new settings), без раздувания под 44px touch-target */
#settings-modal .settings-modal__close,
#notifications-modal .settings-modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  max-width: none;
  max-height: none;
  padding: 4px;
  margin: 0;
  border: none;
  background: none;
  color: #78797c;
  cursor: pointer;
  border-radius: 8px;
  line-height: 0;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

html.theme-dark #settings-modal .settings-modal__close,
html.theme-dark #notifications-modal .settings-modal__close {
  color: var(--text-muted);
}

#settings-modal .settings-modal__close:hover,
#notifications-modal .settings-modal__close:hover {
  background: var(--hover-overlay);
}

#settings-modal .settings-modal__close svg,
#notifications-modal .settings-modal__close svg {
  width: 14px !important;
  height: 14px !important;
  max-width: 14px;
  max-height: 14px;
  display: block;
  flex-shrink: 0;
}

.notifications-center {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 0 24px;
  gap: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.notifications-center__toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 0 16px 8px;
}

.notifications-center__read-all {
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 14px;
  font-weight: 500;
  padding: 4px 0;
  cursor: pointer;
  transition: opacity 0.2s var(--ease-out-smooth), transform 0.2s var(--ease-out-smooth);
}

.notifications-center__read-all:active {
  transform: scale(0.96);
  opacity: 0.85;
}

.notifications-center__read-all.hidden {
  display: none;
}

.notifications-center__tabs {
  display: flex;
  gap: 4px;
  padding: 0 12px 12px;
  border-bottom: 1px solid var(--border, rgba(0, 0, 0, 0.08));
}

.notifications-center__tab {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 500;
  padding: 8px 4px;
  border-radius: 8px;
  cursor: pointer;
  transition:
    color 0.2s var(--ease-out-smooth),
    background 0.2s var(--ease-out-smooth),
    transform 0.15s var(--ease-out-smooth);
}

.notifications-center__tab:active {
  transform: scale(0.97);
}

.notifications-center__tab.is-active {
  color: var(--text);
  background: var(--bg-elevated, rgba(0, 0, 0, 0.05));
}

.notifications-center__list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.notifications-center__section-title {
  margin: 16px 16px 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  animation: notifications-section-enter 0.28s var(--ease-out-smooth) both;
}

@keyframes notifications-section-enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes notifications-item-enter-read {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 0.8;
    transform: none;
  }
}

.notifications-center__item {
  position: relative;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 16px;
  cursor: pointer;
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
  color: inherit;
  font: inherit;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
  animation: notifications-item-enter 0.32s var(--ease-out-smooth) both;
  transition: transform 0.18s var(--ease-out-smooth), opacity 0.2s var(--ease-in-smooth), filter 0.15s;
}

.notifications-center__item--ad .notifications-center__dot {
  display: none;
}

#notifications-modal .notifications-center__item--read {
  opacity: 0.8 !important;
}

#notifications-modal .notifications-center__item--read-init {
  animation-name: notifications-item-enter-read;
}

#notifications-modal .notifications-center__item--ad {
  border: 2px solid #a855f7;
  background: #ffffffb3;
}

#notifications-modal .notifications-center__item--ad:active {
  background: #ffffffb3;
}

html.theme-dark #notifications-modal .notifications-center__item--ad {
  border-color: rgba(168, 85, 247, 0.72);
  background: #ffffffb3;
}

html.theme-dark #notifications-modal .notifications-center__item--ad:active {
  background: #ffffffb3;
}

.notifications-center__item--ad .notifications-center__menu-btn {
  display: none;
}

.notifications-center__item--ad .notifications-center__body {
  padding-right: 0;
}

.notifications-center__item--ad .notifications-center__item-title {
  white-space: normal;
}

.notifications-center__item--ad .notifications-center__item-text {
  display: block;
  -webkit-line-clamp: unset;
  -webkit-box-orient: unset;
  overflow: visible;
}

@keyframes notifications-item-enter {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.notifications-center__item--leaving {
  animation: notifications-item-leave 0.22s var(--ease-in-smooth) forwards;
  pointer-events: none;
}

@keyframes notifications-item-leave {
  to {
    opacity: 0;
    transform: translateX(18px) scale(0.97);
  }
}

.notifications-center__item:active {
  background: rgba(0, 0, 0, 0.04);
}

html.theme-dark .notifications-center__item:active {
  background: rgba(255, 255, 255, 0.06);
}

.notifications-center__media {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
}

.notifications-center__avatar,
.notifications-center__avatar-stack img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-elevated, #e8e8e8);
  display: block;
}

.notifications-center__avatar-ph {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-elevated, #e8e8e8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-muted);
}

.notifications-center__avatar-stack {
  position: relative;
  width: 44px;
  height: 44px;
}

.notifications-center__avatar-stack img,
.notifications-center__avatar-stack .notifications-center__avatar-ph {
  position: absolute;
  width: 28px;
  height: 28px;
  border: 2px solid var(--bg, #fff);
  font-size: 11px;
}

.notifications-center__avatar-stack img:nth-child(1),
.notifications-center__avatar-stack .notifications-center__avatar-ph:nth-child(1) {
  left: 0;
  top: 12px;
  z-index: 1;
}

.notifications-center__avatar-stack img:nth-child(2),
.notifications-center__avatar-stack .notifications-center__avatar-ph:nth-child(2) {
  left: 14px;
  top: 0;
  z-index: 2;
}

.notifications-center__reaction-badge {
  position: absolute;
  right: -4px;
  bottom: -2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg, #fff);
  border: 1px solid var(--border, rgba(0, 0, 0, 0.08));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  z-index: 3;
}

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

.notifications-center__title-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.notifications-center__item-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notifications-center__time {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.notifications-center__item-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notifications-center__item-meta {
  margin: 0;
  font-size: 13px;
  line-height: 1.3;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notifications-center__dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  background: #007AFF;
  transition: transform 0.28s var(--ease-out-smooth), opacity 0.28s var(--ease-out-smooth), background 0.2s;
}

.notifications-center__dot--read {
  background: transparent;
  transform: scale(0);
  opacity: 0;
  width: 0;
  margin: 0;
  overflow: hidden;
}

.notifications-center__menu-btn {
  flex-shrink: 0;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  padding: 4px 2px;
  cursor: pointer;
  align-self: flex-start;
  transition: transform 0.15s var(--ease-out-smooth), opacity 0.15s;
}

.notifications-center__menu-btn:active {
  transform: scale(0.9);
  opacity: 0.7;
}

.notifications-center__item-menu {
  position: absolute;
  right: 12px;
  top: 36px;
  z-index: 5;
  background: var(--bg, #fff);
  border: 1px solid var(--border, rgba(0, 0, 0, 0.1));
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  min-width: 140px;
  overflow: hidden;
}

.notifications-center__item-menu.hidden {
  display: none;
}

.notifications-center__item-menu button {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 12px 14px;
  font-size: 15px;
  color: #e53935;
  cursor: pointer;
}

.notifications-center__empty {
  margin: 48px 24px;
  text-align: center;
  font-size: 15px;
  color: var(--text-muted);
}

.notifications-center__empty.hidden {
  display: none;
}

.notifications-center__list-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

#notifications-modal.notif-onboarding-step2 .settings-modal__header,
#notifications-modal.notif-onboarding-step2 .settings-modal__body,
#notifications-modal.notif-onboarding-step2 .notifications-onboarding-ok-wrap {
  position: relative;
  z-index: 1;
}

#notifications-modal.notif-onboarding-step2 .notifications-onboarding-banner,
#notifications-modal.notif-onboarding-step2 .notifications-onboarding-ok-wrap {
  z-index: 50;
}

.notifications-onboarding-banner {
  position: relative;
  z-index: 50;
  flex-shrink: 0;
  margin: 8px 22px 0;
  padding: 16px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid #dbeafe;
  opacity: 1;
  transform: none;
  animation: notif-onboarding-tooltip-in 0.3s var(--ease-out-smooth, ease-out) both;
  transition:
    opacity 0.26s var(--ease-in-smooth, ease-in),
    transform 0.3s var(--ease-in-smooth, ease-in);
}

.notifications-onboarding-ok-wrap {
  position: relative;
  z-index: 50;
  flex-shrink: 0;
  margin: 8px 22px 0;
  padding: 10px 0 4px;
  background: transparent;
  opacity: 1;
  transform: none;
  transition:
    opacity 0.26s var(--ease-in-smooth, ease-in),
    transform 0.3s var(--ease-in-smooth, ease-in);
}

.notifications-onboarding-banner.hidden,
.notifications-onboarding-ok-wrap.hidden,
.notifications-onboarding-overlay.hidden {
  display: none;
}

.notifications-onboarding-banner__inner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.notifications-onboarding-banner__icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #2f80ed;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notifications-onboarding-banner__title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  color: #111;
}

.notifications-onboarding-banner__sub {
  margin: 2px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: #6b7280;
}

.notifications-onboarding-ok {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 12px;
  background: #2f80ed;
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.notifications-onboarding-ok:hover {
  background: #2570d4;
}

.notifications-onboarding-ok:active {
  transform: scale(0.98);
}

.notifications-onboarding-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.5);
  pointer-events: auto;
  opacity: 1;
  transition: opacity 0.3s var(--ease-in-smooth, ease-in);
}

#notifications-modal.notif-onboarding-step2-closing .notifications-onboarding-overlay {
  opacity: 0;
  pointer-events: none;
}

#notifications-modal.notif-onboarding-step2-closing .notifications-onboarding-banner,
#notifications-modal.notif-onboarding-step2-closing .notifications-onboarding-ok-wrap {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

html.theme-dark .notifications-onboarding-banner {
  background: var(--surface, #1c1c1e);
  border-color: rgba(47, 128, 237, 0.35);
}

html.theme-dark .notifications-onboarding-banner__title {
  color: rgba(236, 236, 241, 0.95);
}

html.theme-dark .notifications-onboarding-banner__sub {
  color: rgba(236, 236, 241, 0.55);
}

#notifications-modal .notifications-center {
  display: flex;
  flex-direction: column;
}

.notifications-center__footer {
  position: sticky;
  bottom: 10px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 16px 12px;
  padding: 12px 14px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.14), 0 2px 8px rgba(15, 23, 42, 0.06);
  text-align: left;
  pointer-events: auto;
}

.notifications-center__footer.hidden {
  display: none;
}

.notifications-center__footer-close {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.16);
  color: rgba(12, 13, 14, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
  -webkit-tap-highlight-color: transparent;
}

.notifications-center__footer-close:hover {
  color: rgba(12, 13, 14, 0.85);
  background: #f3f4f6;
}

.notifications-center__footer-close:active {
  transform: scale(0.94);
}

html.theme-dark .notifications-center__footer-close {
  background: var(--surface, #2c2c2e);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  color: rgba(236, 236, 241, 0.65);
}

html.theme-dark .notifications-center__footer-close:hover {
  color: rgba(236, 236, 241, 0.95);
  background: #3a3a3c;
}

.notifications-center__footer-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #2a7dff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notifications-center__footer-icon svg {
  display: block;
}

.notifications-center__footer-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.notifications-center__footer-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  color: #0c0d0e;
}

.notifications-center__footer-sub {
  font-size: 13px;
  font-weight: 400;
  line-height: 1.3;
  color: rgba(12, 13, 14, 0.55);
}

.settings-modal__body {
  padding: 12px;
  padding-top: 0;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.settings-modal__banner-wrap {
  margin: 0;
  min-height: 120px;
}

.settings-modal__banner-viewport {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 22px;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

.settings-modal__banner-viewport--single {
  touch-action: auto;
}

.settings-modal__banner-track {
  display: flex;
  flex-direction: row;
  will-change: transform;
}

.settings-modal__banner-track.settings-modal__banner-track--anim {
  transition: transform 0.42s cubic-bezier(0.25, 0.1, 0.25, 1);
}

@media (prefers-reduced-motion: reduce) {
  .settings-modal__banner-track.settings-modal__banner-track--anim {
    transition-duration: 0.01ms;
  }
}

.settings-modal__banner-link {
  display: block;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.settings-modal__banner-slide.settings-modal__banner-link {
  box-sizing: border-box;
}

.settings-modal__banner {
  display: block;
  width: 100%;
  height: auto;
  min-height: 120px;
  border-radius: 22px;
  object-fit: cover;
  background: var(--border);
  pointer-events: auto;
}

.settings-modal__banner-slider {
  position: relative;
}

.settings-modal__banner-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.settings-modal__banner-dots.hidden {
  display: none;
}

.settings-modal__banner-dot {
  width: 6px;
  height: 6px;
  border: none;
  padding: 0;
  margin: 0;
  border-radius: 50%;
  background: var(--text-muted);
  opacity: 0.35;
  cursor: pointer;
  transition: opacity 0.2s ease, background 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.settings-modal__banner-dot:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.settings-modal__banner-dot--active {
  opacity: 1;
  background: var(--primary);
}

.settings-modal__plan {
  margin: 0;
  font-size: 16px;
  color: var(--text);
}

.settings-modal__user-id-wrap {
  min-width: 0;
}

.settings-modal__user-id {
  margin: 7px 0 0 0;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 700;
  color: rgba(12, 13, 14, 0.52);
}

html.theme-dark .settings-modal__user-id {
  color: rgba(236, 236, 241, 0.52);
}

.settings-modal__brand-section {
  padding-top: 16px;
}

.settings-modal__brand-heading {
  margin: 7px 0;
  padding: 0 12px;
  font-weight: 700;
  font-size: 14px;
  color: rgba(12, 13, 14, 0.52);
  text-transform: uppercase;
}

html.theme-dark .settings-modal__brand-heading {
  color: rgba(236, 236, 241, 0.52);
}

.settings-modal__brand-wrap {
  margin: 0;
  padding: 12px 14px;
  background: #007aff;
  border-radius: 16px;
  text-align: center;
  border-top: none;
}

html.theme-dark .settings-modal__brand-wrap {
  background: var(--primary);
}

.settings-modal__brand-link {
  display: flex;
  justify-content: center;
  width: 100%;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  padding: 2px;
}

.settings-modal__brand-link:hover,
.settings-modal__brand-link:focus,
.settings-modal__brand-link:active,
.settings-modal__brand-link:visited {
  text-decoration: none;
  color: #fff;
}

.settings-modal__legal-links {
  margin: 0;
  padding-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 0;
  border: none;
}

.settings-modal__legal-heading {
  margin: 7px 0 7px;
  padding: 0 12px;
  font-weight: 700;
  font-size: 14px;
  color: rgba(12, 13, 14, 0.52);
  text-transform: uppercase;
}

html.theme-dark .settings-modal__legal-heading {
  color: rgba(236, 236, 241, 0.52);
}

/* Карточки документов: block + 100% ширины (inline <a> иначе не даёт макет из docs) */
#settings-modal .settings-modal__legal-link + .settings-modal__legal-link {
  margin-top: 16px;
}

#settings-modal .settings-modal__legal-link {
  display: block;
  box-sizing: border-box;
  width: 100%;
  font-size: 16px;
  font-weight: 400;
  color: #000;
  text-decoration: none;
  text-align: left;
  background: #fff;
  border-radius: 16px;
  padding: 14px 12px;
}

html.theme-dark #settings-modal .settings-modal__legal-link {
  color: var(--text);
  background: var(--surface);
}

#settings-modal .settings-modal__legal-link:hover,
#settings-modal .settings-modal__legal-link:focus,
#settings-modal .settings-modal__legal-link:active,
#settings-modal .settings-modal__legal-link:visited {
  text-decoration: none;
}

.settings-modal__theme {
  margin-top: 24px;
  padding-top: 0;
  border-top: none;
}

.settings-modal__theme-label {
  display: block;
  margin: 7px 0 7px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 700;
  color: rgba(12, 13, 14, 0.52);
  text-transform: uppercase;
}

html.theme-dark .settings-modal__theme-label {
  color: rgba(236, 236, 241, 0.52);
}

.settings-modal__theme-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-modal__theme-btn {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s var(--ease-out-smooth), border-color 0.15s, color 0.15s;
}

html.theme-dark .settings-modal__theme-btn {
  background: var(--surface);
}

.settings-modal__theme-btn:hover {
  background: var(--surface-muted);
}

.settings-modal__theme-btn--active {
  border-color: var(--primary);
  background: var(--pro-badge-bg);
  color: var(--primary);
}

/* Экран «Редактировать пост» (из меню канала: только channel_id, поста нет) */
.edit-post-landing {
  padding: 24px 16px;
  min-height: 40vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.edit-post-landing__box {
  max-width: 360px;
  text-align: center;
}
.edit-post-landing__text {
  margin: 0 0 20px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
}
.edit-post-landing__btn {
  display: inline-block;
  text-decoration: none;
}
/* Bottom sheet: подтверждение согласия (комментарий / профиль) */
.consent-sheet {
  position: fixed;
  inset: 0;
  z-index: 10003;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
}

.consent-sheet.hidden {
  display: none !important;
}

.consent-sheet.is-open {
  pointer-events: auto;
}

.consent-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.22s var(--ease-out-smooth);
}

.consent-sheet.is-open .consent-sheet__backdrop {
  opacity: 1;
}

.consent-sheet__panel {
  position: relative;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  padding: 8px 20px 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
  transform: translateY(100%);
  transition: transform 0.3s var(--ease-out-smooth);
}

.consent-sheet.is-open .consent-sheet__panel {
  transform: translateY(0);
}

.consent-sheet__handle {
  width: 36px;
  height: 4px;
  margin: 4px auto 12px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.15);
}

html.theme-dark .consent-sheet__handle {
  background: rgba(255, 255, 255, 0.2);
}

.consent-sheet__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--bg-muted, #f0f1f5);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.consent-sheet__close:active {
  opacity: 0.85;
}

.consent-sheet__icon-wrap {
  display: flex;
  justify-content: center;
  margin: 8px 0 20px;
}

.consent-sheet__icon {
  width: 80px;
  height: 80px;
}

.consent-sheet__title {
  margin: 0 0 24px;
  padding: 0 8px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
  text-align: center;
}

.consent-sheet__cta {
  width: 100%;
  margin-bottom: 16px;
  font-size: 17px;
  font-weight: 600;
  border-radius: 12px;
  min-height: 48px;
}

.consent-sheet__legal {
  margin: 0;
  padding: 0 4px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-muted);
  text-align: center;
}

.consent-sheet__link {
  color: var(--primary);
  text-decoration: none;
}

.consent-sheet__link:hover {
  text-decoration: underline;
}

/* Модал тарифов: поверх всех (выше хедера), плавное появление/закрытие, кнопка закрыть */
.plan-modal {
  pointer-events: none;
  z-index: 10000;
}

.plan-modal.is-open {
  pointer-events: auto;
}

.plan-modal .modal__backdrop {
  transition: opacity 0.22s var(--ease-out-smooth);
  opacity: 0;
}

.plan-modal.is-open .modal__backdrop {
  opacity: 1;
}

.plan-modal .modal__box {
  transition: opacity 0.22s var(--ease-out-smooth), transform 0.22s var(--ease-out-smooth);
  opacity: 0;
  transform: scale(0.96);
}

.plan-modal.is-open .modal__box {
  opacity: 1;
  transform: scale(1);
}

.plan-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.plan-modal__close {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  margin: -8px -8px 0 0;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.plan-modal__close:hover {
  background: var(--hover-overlay);
  color: var(--text);
}

.plan-modal .modal__title,
.plan-modal .modal__snippet {
  font-size: 17px;
}

.plan-modal .modal__title {
  margin: 0;
  flex: 1;
}

.plan-modal .modal__snippet {
  margin-bottom: 0;
  font-size: 17px;
}

.plan-modal__tariffs {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.plan-modal__tariff-btn {
  width: 100%;
  text-align: center;
  text-decoration: none;
}

/* Модал удаления выбранных: выезжает снизу, 2 кнопки — Удалить у всех (красный), Отмена */
.delete-confirm-modal.modal {
  align-items: flex-end;
  justify-content: center;
}

.delete-confirm-modal .modal__box {
  margin: 0 12px 24px;
  margin-bottom: calc(24px + env(safe-area-inset-bottom));
  max-width: 400px;
  width: 100%;
  transform: translateY(100%);
}

.delete-confirm-modal.is-open .modal__box {
  transform: translateY(0);
}

.delete-confirm-modal__box .modal__title {
  margin-bottom: 16px;
  text-align: center;
}

.delete-confirm-modal__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.delete-confirm-modal__btn-delete {
  color: var(--danger);
  background: transparent;
}

.delete-confirm-modal__btn-delete:hover:not(:disabled) {
  background: rgba(220, 38, 38, 0.08);
  color: var(--danger);
}

/* Модал выбора причины жалобы */
.report-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.report-modal__title {
  margin: 0;
  font-weight: 600;
  font-size: 17px;
  flex: 1;
}

.report-modal__close {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  margin: -8px -8px 0 0;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.report-modal__close:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
}

.report-modal__prompt {
  margin: 0 0 16px 0;
  font-size: 15px;
  color: var(--text-muted);
}

.report-modal__reasons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.report-modal__reason {
  display: block;
  width: 100%;
  padding: 12px 16px;
  text-align: left;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.report-modal__reason:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: var(--text-muted);
}

/* ---- Контейнер чата ---- */
.comments--chat-container {
  position: relative;
  transform: translateZ(0);
}

.comments__container--scroll {
  position: relative;
}

/* Кнопка «к последнему комментарию» справа — плавное появление и исчезновение */
.scroll-to-bottom {
  position: fixed;
  right: var(--composer-padding-r, 14px);
  bottom: calc(72px + 24px + env(safe-area-inset-bottom));
  z-index: 9999;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 2px 12px var(--shadow-elevation-3-primary, rgba(0, 0, 0, 0.15));
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.88) translateY(6px);
  visibility: hidden;
  transition: right 0.28s var(--ease-out-smooth), opacity 0.28s var(--ease-out-smooth), transform 0.28s var(--ease-out-smooth), visibility 0s 0.28s;
}

.scroll-to-bottom:not(.hidden) {
  opacity: 1;
  transform: scale(1) translateY(0);
  visibility: visible;
  transition: right 0.28s var(--ease-out-smooth), opacity 0.28s var(--ease-out-smooth), transform 0.28s var(--ease-out-smooth), visibility 0s 0s;
}

.scroll-to-bottom:hover {
  background: var(--surface-elevated, rgba(255, 255, 255, 0.95));
}

.scroll-to-bottom:not(.hidden):active {
  transform: scale(0.95) translateY(0);
}

.scroll-to-bottom.hidden {
  opacity: 0;
  transform: scale(0.88) translateY(6px);
  pointer-events: none;
  visibility: hidden;
  transition: right 0.28s var(--ease-out-smooth), opacity 0.28s var(--ease-out-smooth), transform 0.28s var(--ease-out-smooth), visibility 0s 0.28s;
}

.scroll-to-bottom.hidden:active {
  transform: scale(0.88) translateY(6px);
}

.scroll-to-bottom svg {
  display: block;
}

/* ---- Слой контекста long-press (viewport-fixed): бэкдроп под лентой, бар/меню сверху ---- */
.context-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.context-layer.is-open {
  pointer-events: auto;
}

.context-layer.hidden {
  display: none !important;
}

.context-layer--backdrop {
  z-index: 9999;
}

.context-layer--selected-comment {
  z-index: 10000;
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.context-layer--selected-comment .comment-wrapper {
  pointer-events: auto;
}

.context-layer--ui {
  z-index: 10001;
}

body.context-menu-open #app {
  position: relative;
  z-index: 9998;
}

.context-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(0, 0, 0, 0.25);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.22s var(--ease-out-smooth);
}

.context-layer.is-open .context-backdrop {
  opacity: 1;
}

@supports not (backdrop-filter: blur(1px)) {
  .context-backdrop {
    background: rgba(0, 0, 0, 0.4);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

body.context-menu-open {
  -webkit-user-select: none;
  user-select: none;
  overflow: hidden;
  touch-action: none;
}
/* Модалка согласий: фон не скроллится (без position:fixed, чтобы не ломать вёрстку) */
html.consent-modal-open {
  overflow: hidden;
}
body.consent-modal-open {
  overflow: hidden;
  touch-action: none;
}

/* При открытом контексте можно выделить только тело текста выбранного комментария */
body.context-menu-open .comment--selected .comment__text {
  -webkit-user-select: text;
  user-select: text;
}

/* Защита контента: не-админам нельзя выделять/копировать текст комментариев */
body.comment-copy-protected #comments-list,
body.comment-copy-protected .comment,
body.comment-copy-protected .comment__text,
body.comment-copy-protected .reply-composer__quote-full .comment__text {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

body.comment-copy-protected.context-menu-open .comment--selected .comment__text {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Поле ввода комментария остаётся выделяемым (вставка своего текста) */
body.comment-copy-protected .tg-composer__input,
body.comment-copy-protected input,
body.comment-copy-protected textarea {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

.chat-context-reactions-bar {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  background: var(--surface);
  border-radius: 24px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  opacity: 0;
  transform: translateY(-6px) scale(0.94);
  transform-origin: center bottom;
  transition: opacity 0.22s var(--ease-out-smooth), transform 0.22s var(--ease-out-smooth);
  will-change: opacity, transform;
}

.context-layer.is-open .chat-context-reactions-bar {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.chat-context-reactions-bar__quick {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: nowrap;
}

.chat-context-reactions-bar__quick .chat-context-reaction-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s var(--ease-out-smooth), transform 0.1s var(--ease-out-smooth);
}

.chat-context-reactions-bar__quick .chat-context-reaction-btn:hover {
  background: var(--bg);
}

.chat-context-reactions-bar__quick .chat-context-reaction-btn:active {
  transform: scale(1.12);
}

.chat-context-reactions-bar__more {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--bg);
  font-size: 20px;
  line-height: 1;
  color: var(--text);
  cursor: pointer;
  font-weight: 500;
  transition: background 0.15s var(--ease-out-smooth), transform 0.1s var(--ease-out-smooth);
}

.chat-context-reactions-bar__more:hover {
  background: var(--neutral-fill);
}

.chat-context-reactions-bar__more:active {
  transform: scale(0.95);
}

.comment-context-menu-popover {
  position: absolute;
  z-index: 2;
  min-width: 200px;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);

  opacity: 0;
  transform: translateY(6px) scale(0.94);
  transform-origin: center top;
  transition: opacity 0.22s var(--ease-out-smooth), transform 0.22s var(--ease-out-smooth);
  will-change: opacity, transform;
}

.comment-context-menu-popover--mine {
  transform-origin: right top;
}

.comment-context-menu-popover--other {
  transform-origin: left top;
}

.context-layer.is-open .comment-context-menu-popover {
  opacity: 1;
  transform: translateY(0) scale(1);
}

@media (prefers-reduced-motion: reduce) {
  .context-backdrop,
  .chat-context-reactions-bar,
  .comment-context-menu-popover {
    transition-duration: 0.01ms !important;
  }
}

.comment-context-menu {
  padding: 6px 0;
  margin: 0;
  list-style: none;
}

.comment-context-menu__item {
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: none;
  font: inherit;
  font-size: 16px;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  transition: background 0.1s var(--ease-out-smooth);
  border-radius: 0;
  grid-auto-flow: column;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
}

.comment-context-menu__item:hover,
.comment-context-menu__item:focus {
  background: var(--bg);
}

.comment-context-menu__item:active {
  background: var(--neutral-fill);
}

.comment-context-menu__item--danger {
  color: #e53935;
  display: flex;
  align-items: center;
  gap: 10px;
}

.comment-context-menu__item--danger .comment-context-menu__item-icon {
  flex-shrink: 0;
  color: #e53935;
}

.comment-context-menu__item--danger .comment-context-menu__item-icon use {
  fill: currentColor;
}

.comment-context-menu__item-icon {
  width: 20px;
  height: 20px;
  display: block;
}

.comment-context-menu__divider {
  height: 1px;
  background: var(--border, rgba(0,0,0,0.08));
  margin: 8px 0;
  padding: 0;
  border: none;
  pointer-events: none;
}

.comment-context-menu__item.hidden {
  display: none !important;
}

/* Bottom sheet: Написать от имени */
.write-as-sheet {
  position: fixed;
  inset: 0;
  z-index: 10002;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
}

.write-as-sheet.hidden {
  display: none !important;
}

.write-as-sheet.is-open {
  pointer-events: auto;
}

.write-as-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.2s var(--ease-out-smooth);
}

.write-as-sheet.is-open .write-as-sheet__backdrop {
  opacity: 1;
}

.write-as-sheet__panel {
  position: relative;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
  transform: translateY(100%);
  transition: transform 0.25s var(--ease-out-smooth);
  max-height: calc(100vh - 12px);
  max-height: calc(100dvh - 12px);
  overflow: hidden;
}

.write-as-sheet.is-open .write-as-sheet__panel {
  transform: translateY(0);
}

.write-as-sheet__title {
  margin: 0 0 16px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.write-as-sheet__hint {
  margin: -8px 0 12px 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-muted);
}

.write-as-sheet__hint.hidden {
  display: none !important;
}

.write-as-sheet__pro-link {
  color: var(--primary);
  font-weight: 500;
  text-decoration: none;
}

.write-as-sheet__pro-link:hover,
.write-as-sheet__pro-link:focus,
.write-as-sheet__pro-link:active,
.write-as-sheet__pro-link:visited {
  color: var(--primary);
  text-decoration: none;
}

.write-as-sheet__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
}

#write-as-sheet-channel-rows {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.write-as-sheet__row--select {
  cursor: pointer;
  border-radius: 12px;
  margin: 0 -8px;
  padding: 12px 8px;
}

.write-as-sheet__row--select:hover {
  background: rgba(0, 0, 0, 0.04);
}

.write-as-sheet__row--select:active {
  background: rgba(0, 0, 0, 0.08);
}

.write-as-sheet__name {
  flex: 1;
  font-size: 16px;
  color: var(--text);
}

.write-as-sheet__avatar,
.write-as-sheet__avatar-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

.write-as-sheet__avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
}

.write-as-sheet__avatar-placeholder.hidden {
  display: none !important;
}

/* Выезжающая панель «Картинки в комментариях с подпиской» (при клике на скрепку без подписки) */
.attach-pro-sheet {
  position: fixed;
  inset: 0;
  z-index: 10002;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
}

.attach-pro-sheet.hidden {
  display: none !important;
}

.attach-pro-sheet.is-open {
  pointer-events: auto;
}

.attach-pro-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.22s var(--ease-out-smooth);
}

.attach-pro-sheet.is-open .attach-pro-sheet__backdrop {
  opacity: 1;
}

.attach-pro-sheet__panel {
  position: relative;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 24px 20px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
  transform: translateY(100%);
  transition: transform 0.3s var(--ease-out-smooth);
  max-height: 85vh;
  overflow-y: auto;
}

.attach-pro-sheet.is-open .attach-pro-sheet__panel {
  transform: translateY(0);
}

.attach-pro-sheet__icon-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.attach-pro-sheet__icon {
  width: 56px;
  height: 56px;
}

.attach-pro-sheet__title {
  margin: 0 0 8px 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  line-height: 1.25;
}

.attach-pro-sheet__subtitle {
  margin: 0 0 20px 0;
  font-size: 15px;
  line-height: 1.4;
  color: var(--text-muted);
  text-align: center;
}

.attach-pro-sheet__features {
  list-style: none;
  margin: 0 0 24px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.attach-pro-sheet__feature {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.attach-pro-sheet__feature-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #a855f7 0%, #6366f1 50%, #3b82f6 100%);
}

.attach-pro-sheet__feature-icon--no-ads {
  background: transparent;
  border: 2px solid var(--text-muted);
  position: relative;
}

.attach-pro-sheet__feature-icon--no-ads::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 2px;
  background: var(--text-muted);
  transform: translate(-50%, -50%) rotate(-45deg);
}

.attach-pro-sheet__feature-icon--comments {
  font-size: 16px;
  background: linear-gradient(135deg, #f472b6 0%, #a855f7 100%);
}

.attach-pro-sheet__feature-icon--time {
  font-size: 16px;
  background: linear-gradient(135deg, #8fefa8 0%, #2ce686 100%);
}

.attach-pro-sheet__feature-icon--love {
  font-size: 16px;
  background: linear-gradient(135deg, #f154a5 0%, #f44680 100%);
}

.attach-pro-sheet__feature-icon--ai {
  font-size: 16px;
  background: linear-gradient(135deg, #38bdf8 0%, #6366f1 100%);
}

.attach-pro-sheet__feature-title {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.attach-pro-sheet__feature-desc {
  display: block;
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 2px;
}

.attach-pro-sheet__cta {
  width: 100%;
  padding: 14px 20px;
  font-size: 17px;
  font-weight: 600;
  border-radius: 14px;
}

.all-reactions-sheet {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  pointer-events: none;
}

.all-reactions-sheet.is-open {
  pointer-events: auto;
}

.all-reactions-sheet.hidden {
  display: none !important;
}

.all-reactions-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.2s var(--ease-out-smooth);
}

.all-reactions-sheet.is-open .all-reactions-sheet__backdrop {
  opacity: 1;
}

@supports not (backdrop-filter: blur(1px)) {
  .all-reactions-sheet__backdrop {
    background: rgba(0, 0, 0, 0.4);
  }
}

.all-reactions-sheet__panel {
  position: fixed;
  width: auto;
  max-width: min(320px, calc(100vw - 32px));
  max-height: 50vh;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s var(--ease-out-smooth), transform 0.2s var(--ease-out-smooth);
}

.all-reactions-sheet.is-open .all-reactions-sheet__panel {
  opacity: 1;
  transform: translateY(0);
}

.all-reactions-sheet__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.all-reactions-sheet__grid .all-reactions-sheet__btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--bg);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
}

.all-reactions-sheet__grid .all-reactions-sheet__btn:hover {
  background: var(--neutral-fill);
}

.all-reactions-sheet__grid .all-reactions-sheet__btn:active {
  transform: scale(1.1);
}

/* ---- Панель «Кто поставил реакцию» ---- */
.reaction-users-backdrop {
  position: absolute;
  inset: 0;
  z-index: 10050;
  background: rgba(255, 255, 255, 0.15);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.2s var(--ease-out-smooth);
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.reaction-users-backdrop.reaction-users-backdrop--open {
  opacity: 1;
}

.reaction-users-backdrop.hidden {
  display: none !important;
}

.reaction-users-sheet {
  position: absolute;
  z-index: 10051;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: calc(100% - 32px);
  max-width: 360px;
  max-height: 70vh;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.2s var(--ease-out-smooth), transform 0.2s var(--ease-out-smooth);
  pointer-events: auto;
  touch-action: manipulation;
}

.reaction-users-sheet.reaction-users-sheet--open {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.reaction-users-sheet.hidden {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .reaction-users-backdrop,
  .reaction-users-sheet {
    transition-duration: 0.01ms !important;
  }
}

.reaction-users-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border, rgba(0,0,0,0.08));
  flex-shrink: 0;
}

.reaction-users-sheet__title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.reaction-users-sheet__close {
  padding: 4px;
  border: none;
  background: none;
  color: var(--text-secondary, #666);
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reaction-users-sheet__close:active {
  animation: cross-scale-pop 0.35s var(--ease-out-smooth);
}

.reaction-users-sheet__close:hover {
  background: var(--bg);
  color: var(--text);
}

.reaction-users-sheet__list {
  overflow-y: auto;
  padding: 8px 0;
}

.reaction-users-sheet__row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 16px;
  text-align: left;
  border: none;
  background: none;
  width: 100%;
  font: inherit;
  cursor: default;
}

.reaction-users-sheet__row.reaction-users-sheet__link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.reaction-users-sheet__row.reaction-users-sheet__link:hover {
  background: var(--bg);
}

.reaction-users-sheet__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg);
  display: block;
}

.reaction-users-sheet__avatar-wrap {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
}

.reaction-users-sheet__avatar-wrap--pro {
  box-shadow: 0 0 0 2px #a855f7;
}

.reaction-users-sheet__body {
  flex: 1;
  min-width: 0;
}

.reaction-users-sheet__name {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  margin: 0 0 2px 0;
}

.reaction-users-sheet__name--badges {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.reaction-users-sheet__name-text {
  min-width: 0;
}

.reaction-users-sheet__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary, #666);
}

.reaction-users-sheet__emoji {
  opacity: 0.7;
  font-size: 14px;
  line-height: 1;
}

.reaction-users-sheet__empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-secondary, #666);
  font-size: 15px;
  margin: 0;
}

/* Bottom sheet: модерация реактора (как в TG) */
.reactor-mod-sheet {
  position: fixed;
  inset: 0;
  z-index: 10060;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
}
.reactor-mod-sheet.hidden {
  display: none !important;
}
.reactor-mod-sheet.is-open {
  pointer-events: auto;
}
.reactor-mod-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.22s var(--ease-out-smooth);
}
.reactor-mod-sheet.is-open .reactor-mod-sheet__backdrop {
  opacity: 1;
}
.reactor-mod-sheet__panel {
  position: relative;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  padding: 16px 16px 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.14);
  transform: translateY(100%);
  transition: transform 0.28s var(--ease-out-smooth);
}
.reactor-mod-sheet.is-open .reactor-mod-sheet__panel {
  transform: translateY(0);
}
.reactor-mod-sheet__close {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--bg-muted, #f0f1f5);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
html.theme-dark .reactor-mod-sheet__close {
  background: rgba(255, 255, 255, 0.1);
}
.reactor-mod-sheet__title {
  margin: 4px 40px 20px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  color: var(--text);
}
.reactor-mod-sheet__section {
  margin: 0 4px 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted, #8e8e93);
}
.reactor-mod-sheet__options {
  background: var(--bg-muted, #f2f2f7);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
}
html.theme-dark .reactor-mod-sheet__options {
  background: rgba(255, 255, 255, 0.06);
}
.reactor-mod-sheet__option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  font-size: 16px;
  line-height: 1.3;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
html.theme-dark .reactor-mod-sheet__option {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}
.reactor-mod-sheet__option:last-child {
  border-bottom: none;
}
.reactor-mod-sheet__option:active {
  background: rgba(0, 0, 0, 0.04);
}
.reactor-mod-sheet__radio {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.25);
  box-sizing: border-box;
  position: relative;
}
html.theme-dark .reactor-mod-sheet__radio {
  border-color: rgba(255, 255, 255, 0.35);
}
.reactor-mod-sheet__option.is-selected .reactor-mod-sheet__radio {
  border-color: var(--primary, #007aff);
  background: var(--primary, #007aff);
}
.reactor-mod-sheet__option.is-selected .reactor-mod-sheet__radio::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: #fff;
}
.reactor-mod-sheet__option-label {
  flex: 1;
  min-width: 0;
}
.reactor-mod-sheet__continue {
  width: 100%;
  min-height: 48px;
  font-size: 17px;
  font-weight: 600;
  border-radius: 12px;
}
.reactor-mod-sheet__continue:disabled {
  opacity: 0.45;
  cursor: default;
}
.reaction-users-sheet__row--admin-target {
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

/* Admin panel (same style as comments) */
.admin-main {
  padding: 16px;
  padding-top: 60px;
  min-height: 100vh;
  background: var(--bg);
}
.admin-section__hint {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 12px 0;
}
.admin-channels {
  list-style: none;
  margin: 0;
  padding: 0;
}
.admin-channels li {
  margin-bottom: 8px;
}
.admin-channel-card {
  display: block;
  padding: 14px 16px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
}
.admin-channel-card:active {
  opacity: 0.9;
}
.admin-channel-card__title {
  font-weight: 600;
  font-size: 16px;
  margin: 0 0 4px 0;
}
.admin-channel-card__subs {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}
.admin-channel-info {
  background: var(--surface);
  padding: 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.admin-channel-info__title { font-weight: 600; margin: 0 0 4px 0; }
.admin-channel-info__subs { font-size: 14px; color: var(--text-muted); margin: 0; }
.admin-settings {
  background: var(--surface);
  padding: 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.admin-settings label { display: block; margin-bottom: 8px; font-size: 14px; }
.admin-settings input, .admin-settings select { width: 100%; padding: 8px; margin-top: 4px; box-sizing: border-box; }
.admin-btn-posts { width: 100%; margin-top: 8px; }
.admin-posts-container { display: flex; flex-direction: column; gap: 16px; }
.admin-post-preview {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.admin-post-preview__text { font-size: 15px; margin: 0 0 12px 0; white-space: pre-wrap; word-break: break-word; }
.admin-post-preview__media { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.admin-post-preview__media img, .admin-post-preview__media video { max-width: 100%; border-radius: var(--radius-sm); }
.admin-post-preview__buttons { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.admin-post-preview__buttons a, .admin-post-preview__buttons button {
  display: inline-block;
  padding: 8px 14px;
  font-size: 14px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  text-decoration: none;
  border: none;
  cursor: pointer;
}
.admin-post-preview__buttons a:visited { color: #fff; }

.admin-context-menu {
  position: fixed;
  z-index: 1000;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  min-width: 200px;
}
.admin-context-menu.hidden { display: none; }
.admin-context-menu__inner { display: flex; flex-direction: column; padding: 4px 0; }
.admin-context-menu__item {
  display: block;
  width: 100%;
  padding: 12px 16px;
  text-align: left;
  border: none;
  background: none;
  font-size: 15px;
  cursor: pointer;
  color: var(--text);
}
.admin-context-menu__item:hover { background: var(--bg); }
.admin-context-menu__item.hidden { display: none; }

.admin-modal { position: fixed; inset: 0; z-index: 1001; display: flex; align-items: center; justify-content: center; padding: 16px; }
.admin-modal.hidden { display: none; }
.admin-modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.4); }
.admin-modal__box { position: relative; background: var(--surface); border-radius: var(--radius); padding: 20px; max-width: 360px; width: 100%; box-shadow: 0 8px 32px rgba(0,0,0,0.2); }
.admin-modal__title { margin: 0 0 16px 0; font-size: 18px; }
.admin-modal__label { display: block; margin-bottom: 12px; font-size: 14px; }
.admin-modal__input { width: 100%; padding: 8px 12px; margin-top: 4px; box-sizing: border-box; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; }
.admin-modal__actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
