/*
 * OLONE — мобильный слой для основного приложения (index.html).
 *
 * Подключение в шаблоне: <link ... media="only screen and (max-width: 920px)" />
 * В этом случае весь файл применяется ТОЛЬКО при ширине viewport ≤ 920px — разметка
 * полноценного окна браузера на ПК (>920px) не меняется.
 *
 * Если уж нужно переопределить конкретный селектор из встроенного <style>,
 * добавляйте сюда с достаточной специфичностью (иногда понадобится селектор длиннее
 * или !important только в крайнем случае).
 *
 * Контрольные ширины для ручной проверки в DevTools: 360px, 390px, 430px.
 */

:root {
  --olone-mobile-breakpoint-max: 920px;
  -webkit-tap-highlight-color: color-mix(in srgb, var(--text, #222833) 12%, transparent);
}

/* После авторизации нижнее меню можно зафиксировать — пример-хук (раскомментируйте при вёрстке). */
/*
body.olone-chat-active .sidebar-footer {
  position: sticky;
  bottom: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
*/

/*
 * Пре-чат авторизация: на узкой ширине правую колонку с подсказкой скрываем,
 * подсказка открывается по «?». На ПК (без этого файла) остаётся двухколоночная вёрстка.
 */
.pre-chat-card.authLayout .auth-layout-row {
  grid-template-columns: minmax(0, 1fr) !important;
}

.pre-chat-card.authLayout #authHintPanel {
  display: none !important;
}

/* Шапка входа/регистрации: «Назад» по центру относительно блока заголовка */
.pre-chat-card.authLayout .auth-header {
  align-items: center;
  padding-top: 10px;
  padding-bottom: 12px;
}

.pre-chat-card.authLayout .auth-header #authBackBtn {
  align-self: center;
  flex-shrink: 0;
}

.pre-chat-card.authLayout .auth-level-toolbar {
  display: flex !important;
  align-items: center;
  width: 100%;
  gap: 10px;
  /* отступы снимаем с .levelDropdown — иначе «?» центрируется по «высокой» колонке */
  padding-bottom: 10px;
  box-sizing: border-box;
}

.pre-chat-card.authLayout .auth-level-toolbar .levelDropdown {
  flex: 1;
  min-width: 0;
  padding: 0 !important;
  align-self: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.pre-chat-card.authLayout .auth-level-toolbar #levelDropdownBtn {
  box-sizing: border-box;
  min-height: 44px;
}

.pre-chat-card.authLayout .auth-level-toolbar .auth-help-trigger {
  display: flex !important;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-sizing: border-box;
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  margin: 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition:
    background-color 240ms ease,
    color 240ms ease,
    border-color 240ms ease;
}

.pre-chat-card.authLayout .auth-level-toolbar .auth-help-trigger:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--border) 70%, var(--text));
}

.pre-chat-card.authLayout .auth-level-toolbar .auth-help-trigger[aria-expanded="true"] {
  color: var(--text);
  border-color: var(--text);
}

/* Выпадающее меню уровня: без лишнего горизонтального смещения (padding перенесён на ряд выше при необходимости) */
.pre-chat-card.authLayout .auth-level-toolbar .levelDropdownMenu {
  left: 0 !important;
  right: 0 !important;
}

/* Поле пароля и кнопка «глаз»: одинаковая высота и выравнивание по центру */
.pre-chat-card.authLayout .password-wrap {
  align-items: center;
}

.pre-chat-card.authLayout .password-wrap input[type="password"],
.pre-chat-card.authLayout .password-wrap input[type="text"] {
  box-sizing: border-box;
  min-height: 44px;
}

.pre-chat-card.authLayout .password-wrap #togglePasswordBtn {
  box-sizing: border-box;
  min-height: 44px;
  min-width: 44px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pre-chat-card.authLayout .auth-remember-mobile-only:not(.hidden) {
  display: flex !important;
}

.auth-help-root:not(.hidden) {
  display: grid !important;
  position: fixed;
  inset: 0;
  z-index: 4500;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  box-sizing: border-box;
}

.auth-help-root .auth-help-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  cursor: pointer;
}

.auth-help-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  max-height: min(72vh, 560px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  padding: 16px 18px 14px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-help-card .hint-title {
  margin-bottom: 0;
  font-size: 15px;
}

.auth-help-card .hint-text {
  font-size: 13px;
}

.auth-help-popover-close {
  margin-top: 4px;
  width: 100%;
}

/*
 * Мобильный просмотр профиля (чужой): обычная стеклянная модалка по центру.
 * Свой профиль как «дом»: класс .olone-mobile-profile-home — на весь экран, без блюра.
 */
#profileViewerModal:not(.olone-mobile-profile-home) .modal.modal--profile-viewer {
  width: min(560px, 96vw);
  max-height: 94vh;
}

#profileViewerModal:not(.olone-mobile-profile-home) .profile-viewer-layout {
  grid-template-columns: 1fr !important;
}

#profileViewerModal:not(.olone-mobile-profile-home) .profile-viewer-identity-row {
  /* Не дублируем сильный подъём: у аватара уже есть margin-top:-72px в базовой вёрстке. */
  margin-top: -14px;
}

/* Полноэкранный «дом» — основной экран после входа */
#profileViewerModal.olone-mobile-profile-home.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1250;
  padding: 0 !important;
  display: flex !important;
  align-items: stretch;
  justify-content: stretch;
  place-items: unset;
  background: var(--bg, #0c0d10) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

#profileViewerModal.olone-mobile-profile-home .modal.modal--profile-viewer {
  width: 100%;
  max-width: none;
  height: 100%;
  min-height: 100%;
  max-height: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#profileViewerModal.olone-mobile-profile-home .profile-viewer-back-btn,
#profileViewerModal.olone-mobile-profile-home .modal-close,
#profileViewerModal.olone-mobile-profile-home .profile-view-controls {
  display: none !important;
}

/* Заголовок «Профиль» над обложкой — не нужен на полноэкранном своём профиле */
#profileViewerModal.olone-mobile-profile-home .modal-header-row--profile-viewer {
  display: none !important;
}

#profileViewerModal.olone-mobile-profile-home .profile-viewer-layout {
  grid-template-columns: 1fr !important;
  gap: 8px;
  min-height: 0;
}

#profileViewerModal.olone-mobile-profile-home .profile-viewer-left {
  padding-left: 0;
  padding-right: 0;
  padding-top: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  gap: 0;
}

#profileViewerModal.olone-mobile-profile-home .profile-viewer-cover {
  width: 100%;
  margin: 0;
  border-radius: 0;
  box-sizing: border-box;
}

#profileViewerModal.olone-mobile-profile-home .profile-viewer-identity-row {
  /* Не дублируем сильный подъём: у аватара уже есть margin-top:-72px в базовой вёрстке. */
  margin-top: -14px;
  padding: 0 12px;
  align-items: flex-end;
}

#profileViewerModal.olone-mobile-profile-home .profile-viewer-integrations {
  padding: 0 12px;
  margin-top: 10px;
  min-height: 0;
}

#profileViewerModal.olone-mobile-profile-home .profile-viewer-integrations:not(.hidden) {
  min-height: auto;
}

#profileViewerModal.olone-mobile-profile-home .profile-viewer-integrations.hidden {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

#profileViewerModal.olone-mobile-profile-home .profile-viewer-level-status {
  padding: 6px 12px 10px;
}

#profileViewerModal.olone-mobile-profile-home .profile-viewer-left [data-profile-edit-only] {
  margin-left: 12px;
  margin-right: 12px;
}

#profileViewerModal.olone-mobile-profile-home .profile-viewer-right {
  padding: 0 14px 12px;
  border: none;
  background: transparent;
  gap: 10px;
}

#profileViewerModal.olone-mobile-profile-home .profile-viewer-mobile-nav:not(.hidden) {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
  box-sizing: border-box;
}

#profileViewerModal.olone-mobile-profile-home .profile-viewer-mobile-nav.hidden {
  display: none !important;
}

#profileViewerModal.olone-mobile-profile-home .profile-viewer-featured-wrap {
  margin-top: 2px;
}

/* Чужой профиль: «Назад» и закрытие на одной линии с блоком действий справа */
#profileViewerModal:not(.olone-mobile-profile-home) .modal.modal--profile-viewer {
  padding-left: 0;
  padding-right: 0;
  padding-top: 10px;
}

#profileViewerModal:not(.olone-mobile-profile-home) .modal-header-row--profile-viewer,
#profileViewerModal:not(.olone-mobile-profile-home) .profile-view-controls {
  padding-left: 14px;
  padding-right: 14px;
}

#profileViewerModal:not(.olone-mobile-profile-home) .modal-header-row--profile-viewer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

#profileViewerModal:not(.olone-mobile-profile-home) .profile-viewer-back-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  box-sizing: border-box;
  padding: 6px 12px;
  font-size: 13px;
}

#profileViewerModal:not(.olone-mobile-profile-home) .modal-close {
  width: 36px;
  height: 36px;
}

#profileViewerModal:not(.olone-mobile-profile-home) .profile-viewer-left {
  padding-left: 0;
  padding-right: 0;
  padding-top: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  gap: 0;
}

#profileViewerModal:not(.olone-mobile-profile-home) .profile-viewer-cover {
  width: 100%;
  margin: 0;
  border-radius: 0;
  box-sizing: border-box;
}

#profileViewerModal:not(.olone-mobile-profile-home) .profile-viewer-integrations {
  padding: 0 12px;
  margin-top: 10px;
  min-height: 0;
}

#profileViewerModal:not(.olone-mobile-profile-home) .profile-viewer-integrations:not(.hidden) {
  min-height: auto;
}

#profileViewerModal:not(.olone-mobile-profile-home) .profile-viewer-integrations.hidden {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

#profileViewerModal:not(.olone-mobile-profile-home) .profile-viewer-level-status {
  padding: 6px 12px 10px;
}

#profileViewerModal:not(.olone-mobile-profile-home) .profile-viewer-left [data-profile-edit-only] {
  margin-left: 12px;
  margin-right: 12px;
}

#profileViewerModal:not(.olone-mobile-profile-home) .profile-viewer-right {
  padding: 0 14px 12px;
  border: none;
  background: transparent;
  gap: 10px;
}

#profileViewerModal:not(.olone-mobile-profile-home) .profile-viewer-mobile-nav:not(.hidden) {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
  box-sizing: border-box;
}

#profileViewerModal:not(.olone-mobile-profile-home) .profile-viewer-mobile-nav.hidden {
  display: none !important;
}

#profileViewerModal:not(.olone-mobile-profile-home) .profile-viewer-featured-wrap {
  margin-top: 2px;
}

/* Чужой профиль на телефоне — тот же полноэкранный лист, что и «дом», но с шапкой Назад / Закрыть */
@media (max-width: 920px) {
  #profileViewerModal:not(.olone-mobile-profile-home).modal-backdrop {
    padding: 0 !important;
    align-items: stretch;
    justify-content: stretch;
    place-items: unset;
  }

  #profileViewerModal:not(.olone-mobile-profile-home) .modal.modal--profile-viewer {
    width: 100%;
    max-width: none;
    min-height: 100dvh;
    max-height: none;
    height: auto;
    border-radius: 0;
    border: none;
    box-shadow: none;
    padding-top: 0;
    padding-left: 0;
    padding-right: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  #profileViewerModal:not(.olone-mobile-profile-home) .profile-viewer-right {
    border: none;
    background: transparent;
  }

  /* Кадрирование аватара — тот же полноэкранный слой, что и профиль (поверх него по z-index). */
  #avatarCropModal.modal-backdrop {
    padding: 0 !important;
    align-items: stretch;
    justify-content: stretch;
    place-items: unset;
    background: var(--bg, #0c0d10) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  #avatarCropModal .modal {
    width: 100%;
    max-width: none;
    min-height: 100dvh;
    max-height: none;
    height: auto;
    border-radius: 0;
    border: none;
    box-shadow: none;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 14px 14px calc(14px + env(safe-area-inset-bottom, 0px));
    margin: 0;
  }

  #avatarCropModal .avatar-crop-canvas {
    max-width: min(420px, 100%);
    align-self: center;
  }
}

/* Мессенджер: вертикальный стек, списки — на весь экран без «островков» карточек */
.app {
  min-height: 100vh;
  min-height: 100dvh;
}

.messenger-shell:not(.hidden) {
  flex: 1;
  min-height: 0;
  display: flex !important;
  flex-direction: column;
  align-items: stretch;
  border-top-color: transparent;
}

.messenger-shell:not(.hidden) .col-dialogs,
.messenger-shell:not(.hidden) .col-user {
  flex: 0 0 auto;
}

.messenger-shell:not(.hidden)[data-olone-mobile-detail="none"] .col-dialogs.panel-card {
  flex: 1 1 auto;
  min-height: 0;
  border: none !important;
  background: transparent !important;
}

.messenger-shell:not(.hidden) > .panel-card,
.messenger-shell:not(.hidden) > main {
  border-right: none !important;
}

/* Без активного чата/канала список занимает экран под поиском и нижними вкладками */
.messenger-shell:not(.hidden)[data-olone-mobile-detail="none"] .dialogs-scroll-strip {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none !important;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Расширенный чат: полноэкранный список тем (отдельный экран до выбора темы) */
.messenger-shell:not(.hidden)[data-olone-mobile-detail="gc-topics"] .col-chat {
  display: none !important;
}

.messenger-shell:not(.hidden)[data-olone-mobile-detail="gc-topics"] .col-dialogs {
  display: flex !important;
  flex: 1 1 auto;
  min-height: 0;
  order: 1;
  border: none !important;
  background: transparent !important;
}

.messenger-shell:not(.hidden)[data-olone-mobile-detail="gc-topics"] .col-user {
  display: none !important;
}

.messenger-shell:not(.hidden)[data-olone-mobile-detail="gc-topics"] #searchColumn {
  display: none !important;
}

.messenger-shell:not(.hidden)[data-olone-mobile-detail="gc-topics"] .col-dialogs .panel-head {
  display: none !important;
}

.messenger-shell:not(.hidden)[data-olone-mobile-detail="gc-topics"] .dialogs-scroll-strip {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-top: 0;
}

.messenger-shell:not(.hidden)[data-olone-mobile-detail="gc-topics"] .dialogs-rail-mobile-wrap {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  box-sizing: border-box;
}

.messenger-shell:not(.hidden)[data-olone-mobile-detail="gc-topics"] #groupChatsRailWrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.messenger-shell:not(.hidden)[data-olone-mobile-detail="gc-topics"] .gc-topics-rail:not(.hidden) {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-self: stretch;
  width: 100%;
}

.messenger-shell:not(.hidden)[data-olone-mobile-detail="gc-topics"] .gc-topics-rail-top {
  position: sticky;
  top: 0;
  z-index: 12;
  flex-shrink: 0;
  background: var(--bg, #0c0d10);
  padding-top: max(8px, env(safe-area-inset-top, 0px));
  border-bottom: 1px solid color-mix(in srgb, var(--border, #252830) 65%, transparent);
}

.messenger-shell:not(.hidden)[data-olone-mobile-detail="gc-topics"] .gc-topics-rail-head {
  padding-top: 0;
}

.messenger-shell:not(.hidden)[data-olone-mobile-detail="gc-topics"] .gc-topics-rail-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
}

.messenger-shell:not(.hidden)[data-olone-mobile-detail="gc-topics"] .gc-topics-list {
  flex: 0 0 auto;
  min-height: 0;
  overflow: visible;
  justify-content: flex-start;
  align-content: flex-start;
}

.messenger-shell:not(.hidden)[data-olone-mobile-detail="gc-topics"] .gc-topics-add-btn {
  flex-shrink: 0;
  margin-top: 0;
}

.messenger-shell:not(.hidden)[data-olone-mobile-detail="open"] .col-dialogs {
  display: none !important;
}

.messenger-shell:not(.hidden)[data-olone-mobile-detail="open"] .col-user {
  display: none !important;
}

.messenger-shell:not(.hidden)[data-olone-mobile-detail="open"] #searchColumn {
  display: none !important;
}

.messenger-shell:not(.hidden)[data-olone-mobile-detail="none"] .col-chat {
  display: none !important;
}

/* Вкладки «Друзья» и «Каналы»: чат скрыт, но правая колонка поиска должна быть видна. */
.messenger-shell:not(.hidden)[data-olone-mobile-detail="none"][data-olone-mobile-pane="friends"] .col-chat,
.messenger-shell:not(.hidden)[data-olone-mobile-detail="none"][data-olone-mobile-pane="channels"] .col-chat {
  display: block !important;
  flex: 0 0 auto;
  min-height: 0;
  border: none !important;
  background: transparent !important;
}

.messenger-shell:not(.hidden)[data-olone-mobile-detail="none"][data-olone-mobile-pane="friends"] .col-chat-row > .chat-main,
.messenger-shell:not(.hidden)[data-olone-mobile-detail="none"][data-olone-mobile-pane="channels"] .col-chat-row > .chat-main {
  display: none !important;
}

.messenger-shell:not(.hidden)[data-olone-mobile-detail="none"][data-olone-mobile-pane="friends"] .composer,
.messenger-shell:not(.hidden)[data-olone-mobile-detail="none"][data-olone-mobile-pane="channels"] .composer {
  display: none !important;
}

/* Комментарии к посту (каналы): на телефоне — полноэкранный диалог */
@media (max-width: 920px) {
  #channelCommentsModal.modal-backdrop--glass:not(.hidden) {
    padding: 0 !important;
    align-items: stretch;
    justify-content: stretch;
    place-items: unset;
    background: var(--bg, #0c0d10) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  #channelCommentsModal .modal.channel-comments-modal {
    width: 100%;
    max-width: none;
    height: 100%;
    min-height: 100dvh;
    max-height: none;
    border-radius: 0;
    border: none;
    box-shadow: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  #channelCommentsModal .channel-comments-modal-header {
    position: sticky;
    top: 0;
    z-index: 2;
    border-bottom: 1px solid color-mix(in srgb, var(--border, #252830) 75%, transparent);
    background: color-mix(in srgb, var(--bg, #0c0d10) 72%, transparent);
    backdrop-filter: blur(14px) saturate(1.05);
    -webkit-backdrop-filter: blur(14px) saturate(1.05);
    padding-top: max(10px, env(safe-area-inset-top, 0px));
  }

  #channelCommentsModal .channel-comments-modal-thread {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
  }

  #channelCommentsModal .channel-comments-modal-locked {
    padding-left: 14px;
    padding-right: 14px;
  }

  #channelCommentsModal .channel-comments-modal-composer {
    position: sticky;
    bottom: 0;
    z-index: 2;
    padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
    border-top: 1px solid color-mix(in srgb, var(--border, #252830) 75%, transparent);
    background: color-mix(in srgb, var(--bg, #0c0d10) 78%, transparent);
    backdrop-filter: blur(14px) saturate(1.05);
    -webkit-backdrop-filter: blur(14px) saturate(1.05);
  }
}

.messenger-shell:not(.hidden)[data-olone-mobile-detail="open"] #chatView > .col-chat-row {
  flex-direction: column !important;
}

.messenger-shell:not(.hidden)[data-olone-mobile-detail="open"] #chatView > .col-chat-row > .chat-main {
  flex: 1 1 auto !important;
  width: 100% !important;
  min-width: 0 !important;
}

.messenger-shell:not(.hidden)[data-olone-mobile-detail="open"] #searchColumn,
.messenger-shell:not(.hidden)[data-olone-mobile-detail="open"] #searchColumn .profile-card-wrap {
  display: none !important;
  width: 0 !important;
  min-width: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
}

.messenger-shell:not(.hidden)[data-olone-mobile-detail="open"] .col-chat,
.messenger-shell:not(.hidden)[data-olone-mobile-detail="open"] #chatView {
  display: flex !important;
  flex: 1 1 auto;
  min-height: 0 !important;
  min-width: 0;
  width: 100%;
  border: none !important;
}

.messenger-shell:not(.hidden)[data-olone-mobile-detail="open"] .panel-card.col-chat,
.messenger-shell:not(.hidden)[data-olone-mobile-detail="open"] #chatView {
  background: var(--bg, #0c0d10) !important;
}

/* DOM: боковая колонка профиля идёт первой — поднимаем список выше нижних вкладок */
.messenger-shell:not(.hidden)[data-olone-mobile-detail="none"] .col-dialogs {
  order: 1;
}

.messenger-shell:not(.hidden)[data-olone-mobile-detail="none"] .col-user {
  order: 3;
}

/* Список без выбранного диалога — строка заголовка «Диалоги» скрыта */
.messenger-shell[data-olone-mobile-detail="none"] .col-dialogs .panel-head {
  display: none !important;
}

/* Режим «только вкладки» внизу: без блока информации профиля */
.messenger-shell[data-olone-mobile-detail="none"] .col-user .panel-head {
  display: none !important;
}

.messenger-shell[data-olone-mobile-detail="none"] .col-user .profile-info {
  display: none !important;
}

.messenger-shell[data-olone-mobile-detail="none"] .col-user .profile-footer {
  display: none !important;
}

.messenger-shell[data-olone-mobile-detail="none"] #profileTabsWrap .profile-tab-panels:not(.profile-tab-panels--aux) {
  display: none !important;
}

/* Вкладки фильтров — внизу экрана (перенесены из col-user в col-dialogs) */
.messenger-shell:not(.hidden)[data-olone-mobile-detail="none"] .col-dialogs {
  display: flex;
  flex-direction: column;
}

.messenger-shell[data-olone-mobile-detail="none"] .col-dialogs .dialogs-nav-sticky {
  order: 2;
  flex-shrink: 0;
}

.messenger-shell[data-olone-mobile-detail="none"] .col-dialogs .dialogs-scroll-strip {
  order: 1;
}

.messenger-shell[data-olone-mobile-detail="none"] .col-dialogs .profile-tabs-wrap {
  padding: 6px 12px calc(6px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border, #252830);
  background: color-mix(in srgb, var(--panel, #15171c) 96%, transparent);
}

.messenger-shell[data-olone-mobile-detail="none"] .col-dialogs .dialogs-filter-pills .profile-tab {
  flex: 1 1 calc(33.333% - 6px);
}

.messenger-shell[data-olone-mobile-detail="none"] .col-dialogs .dialogs-search-stack {
  display: none !important;
}

.messenger-shell[data-olone-mobile-detail="none"] .col-dialogs .profile-tab-panels--aux {
  display: flex !important;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.messenger-shell[data-olone-mobile-detail="none"] .col-dialogs .profile-tab-panels--aux .profile-tab-panel.hidden {
  display: none !important;
}

.messenger-shell[data-olone-mobile-detail="none"] .col-dialogs .dialogs-rail-search-wrap,
.messenger-shell[data-olone-mobile-detail="none"] .col-dialogs .channels-tab-toolbar-combo {
  min-width: 0;
}

.messenger-shell[data-olone-mobile-detail="none"] .col-dialogs .dialogs-rail-search-wrap .olone-search-field,
.messenger-shell[data-olone-mobile-detail="none"] .col-dialogs .channels-tab-toolbar-combo .olone-search-field {
  width: 100%;
  min-height: 44px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg, #0c0d10) 48%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--border, #383c48) 65%, transparent);
}

.messenger-shell[data-olone-mobile-detail="none"] .col-dialogs .channels-tab-toolbar-combo {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 8px;
}

.messenger-shell[data-olone-mobile-detail="none"] .col-dialogs .channels-tab-toolbar-combo .channel-toolbar-icon-btn,
.messenger-shell[data-olone-mobile-detail="none"] .col-dialogs .dialogs-rail-search-combo .add-friend-search-btn {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  border-radius: 14px;
}

.messenger-shell[data-olone-mobile-detail="none"] .col-dialogs .channels-tab-toolbar-combo button.olone-search-clear {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  right: 4px;
  border-radius: 12px;
}

.messenger-shell[data-olone-mobile-detail="none"] .col-dialogs .channels-tab-toolbar-combo .olone-search-field input[type="search"] {
  padding-right: 48px;
}

.messenger-shell[data-olone-mobile-detail="none"] .col-dialogs .dialogs-rail-search-wrap.hidden {
  display: none !important;
}

.messenger-shell:not(.hidden)[data-olone-mobile-detail="none"] .col-user {
  display: none !important;
}

.messenger-shell[data-olone-mobile-detail="none"] .col-user.panel-card {
  border: none !important;
  border-top: 1px solid var(--border, #252830);
}

.messenger-shell[data-olone-mobile-detail="none"] .col-user .panel-scroll {
  overflow: visible;
}

.messenger-shell[data-olone-mobile-detail="none"] .col-user .settings {
  padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
}

.messenger-shell[data-olone-mobile-detail="none"][data-olone-mobile-pane="friends"] .dialogs-scroll-strip,
.messenger-shell[data-olone-mobile-detail="none"][data-olone-mobile-pane="channels"] .dialogs-scroll-strip,
.messenger-shell[data-olone-mobile-detail="none"][data-olone-mobile-pane="chats"] .dialogs-scroll-strip {
  padding-top: calc(env(safe-area-inset-top, 0px) + 10px);
}

/*
 * Поиск перенесён во вкладки слева — фиксированная правая колонка отключена.
 */
.messenger-shell[data-olone-mobile-detail="none"] #searchColumn {
  display: none !important;
}

.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"] #searchColumn,
.messenger-shell[data-olone-mobile-pane="channels"][data-olone-mobile-detail="none"] #searchColumn {
  display: none !important;
}

.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"] #searchColumn:focus-within,
.messenger-shell[data-olone-mobile-pane="channels"][data-olone-mobile-detail="none"] #searchColumn:focus-within {
  display: flex !important;
  position: fixed;
  inset: 0;
  z-index: 1250;
  align-items: flex-start;
  justify-content: center;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 14px 14px;
  box-sizing: border-box;
  background: color-mix(in srgb, var(--bg, #0c0d10) 42%, transparent);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  top: calc(env(safe-area-inset-top, 0px) + 6px);
}

.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"] #searchPanelChannel,
.messenger-shell[data-olone-mobile-pane="channels"][data-olone-mobile-detail="none"] #searchPanelUser {
  display: none !important;
}

.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"] #searchPanelUser,
.messenger-shell[data-olone-mobile-pane="channels"][data-olone-mobile-detail="none"] #searchPanelChannel {
  display: flex !important;
  flex-direction: column;
  gap: 10px;
  padding: 13px 14px;
  box-sizing: border-box;
  justify-content: center;
  /* Полупрозрачный прямоугольник со скруглением без острых углов */
  border-radius: 16px;
  clip-path: none;
  border: 1px solid color-mix(in srgb, var(--border, #383c48) 72%, transparent);
  background: color-mix(in srgb, var(--panel, #15171c) 48%, transparent);
  backdrop-filter: blur(11px) saturate(1.05);
  -webkit-backdrop-filter: blur(11px) saturate(1.05);
  transition:
    backdrop-filter 0.48s cubic-bezier(0.22, 1, 0.36, 1),
    -webkit-backdrop-filter 0.48s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.48s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.48s ease,
    border-color 0.35s ease;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.2);
}

.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"] #searchColumn:focus-within #searchPanelUser,
.messenger-shell[data-olone-mobile-pane="channels"][data-olone-mobile-detail="none"] #searchColumn:focus-within #searchPanelChannel {
  backdrop-filter: blur(18px) saturate(1.12);
  -webkit-backdrop-filter: blur(18px) saturate(1.12);
  transform: translateY(-1px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"] #searchPanelUserHead,
.messenger-shell[data-olone-mobile-pane="channels"][data-olone-mobile-detail="none"] #searchPanelChannelHead {
  display: none !important;
}

/* Мобильные каналы: подсказка под строкой поиска не показывается */
.messenger-shell[data-olone-mobile-pane="channels"][data-olone-mobile-detail="none"] .channel-search-hint-idle {
  display: none !important;
}

/* Результат поиска пользователя — компактная карточка под строкой поиска */
.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"] #searchPanelUser .profile-card-wrap {
  display: block !important;
  margin: 0;
  padding: 0;
  max-height: min(38vh, 280px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"] #searchPanelUser .profile-card-wrap .profile-card {
  margin: 8px 0 0;
  min-height: 0;
  padding: 12px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel, #15171c) 82%, transparent);
}

.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"] #searchPanelUser .profile-card-wrap .profile-card.hidden {
  display: none !important;
}

.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"] #searchPanelUser .search-row-h.olone-search-combo,
.messenger-shell[data-olone-mobile-pane="channels"][data-olone-mobile-detail="none"] #searchPanelChannel .search-row-h.olone-search-combo {
  padding: 0;
  margin: 0;
  border: none;
  align-items: center;
  min-height: 0;
}

.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"] #searchPanelUser .olone-search-field,
.messenger-shell[data-olone-mobile-pane="channels"][data-olone-mobile-detail="none"] #searchPanelChannel .olone-search-field {
  align-self: stretch;
  min-height: 46px;
  background: color-mix(in srgb, var(--bg, #0c0d10) 48%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 14px;
  overflow: hidden;
  /* Убираем «двойную» линию от border базового .olone-search-field */
  border: none !important;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--border, #383c48) 65%, transparent);
}

.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"] #searchPanelUser .olone-search-field:focus-within,
.messenger-shell[data-olone-mobile-pane="channels"][data-olone-mobile-detail="none"] #searchPanelChannel .olone-search-field:focus-within {
  /* На базе есть внешний box-shadow — он даёт дубль линии. */
  border: none !important;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--muted, #7a8494) 30%, var(--border, #383c48));
}

.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"] #searchPanelUser .olone-search-field input:focus,
.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"] #searchPanelUser .olone-search-field input:focus-visible,
.messenger-shell[data-olone-mobile-pane="channels"][data-olone-mobile-detail="none"] #searchPanelChannel .olone-search-field input:focus,
.messenger-shell[data-olone-mobile-pane="channels"][data-olone-mobile-detail="none"] #searchPanelChannel .olone-search-field input:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"] #searchPanelUser .olone-search-field input[type="text"],
.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"] #searchPanelUser .olone-search-field input[type="search"],
.messenger-shell[data-olone-mobile-pane="channels"][data-olone-mobile-detail="none"] #searchPanelChannel .olone-search-field input[type="text"],
.messenger-shell[data-olone-mobile-pane="channels"][data-olone-mobile-detail="none"] #searchPanelChannel .olone-search-field input[type="search"] {
  padding-top: 9px;
  padding-bottom: 9px;
  line-height: 1.25;
}

.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"] #searchPanelUser .friend-requests-nav-row {
  padding: 0;
  margin: 10px 0 0;
  width: 100%;
  align-self: stretch;
  box-sizing: border-box;
}

.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"] #searchPanelUser .friend-requests-nav-btn {
  width: 100%;
  margin: 0;
  min-height: 48px;
  padding: 10px 12px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  border: 1px solid color-mix(in srgb, var(--border, #383c48) 80%, transparent);
  background: color-mix(in srgb, var(--panel, #15171c) 70%, transparent);
}

.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"]
  #searchPanelUser
  .friend-requests-nav-btn[data-has-requests="1"] {
  border-color: color-mix(in srgb, #5a91ff 55%, var(--border, #383c48));
  background: linear-gradient(
    135deg,
    color-mix(in srgb, #5a91ff 22%, var(--panel, #15171c)),
    color-mix(in srgb, var(--panel, #15171c) 88%, transparent)
  );
  box-shadow: 0 8px 24px rgba(90, 145, 255, 0.18);
}

.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"] #searchPanelUser .friend-requests-nav-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"] #searchPanelUser .friend-requests-nav-sub {
  font-size: 12px;
  font-weight: 600;
  color: color-mix(in srgb, #8eb8ff 85%, var(--muted, #7a8494));
  line-height: 1.25;
}

.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"] #searchPanelUser .friend-requests-nav-badge {
  flex-shrink: 0;
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  background: #5a91ff;
  color: #fff;
}

.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"]
  #searchPanelUser
  .friend-requests-nav-row--idle
  .friend-requests-nav-btn {
  opacity: 0.72;
  box-shadow: none;
}

.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"] #searchPanelUser .peer-search-card-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"] #searchPanelUser .peer-search-card-hit {
  flex: 1 1 auto;
  min-width: 0;
}

.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"] #searchPanelUser .peer-search-card-avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: color-mix(in srgb, var(--panel) 70%, var(--bg));
  overflow: hidden;
  flex-shrink: 0;
}

.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"] #searchPanelUser .peer-search-card-avatar .rail-avatar-img:not(.olone-user-avatar-fallback-active) {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"] #searchPanelUser .peer-search-card-meta {
  min-width: 0;
  flex: 1;
}

.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"] #searchPanelUser .peer-search-card-name {
  font-weight: 700;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"] #searchPanelUser .peer-search-card-id,
.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"] #searchPanelUser .peer-search-card-sub {
  font-size: 12px;
  color: var(--muted, #7a8494);
}

.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"]
  #searchPanelUser
  .profile-card.peer-search-card
  .peer-search-card-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.messenger-shell[data-olone-mobile-detail="none"] .dialog-item .rail-comm-menu-btn {
  opacity: 1;
  pointer-events: auto;
}

.messenger-shell[data-olone-mobile-detail="none"] .dialogs.dialogs-rail {
  gap: 0;
}

/* Пустой список диалогов — текст по центру видимой области */
.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"]
  #dialogs:has(> .status.empty-dlg-hint:only-child) {
  min-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 240px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 16px;
}

.messenger-shell[data-olone-mobile-pane="friends"][data-olone-mobile-detail="none"]
  #dialogs:has(> .status.empty-dlg-hint:only-child) .status.empty-dlg-hint {
  text-align: center;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  font-size: 15px;
  line-height: 1.45;
  color: var(--muted, #9aa3b2);
}

/* Обёртка: список + «+» в одной колонке прокрутки (не fixed к экрану) */
.messenger-shell[data-olone-mobile-detail="none"] .dialogs-rail-mobile-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 0 0 auto;
  width: 100%;
  box-sizing: border-box;
}

/* «+» внизу видимой области списка каналов / чатов (sticky внутри #dialogsScrollStrip) */
.messenger-shell[data-olone-mobile-detail="none"] .olone-mobile-create-fab:not(.hidden) {
  /* Плавающая кнопка: справа снизу над нижними вкладками. */
  position: fixed;
  right: max(14px, env(safe-area-inset-right, 0px));
  bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  z-index: 120;
  margin: 0;
}

/* На всякий случай: на мобилке одновременно показываем только 1 FAB по атрибуту shell. */
@media (max-width: 920px) {
  .messenger-shell[data-olone-mobile-fab="none"] #oloneMobileFabChannel,
  .messenger-shell[data-olone-mobile-fab="none"] #oloneMobileFabGroupChat {
    display: none !important;
  }

  .messenger-shell[data-olone-mobile-fab="channel"] #oloneMobileFabGroupChat {
    display: none !important;
  }

  .messenger-shell[data-olone-mobile-fab="groupchat"] #oloneMobileFabChannel {
    display: none !important;
  }

  .messenger-shell[data-olone-mobile-fab="channel"] #openCreateChannelModalBtn {
    display: none !important;
  }

  .messenger-shell[data-olone-mobile-fab="groupchat"] #openCreateGroupChatModalBtn {
    display: none !important;
  }
}

.olone-mobile-create-fab {
  width: 56px;
  height: 56px;
  padding: 0;
  margin: 0;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--text, #e8eaef) 28%, transparent);
  background: color-mix(in srgb, var(--panel, #1a1c22) 42%, transparent);
  color: #fff;
  backdrop-filter: blur(12px) saturate(1.06);
  -webkit-backdrop-filter: blur(12px) saturate(1.06);
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    border-color 0.2s ease,
    background-color 0.25s ease;
}

.olone-mobile-create-fab svg {
  filter: none;
}

.olone-mobile-create-fab:active {
  transform: scale(0.94);
}

/* Вкладка «Чаты»: без блока поиска */
.messenger-shell[data-olone-mobile-pane="chats"] #searchColumn {
  display: none !important;
}

.chat-header {
  align-items: center;
}

.chat-mobile-back-btn:not(.hidden) {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  align-self: center;
  margin-right: 8px;
  min-width: 44px;
  height: 40px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border, #252830);
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.chat-header-main {
  flex: 1;
  min-width: 0;
}

.messenger-shell #chatView {
  display: flex;
  flex-direction: column;
}

.messenger-shell #chatView > .col-chat-row {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: row;
}

.messenger-shell .chat-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.messenger-shell .messages {
  flex: 1;
  min-height: 120px;
}

/* Шапка открытого канала: заголовок и кнопки не сжимаются в одну колонку */
@media (max-width: 920px) {
  .messenger-shell[data-olone-mobile-detail="open"] .chat-header {
    /* Компактная шапка */
    flex-wrap: nowrap;
    align-items: center;
    row-gap: 0;
    gap: 10px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .messenger-shell[data-olone-mobile-detail="open"] .chat-header-main {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
  }

  .messenger-shell[data-olone-mobile-detail="open"] .chat-header {
    position: sticky;
    top: 0;
    z-index: 5;
    backdrop-filter: blur(12px) saturate(1.05);
    -webkit-backdrop-filter: blur(12px) saturate(1.05);
    background: color-mix(in srgb, var(--panel, #15171c) 88%, transparent);
  }

  .messenger-shell[data-olone-mobile-detail="open"] .olone-chat-header__avatar {
    display: none;
  }

  .messenger-shell[data-olone-mobile-detail="open"] #groupChatSettingsBtn,
  .messenger-shell[data-olone-mobile-detail="open"] #channelSettingsBtn,
  .messenger-shell[data-olone-mobile-detail="open"] #dialogMediaBtn {
    display: none !important;
  }

  .messenger-shell[data-olone-mobile-detail="open"] .olone-chat-header-menu-wrap {
    display: block;
  }

  .messenger-shell[data-olone-mobile-detail="open"] .chat-header-main strong,
  .messenger-shell[data-olone-mobile-detail="open"] #chatTitle,
  .messenger-shell[data-olone-mobile-detail="open"] .olone-chat-header__title {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 16px;
    line-height: 1.25;
    max-width: 100%;
  }

  .messenger-shell[data-olone-mobile-detail="open"] .chat-header-main .status,
  .messenger-shell[data-olone-mobile-detail="open"] #chatSubtitle,
  .messenger-shell[data-olone-mobile-detail="open"] .olone-chat-header__subtitle {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
    font-size: 12px;
    max-width: 100%;
  }

  .messenger-shell[data-olone-mobile-detail="open"] .chat-header {
    flex-shrink: 0;
    min-height: 48px;
    max-height: 56px;
    overflow: visible;
    padding-top: max(6px, env(safe-area-inset-top, 0px));
    padding-bottom: 8px;
  }

  .messenger-shell[data-olone-mobile-detail="open"] .olone-chat-header-menu-wrap {
    position: relative;
    z-index: 120;
  }

  .olone-chat-header-menu--floating {
    position: fixed !important;
    z-index: 25000 !important;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  }

  /* Модалки (настройки чата, профиль участника) — поверх полноэкранного чата на телефоне */
  body .modal-backdrop:not(.hidden) {
    z-index: 30000;
  }

  /* Фоны диалога — top-level поверх всех остальных модалок */
  body .modal-backdrop--chat-bg-picker:not(.hidden) {
    z-index: 40000 !important;
    isolation: isolate;
  }

  .messenger-shell[data-olone-mobile-detail="open"] .messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .messenger-shell[data-olone-mobile-detail="open"] .composer {
    flex-shrink: 0;
    padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
  }

  .messenger-shell[data-olone-mobile-detail="open"] .col-chat,
  .messenger-shell[data-olone-mobile-detail="gc-topics"] .col-dialogs.panel-card {
    animation: olone-mobile-pane-in 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  }

  @keyframes olone-mobile-pane-in {
    from {
      opacity: 0.92;
      transform: translateX(10px);
    }
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .messenger-shell[data-olone-mobile-detail="open"] .col-chat,
    .messenger-shell[data-olone-mobile-detail="gc-topics"] .col-dialogs.panel-card {
      animation: none;
    }
  }

  .messenger-shell[data-olone-mobile-detail="open"] .header-actions {
    flex: 0 0 auto;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
  }

  /* Профиль: ник / ID по центру над уровнем; у аватара — без второй колонки текста */
  #profileViewerModal .profile-viewer-hero-line {
    display: block;
    text-align: center;
    font-size: 19px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--text);
    padding: 2px 14px 8px;
    box-sizing: border-box;
  }

  #profileViewerModal .profile-viewer-hero-line .premium-crown-inline {
    vertical-align: -0.12em;
  }

  #profileViewerModal .profile-viewer-identity-text .profile-viewer-internal-id-line,
  #profileViewerModal .profile-viewer-identity-text .profile-viewer-id {
    display: none !important;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-viewer-left [data-profile-edit-only] {
    width: calc(100% - 24px);
    max-width: 100%;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box;
    align-self: center;
  }

  #profileViewerModal .profile-viewer-mobile-nav {
    justify-items: stretch;
  }

  #profileViewerModal .profile-viewer-mobile-nav-btn {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Каналы: опросы должны переноситься, не уезжать за экран */
  .channel-post-poll-host .bubble-poll,
  .channel-post-poll-host .bubble-poll-option-inner,
  .channel-post-poll-host .bubble-poll-option-label,
  .channel-post-poll-host .bubble-poll-question {
    max-width: 100%;
    min-width: 0;
  }

  .channel-post-poll-host .bubble-poll-question,
  .channel-post-poll-host .bubble-poll-option-label {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  /* Toast: сверху по центру — не перекрывает композер и кнопку «Отправить» */
  #toastBox.toast {
    left: 50%;
    right: auto;
    top: max(12px, env(safe-area-inset-top, 0px));
    bottom: auto;
    transform: translateX(-50%);
    min-width: 0;
    width: min(340px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    border-radius: 14px;
    padding: 10px 14px;
    opacity: 0.98;
  }

  /* Моб. шапка: вместо «Назад» — компактная аватарка/иконка */
  .messenger-shell[data-olone-mobile-detail="open"] .chat-mobile-back-btn {
    border: none;
    background: transparent;
    min-width: 44px;
    width: 44px;
    height: 44px;
    padding: 0;
  }

  .messenger-shell[data-olone-mobile-detail="open"] .chat-mobile-back-text {
    display: none !important;
  }

  .chat-mobile-back-avatar {
    display: inline-flex;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid color-mix(in srgb, var(--border, #252830) 70%, transparent);
    overflow: hidden;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--panel, #1a1c22) 45%, transparent);
  }

  .chat-mobile-back-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .chat-mobile-back-avatar-ph {
    color: var(--text);
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    padding: 0;
    margin: 0;
  }

  .chat-mobile-back-avatar-ph svg {
    display: block;
    width: 22px;
    height: 22px;
  }

  /* В хедере показываем строго одно: либо img, либо placeholder */
  .chat-mobile-back-avatar-img.hidden {
    display: none !important;
  }

  .chat-mobile-back-avatar-ph.hidden {
    display: none !important;
  }
}

@media (min-width: 921px) {
  #profileViewerModal .profile-viewer-hero-line {
    display: none !important;
  }
}

/* Настройки мессенджера: на узкой ширине — одна колонка, скролл, удобная высота */
@media (max-width: 920px) {
  #messengerSettingsModal .modal.modal--settings-hub {
    width: 100%;
    max-width: min(520px, 100vw - 16px);
    max-height: min(88dvh, 100vh - env(safe-area-inset-top, 0px) - 12px);
    min-height: 0;
  }

  #messengerSettingsModal .settings-hub-layout {
    grid-template-columns: 1fr;
    gap: 10px;
    min-height: 0;
    flex: 1 1 auto;
  }

  #messengerSettingsModal .settings-hub-col {
    min-height: 0;
    flex: 1 1 auto;
    padding: 10px 12px;
  }

  #messengerSettingsModal .settings-hub-btn-stack {
    max-height: min(38dvh, 320px);
  }

  #messengerSettingsModal .settings-hub-col:last-of-type .settings-hub-btn-stack {
    max-height: min(48dvh, 420px);
  }

  #messengerSettingsModal .settings-hub-item-btn,
  #messengerSettingsModal .settings-hub-item-btn--sub {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  #settingsNestedModal .settings-nested-body {
    padding-left: 4px;
    padding-right: 4px;
    box-sizing: border-box;
  }

  #settingsNestedModal .sessions-btn,
  #settingsNestedModal .btn-logout-danger,
  #settingsNestedModal .settings-action-row .primary,
  #settingsNestedModal .settings-action-row .secondary {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  #settingsNestedModal .privacy-consent-toggle {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  #settingsNestedModal .settings-theme-toggle-row .sessions-btn {
    width: auto;
    min-width: min(200px, 100%);
  }
}

/* Profile V2 — compact mini dashboard in left column */
.profile-v2-mini--v31 .profile-v2-hero-avatar {
  width: 64px;
  height: 64px;
  font-size: 20px;
}

.profile-v2-mini--v31 .profile-v2-hero-name {
  font-size: 18px;
}

.profile-v2-mini--v31 .profile-v2-hero-top {
  gap: 8px;
}

.profile-v2-stat-grid--quad {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.profile-v2-mini-streak {
  font-size: 11px;
  padding: 5px 8px;
}

.profile-v2-stat-grid--compact {
  gap: 5px;
}

.profile-v2-stat-grid--compact .profile-v2-stat-card {
  min-height: 48px;
  padding: 7px 5px;
}

.profile-v2-stat-grid--compact .profile-v2-stat-card-value {
  font-size: 15px;
}

.profile-v2-milestone-badge,
.profile-v2-rep-badge,
.profile-v2-mini--v31 .profile-v2-premium-pill {
  display: none !important;
}

/* ===== Profile Nitro — mobile layout ===== */
/* ===== Profile Nitro — mobile layout ===== */
#profileViewerModal.olone-mobile-profile-home .profile-viewer-layout.profile-nitro-layout {
  grid-template-columns: 1fr;
  gap: 12px;
}

#profileViewerModal.olone-mobile-profile-home .profile-nitro-card {
  width: 100%;
  max-height: 85vh;
  min-height: 0;
}

#profileViewerModal.olone-mobile-profile-home .profile-nitro-body {
  overflow-y: auto;
}

#profileViewerModal.olone-mobile-profile-home .profile-v152-rep-card .profile-nitro-reputation-ring-score {
  font-size: 28px !important;
}

#profileViewerModal.olone-mobile-profile-home .profile-v152-rep-card .profile-nitro-reputation-ring-donut {
  width: 140px !important;
  height: 140px !important;
}

#profileViewerModal.olone-mobile-profile-home .profile-nitro-card.is-premium .profile-v152-rep-card .profile-nitro-reputation-ring-donut {
  width: 144px !important;
  height: 144px !important;
}

#profileViewerModal.olone-mobile-profile-home .profile-nitro-cover {
  height: 92px;
}

#profileViewerModal.olone-mobile-profile-home .profile-nitro-card.is-premium .profile-nitro-cover {
  height: 96px;
}

#profileViewerModal.olone-mobile-profile-home .profile-nitro-name {
  font-size: 28px;
}

#profileViewerModal.olone-mobile-profile-home .profile-nitro-ach-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#profileViewerModal.olone-mobile-profile-home .profile-nitro-showcase,
.profile-viewer-modal .profile-nitro-showcase {
  display: flex;
  overflow-x: auto;
  gap: 10px;
  padding-bottom: 4px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

#profileViewerModal.olone-mobile-profile-home .profile-nitro-showcase-card,
.profile-viewer-modal .profile-nitro-showcase-card {
  flex: 0 0 128px;
  max-width: 128px;
  scroll-snap-align: start;
}

#profileViewerModal.olone-mobile-profile-home .profile-nitro-about-quote {
  font-size: 18px;
  line-height: 1.64;
}

#profileViewerModal.olone-mobile-profile-home .profile-v2-channel-card {
  padding: 14px;
}

/* ===== PROFILE V17.2 — Mobile First Fold (390×844 only) ===== */
@media (max-width: 390px) {
  #profileViewerModal.olone-mobile-profile-home .profile-viewer-layout.profile-nitro-layout {
    gap: 6px;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-viewer-right {
    padding: 0 14px 12px;
    gap: 8px;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-nitro-cover {
    height: 70px !important;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-nitro-card.is-premium .profile-nitro-cover {
    height: 74px !important;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-nitro-card.tier-level2 .profile-nitro-cover {
    height: 70px !important;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-nitro-avatar-stage {
    width: 96px;
    height: 96px;
    margin: -20px auto 0;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-nitro-avatar-btn {
    width: 88px;
    height: 88px;
    font-size: 28px;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-nitro-identity {
    gap: 4px;
    padding: 2px 12px 0;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-nitro-name {
    font-size: 24px;
    line-height: 1.08;
  }

  #profileViewerModal.olone-mobile-profile-home #profileNitroIdentityStory,
  #profileViewerModal.olone-mobile-profile-home #profileNitroStatus,
  #profileViewerModal.olone-mobile-profile-home #profileNitroInterestTags,
  #profileViewerModal.olone-mobile-profile-home #profileNitroFocus,
  #profileViewerModal.olone-mobile-profile-home #profileNitroSocial,
  #profileViewerModal.olone-mobile-profile-home #profileNitroTags {
    display: none !important;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-nitro-card.tier-level2 .profile-nitro-body {
    gap: 8px;
    padding-bottom: 4px;
  }

  #profileViewerModal.olone-mobile-profile-home #profileNitroMobilePerson {
    width: 100%;
    padding: 0 14px;
    box-sizing: border-box;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-v172-mobile-person {
    width: 100%;
    padding: 8px 12px;
    border-radius: 14px;
    border: 1px solid color-mix(in srgb, #fff 12%, transparent);
    background: color-mix(in srgb, var(--panel) 92%, transparent);
    box-sizing: border-box;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-v172-mobile-role {
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
    color: color-mix(in srgb, #fff 86%, transparent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-v172-mobile-known {
    margin-top: 2px;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.25;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-nitro-card.tier-level2 .profile-nitro-reputation-ring {
    padding: 4px 0 2px;
    margin-top: 0;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-v152-rep-card {
    padding: 12px 12px 10px;
    border-radius: 14px;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-v152-rep-head {
    margin-bottom: 10px;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-v152-rep-body {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    min-height: 0;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-v152-rep-divider {
    width: 100%;
    height: 1px;
    min-height: 1px;
    align-self: stretch;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-v152-rep-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 0;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-v152-rep-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2px;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-v152-rep-stat-ic {
    font-size: 18px;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-v152-rep-stat-val {
    font-size: 18px;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-v152-rep-stat-lbl {
    font-size: 9px;
    line-height: 1.2;
  }

  #profileViewerModal.olone-mobile-profile-home #profileNitroBadges,
  #profileViewerModal.olone-mobile-profile-home #profileNitroMeta {
    display: none !important;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-v152-rep-card .profile-nitro-reputation-ring-donut {
    width: 132px !important;
    height: 132px !important;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-nitro-card.is-premium .profile-v152-rep-card .profile-nitro-reputation-ring-donut {
    width: 136px !important;
    height: 136px !important;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-v152-rep-card .profile-nitro-reputation-ring-score {
    font-size: 24px !important;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-v182-rep-donut {
    width: 100px !important;
    height: 100px !important;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-v182-rep-score {
    font-size: 28px !important;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-v182-rep-stat-val {
    font-size: 18px;
  }

  #profileViewerModal.olone-mobile-profile-home #profileNitroRepHighlight,
  #profileViewerModal.olone-mobile-profile-home #profileNitroMetrics:not(.profile-v18-quick-stats),
  #profileViewerModal.olone-mobile-profile-home #profileNitroIdentityShowcase,
  #profileViewerModal.olone-mobile-profile-home #profileViewerFeaturedIdentity,
  #profileViewerModal.olone-mobile-profile-home #profileViewerFeaturedProject {
    display: none !important;
  }

  #profileViewerModal.olone-mobile-profile-home #profileNitroMobilePerson:not(.hidden),
  #profileViewerModal.olone-mobile-profile-home #profileNitroMobileChannel:not(.hidden) {
    display: block !important;
  }

  #profileViewerModal.olone-mobile-profile-home #profileNitroMobileChannel {
    width: 100%;
    padding: 0 14px 4px;
    box-sizing: border-box;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-v172-mobile-channel {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 72px;
    max-height: 100px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid color-mix(in srgb, #fff 12%, transparent);
    background: color-mix(in srgb, var(--panel) 92%, transparent);
    box-sizing: border-box;
    text-align: left;
    cursor: pointer;
    color: inherit;
    font: inherit;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-v172-mobile-channel-avatar {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--bubble-in) 70%, transparent);
    font-size: 13px;
    font-weight: 800;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-v172-mobile-channel-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-v172-mobile-channel-title {
    font-size: 14px;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #profileViewerModal.olone-mobile-profile-home .profile-v172-mobile-channel-meta {
    font-size: 11px;
    line-height: 1.25;
    color: color-mix(in srgb, var(--text) 78%, var(--muted));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #profileViewerModal.olone-mobile-profile-home #profileViewerActivePresence .profile-v17-presence-item:nth-child(n + 3) {
    display: none;
  }

  #profileViewerModal.olone-mobile-profile-home #profileViewerActivePresence .profile-nitro-panel-title {
    font-size: 10px;
    margin-bottom: 6px;
  }

  #profileViewerModal.profile-ui-v18.olone-mobile-profile-home .profile-v182-featured-hero {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  #profileViewerModal.profile-ui-v18.olone-mobile-profile-home .profile-v182-featured-banner {
    min-height: 96px;
  }

  #profileViewerModal.profile-ui-v18.olone-mobile-profile-home .profile-v182-featured-content {
    padding: 12px 14px;
  }

  #profileViewerModal.profile-ui-v18.olone-mobile-profile-home #profileViewerFeaturedProject {
    padding: 0;
  }

  #profileViewerModal.profile-ui-v18.olone-mobile-profile-home #profileNitroIdentityStory:not(.hidden),
  #profileViewerModal.profile-ui-v18.olone-mobile-profile-home #profileNitroIdentityShowcase:not(.hidden),
  #profileViewerModal.profile-ui-v18.olone-mobile-profile-home #profileViewerFeaturedProject:not(.hidden) {
    display: block !important;
  }

  #profileViewerModal.profile-ui-v18.olone-mobile-profile-home #profileNitroMobilePerson,
  #profileViewerModal.profile-ui-v18.olone-mobile-profile-home #profileNitroMobileChannel {
    display: none !important;
  }

  #profileViewerModal.profile-ui-v18.olone-mobile-profile-home #profileNitroMetrics.profile-v18-quick-stats {
    display: block !important;
  }

  #profileViewerModal.profile-ui-v18.olone-mobile-profile-home .profile-v182-channels-grid {
    grid-template-columns: 1fr;
  }

  #profileViewerModal.profile-ui-v19.olone-mobile-profile-home #profileNitroIdentityStory:not(.hidden),
  #profileViewerModal.profile-ui-v19.olone-mobile-profile-home #profileNitroMetrics.profile-v19-metrics-grid,
  #profileViewerModal.profile-ui-v19.olone-mobile-profile-home #profileViewerFeaturedProject:not(.hidden) {
    display: block !important;
  }

  #profileViewerModal.profile-ui-v19.olone-mobile-profile-home #profileNitroIdentityShowcase,
  #profileViewerModal.profile-ui-v19.olone-mobile-profile-home #profileViewerFeaturedProject .profile-v182-featured-hero {
    display: none !important;
  }

  #profileViewerModal.profile-ui-v19.olone-mobile-profile-home #profileNitroMobilePerson,
  #profileViewerModal.profile-ui-v19.olone-mobile-profile-home #profileNitroMobileChannel {
    display: none !important;
  }

  #profileViewerModal.profile-ui-v20.olone-mobile-profile-home #profileNitroIdentityStory:not(.hidden),
  #profileViewerModal.profile-ui-v20.olone-mobile-profile-home #profileNitroMetrics.profile-v20-social-grid,
  #profileViewerModal.profile-ui-v20.olone-mobile-profile-home #profileViewerFeaturedProject:not(.hidden) {
    display: block !important;
  }

  #profileViewerModal.profile-ui-v20.olone-mobile-profile-home #profileNitroIdentityShowcase,
  #profileViewerModal.profile-ui-v20.olone-mobile-profile-home #profileNitroMobilePerson,
  #profileViewerModal.profile-ui-v20.olone-mobile-profile-home #profileNitroMobileChannel,
  #profileViewerModal.profile-ui-v20.olone-mobile-profile-home #profileViewerMemberSince {
    display: none !important;
  }

  #profileViewerModal.profile-ui-v20.olone-mobile-profile-home #profileNitroMetrics.profile-v20-social-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #profileViewerModal.profile-ui-v20.olone-mobile-profile-home .profile-v20-channels-grid {
    grid-template-columns: 1fr;
  }

  #profileViewerModal.profile-ui-v21.olone-mobile-profile-home #profileNitroIdentityStory:not(.hidden),
  #profileViewerModal.profile-ui-v21.olone-mobile-profile-home #profileNitroUserId:not(.hidden),
  #profileViewerModal.profile-ui-v21.olone-mobile-profile-home #profileNitroMetrics.profile-v21-social-grid,
  #profileViewerModal.profile-ui-v21.olone-mobile-profile-home #profileViewerFeaturedProject:not(.hidden) {
    display: block !important;
  }

  #profileViewerModal.profile-ui-v21.olone-mobile-profile-home #profileNitroIdentityShowcase,
  #profileViewerModal.profile-ui-v21.olone-mobile-profile-home #profileNitroMobilePerson,
  #profileViewerModal.profile-ui-v21.olone-mobile-profile-home #profileNitroMobileChannel {
    display: none !important;
  }

  #profileViewerModal.profile-ui-v21.olone-mobile-profile-home #profileNitroMetrics.profile-v21-social-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #profileViewerModal.profile-ui-v21.olone-mobile-profile-home .profile-v21-channels-grid,
  #profileViewerModal.profile-ui-v21.olone-mobile-profile-home .profile-v182-featured-hero {
    grid-template-columns: 1fr;
  }

  #profileViewerModal.profile-ui-v21.olone-mobile-profile-home .profile-v182-featured-banner {
    min-height: 120px;
  }

  #profileViewerModal.profile-ui-v21.olone-mobile-profile-home .profile-v182-featured-hero {
    min-height: 0;
  }

  #profileViewerModal.profile-ui-v21.olone-mobile-profile-home .profile-nitro-avatar-stage {
    width: 132px;
    height: 132px;
    margin: -28px auto 0;
  }

  #profileViewerModal.profile-ui-v21.olone-mobile-profile-home .profile-nitro-avatar-btn {
    width: 120px;
    height: 120px;
    font-size: 32px;
  }

  /* ===== V22 MOBILE ===== */
  #profileViewerModal.profile-ui-v22.olone-mobile-profile-home .profile-viewer-layout.profile-nitro-layout {
    grid-template-columns: 1fr;
  }

  #profileViewerModal.profile-ui-v22.olone-mobile-profile-home .profile-viewer-right {
    border-left: none;
    border-top: 1px solid color-mix(in srgb, var(--border) 28%, transparent);
    padding: 16px 16px;
    max-height: none;
  }

  #profileViewerModal.profile-ui-v22.olone-mobile-profile-home .profile-viewer-left {
    max-height: none;
    overflow-y: visible;
  }

  #profileViewerModal.profile-ui-v22.olone-mobile-profile-home .profile-nitro-body {
    padding: 16px 16px 12px;
  }

  #profileViewerModal.profile-ui-v22.olone-mobile-profile-home .profile-nitro-avatar-stage {
    width: 88px;
    height: 88px;
    margin: 0 auto 10px;
  }

  #profileViewerModal.profile-ui-v22.olone-mobile-profile-home .profile-nitro-avatar-btn {
    width: 80px;
    height: 80px;
    font-size: 22px;
  }

  #profileViewerModal.profile-ui-v22.olone-mobile-profile-home .profile-v22-rep-donut {
    width: 80px;
    height: 80px;
  }

  #profileViewerModal.profile-ui-v22.olone-mobile-profile-home .profile-v22-rep-score {
    font-size: 26px;
  }

  #profileViewerModal.profile-ui-v22.olone-mobile-profile-home .profile-v22-stats-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  #profileViewerModal.profile-ui-v22.olone-mobile-profile-home .profile-v22-featured-thumb {
    width: 64px;
    height: 64px;
  }

  #profileViewerModal.profile-ui-v22.olone-mobile-profile-home .profile-v22-achievements-panel .profile-nitro-showcase {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  #profileViewerModal.profile-ui-v22.olone-mobile-profile-home #profileNitroIdentityShowcase,
  #profileViewerModal.profile-ui-v22.olone-mobile-profile-home #profileNitroMobilePerson,
  #profileViewerModal.profile-ui-v22.olone-mobile-profile-home #profileNitroMobileChannel {
    display: none !important;
  }

  /* ===== V26 MOBILE ===== */
  /* Revert grid back to single column on mobile */
  #profileViewerModal.profile-ui-v23.profile-ui-v25.profile-ui-v26.olone-mobile-profile-home #profileViewerV2Sections {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: unset !important;
  }

  #profileViewerModal.profile-ui-v23.profile-ui-v25.profile-ui-v26.olone-mobile-profile-home #profileViewerAbout,
  #profileViewerModal.profile-ui-v23.profile-ui-v25.profile-ui-v26.olone-mobile-profile-home #profileViewerFeaturedProject,
  #profileViewerModal.profile-ui-v23.profile-ui-v25.profile-ui-v26.olone-mobile-profile-home #profileViewerChannelsList,
  #profileViewerModal.profile-ui-v23.profile-ui-v25.profile-ui-v26.olone-mobile-profile-home #profileViewerAchievements,
  #profileViewerModal.profile-ui-v23.profile-ui-v25.profile-ui-v26.olone-mobile-profile-home #profileViewerSocialPills {
    grid-column: unset !important;
    grid-row: unset !important;
    border-right: none !important;
    padding: 14px 16px !important;
  }

  /* ===== V27 MOBILE ===== */
  /* Revert the 320px left column to single-column stack on mobile */
  #profileViewerModal.profile-ui-v23.profile-ui-v25.profile-ui-v26.profile-ui-v27.olone-mobile-profile-home .profile-viewer-layout.profile-nitro-layout {
    grid-template-columns: 1fr !important;
  }

  /* V27 inherits V26 grid reset. Identity zone: column layout, centered */
  #profileViewerModal.profile-ui-v23.profile-ui-v25.profile-ui-v26.profile-ui-v27.olone-mobile-profile-home .profile-nitro-body {
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    padding: 20px 16px 14px !important;
  }

  #profileViewerModal.profile-ui-v23.profile-ui-v25.profile-ui-v26.profile-ui-v27.olone-mobile-profile-home .profile-nitro-avatar-stage {
    width: 72px !important;
    height: 72px !important;
    margin: 0 0 10px 0 !important;
    align-self: center !important;
  }

  #profileViewerModal.profile-ui-v23.profile-ui-v25.profile-ui-v26.profile-ui-v27.olone-mobile-profile-home .profile-nitro-avatar-btn {
    width: 72px !important;
    height: 72px !important;
    font-size: 22px !important;
  }

  #profileViewerModal.profile-ui-v23.profile-ui-v25.profile-ui-v26.profile-ui-v27.olone-mobile-profile-home .profile-nitro-identity {
    align-items: center !important;
    text-align: center !important;
    flex: unset !important;
    width: 100%;
    min-width: 0 !important;
  }

  #profileViewerModal.profile-ui-v23.profile-ui-v25.profile-ui-v26.profile-ui-v27.olone-mobile-profile-home .profile-nitro-name {
    font-size: 22px !important;
    text-align: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  #profileViewerModal.profile-ui-v23.profile-ui-v25.profile-ui-v26.profile-ui-v27.olone-mobile-profile-home .profile-v18-user-id-host {
    text-align: center !important;
  }

  #profileViewerModal.profile-ui-v23.profile-ui-v25.profile-ui-v26.profile-ui-v27.olone-mobile-profile-home .profile-v23-rep-score {
    font-size: 22px !important;
  }

  #profileViewerModal.profile-ui-v23.profile-ui-v25.profile-ui-v26.profile-ui-v27.olone-mobile-profile-home .profile-v23-rep-donut {
    width: 32px !important;
    height: 32px !important;
  }

  /* Task 4: Eliminate gap between rep and bio on mobile */
  #profileViewerModal.profile-ui-v23.profile-ui-v25.profile-ui-v26.profile-ui-v27.olone-mobile-profile-home #profileNitroRep {
    margin-bottom: 0 !important;
  }

  #profileViewerModal.profile-ui-v23.profile-ui-v25.profile-ui-v26.profile-ui-v27.olone-mobile-profile-home #profileViewerAbout {
    padding-top: 14px !important;
  }

  /* ===== V25 MOBILE ===== */
  /* On mobile: revert to stacked (column) layout for the identity header */
  #profileViewerModal.profile-ui-v23.profile-ui-v25.olone-mobile-profile-home .profile-nitro-body {
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    padding: 20px 16px 14px !important;
  }

  #profileViewerModal.profile-ui-v23.profile-ui-v25.olone-mobile-profile-home .profile-nitro-avatar-stage {
    width: 80px !important;
    height: 80px !important;
    margin: 0 0 10px 0 !important;
    align-self: center !important;
  }

  #profileViewerModal.profile-ui-v23.profile-ui-v25.olone-mobile-profile-home .profile-nitro-avatar-btn {
    width: 80px !important;
    height: 80px !important;
    font-size: 22px !important;
  }

  #profileViewerModal.profile-ui-v23.profile-ui-v25.olone-mobile-profile-home .profile-nitro-identity {
    align-items: center !important;
    text-align: center !important;
    flex: unset !important;
    width: 100%;
  }

  #profileViewerModal.profile-ui-v23.profile-ui-v25.olone-mobile-profile-home .profile-nitro-name {
    text-align: center !important;
    font-size: 20px !important;
  }

  #profileViewerModal.profile-ui-v23.profile-ui-v25.olone-mobile-profile-home .profile-v18-user-id-host {
    text-align: center !important;
  }

  #profileViewerModal.profile-ui-v23.profile-ui-v25.olone-mobile-profile-home .profile-v18-title-line {
    justify-content: center !important;
  }

  #profileViewerModal.profile-ui-v23.profile-ui-v25.olone-mobile-profile-home #profileNitroRep {
    flex: unset !important;
    width: 100% !important;
    margin-top: 12px !important;
  }

  #profileViewerModal.profile-ui-v23.profile-ui-v25.olone-mobile-profile-home #profileNitroMetrics {
    flex: unset !important;
    width: 100% !important;
  }

  #profileViewerModal.profile-ui-v23.profile-ui-v25.olone-mobile-profile-home .profile-v23-rep-score {
    font-size: 34px !important;
  }

  #profileViewerModal.profile-ui-v23.profile-ui-v25.olone-mobile-profile-home .profile-v23-rep-donut {
    width: 40px !important;
    height: 40px !important;
  }

  /* ===== V24 MOBILE ===== */
  #profileViewerModal.profile-ui-v24.olone-mobile-profile-home .profile-v24-strip {
    flex-direction: column;
    align-items: center;
    padding: 20px 16px 16px;
    gap: 14px;
  }

  #profileViewerModal.profile-ui-v24.olone-mobile-profile-home .profile-v24-id-zone {
    align-items: center;
    text-align: center;
  }

  #profileViewerModal.profile-ui-v24.olone-mobile-profile-home .profile-nitro-name {
    text-align: center !important;
    font-size: 22px !important;
  }

  #profileViewerModal.profile-ui-v24.olone-mobile-profile-home .profile-v24-rep-zone {
    width: 100%;
  }

  #profileViewerModal.profile-ui-v24.olone-mobile-profile-home .profile-v24-rep-widget {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    text-align: left;
    padding: 12px 14px;
  }

  #profileViewerModal.profile-ui-v24.olone-mobile-profile-home .profile-v24-rep-score {
    font-size: 32px;
    flex-shrink: 0;
  }

  #profileViewerModal.profile-ui-v24.olone-mobile-profile-home .profile-v24-rep-ring {
    width: 28px;
    height: 28px;
    padding: 4px;
  }

  #profileViewerModal.profile-ui-v24.olone-mobile-profile-home #profileViewerV2Sections {
    display: flex;
    flex-direction: column;
    grid-template-columns: unset;
  }

  #profileViewerModal.profile-ui-v24.olone-mobile-profile-home #profileViewerFeaturedProject,
  #profileViewerModal.profile-ui-v24.olone-mobile-profile-home #profileViewerChannelsList,
  #profileViewerModal.profile-ui-v24.olone-mobile-profile-home #profileViewerAchievements,
  #profileViewerModal.profile-ui-v24.olone-mobile-profile-home #profileViewerSocialPills {
    grid-column: unset;
    grid-row: unset;
    border-right: none;
  }

  #profileViewerModal.profile-ui-v24.olone-mobile-profile-home .profile-viewer-right {
    max-height: none;
    overflow-y: visible;
  }

  #profileViewerModal.profile-ui-v24.olone-mobile-profile-home #profileNitroIdentityShowcase,
  #profileViewerModal.profile-ui-v24.olone-mobile-profile-home #profileNitroMobilePerson,
  #profileViewerModal.profile-ui-v24.olone-mobile-profile-home #profileNitroMobileChannel {
    display: none !important;
  }

  /* ===== V23 MOBILE ===== */
  #profileViewerModal.profile-ui-v23.olone-mobile-profile-home .profile-viewer-layout.profile-nitro-layout {
    grid-template-columns: 1fr;
  }

  #profileViewerModal.profile-ui-v23.olone-mobile-profile-home .profile-viewer-right {
    border-left: none;
    border-top: 1px solid color-mix(in srgb, var(--border) 25%, transparent);
    padding: 16px;
    max-height: none;
  }

  #profileViewerModal.profile-ui-v23.olone-mobile-profile-home .profile-viewer-left {
    max-height: none;
    overflow-y: visible;
    padding: 20px 16px 16px;
    width: 100% !important;
    max-width: 100% !important;
  }

  #profileViewerModal.profile-ui-v23.olone-mobile-profile-home .profile-nitro-avatar-stage {
    width: 80px;
    height: 80px;
  }

  #profileViewerModal.profile-ui-v23.olone-mobile-profile-home .profile-nitro-avatar-btn {
    width: 80px !important;
    height: 80px !important;
    font-size: 24px !important;
  }

  #profileViewerModal.profile-ui-v23.olone-mobile-profile-home .profile-v23-rep-donut {
    width: 60px;
    height: 60px;
  }

  #profileViewerModal.profile-ui-v23.olone-mobile-profile-home .profile-v23-rep-score {
    font-size: 30px;
  }

  #profileViewerModal.profile-ui-v23.olone-mobile-profile-home .profile-v23-featured-thumb {
    width: 80px;
    height: 80px;
  }

  #profileViewerModal.profile-ui-v23.olone-mobile-profile-home .profile-v23-achievements-panel .profile-nitro-showcase {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  #profileViewerModal.profile-ui-v23.olone-mobile-profile-home #profileNitroIdentityShowcase,
  #profileViewerModal.profile-ui-v23.olone-mobile-profile-home #profileNitroMobilePerson,
  #profileViewerModal.profile-ui-v23.olone-mobile-profile-home #profileNitroMobileChannel {
    display: none !important;
  }

  /* ── V28/V29/V30/V31 mobile: show streak block ── */
  #profileViewerModal.profile-ui-v28.olone-mobile-profile-home #profileNitroMetrics.profile-v28-streak-host,
  #profileViewerModal.profile-ui-v29.olone-mobile-profile-home #profileNitroMetrics.profile-v28-streak-host,
  #profileViewerModal.profile-ui-v30.olone-mobile-profile-home #profileNitroMetrics.profile-v30-streak-host,
  #profileViewerModal.profile-ui-v31.olone-mobile-profile-home #profileNitroMetrics.profile-v31-streak-host,
  #profileViewerModal.profile-ui-v32.olone-mobile-profile-home #profileNitroMetrics.profile-v32-streak-host,
  #profileViewerModal.profile-ui-v33.olone-mobile-profile-home #profileNitroMetrics.profile-v33-streak-host,
  #profileViewerModal.profile-ui-v34.olone-mobile-profile-home #profileNitroMetrics.profile-v33-streak-host {
    display: block !important;
  }

  /* V28/V29/V30/V31/V32/V33 mobile: center streak text */
  #profileViewerModal.profile-ui-v28.olone-mobile-profile-home .profile-v28-streak,
  #profileViewerModal.profile-ui-v29.olone-mobile-profile-home .profile-v28-streak,
  #profileViewerModal.profile-ui-v30.olone-mobile-profile-home .profile-v30-streak,
  #profileViewerModal.profile-ui-v31.olone-mobile-profile-home .profile-v31-streak,
  #profileViewerModal.profile-ui-v32.olone-mobile-profile-home .profile-v32-streak,
  #profileViewerModal.profile-ui-v33.olone-mobile-profile-home .profile-v33-streak,
  #profileViewerModal.profile-ui-v34.olone-mobile-profile-home .profile-v33-streak {
    align-items: center;
    padding: 8px 0 4px;
  }

  /* V29/V30/V31 mobile: show Premium line under nickname */
  #profileViewerModal.profile-ui-v29.olone-mobile-profile-home #profileNitroIdentityStory:not(.hidden),
  #profileViewerModal.profile-ui-v30.olone-mobile-profile-home #profileNitroIdentityStory:not(.hidden),
  #profileViewerModal.profile-ui-v31.olone-mobile-profile-home #profileNitroIdentityStory:not(.hidden),
  #profileViewerModal.profile-ui-v32.olone-mobile-profile-home #profileNitroIdentityStory:not(.hidden),
  #profileViewerModal.profile-ui-v33.olone-mobile-profile-home #profileNitroIdentityStory:not(.hidden),
  #profileViewerModal.profile-ui-v34.olone-mobile-profile-home #profileNitroIdentityStory:not(.hidden) {
    display: block !important;
  }

  #profileViewerModal.profile-ui-v29.olone-mobile-profile-home .profile-nitro-name,
  #profileViewerModal.profile-ui-v30.olone-mobile-profile-home .profile-nitro-name,
  #profileViewerModal.profile-ui-v31.olone-mobile-profile-home .profile-nitro-name,
  #profileViewerModal.profile-ui-v32.olone-mobile-profile-home .profile-nitro-name,
  #profileViewerModal.profile-ui-v33.olone-mobile-profile-home .profile-nitro-name,
  #profileViewerModal.profile-ui-v34.olone-mobile-profile-home .profile-nitro-name {
    font-size: 34px !important;
    font-weight: 700 !important;
    letter-spacing: -0.04em !important;
  }

  #profileViewerModal.profile-ui-v33.olone-mobile-profile-home .profile-nitro-avatar-stage,
  #profileViewerModal.profile-ui-v34.olone-mobile-profile-home .profile-nitro-avatar-stage {
    width: 128px !important;
    height: 128px !important;
  }

  #profileViewerModal.profile-ui-v33.olone-mobile-profile-home .profile-nitro-avatar-btn,
  #profileViewerModal.profile-ui-v34.olone-mobile-profile-home .profile-nitro-avatar-btn {
    width: 128px !important;
    height: 128px !important;
  }
}
