*{box-sizing:border-box;margin:0;padding:0;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent}
input,textarea{-webkit-user-select:text;user-select:text}
/* html и body не прокручиваются: прокручивается только список сообщений.
   Иначе на телефоне страница целиком уезжает под шапку при появлении
   клавиатуры. */
html,body{height:100%;min-height:0;overflow:hidden;overscroll-behavior:none}
/* ================================================================
   ШРИФТЫ ИНТЕРФЕЙСА
   Выбор из трёх встроенных шрифтов (Comfortaa / Press Start 2P /
   Unbounded) + свой .ttf, загруженный пользователем (см. script.js).
   ================================================================ */
:root{--font-ui:'Comfortaa',sans-serif}
/* Единая плотность размытия подложек. Эталон — карточка контекстного меню
   сообщения (#messageMenuDialog .menu-content): blur(20px) saturate(150%).
   Все остальные backdrop-filter берут значения отсюда, чтобы стекло
   выглядело одинаково во всех окнах, панелях и меню. */
:root{--ui-blur:20px;--ui-blur-sat:150%}
/* Единые кривые анимаций: мягкий выход и пружинный переход.
   Все обновлённые анимации интерфейса используют их, чтобы движение
   выглядело согласованно, а не как набор случайных таймингов. */
:root{--ease-out-quint:cubic-bezier(.22,1,.36,1);--ease-spring:cubic-bezier(.34,1.4,.64,1);--ease-emphasized:cubic-bezier(.2,0,0,1)}
body{background:var(--md-sys-color-surface);color:var(--md-sys-color-on-surface);font-family:var(--font-ui,'Comfortaa',sans-serif);height:100vh;height:100dvh;display:flex;overflow:hidden;color-scheme:light dark;overscroll-behavior:none;transition:background-color .4s ease,color .4s ease;--msg-font-size:15px}
body.light-theme{color-scheme:light;--md-sys-color-surface:#f5f5f5;--md-sys-color-surface-container:#e8e8e8;--md-sys-color-surface-variant:#dcdcdc;--md-sys-color-on-surface:#0a0a0a;--md-sys-color-on-surface-variant:#444;--md-sys-color-primary:#0a0a0a;--md-sys-color-on-primary:#fff;--md-sys-color-primary-container:#e0e0e0;--md-sys-color-secondary-container:#cccccc;--md-sys-color-on-secondary-container:#000;--md-sys-color-outline:#646464;--md-sys-color-outline-variant:#aaaaaa;--md-sys-color-error:#c62828;--md-sys-color-on-error:#fff;--bubble-own-bg:#fff;--bubble-own-text:#0a0a0a;--bubble-other-bg:#e8e8e8;--bubble-other-text:#0a0a0a}
/* Тёмная тема: фон глубокий, но не чёрный — панели и меню читаются
   как слои над ним (surface < container < variant). */
body.dark-theme{color-scheme:dark;--md-sys-color-surface:#212121;--md-sys-color-surface-container:#2a2a2a;--md-sys-color-surface-variant:#343434;--md-sys-color-on-surface:#ececec;--md-sys-color-on-surface-variant:#b6b6b6;--md-sys-color-primary:#e8e8e8;--md-sys-color-on-primary:#212121;--md-sys-color-primary-container:#363636;--md-sys-color-secondary-container:#323232;--md-sys-color-on-secondary-container:#e8e8e8;--md-sys-color-outline:#8c8c8c;--md-sys-color-outline-variant:#4a4a4a;--md-sys-color-error:#ef5350;--md-sys-color-on-error:#000;--bubble-own-bg:#e8e8e8;--bubble-own-text:#212121;--bubble-other-bg:#2e2e2e;--bubble-other-text:#e8e8e8}
body[data-font="small"]{--msg-font-size:13px}
body[data-font="medium"]{--msg-font-size:15px}
body[data-font="large"]{--msg-font-size:17px}
body[data-font="xlarge"]{--msg-font-size:19px}

@keyframes fadeIn{from{opacity:0}to{opacity:1}}
/* Страница чата въезжает сдвигом, но НЕ гаснет: раньше здесь стояло
   opacity:0 → 1, и всё это время сквозь шапку и фон чата был виден
   главный экран («Все / Группы», строка чата). Полупрозрачность остаётся
   только у отдельных элементов самого чата. */
@keyframes slideInRight{from{opacity:1;transform:translateX(40px)}to{opacity:1;transform:translateX(0)}}
@keyframes slideInLeft{from{opacity:0;transform:translateX(-40px)}to{opacity:1;transform:translateX(0)}}
@keyframes slideInUp{from{opacity:0;transform:translateY(30px)}to{opacity:1;transform:translateY(0)}}
@keyframes slideInDown{from{opacity:0;transform:translateY(-30px)}to{opacity:1;transform:translateY(0)}}
/* Сообщения появляются в сторону своей выравнивания: свои — справа,
   входящие — слева. Небольшой «перелёт» и возврат дают ощущение
   пружины вместо резкого pop. */
@keyframes bubbleInOwn{0%{opacity:0;transform:translate3d(20px,12px,0) scale(.92)}55%{opacity:1;transform:translate3d(-3px,-3px,0) scale(1.025)}100%{opacity:1;transform:translate3d(0,0,0) scale(1)}}
@keyframes bubbleInOther{0%{opacity:0;transform:translate3d(-20px,12px,0) scale(.92)}55%{opacity:1;transform:translate3d(3px,-3px,0) scale(1.025)}100%{opacity:1;transform:translate3d(0,0,0) scale(1)}}
@keyframes popIn{0%{opacity:0;transform:scale(.6)}60%{opacity:1;transform:scale(1.06)}100%{opacity:1;transform:scale(1)}}
@keyframes popOut{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.6)}}
/* Плавное появление окон: без «отскока» в середине, ровный выход шкалы */
@keyframes dialogIn{0%{opacity:0;transform:scale(.92) translateY(18px)}100%{opacity:1;transform:scale(1) translateY(0)}}
@keyframes dialogOut{0%{opacity:1;transform:scale(1) translateY(0)}100%{opacity:0;transform:scale(.96) translateY(10px)}}
/* Разделитель дня плавно «раскрывается» по ширине. */
@keyframes separatorIn{from{opacity:0;transform:scaleX(.72)}to{opacity:1;transform:scaleX(1)}}
/* Точки набора текста — живая волна вместо простого мерцания прозрачности. */
@keyframes typingDot{0%,60%,100%{opacity:.35;transform:translateY(0) scale(.85)}30%{opacity:1;transform:translateY(-4px) scale(1)}}
@keyframes slideUp{from{opacity:0;transform:translateY(100%)}to{opacity:1;transform:translateY(0)}}
@keyframes breathe{0%,100%{opacity:.5;transform:translateY(0)}50%{opacity:1;transform:translateY(-2px)}}
@keyframes floatY{0%,100%{transform:translateY(0)}50%{transform:translateY(-8px)}}
@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}
@keyframes shakeX{0%,100%{transform:translateX(0)}20%{transform:translateX(-8px)}40%{transform:translateX(8px)}60%{transform:translateX(-5px)}80%{transform:translateX(5px)}}
@keyframes msgDel{0%{opacity:1;transform:scale(1)}28%{opacity:1;transform:scale(1.07)}62%{opacity:.55;transform:scale(.9)}100%{opacity:0;transform:scale(.4)}}
@keyframes rowIn{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}
@keyframes cardIn{0%{opacity:0;transform:translateY(20px) scale(.96)}60%{opacity:1;transform:translateY(-2px) scale(1.01)}100%{opacity:1;transform:translateY(0) scale(1)}}
@keyframes iconBounce{0%,100%{transform:scale(1)}30%{transform:scale(1.2)}60%{transform:scale(.95)}}
@keyframes glowPulse{0%,100%{box-shadow:0 0 0 0 rgba(34,197,94,.4)}50%{box-shadow:0 0 20px 4px rgba(34,197,94,.2)}}
@keyframes rotateIn{from{transform:rotate(-180deg) scale(.5);opacity:0}to{transform:rotate(0) scale(1);opacity:1}}
@keyframes mesh{0%,100%{background-position:0% 0%,100% 0%,100% 100%,0% 100%}50%{background-position:50% 50%,50% 50%,50% 50%,50% 50%}}
@keyframes authCardIn{0%{opacity:0;transform:scale(.94) translateY(30px)}60%{opacity:1;transform:scale(1.01) translateY(-4px)}100%{opacity:1;transform:scale(1) translateY(0)}}
@keyframes authStepInRight{0%{opacity:0;transform:translateX(60px)}100%{opacity:1;transform:translateX(0)}}
@keyframes authStepInLeft{0%{opacity:0;transform:translateX(-60px)}100%{opacity:1;transform:translateX(0)}}
@keyframes capSpin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}
@keyframes capCheckIn{0%{transform:scale(0) rotate(-90deg)}60%{transform:scale(1.3) rotate(8deg)}100%{transform:scale(1) rotate(0)}}
@keyframes m3LinearIndet{
  0%{transform:translateX(-100%) scaleX(.5)}
  50%{transform:translateX(55%) scaleX(1)}
  100%{transform:translateX(240%) scaleX(.5)}
}
@keyframes replyHintIn{from{opacity:0;transform:scale(.5)}to{opacity:1;transform:scale(1)}}
@keyframes tileIn{0%{opacity:0;transform:scale(.6) translateY(20px)}100%{opacity:1;transform:scale(1) translateY(0)}}
@keyframes tileOut{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.4)}}
@keyframes speaking{0%,100%{box-shadow:0 0 0 3px rgba(34,197,94,.6),0 0 20px rgba(34,197,94,.4)}50%{box-shadow:0 0 0 6px rgba(34,197,94,.2),0 0 30px rgba(34,197,94,.6)}}
@keyframes langFade{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}
@keyframes circleOverlayIn{from{opacity:0}to{opacity:1}}
@keyframes circleDropIn{0%{opacity:0;transform:translateY(-70vh) scale(.35)}65%{opacity:1;transform:translateY(14px) scale(1.04)}100%{opacity:1;transform:translateY(0) scale(1)}}
@keyframes circleLeave{0%{transform:scale(1) translate(0,0);opacity:1}100%{transform:scale(.12) translate(60vw,42vh);opacity:0}}
@keyframes recDot{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.35;transform:scale(.7)}}
@keyframes ringPulse{0%{box-shadow:0 0 0 0 color-mix(in srgb,var(--md-sys-color-primary) 55%,transparent)}100%{box-shadow:0 0 0 14px color-mix(in srgb,var(--md-sys-color-primary) 0%,transparent)}}
@keyframes listItemIn{0%{opacity:0;transform:translateX(-24px)}100%{opacity:1;transform:translateX(0)}}
@keyframes reactionPop{0%{opacity:0;transform:scale(.3)}70%{transform:scale(1.15)}100%{opacity:1;transform:scale(1)}}
@keyframes onlinePulse{0%,100%{transform:scale(1);opacity:1}50%{transform:scale(1.15);opacity:.85}}

#loadingScreen{position:fixed;inset:0;z-index:9999;color:#fff;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:22px;transition:opacity .5s,visibility .5s}
#loadingScreen.done{opacity:0;visibility:hidden;pointer-events:none}
.loading-logo{width:96px;height:96px;border-radius:26px;object-fit:contain;box-shadow:0 20px 48px -16px rgba(120,120,120,.55);animation:popIn .8s cubic-bezier(.34,1.56,.64,1),floatY 3s ease-in-out 1s infinite}
.loading-name{font-size:32px;font-weight:700;background:linear-gradient(135deg,#a0a0a0,#d0d0d0);-webkit-background-clip:text;background-clip:text;color:transparent}
.loading-tag{font-size:12px;opacity:.5;letter-spacing:3px;text-transform:uppercase}
/* Спелш-загрузка — M3 Expressive Wavy Linear Progress (Indeterminate):
   волнистая линия-трек («кривая полоса») + активный сегмент с округлыми
   концами, бегущий по волне. pathLength=100 нормализует длину пути. */
.loading-bar{position:relative;width:min(240px,60vw);height:18px;line-height:0}
.loading-bar .m3-wavy{display:block;width:100%;height:100%;overflow:visible}
.loading-bar .wv-track{fill:none;stroke:rgba(255,255,255,.14);stroke-width:3.4;stroke-linecap:round}
.loading-bar .wv-active{
  fill:none;
  stroke:linear-gradient(90deg,#a0a0a0,#d0d0d0);
  stroke:#c8c8c8;
  stroke-width:3.4;
  stroke-linecap:round;
  stroke-dasharray:26 100;
  stroke-dashoffset:0;
  animation:m3WavyIndet 1.6s cubic-bezier(.2,0,0,1) infinite;
}
@keyframes m3WavyIndet{
  0%{stroke-dasharray:8 100;stroke-dashoffset:0}
  50%{stroke-dasharray:58 100;stroke-dashoffset:-30}
  100%{stroke-dasharray:8 100;stroke-dashoffset:-108}
}
.loading-status{font-size:11px;opacity:.4}
body.auth-locked{overflow:hidden}
body.auth-locked #app,body.auth-locked .dock-container,body.auth-locked #mobileChatScreen,body.auth-locked #callScreen,body.auth-locked #groupCallScreen{display:none!important}

.now-playing-bar{position:relative;z-index:5;display:flex;align-items:center;gap:10px;margin:8px 10px 0;padding:8px 10px;flex-shrink:0;overflow:hidden;border-radius:18px;background:var(--md-sys-color-surface-container);border:1px solid color-mix(in srgb,var(--md-sys-color-outline-variant) 60%,transparent);box-shadow:0 12px 26px -20px rgba(0,0,0,.95);animation:fadeIn .25s ease;transition:transform .35s cubic-bezier(.22,1,.36,1),opacity .3s}
.now-playing-bar.hidden{display:none!important}
.now-playing-bar::before{content:'';position:absolute;left:0;right:0;bottom:0;height:2px;background:linear-gradient(90deg,transparent,var(--md-sys-color-primary),transparent);opacity:.6}
.np-art{width:44px;height:44px;flex-shrink:0;border-radius:12px;background:linear-gradient(135deg,var(--md-sys-color-primary-container),var(--md-sys-color-secondary-container));display:flex;align-items:center;justify-content:center;overflow:hidden;box-shadow:0 4px 12px -4px rgba(0,0,0,.4)}
.np-art img{width:100%;height:100%;object-fit:cover}
.np-art .material-symbols-outlined{font-size:24px;color:var(--md-sys-color-primary);animation:breathe 2.2s ease-in-out infinite}
.np-meta{flex:1;min-width:0;line-height:1.2}
.np-title{font-size:13px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.np-artist{font-size:11px;opacity:.65;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px}
.np-controls{display:flex;align-items:center;gap:4px;flex-shrink:0}
.np-btn{width:36px;height:36px;border-radius:50%;border:none;background:transparent;color:var(--md-sys-color-on-surface);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .2s,transform .2s}
.np-btn:hover{background:var(--md-sys-color-surface-variant)}
.np-btn:active{transform:scale(.9)}
.np-btn .material-symbols-outlined{font-size:22px}
.np-btn.np-play{background:var(--md-sys-color-primary);color:var(--md-sys-color-on-primary);width:40px;height:40px}
.np-btn.np-play .material-symbols-outlined{font-size:24px}
.np-btn.np-close{opacity:.65}
.np-btn.np-close:hover{opacity:1}
/* Строка мини-плеера идёт в потоке под шапкой — компенсация сверху не нужна */
body.has-now-playing #app,body.has-now-playing .list-panel{padding-top:0}

/* ================================================================
   LANGUAGE PICKER
   ================================================================ */
.lang-overlay{position:fixed;inset:0;z-index:10000;display:flex;align-items:center;justify-content:center;background:var(--md-sys-color-surface,#212121);padding:24px;overflow-y:auto}
body.light-theme .lang-overlay{background:#f5f5f5}
.lang-bg{position:absolute;inset:0;pointer-events:none;overflow:hidden;background:radial-gradient(circle at 0% 0%,rgba(120,120,120,.55) 0%,transparent 45%),radial-gradient(circle at 100% 0%,rgba(100,100,100,.45) 0%,transparent 45%),radial-gradient(circle at 100% 100%,rgba(140,140,140,.4) 0%,transparent 45%),radial-gradient(circle at 0% 100%,rgba(130,130,130,.4) 0%,transparent 45%);background-size:160% 160%;animation:mesh 22s ease-in-out infinite}
.lang-bg::after{content:'';position:absolute;inset:0;background:radial-gradient(circle at 50% 50%,transparent 30%,rgba(30,30,30,.5) 90%)}
body.light-theme .lang-bg::after{background:radial-gradient(circle at 50% 50%,transparent 30%,rgba(245,245,245,.5) 90%)}
.lang-shell{position:relative;z-index:1;width:100%;max-width:400px;background:color-mix(in srgb,var(--md-sys-color-surface-container) 90%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));border-radius:28px;padding:34px 26px 30px;box-shadow:0 32px 80px -24px rgba(0,0,0,.55),0 0 0 1px var(--md-sys-color-outline-variant);animation:authCardIn .55s cubic-bezier(.22,1,.36,1) both}
body[data-matte="glass"] .lang-shell{background:color-mix(in srgb,var(--md-sys-color-surface-container) 72%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat)) saturate(var(--glass-saturate))}
.lang-logo{display:flex;flex-direction:column;align-items:center;gap:10px;margin-bottom:22px}
.brand-mark{width:84px;height:auto;display:block;object-fit:contain;filter:drop-shadow(0 14px 30px rgba(0,0,0,.38));animation:popIn .7s cubic-bezier(.34,1.56,.64,1),floatY 3s ease-in-out 1s infinite}
body.light-theme .brand-mark{filter:drop-shadow(0 14px 26px rgba(40,40,70,.18))}
.brand-mark.theme-light{display:none}
body.light-theme .brand-mark.theme-dark{display:none}
body.light-theme .brand-mark.theme-light{display:block}
.brand-mark-auth{width:96px;animation:popIn .6s cubic-bezier(.34,1.56,.64,1)}
.lang-logo-text{font-size:22px;font-weight:700;background:linear-gradient(135deg,#a0a0a0,#d0d0d0);-webkit-background-clip:text;background-clip:text;color:transparent}
.auth-logo-text{font-size:22px;font-weight:700;background:linear-gradient(135deg,#a0a0a0,#d0d0d0);-webkit-background-clip:text;background-clip:text;color:transparent}
body.light-theme .lang-logo-text,
body.light-theme .auth-logo-text{background:linear-gradient(135deg,#1f1f24,#5c5c66);-webkit-background-clip:text;background-clip:text;color:transparent}
.lang-heading{display:flex;flex-direction:column;align-items:center;gap:3px;margin-bottom:22px;text-align:center}
.lang-heading-line{font-size:13.5px;color:var(--md-sys-color-on-surface-variant);font-weight:500;line-height:1.45;animation:profileTextIn .5s cubic-bezier(.22,1,.36,1) both}
.lang-heading-line:nth-child(1){animation-delay:.08s}
.lang-heading-line:nth-child(2){animation-delay:.14s}
.lang-heading-line:nth-child(3){animation-delay:.20s}
.lang-options{display:flex;flex-direction:column;gap:10px}
.lang-option{display:flex;align-items:center;gap:14px;padding:14px 18px;border-radius:16px;border:1.5px solid var(--md-sys-color-outline-variant);background:color-mix(in srgb,var(--md-sys-color-surface) 70%,transparent);color:var(--md-sys-color-on-surface);font-family:inherit;font-size:15px;font-weight:500;cursor:pointer;transition:transform .22s cubic-bezier(.34,1.56,.64,1),background .2s,border-color .2s,box-shadow .2s;animation:profileCardIn .5s cubic-bezier(.22,1,.36,1) both}
.lang-option:nth-child(1){animation-delay:.26s}
.lang-option:nth-child(2){animation-delay:.32s}
.lang-option:nth-child(3){animation-delay:.38s}
.lang-option:hover{background:var(--md-sys-color-surface-variant);border-color:var(--md-sys-color-primary);transform:translateY(-2px);box-shadow:0 10px 24px -14px rgba(0,0,0,.5)}
.lang-option:active{transform:scale(.97)}
.lang-option-code{display:inline-flex;align-items:center;justify-content:center;min-width:40px;height:32px;padding:0 10px;border-radius:10px;background:var(--md-sys-color-primary);color:var(--md-sys-color-on-primary);font-size:12px;font-weight:700;letter-spacing:.6px}
.lang-option-name{flex:1;text-align:left;font-size:15px;font-weight:600}

@keyframes profileAvatarIn{0%{opacity:0;transform:scale(.35) rotate(-14deg)}55%{opacity:1;transform:scale(1.12) rotate(5deg)}78%{transform:scale(.96) rotate(-2deg)}100%{opacity:1;transform:scale(1) rotate(0)}}
@keyframes profileTextIn{0%{opacity:0;transform:translateY(10px)}100%{opacity:1;transform:translateY(0)}}
@keyframes profileCardIn{0%{opacity:0;transform:translateY(16px) scale(.95)}60%{opacity:1;transform:translateY(-2px) scale(1.012)}100%{opacity:1;transform:translateY(0) scale(1)}}

#panelContent .profile-panel-hero{position:relative;display:flex;flex-direction:column;align-items:center;padding:24px 18px 10px;transform-origin:top center;contain:layout style}
#panelContent .profile-panel-hero .profile-hero-avatar{width:76px;height:76px;min-width:76px;max-width:76px;border-radius:50%;background:linear-gradient(135deg,var(--md-sys-color-primary-container),var(--md-sys-color-secondary-container));display:flex;align-items:center;justify-content:center;font-size:26px;color:var(--md-sys-color-on-surface-variant);overflow:hidden;margin-bottom:12px;flex:0 0 auto;will-change:width,height,font-size,margin-bottom;animation:profileAvatarIn .68s cubic-bezier(.34,1.4,.64,1) .04s both}
#panelContent .profile-panel-hero .profile-hero-avatar img{width:100%;height:100%;object-fit:cover;border-radius:50%;display:block}
#panelContent .profile-panel-hero .profile-hero-avatar .material-symbols-outlined{font-size:inherit}
#panelContent .profile-panel-hero .profile-hero-name{font-size:16px;font-weight:600;text-align:center;line-height:1.25;will-change:font-size,opacity;animation:profileTextIn .5s cubic-bezier(.22,1,.36,1) .12s both}
#panelContent .profile-panel-hero .profile-hero-id{font-size:12px;color:var(--md-sys-color-on-surface-variant);margin-top:4px;text-align:center;opacity:.7;will-change:opacity;animation:profileTextIn .5s cubic-bezier(.22,1,.36,1) .18s both}
#panelContent .profile-panel-hero .profile-hero-email{font-size:11.5px;color:var(--md-sys-color-on-surface-variant);margin-top:2px;text-align:center;opacity:.55;will-change:opacity;animation:profileTextIn .5s cubic-bezier(.22,1,.36,1) .24s both}
#panelContent .favorites-button{animation:profileCardIn .52s cubic-bezier(.22,1.15,.36,1) .22s both;will-change:transform,opacity}
#panelContent .profile-section-title{animation:profileTextIn .42s cubic-bezier(.22,1,.36,1) .28s both}
#panelContent .settings-menu-grid .settings-menu-card{animation:profileCardIn .48s cubic-bezier(.22,1.15,.36,1) both;will-change:transform,opacity}
#panelContent .settings-menu-grid .settings-menu-card:nth-child(1){animation-delay:.34s}
#panelContent .settings-menu-grid .settings-menu-card:nth-child(2){animation-delay:.38s}
#panelContent .settings-menu-grid .settings-menu-card:nth-child(3){animation-delay:.42s}
#panelContent .settings-menu-grid .settings-menu-card:nth-child(4){animation-delay:.46s}
#panelContent .settings-menu-grid .settings-menu-card:nth-child(5){animation-delay:.50s}
#panelContent .settings-menu-grid .settings-menu-card:nth-child(6){animation-delay:.54s}
#panelContent #profileLogoutBtn{animation:profileCardIn .5s cubic-bezier(.22,1.15,.36,1) .58s both;will-change:transform,opacity}

.auth-overlay{position:fixed;inset:0;z-index:900;align-items:center;justify-content:center;background:var(--md-sys-color-surface,#212121);overflow-y:auto;padding:20px}
body.light-theme .auth-overlay{background:#f5f5f5}
.auth-overlay.hidden-overlay{display:none!important}
.auth-bg{position:absolute;inset:0;pointer-events:none;overflow:hidden;background:radial-gradient(circle at 0% 0%,rgba(120,120,120,.55) 0%,transparent 45%),radial-gradient(circle at 100% 0%,rgba(100,100,100,.45) 0%,transparent 45%),radial-gradient(circle at 100% 100%,rgba(140,140,140,.4) 0%,transparent 45%),radial-gradient(circle at 0% 100%,rgba(130,130,130,.4) 0%,transparent 45%);background-size:160% 160%;animation:mesh 22s ease-in-out infinite}
.auth-bg::after{content:'';position:absolute;inset:0;background:radial-gradient(circle at 50% 50%,transparent 30%,rgba(30,30,30,.5) 90%)}
body.light-theme .auth-bg::after{background:radial-gradient(circle at 50% 50%,transparent 30%,rgba(245,245,245,.5) 90%)}
.auth-shell{position:relative;z-index:1;width:100%;max-width:420px;background:color-mix(in srgb,var(--md-sys-color-surface-container) 90%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));border-radius:28px;padding:28px 26px 26px;box-shadow:0 32px 80px -24px rgba(0,0,0,.5),0 0 0 1px var(--md-sys-color-outline-variant);animation:authCardIn .55s cubic-bezier(.22,1,.36,1) both}
.auth-logo{display:flex;flex-direction:column;align-items:center;gap:14px;margin-bottom:22px}
.auth-logo-text{font-size:22px;font-weight:700;background:linear-gradient(135deg,#a0a0a0,#d0d0d0);-webkit-background-clip:text;background-clip:text;color:transparent}
.auth-tabs{display:flex;gap:4px;padding:4px;border-radius:999px;background:var(--md-sys-color-surface-variant);margin-bottom:22px}
.auth-tab{flex:1;padding:9px 16px;border-radius:999px;border:none;background:transparent;color:var(--md-sys-color-on-surface-variant);font-family:inherit;font-size:13px;font-weight:600;cursor:pointer;transition:background .3s,color .3s,transform .2s}
.auth-tab:active{transform:scale(.96)}
.auth-tab.active{background:var(--md-sys-color-primary);color:var(--md-sys-color-on-primary)}
.auth-steps{position:relative;min-height:280px}
.auth-step{display:none;flex-direction:column;gap:14px}
.auth-step.active{display:flex;animation:authStepInRight .4s cubic-bezier(.22,1,.36,1) both}
.auth-step.reverse.active{animation:authStepInLeft .4s cubic-bezier(.22,1,.36,1) both}
.auth-step h2{font-size:20px;font-weight:600}
.auth-step .sub{font-size:12.5px;color:var(--md-sys-color-on-surface-variant);margin-top:-8px}
.auth-step .sub b{color:var(--md-sys-color-primary);word-break:break-all}
.auth-field{position:relative;margin-top:4px}
.auth-field input{width:100%;padding:14px 46px 14px 46px;border-radius:14px;border:1.5px solid var(--md-sys-color-outline-variant);background:color-mix(in srgb,var(--md-sys-color-surface) 70%,transparent);color:var(--md-sys-color-on-surface);font-family:inherit;font-size:15px;outline:none;transition:border-color .25s,box-shadow .25s}
.auth-field input:focus{border-color:var(--md-sys-color-primary);box-shadow:0 0 0 4px color-mix(in srgb,var(--md-sys-color-primary) 12%,transparent)}
.auth-field input.error{border-color:var(--md-sys-color-error);animation:shakeX .45s ease}
.auth-field .icon{position:absolute;left:14px;top:50%;transform:translateY(-50%);font-family:'Material Symbols Outlined';font-size:20px;color:var(--md-sys-color-on-surface-variant);pointer-events:none}
.auth-field .pwd-toggle{position:absolute;right:8px;top:50%;transform:translateY(-50%);width:36px;height:36px;border-radius:50%;border:none;background:transparent;color:var(--md-sys-color-on-surface-variant);cursor:pointer;display:flex;align-items:center;justify-content:center}
.auth-hint-box{display:flex;align-items:center;gap:8px;padding:10px 12px;border-radius:12px;background:color-mix(in srgb,var(--md-sys-color-primary) 10%,transparent);font-size:12.5px;color:var(--md-sys-color-on-surface)}
.auth-hint-box .material-symbols-outlined{font-size:18px;color:var(--md-sys-color-primary)}
.auth-btn{padding:14px 22px;border-radius:14px;border:none;background:var(--md-sys-color-primary);color:var(--md-sys-color-on-primary);font-family:inherit;font-size:15px;font-weight:600;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:10px;position:relative;overflow:hidden;transition:transform .2s cubic-bezier(.34,1.56,.64,1),box-shadow .25s,opacity .2s}
.auth-btn:active{transform:scale(.97)}
.auth-btn:disabled{opacity:.55;cursor:not-allowed}
.auth-btn.ghost{background:transparent;color:var(--md-sys-color-on-surface-variant);border:1.5px solid var(--md-sys-color-outline-variant)}
.auth-btn .spinner{width:16px;height:16px;border-radius:50%;border:2px solid rgba(255,255,255,.35);border-top-color:#fff;animation:spin .8s linear infinite}
.auth-row{display:flex;gap:10px}
.auth-row > *{flex:1}
.auth-error{font-size:12px;color:var(--md-sys-color-error);padding:8px 12px;border-radius:10px;background:color-mix(in srgb,var(--md-sys-color-error) 12%,transparent);display:none}
.auth-error.show{display:block;animation:slideInDown .3s ease}
.auth-link{background:transparent;border:none;color:var(--md-sys-color-primary);font-family:inherit;font-size:12.5px;font-weight:600;cursor:pointer;text-align:right;padding:4px 2px;text-decoration:underline;align-self:flex-end;margin-top:-6px}
.auth-resend{font-size:12px;text-align:center;color:var(--md-sys-color-on-surface-variant);margin-top:4px}
.auth-resend button{background:transparent;border:none;color:var(--md-sys-color-primary);font-family:inherit;font-size:12px;font-weight:600;cursor:pointer;text-decoration:underline;padding:0 2px}
.auth-resend button:disabled{opacity:.5;cursor:not-allowed}
.avatar-pick{display:flex;flex-direction:column;align-items:center;gap:8px}
.avatar-pick .apv{width:96px;height:96px;border-radius:50%;background:var(--md-sys-color-surface-variant);display:flex;align-items:center;justify-content:center;overflow:hidden;cursor:pointer;border:2px dashed var(--md-sys-color-outline-variant);transition:border-color .2s,transform .2s}
.avatar-pick .apv:hover{border-color:var(--md-sys-color-primary);transform:scale(1.05)}
.avatar-pick .apv img{width:100%;height:100%;object-fit:cover;display:block;border-radius:50%}
.avatar-pick .apv-hint{font-size:11px;color:var(--md-sys-color-on-surface-variant)}
.auth-agree{display:flex;gap:10px;align-items:flex-start;padding:12px 14px;border-radius:14px;background:color-mix(in srgb,var(--md-sys-color-surface) 60%,transparent);border:1.5px solid var(--md-sys-color-outline-variant);font-size:12.5px;color:var(--md-sys-color-on-surface-variant);cursor:pointer;line-height:1.5;transition:border-color .25s,background .25s}
.auth-agree.checked{border-color:var(--md-sys-color-primary);background:color-mix(in srgb,var(--md-sys-color-primary) 7%,transparent)}
.auth-agree input{display:none}
.auth-agree .cbx{width:22px;height:22px;border-radius:7px;flex-shrink:0;border:2px solid var(--md-sys-color-outline);display:flex;align-items:center;justify-content:center;background:var(--md-sys-color-surface);transition:background .25s,border-color .25s}
.auth-agree.checked .cbx{background:var(--md-sys-color-primary);border-color:var(--md-sys-color-primary)}
.auth-agree .cbx .material-symbols-outlined{font-size:16px;color:var(--md-sys-color-on-primary);transform:scale(0);transition:transform .25s cubic-bezier(.34,1.56,.64,1)}
.auth-agree.checked .cbx .material-symbols-outlined{transform:scale(1)}
.auth-code-wrap{display:flex;justify-content:center;padding:6px 0}
.auth-code{width:100%;max-width:260px;padding:16px 12px;border-radius:16px;border:2px solid var(--md-sys-color-outline-variant);background:color-mix(in srgb,var(--md-sys-color-surface) 80%,transparent);color:var(--md-sys-color-on-surface);font-family:'Courier New',monospace;font-size:30px;font-weight:700;letter-spacing:6px;text-align:center;outline:none}
.auth-code:focus{border-color:var(--md-sys-color-primary);box-shadow:0 0 0 4px color-mix(in srgb,var(--md-sys-color-primary) 12%,transparent)}
.auth-success-icon{width:80px;height:80px;border-radius:50%;align-self:center;background:linear-gradient(135deg,#22c55e,#16a34a);display:flex;align-items:center;justify-content:center;animation:popIn .55s cubic-bezier(.34,1.56,.64,1)}
.auth-success-icon .material-symbols-outlined{font-size:44px;color:#fff}
.auth-step.success{text-align:center}
.aerren-captcha{display:flex;align-items:center;gap:14px;padding:16px 18px;border-radius:18px;background:var(--md-sys-color-surface-variant);border:1.5px solid var(--md-sys-color-outline-variant);cursor:pointer;transition:border-color .3s,background .3s,transform .2s}
.aerren-captcha:hover{border-color:var(--md-sys-color-primary)}
.aerren-captcha:active{transform:scale(.98)}
.aerren-captcha.verifying{border-color:var(--md-sys-color-primary);cursor:progress}
.aerren-captcha.solved{border-color:#22c55e;background:color-mix(in srgb,#22c55e 10%,var(--md-sys-color-surface-variant));cursor:default}
.cap-box{width:28px;height:28px;min-width:28px;border-radius:9px;border:2px solid var(--md-sys-color-outline);background:var(--md-sys-color-surface);display:flex;align-items:center;justify-content:center;flex-shrink:0;cursor:pointer;position:relative}
.aerren-captcha.solved .cap-box{background:#22c55e;border-color:#22c55e}
.cap-check{font-family:'Material Symbols Outlined';font-size:20px;color:#fff;opacity:0;transform:scale(0)}
.aerren-captcha.solved .cap-check{animation:capCheckIn .45s cubic-bezier(.34,1.56,.64,1) forwards;opacity:1}
.cap-spinner{position:absolute;top:2px;left:2px;right:2px;bottom:2px;border-radius:50%;border:2.5px solid transparent;border-top-color:var(--md-sys-color-primary);opacity:0;pointer-events:none}
.aerren-captcha.verifying .cap-spinner{opacity:1;animation:capSpin .8s linear infinite}
.cap-text{flex:1;min-width:0}
.cap-title{font-size:14.5px;font-weight:500}
.aerren-captcha.solved .cap-title{color:#22c55e;font-weight:600}
.cap-brand{font-size:10px;letter-spacing:1.5px;text-transform:uppercase;opacity:.5;margin-top:3px;font-weight:600;background:linear-gradient(135deg,#a0a0a0,#d0d0d0);-webkit-background-clip:text;background-clip:text;color:transparent}
.cap-status{font-size:11px;color:var(--md-sys-color-primary);margin-top:2px;opacity:0;transition:opacity .3s;height:0;overflow:hidden}
.aerren-captcha.verifying .cap-status,.aerren-captcha.solved .cap-status{opacity:1;height:auto}
.aerren-captcha.solved .cap-status{color:#22c55e}

.md-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:10px 22px;border-radius:20px;font-family:inherit;font-weight:500;font-size:14px;cursor:pointer;border:none;background:transparent;color:var(--md-sys-color-primary);transition:background .25s,transform .22s cubic-bezier(.34,1.56,.64,1),box-shadow .25s}
.md-btn:active{transform:scale(.94)}
.md-btn-filled{background:var(--md-sys-color-primary);color:var(--md-sys-color-on-primary)}
.md-btn-outlined{border:1px solid var(--md-sys-color-outline);color:var(--md-sys-color-primary)}
.md-btn-outlined:hover{background:var(--md-sys-color-surface-variant)}
.md-btn-danger{background:var(--md-sys-color-error);color:var(--md-sys-color-on-error)}
.md-icon-btn{display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:50%;border:none;background:transparent;color:var(--md-sys-color-on-surface-variant);cursor:pointer;transition:background .25s,color .25s,transform .22s;flex-shrink:0}
.md-icon-btn:hover{background:var(--md-sys-color-surface-variant);color:var(--md-sys-color-on-surface)}
.md-icon-btn:active{transform:scale(.86)}
.md-text-field{position:relative;margin:8px 0}
.md-text-field-filled input{width:100%;padding:12px 46px 12px 16px;border-radius:4px 4px 0 0;border:none;border-bottom:1px solid var(--md-sys-color-outline);background:var(--md-sys-color-surface-variant);color:var(--md-sys-color-on-surface);font-family:inherit;font-size:16px;outline:none}
.md-text-field-label{position:absolute;left:16px;top:12px;color:var(--md-sys-color-on-surface-variant);transition:all .2s;pointer-events:none;font-size:16px}
.md-text-field-filled input:focus + .md-text-field-label,.md-text-field-filled input:not(:placeholder-shown) + .md-text-field-label{top:-8px;left:12px;font-size:12px;background:var(--md-sys-color-surface-variant);padding:0 4px;color:var(--md-sys-color-primary)}
.md-text-field .pwd-toggle{position:absolute;right:6px;top:50%;transform:translateY(-50%);width:36px;height:36px;border-radius:50%;border:none;background:transparent;color:var(--md-sys-color-on-surface-variant);cursor:pointer;display:flex;align-items:center;justify-content:center;z-index:2}

.dialog-btn-row{display:flex;gap:8px;flex-wrap:wrap}
.dialog-btn-row > *{flex:1 1 90px;min-width:80px}
@media (max-width:520px){
  .dialog-btn-row > *{flex:1 1 100%;min-width:0}
  .dialog-btn-row{flex-direction:column}
  .dialog-btn-row.md-btn-row-inline{flex-direction:row}
  .dialog-btn-row.md-btn-row-inline > *{flex:1 1 calc(50% - 4px)}
}

#app{display:flex;width:100%;height:100%;flex-direction:row;transition:padding-top .3s,opacity .3s ease;min-height:0;opacity:0}
#app.ready{opacity:1}
.list-panel{width:var(--panel-width,340px);min-width:240px;max-width:560px;background:var(--md-sys-color-surface);border-right:1px solid var(--md-sys-color-outline-variant);display:flex;flex-direction:column;position:relative;min-height:0}
.panel-header{position:sticky;top:0;z-index:4;padding:16px 18px 10px;font-size:22px;font-weight:500;display:flex;align-items:center;gap:8px;flex-shrink:0;background:color-mix(in srgb,var(--md-sys-color-surface) 75%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
/* min-width:0 + ellipsis: заголовок обязан ужиматься, иначе широкий шрифт
   (Press Start 2P и т.п.) выталкивает кнопки справа за край панели */
.panel-header h2{font-size:22px;font-weight:500;flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.panel-header .md-icon-btn{width:36px;height:36px}
.panel-header-actions{display:flex;align-items:center;gap:6px;flex-shrink:0}

/* ===== ПЕРЕКЛЮЧАТЕЛЬ АККАУНТОВ ===== */
.account-switch-btn{position:relative;width:36px;height:36px;padding:0;border:none;background:transparent;cursor:pointer;border-radius:50%;flex-shrink:0;-webkit-tap-highlight-color:transparent}
.account-avatar{display:flex;align-items:center;justify-content:center;width:36px;height:36px;border-radius:50%;overflow:hidden;background:var(--md-sys-color-primary-container);color:var(--md-sys-color-on-surface);font-size:15px;font-weight:600;line-height:1;user-select:none;touch-action:pan-x;transition:transform .22s cubic-bezier(.34,1.56,.64,1),box-shadow .22s}
.account-avatar img{width:100%;height:100%;object-fit:cover;display:block}
.account-switch-btn:hover .account-avatar{box-shadow:0 4px 14px -6px rgba(0,0,0,.55)}
.account-switch-btn.swiping .account-avatar{box-shadow:0 8px 22px -8px rgba(0,0,0,.7)}
.account-switch-btn.swiping .account-avatar{transition:none}
.account-badge{position:absolute;top:-3px;right:-4px;min-width:16px;height:16px;padding:0 4px;border-radius:999px;box-sizing:border-box;background:var(--md-sys-color-primary);color:var(--md-sys-color-on-primary);font-size:10px;font-weight:700;display:flex;align-items:center;justify-content:center;border:2px solid var(--md-sys-color-surface);pointer-events:none}
.account-badge.hidden{display:none}
.account-toast{position:absolute;top:calc(100% + 6px);right:0;white-space:nowrap;font-size:11px;padding:5px 10px;border-radius:999px;background:var(--md-sys-color-surface-variant);color:var(--md-sys-color-on-surface);opacity:0;transform:translateY(-4px);transition:opacity .2s,transform .2s;pointer-events:none;z-index:5}
.account-switch-dialog{width:min(92vw,380px);min-width:0}
.account-list{display:flex;flex-direction:column;gap:6px;max-height:46vh;overflow-y:auto;margin-bottom:10px}
.account-row{display:flex;align-items:center;gap:12px;width:100%;padding:8px 10px;border-radius:16px;background:var(--md-sys-color-surface-container);border:1px solid transparent;cursor:pointer;text-align:left;font-family:inherit;color:inherit;transition:background .2s,transform .16s,border-color .2s}
.account-row:active{transform:scale(.985)}
.account-row.active{border-color:transparent;background:var(--md-sys-color-surface-variant)}
.account-row.add{background:transparent;border:1px dashed var(--md-sys-color-outline)}
.account-row.add:hover{background:var(--md-sys-color-surface-container)}
.account-row .ar-av{width:40px;height:40px;border-radius:50%;flex-shrink:0;overflow:hidden;display:flex;align-items:center;justify-content:center;background:var(--md-sys-color-primary-container);color:var(--md-sys-color-on-surface);font-weight:600;font-size:16px}
.account-row .ar-av img{width:100%;height:100%;object-fit:cover}
.account-row .ar-av.ar-add{background:transparent;color:var(--md-sys-color-on-surface-variant)}
.account-row .ar-text{flex:1;min-width:0}
.account-row .ar-title{font-size:14px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.account-row .ar-sub{font-size:11.5px;color:var(--md-sys-color-on-surface-variant);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:1px}
.account-row .ar-check{color:var(--md-sys-color-primary);font-size:20px;flex-shrink:0}
.account-row .ar-del{width:34px;height:34px;flex-shrink:0}
.account-row .ar-del:hover{background:var(--md-sys-color-error);color:var(--md-sys-color-on-error)}
.auth-back-account{position:fixed;left:50%;bottom:max(18px,var(--safe-bottom));transform:translateX(-50%);z-index:2;padding:10px 18px;border-radius:999px;border:1px solid var(--md-sys-color-outline);background:color-mix(in srgb,var(--md-sys-color-surface-container) 92%,transparent);color:var(--md-sys-color-primary);font-family:inherit;font-size:13px;font-weight:500;cursor:pointer;max-width:min(88vw,420px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;animation:fadeIn .3s ease}
.auth-back-account:active{transform:translateX(-50%) scale(.96)}
.app-update-button{display:inline-flex;align-items:center;gap:5px;min-height:34px;padding:6px 10px;border:1px solid color-mix(in srgb,var(--md-sys-color-primary) 35%,transparent);border-radius:999px;background:color-mix(in srgb,var(--md-sys-color-primary) 12%,var(--md-sys-color-surface-container));color:var(--md-sys-color-primary);font-family:inherit;font-size:11px;font-weight:700;cursor:pointer;white-space:nowrap;box-shadow:0 4px 12px -8px color-mix(in srgb,var(--md-sys-color-primary) 70%,transparent);transition:transform .18s,background .2s}
.app-update-button:hover{background:color-mix(in srgb,var(--md-sys-color-primary) 20%,var(--md-sys-color-surface-container))}
.app-update-button:active{transform:scale(.96)}
.app-update-button .material-symbols-outlined{font-size:18px}
.app-update-button small{font-size:10px;font-weight:600;opacity:.8}
.app-update-button.hidden{display:none!important}
.app-update-dialog-content{width:min(390px,calc(100vw - 32px));text-align:center}
.app-update-dialog-icon{width:58px;height:58px;margin:0 auto 12px;border-radius:18px;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--md-sys-color-primary) 14%,transparent);color:var(--md-sys-color-primary)}
.app-update-dialog-icon .material-symbols-outlined{font-size:30px}
.app-update-dialog-content h3{margin-bottom:6px}
.app-update-version{font-size:16px;font-weight:700;color:var(--md-sys-color-primary);margin:0 0 4px}
.app-update-filename{font-size:11px;color:var(--md-sys-color-on-surface-variant);margin:0;word-break:break-all}
.app-update-dialog-content .md-btn{display:inline-flex;align-items:center;justify-content:center;gap:6px}
.app-update-dialog-content .md-btn .material-symbols-outlined{font-size:18px}
#chatsTabsContainer{min-width:0}
.chat-tabs{display:flex;gap:2px;padding:4px;margin:0 14px 10px;border-radius:999px;background:var(--md-sys-color-surface-variant);overflow-x:auto;scrollbar-width:none;flex-shrink:0}
.chat-tabs::-webkit-scrollbar{display:none}
.tab-item{flex:1;padding:8px 14px;border-radius:999px;border:none;background:transparent;color:var(--md-sys-color-on-surface-variant);font-family:inherit;font-size:12px;font-weight:500;white-space:nowrap;cursor:pointer;transition:background .3s,color .3s,transform .2s}
.tab-item:active{transform:scale(.95)}
.tab-item.active{background:var(--md-sys-color-primary);color:var(--md-sys-color-on-primary);animation:popIn .3s cubic-bezier(.34,1.56,.64,1)}
.panel-content{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;padding:6px 14px 14px;overscroll-behavior:contain;touch-action:pan-y}
.dock-desktop{display:flex;align-items:center;justify-content:space-around;gap:4px;padding:10px 12px;padding-bottom:max(12px,var(--safe-bottom));background:color-mix(in srgb,var(--md-sys-color-surface-container) 60%,var(--md-sys-color-surface));border-top:1px solid var(--md-sys-color-outline-variant);flex-shrink:0}
.dock-desktop .dock-item{flex:1;display:flex;flex-direction:column;align-items:center;gap:3px;padding:8px 6px;border-radius:16px;border:none;background:transparent;color:var(--md-sys-color-on-surface-variant);font-family:inherit;font-size:10px;cursor:pointer;transition:background .3s,color .3s,transform .2s}
.dock-desktop .dock-item:active{transform:scale(.94)}
.dock-desktop .dock-item .material-symbols-outlined{font-size:24px}
.dock-desktop .dock-item.active{background:var(--md-sys-color-secondary-container);color:var(--md-sys-color-on-secondary-container)}
.dock-desktop .search-fab-mini{width:44px;height:44px;border-radius:50%;border:none;background:var(--md-sys-color-primary);color:var(--md-sys-color-on-primary);display:flex;align-items:center;justify-content:center;cursor:pointer;flex-shrink:0;transition:transform .25s cubic-bezier(.34,1.56,.64,1)}
.dock-desktop .search-fab-mini:active{transform:scale(.88) rotate(15deg)}
.panel-resizer{position:absolute;top:0;right:-4px;bottom:0;width:8px;cursor:col-resize;z-index:5}
.panel-resizer::after{content:'';position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:3px;height:36px;border-radius:2px;background:var(--md-sys-color-outline-variant);opacity:.5}
.dock-container{position:fixed;bottom:max(14px,var(--safe-bottom));left:50%;transform:translateX(-50%);display:none;align-items:center;justify-content:center;gap:10px;z-index:25;padding:0 10px;width:calc(100vw - 20px);max-width:440px;transition:transform .4s,opacity .3s;pointer-events:none}
.dock-container > *{pointer-events:auto}
#app.chat-open .dock-container{transform:translateX(-50%) translateY(200%);opacity:0;pointer-events:none}
.dock-bar{display:flex;align-items:center;justify-content:space-around;gap:2px;padding:6px 4px;border-radius:999px;flex:1;min-width:0;background:color-mix(in srgb,var(--md-sys-color-surface-container) 92%,transparent);box-shadow:0 14px 38px -12px rgba(0,0,0,.55);border:1px solid var(--md-sys-color-outline-variant);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));height:60px}
.dock-item-mobile{display:flex;flex-direction:column;align-items:center;gap:2px;padding:8px 6px;min-width:0;flex:1;border-radius:999px;border:none;background:transparent;color:var(--md-sys-color-on-surface-variant);font-family:inherit;font-size:10px;cursor:pointer;transition:background .3s,color .3s,transform .2s}
.dock-item-mobile:active{transform:scale(.9)}
.dock-item-mobile .material-symbols-outlined{font-size:24px}
.dock-item-mobile.active{background:var(--md-sys-color-secondary-container);color:var(--md-sys-color-on-secondary-container)}
.search-fab{width:56px;height:56px;border-radius:50%;border:none;background:var(--md-sys-color-primary);color:var(--md-sys-color-on-primary);display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:0 12px 28px -8px rgba(0,0,0,.6);flex-shrink:0;transition:transform .25s cubic-bezier(.34,1.56,.64,1)}
.search-fab:active{transform:scale(.88) rotate(15deg)}
.chat-area{flex:1;display:flex;flex-direction:column;background:var(--md-sys-color-surface);min-width:0;min-height:0;position:relative}
.chat-placeholder{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;color:var(--md-sys-color-on-surface-variant);font-size:15px;text-align:center;padding:20px;gap:16px}
.chat-placeholder .material-symbols-outlined{font-size:64px;opacity:.35;animation:breathe 3s ease-in-out infinite}
.mobile-screen{display:none;position:absolute;top:0;left:0;right:0;bottom:0;background:var(--md-sys-color-surface);z-index:30;flex-direction:column;min-height:0}
.mobile-screen.active{display:flex;animation:slideInRight .35s cubic-bezier(.22,1,.36,1)}

/* Desktop drag & drop */
.desktop-drop-zone{position:absolute;inset:10px;z-index:60;display:flex;align-items:center;justify-content:center;padding:24px;opacity:0;visibility:hidden;pointer-events:none;background:color-mix(in srgb,var(--md-sys-color-surface) 76%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));transition:opacity .22s ease,visibility .22s ease}
.desktop-drop-zone::before{content:'';position:absolute;inset:0;background-image:radial-gradient(circle at 1px 1px,color-mix(in srgb,var(--md-sys-color-on-surface) 13%,transparent) 1px,transparent 0);background-size:22px 22px;opacity:.3;mask-image:radial-gradient(circle at center,#000,transparent 72%)}
.desktop-drop-zone.is-active{opacity:1;visibility:visible}
.desktop-drop-frame{position:relative;width:min(520px,90%);padding:5px;border-radius:34px;border:2px dashed color-mix(in srgb,var(--md-sys-color-primary) 55%,transparent);background:color-mix(in srgb,var(--md-sys-color-primary) 6%,transparent);transform:scale(.97);transition:transform .3s cubic-bezier(.34,1.56,.64,1),border-color .25s,background .25s}
.desktop-drop-zone.is-dragging .desktop-drop-frame{animation:dropZoneBreathe 1.25s ease-in-out infinite}
.desktop-drop-card{position:relative;display:flex;flex-direction:column;align-items:center;min-width:0;padding:34px 30px 26px;border-radius:29px;background:color-mix(in srgb,var(--md-sys-color-surface-container) 94%,transparent);border:1px solid var(--md-sys-color-outline-variant);box-shadow:0 26px 60px -22px rgba(0,0,0,.58);overflow:hidden;text-align:center}
.desktop-drop-card::before{content:'';position:absolute;left:50%;top:-64px;width:210px;height:150px;border-radius:50%;background:radial-gradient(circle,color-mix(in srgb,var(--md-sys-color-primary) 18%,transparent),transparent 70%);transform:translateX(-50%);pointer-events:none}
.desktop-drop-icon{position:relative;width:72px;height:72px;display:flex;align-items:center;justify-content:center;margin-bottom:16px;border-radius:24px;background:var(--md-sys-color-primary);color:var(--md-sys-color-on-primary);box-shadow:0 15px 30px -14px color-mix(in srgb,var(--md-sys-color-primary) 85%,transparent)}
.desktop-drop-icon .material-symbols-outlined{font-size:35px;line-height:1}
.desktop-drop-title{position:relative;max-width:100%;font-size:20px;font-weight:700;color:var(--md-sys-color-on-surface);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.desktop-drop-meta{position:relative;max-width:100%;min-height:20px;margin-top:7px;font-size:12.5px;color:var(--md-sys-color-on-surface-variant);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.desktop-drop-types{position:relative;display:flex;justify-content:center;gap:8px;flex-wrap:wrap;margin-top:20px}
.desktop-drop-types>span{display:flex;align-items:center;gap:5px;padding:7px 10px;border-radius:999px;background:color-mix(in srgb,var(--md-sys-color-on-surface) 7%,transparent);font-size:10.5px;color:var(--md-sys-color-on-surface-variant)}
.desktop-drop-types .material-symbols-outlined{font-size:16px;color:var(--md-sys-color-primary)}
.desktop-drop-types b{font-weight:600}
.desktop-drop-progress{position:absolute;left:0;right:0;bottom:0;height:4px;background:color-mix(in srgb,var(--md-sys-color-on-surface) 8%,transparent);overflow:hidden}
.desktop-drop-progress>span{position:relative;display:block;width:var(--drop-progress,0%);height:100%;background:linear-gradient(90deg,var(--md-sys-color-primary),var(--md-sys-color-secondary-container));transition:width .16s linear;overflow:hidden}
.desktop-drop-progress>span::after{content:'';position:absolute;inset:0;background:linear-gradient(90deg,transparent,rgba(255,255,255,.65),transparent);transform:translateX(-100%);animation:dropProgressShimmer 1.15s ease-in-out infinite}
.desktop-drop-zone.is-uploading .desktop-drop-frame{border-color:var(--md-sys-color-primary);box-shadow:0 0 0 4px color-mix(in srgb,var(--md-sys-color-primary) 8%,transparent);animation:dropZoneUploading 1.05s ease-in-out infinite alternate}
.desktop-drop-zone.is-uploading .desktop-drop-progress{height:5px;box-shadow:0 0 10px color-mix(in srgb,var(--md-sys-color-primary) 45%,transparent)}
.desktop-drop-zone.is-uploading .desktop-drop-icon .material-symbols-outlined{animation:spin 1s linear infinite}
.desktop-drop-zone.is-complete .desktop-drop-frame{border-color:rgba(34,197,94,.72);background:rgba(34,197,94,.08)}
.desktop-drop-zone.is-complete .desktop-drop-icon{background:#22c55e;color:#fff;animation:fileDownloadCheckPop .48s cubic-bezier(.34,1.56,.64,1)}
.desktop-drop-zone.is-complete .desktop-drop-progress>span{background:#22c55e}
.desktop-drop-zone.is-error .desktop-drop-frame{border-color:color-mix(in srgb,var(--md-sys-color-error) 65%,transparent);background:color-mix(in srgb,var(--md-sys-color-error) 7%,transparent)}
.desktop-drop-zone.is-error .desktop-drop-icon{background:var(--md-sys-color-error);color:var(--md-sys-color-on-error);animation:fileDownloadCheckPop .42s cubic-bezier(.34,1.56,.64,1)}
.desktop-drop-zone.is-error .desktop-drop-progress>span{background:var(--md-sys-color-error)}
@keyframes dropZoneBreathe{0%,100%{transform:scale(.985)}50%{transform:scale(1.015)}}
@keyframes dropZoneUploading{from{transform:scale(1)}to{transform:scale(1.012)}}
@keyframes dropProgressShimmer{0%{transform:translateX(-100%)}55%,100%{transform:translateX(100%)}}
@media (max-width:768px){.desktop-drop-zone{display:none!important}}
@media (prefers-reduced-motion:reduce){
  .desktop-drop-zone.is-dragging .desktop-drop-frame,
  .desktop-drop-zone.is-uploading .desktop-drop-frame,
  .desktop-drop-zone.is-uploading .desktop-drop-icon .material-symbols-outlined,
  .desktop-drop-zone.is-uploading .desktop-drop-progress>span::after{animation:none!important}
}
body[data-matte="glass"] .desktop-drop-zone{background:color-mix(in srgb,var(--md-sys-color-surface) 54%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat)) saturate(var(--glass-saturate))}
body[data-matte="glass"] .desktop-drop-card{background:color-mix(in srgb,var(--md-sys-color-surface-container) 56%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat)) saturate(var(--glass-saturate))}

/* ================================================================
   ОБОИ ВО ВСЕЙ ЭКРАН ДЛЯ МОБИЛЬНОГО ЧАТА
   ВАЖНО: без position:relative — .mobile-screen уже position:absolute;inset:0
   ================================================================ */
@media (max-width: 768px){
  #mobileChatScreen{
    overflow:hidden;
    background:var(--md-sys-color-surface);
  }
  #mobileChatScreen::before{
    content:'';
    position:absolute;inset:0;
    z-index:0;
    pointer-events:none;
    background-repeat:no-repeat;
    background-size:cover;
    background-position:center;
    transition:background-image .4s ease;
  }
  /* Только элементы, которые действительно идут в поток. Правило
     «#mobileChatScreen > *» с позицией relative перебивало по
     специфичности position:absolute у кнопки «вниз» и подсказки о
     непрочитанном: оба становились строками flex-колонки и съедали
     под собой ~50px высоты, сдвигая композер вверх. */
  #mobileChatScreen > :not(.chat-unread-hint):not(.chat-down-btn){position:relative;z-index:1}

  /* Stars */
  #mobileChatScreen:has(#mobileChatMessages[data-wallpaper="stars"])::before{
    background-image:
      radial-gradient(circle at 20% 30%,rgba(255,255,255,.10) 1.5px,transparent 2px),
      radial-gradient(circle at 80% 70%,rgba(255,255,255,.08) 1.5px,transparent 2px),
      radial-gradient(circle at 50% 90%,rgba(255,255,255,.06) 2px,transparent 2.5px),
      radial-gradient(circle at 15% 85%,rgba(255,255,255,.07) 1.2px,transparent 1.8px),
      radial-gradient(circle at 90% 20%,rgba(255,255,255,.05) 1.8px,transparent 2.3px),
      linear-gradient(135deg,#0d0d1a 0%,#1a1a2e 100%);
    background-size:200px 200px,250px 250px,300px 300px,180px 180px,220px 220px,100% 100%;
  }
  body.light-theme #mobileChatScreen:has(#mobileChatMessages[data-wallpaper="stars"])::before{
    background-image:
      radial-gradient(circle at 20% 30%,rgba(80,80,120,.15) 1.5px,transparent 2px),
      radial-gradient(circle at 80% 70%,rgba(80,80,120,.12) 1.5px,transparent 2px),
      radial-gradient(circle at 50% 90%,rgba(80,80,120,.10) 2px,transparent 2.5px),
      linear-gradient(135deg,#e8e8f0 0%,#f0f0f8 100%);
    background-size:200px 200px,250px 250px,300px 300px,100% 100%;
  }
  /* Gradient */
  #mobileChatScreen:has(#mobileChatMessages[data-wallpaper="gradient"])::before{
    background-image:linear-gradient(135deg,#2a1a3a 0%,#1a2a3a 50%,#1a3a3a 100%);
  }
  body.light-theme #mobileChatScreen:has(#mobileChatMessages[data-wallpaper="gradient"])::before{
    background-image:linear-gradient(135deg,#f5e8ff 0%,#e8f0ff 50%,#e8fff5 100%);
  }
  /* Paper */
  #mobileChatScreen:has(#mobileChatMessages[data-wallpaper="paper"])::before{
    background-image:
      linear-gradient(45deg,rgba(255,255,255,.02) 25%,transparent 25%),
      linear-gradient(-45deg,rgba(255,255,255,.02) 25%,transparent 25%),
      linear-gradient(135deg,#3a3428 0%,#2a2518 100%);
    background-size:20px 20px,20px 20px,100% 100%;
  }
  body.light-theme #mobileChatScreen:has(#mobileChatMessages[data-wallpaper="paper"])::before{
    background-image:
      linear-gradient(45deg,rgba(0,0,0,.02) 25%,transparent 25%),
      linear-gradient(-45deg,rgba(0,0,0,.02) 25%,transparent 25%),
      linear-gradient(135deg,#faf5e8 0%,#f0e8d8 100%);
    background-size:20px 20px,20px 20px,100% 100%;
  }
  /* Custom — картинка задаётся inline-style через JS на #mobileChatScreen */
  #mobileChatScreen[data-wallpaper="custom"]::before{
    background-image:var(--wallpaper-image,none);
    background-size:cover;
    background-position:center;
  }

  /* Сами сообщения больше не рисуют фон — он теперь на #mobileChatScreen */
  #mobileChatMessages{background:transparent!important;background-image:none!important}
}

.chat-messages{display:flex;flex-direction:column;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;transition:background-image .4s ease,background-color .4s ease;background-repeat:no-repeat;background-size:cover;background-position:center;min-height:0;isolation:isolate;
  /* Оптимизация: лента не пересчитывает геометрию своих детей без нужды. */
  contain:layout style paint;
}
/* Виртуализация отрисовки без JS: пузыри за пределами вьюпита
   пропускают layout/paint. contain-intrinsic-size держит примерную
   высоту, чтобы полоса прокрутки не прыгала при быстром скролле. */
.message-bubble{content-visibility:auto;contain-intrinsic-size:auto 56px;}
.chat-messages[data-wallpaper="stars"]{background-color:transparent;background-image:radial-gradient(circle at 20% 30%,rgba(255,255,255,.10) 1.5px,transparent 2px),radial-gradient(circle at 80% 70%,rgba(255,255,255,.08) 1.5px,transparent 2px),radial-gradient(circle at 50% 90%,rgba(255,255,255,.06) 2px,transparent 2.5px),radial-gradient(circle at 15% 85%,rgba(255,255,255,.07) 1.2px,transparent 1.8px),radial-gradient(circle at 90% 20%,rgba(255,255,255,.05) 1.8px,transparent 2.3px),linear-gradient(135deg,#0d0d1a 0%,#1a1a2e 100%);background-size:200px 200px,250px 250px,300px 300px,180px 180px,220px 220px,100% 100%}
body.light-theme .chat-messages[data-wallpaper="stars"]{background-image:radial-gradient(circle at 20% 30%,rgba(80,80,120,.15) 1.5px,transparent 2px),radial-gradient(circle at 80% 70%,rgba(80,80,120,.12) 1.5px,transparent 2px),radial-gradient(circle at 50% 90%,rgba(80,80,120,.10) 2px,transparent 2.5px),linear-gradient(135deg,#e8e8f0 0%,#f0f0f8 100%);background-size:200px 200px,250px 250px,300px 300px,100% 100%}
.chat-messages[data-wallpaper="gradient"]{background-image:linear-gradient(135deg,#2a1a3a 0%,#1a2a3a 50%,#1a3a3a 100%)}
body.light-theme .chat-messages[data-wallpaper="gradient"]{background-image:linear-gradient(135deg,#f5e8ff 0%,#e8f0ff 50%,#e8fff5 100%)}
.chat-messages[data-wallpaper="paper"]{background-image:linear-gradient(45deg,rgba(255,255,255,.02) 25%,transparent 25%),linear-gradient(-45deg,rgba(255,255,255,.02) 25%,transparent 25%),linear-gradient(135deg,#3a3428 0%,#2a2518 100%);background-size:20px 20px,20px 20px,100% 100%}
body.light-theme .chat-messages[data-wallpaper="paper"]{background-image:linear-gradient(45deg,rgba(0,0,0,.02) 25%,transparent 25%),linear-gradient(-45deg,rgba(0,0,0,.02) 25%,transparent 25%),linear-gradient(135deg,#faf5e8 0%,#f0e8d8 100%);background-size:20px 20px,20px 20px,100% 100%}
.chat-messages[data-wallpaper="custom"]{background-size:cover;background-position:center;background-repeat:no-repeat}

/* ================================================================
   MOBILE CHAT HEADER — круглые плашки + центральная плашка с именем
   ================================================================ */
.mobile-chat-header{
  display:flex;
  align-items:center;
  gap:8px;
  padding:10px 12px;
  /* Отступ под строку состояния — РОВНО ОДИН раз и только через env().
     Раньше сюда клался ещё и --status-h из нативного моста, и на
     устройстве, где WebView уже стоит под строкой состояния, отступ
     считался дважды: шапка уезжала вниз больше чем на 100 px.
     env() сам возвращает 0, когда окно уже под статус-баром, и
     настоящий вырез, когда окноedge-to-edge, — то есть он не врёт. */
  padding-top:calc(env(safe-area-inset-top, 0px) + 10px);
  flex-shrink:0;
  position:relative;
  z-index:5;
  background:transparent;
  box-shadow:none;
  transition:background .3s,box-shadow .3s;
}
/* Закраска шапки. Верх начинается под строкой состояния, поэтому фон
   чата продолжается вверх до самого края экрана. */
.mobile-chat-header::before{
  content:'';
  position:absolute;
  left:0;
  right:0;
  top:calc(env(safe-area-inset-top, 0px) + 10px);
  bottom:0;
  background:var(--md-sys-color-surface);
  box-shadow:0 4px 14px -8px rgba(0,0,0,.35);
  z-index:-1;
  /* Скругление только снизу: шапка — отдельная плашка, висящая
     над лентой. */
  border-radius:0 0 18px 18px;
  overflow:hidden;
}

.mobile-circle-btn{
  width:42px;height:42px;min-width:42px;
  border-radius:50%;
  border:none;
  background:var(--md-sys-color-surface-container);
  color:var(--md-sys-color-on-surface);
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  flex-shrink:0;
  transition:background .25s,color .25s,transform .22s cubic-bezier(.34,1.56,.64,1);
  -webkit-tap-highlight-color:transparent;
}
.mobile-circle-btn:hover{background:var(--md-sys-color-surface-variant)}
.mobile-circle-btn:active{transform:scale(.88)}
.mobile-circle-btn .material-symbols-outlined{font-size:22px}
.mobile-circle-btn.hidden{display:none!important}

/* Кнопка «назад» заметно темнее остальных кнопок шапки: это главный
   навигационный элемент, он должен читаться первым. */
/* Кнопка «назад» — самая тёмная в шапке. Микс с on-surface в тёмной
   теме ОСВЕТЛЯЛ кнопку (on-surface там почти белый) — поэтому затемняем
   чёрным: заливка темнее остальных кнопок в обеих темах. Иконка всегда
   белая, чтобы не потерять контраст на таком тёмном фоне. */
#mobileBackBtn{
  background:color-mix(in srgb,var(--md-sys-color-surface-container) 60%,#000);
  color:#fff;
}
#mobileBackBtn:hover{
  background:color-mix(in srgb,var(--md-sys-color-surface-container) 55%,#000);
}
#mobileBackBtn .material-symbols-outlined{color:#fff}
/* Стекло: та же тёмная заливка, но с размытием под ней. */
body[data-matte="glass"] #mobileBackBtn{
  background:color-mix(in srgb,var(--md-sys-color-surface-container) 60%,color-mix(in srgb,#000 40%,transparent));
  border:none;
}

/* ==== Вызов и «троеточие» — в одной овальной капсуле с разделителем ==== */
.chat-action-capsule{
  display:inline-flex;
  align-items:center;
  flex-shrink:0;
  padding:2px;
  border-radius:999px;
  background:color-mix(in srgb,var(--md-sys-color-surface-container) 2%,transparent);
  -webkit-tap-highlight-color:transparent;
  transition:background .25s;
}
/* В режиме monochrome капсула вызова/троеточия — с чётким бордером,
   чтобы не сливалась с тёмным фоном шапки. */
body:not([data-matte="glass"]) .chat-action-capsule{
  border:1px solid var(--md-sys-color-outline-variant);
}
.chat-action-capsule .mobile-circle-btn,
.chat-action-capsule .md-icon-btn{
  width:38px;height:38px;min-width:38px;
  background:transparent;
}
.chat-action-capsule .mobile-circle-btn:hover,
.chat-action-capsule .md-icon-btn:hover{background:var(--md-sys-color-surface-variant)}
.chat-action-capsule .mobile-circle-btn:active,
.chat-action-capsule .md-icon-btn:active{transform:scale(.88)}
.chat-action-capsule .mobile-circle-btn .material-symbols-outlined,
.chat-action-capsule .md-icon-btn .material-symbols-outlined{font-size:21px}
.chat-action-sep{
  width:1px;height:18px;flex-shrink:0;
  background:var(--md-sys-color-outline-variant);
  margin:0 1px;
}
/* Кнопки вызова нет (например, избранное) — разделитель тоже не нужен. */
#mobileCallBtn.hidden + .chat-action-sep,
#desktopCallBtn.hidden + .chat-action-sep{display:none}
/* Стеклянная матта: капсула — одна стеклянная плашка, а не две
   отдельные круглые кнопки внутри неё. */
body[data-matte="glass"] .chat-action-capsule{
  background:color-mix(in srgb,var(--md-sys-color-surface-container) 2%,transparent);
  backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  -webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  border:1px solid color-mix(in srgb,var(--md-sys-color-outline-variant) 45%,transparent);
}
body[data-matte="glass"] .chat-action-capsule .mobile-circle-btn,
body[data-matte="glass"] .chat-action-capsule .md-icon-btn{
  background:transparent;
  border:none;
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
}

/* ==== Центральная плашка: аватар + имя + онлайн ==== */
.mobile-chat-header-info{
  flex:1;
  min-width:0;
  display:flex;
  align-items:center;
  gap:10px;
  cursor:pointer;
  padding:4px 16px 4px 5px;
  border-radius:22px;
  background:var(--md-sys-color-surface-container);
  transition:background .2s, transform .15s;
  -webkit-tap-highlight-color:transparent;
}
.mobile-chat-header-info:hover{
  background:var(--md-sys-color-surface-variant);
}
.mobile-chat-header-info:active{
  transform:scale(.98);
  background:var(--md-sys-color-surface-variant);
}

.mobile-chat-header-info .chat-avatar-btn{
  width:34px;height:34px;min-width:34px;
  font-size:13px;
}
.mobile-chat-header-info .chat-avatar-btn img{border-radius:50%}

.mobile-chat-header-text{flex:1;min-width:0;line-height:1.2}
.mobile-chat-header-text h3{
  font-size:14.5px;
  font-weight:500;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  color:var(--md-sys-color-on-surface);
}
.mobile-chat-header-text .chat-sub-line{
  display:flex;
  align-items:center;
  gap:6px;
  margin-top:2px;
}
.mobile-chat-header-text .chat-sub-line span{
  font-size:11px;
  color:var(--md-sys-color-on-surface-variant);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

/* ================================================================
   MOBILE INPUT DOCK — 3 части
   ================================================================ */
.mobile-input-dock{
  display:flex;
  align-items:flex-end;
  gap:8px;
  padding:8px 10px;
  padding-bottom:max(8px,var(--safe-bottom));
  flex-shrink:0;
  background:var(--md-sys-color-surface);
  border-top:none;
  box-shadow:0 -4px 14px -8px rgba(0,0,0,.35);
  position:relative;
  z-index:5;touch-action:none;overscroll-behavior:contain;
  transition:background .3s,box-shadow .3s;
  /* Скругление только сверху: панель — отдельная плашка под лентой. */
  border-radius:18px 18px 0 0;
}

/* Островок с инструментами */
.mobile-dock-tools{
  display:flex;
  align-items:center;
  gap:0;
  padding:2px;
  border-radius:22px;
  background:var(--md-sys-color-surface-container);
  flex-shrink:0;
  transition:background .3s;
}
.mobile-dock-tools .mobile-dock-btn{
  width:38px;height:38px;
  border-radius:50%;
  border:none;
  background:transparent;
  color:var(--md-sys-color-on-surface-variant);
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  flex-shrink:0;
  transition:background .2s,color .2s,transform .2s;
  -webkit-tap-highlight-color:transparent;
}
.mobile-dock-tools .mobile-dock-btn:hover{
  background:color-mix(in srgb,var(--md-sys-color-surface-variant) 50%,transparent);
  color:var(--md-sys-color-on-surface);
}
.mobile-dock-tools .mobile-dock-btn:active{
  transform:scale(.9);
  background:color-mix(in srgb,var(--md-sys-color-primary) 20%,transparent);
  color:var(--md-sys-color-primary);
}
.mobile-dock-tools .mobile-dock-btn .material-symbols-outlined{font-size:22px}

.kb-blur{
  position:fixed;
  left:0;
  right:0;
  bottom:0;
  height:var(--kb-offset, 0px);
  z-index:120;
  background:color-mix(in srgb,var(--md-sys-color-surface) 34%,transparent);
  backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  -webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  pointer-events:none;
  opacity:0;
  /* Высота блюра идёт за клавиатурой так же быстро, как экран за композером:
     иначе между композером и краем клавиатуры оставалась бы неразмытая
     полоска. */
  transition:opacity .2s ease, height .1s cubic-bezier(.22,1,.36,1);
}
/* В режиме monochrome под клавиатурой — сплошной фон цвета панели ввода,
   без блюра (как сам .mobile-input-dock). */
body:not([data-matte="glass"]) .kb-blur{
  background:var(--md-sys-color-surface);
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
}
body.kb-open .kb-blur{
  opacity:1;
}

.mobile-dock-divider{
  width:1px;
  height:20px;
  background:var(--md-sys-color-outline-variant);
  flex-shrink:0;
  opacity:.6;
}

#mobileChatInput,#desktopChatInput,.mobile-dock-input,.desktop-input-area .chat-input{
  touch-action:none;
  overscroll-behavior:contain;
}
.mobile-dock-input{
  flex:1;
  min-width:0;
  padding:11px 18px;
  border-radius:22px;
  border:1.5px solid var(--md-sys-color-outline-variant);
  background:var(--md-sys-color-surface-container);
  color:var(--md-sys-color-on-surface);
  font-family:inherit;
  font-size:15px;
  outline:none;
  min-height:44px;
  transition:border-color .25s,box-shadow .25s,background .3s;
}
.mobile-dock-input:focus{
  border-color:var(--md-sys-color-primary);
  box-shadow:0 0 0 3px color-mix(in srgb,var(--md-sys-color-primary) 10%,transparent);
}

.mobile-dock-send{
  width:44px;height:44px;min-width:44px;
  border-radius:50%;
  border:none;
  background:var(--md-sys-color-primary);
  color:var(--md-sys-color-on-primary);
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  flex-shrink:0;
  touch-action:none;
  transition:background .3s,color .3s,transform .2s cubic-bezier(.34,1.56,.64,1);
  -webkit-tap-highlight-color:transparent;
}
.mobile-dock-send:active{transform:scale(.9)}
.mobile-dock-send .material-symbols-outlined{font-size:22px}
.mobile-dock-send.send-mode{background:var(--md-sys-color-primary)!important;color:var(--md-sys-color-on-primary)!important}
.mobile-dock-send.audio-mode{background:#7c7c7c!important;color:#fff!important}
.mobile-dock-send.video-mode{background:#fff!important;color:#000!important}

.mobile-input-dock .channel-locked-notice{
  flex:1;
  padding:12px 16px;
  border-radius:22px;
  background:var(--md-sys-color-surface-variant);
  color:var(--md-sys-color-on-surface-variant);
  text-align:center;
  font-size:13px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:6px;
}

/* ================================================================
   MATTE GLASS — плашки мобильного чата
   ================================================================ */
body[data-matte="glass"] .mobile-chat-header{
  background:transparent;
  box-shadow:none;
}
/* Шапка и панель ввода — по-настоящему прозрачные, как в Telegram:
   переписка видна прямо сквозь них. Раньше заливка 40% плюс тень по краю
   читались отдельной полосой поверх сообщений («блюрный прямоугольник»).
   Остаётся лёгкое размытие для читаемости, а резкой границы-канты нет. */
body[data-matte="glass"] .mobile-chat-header::before{
  background:color-mix(in srgb,var(--md-sys-color-surface) 16%,transparent);
  backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  -webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  box-shadow:none;
}
body[data-matte="glass"] .mobile-circle-btn{
  background:color-mix(in srgb,var(--md-sys-color-surface-container) 48%,transparent);
  backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  -webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  border:1px solid color-mix(in srgb,var(--md-sys-color-outline-variant) 45%,transparent);
}
body[data-matte="glass"] .mobile-chat-header-info{
  background:color-mix(in srgb,var(--md-sys-color-surface-container) 48%,transparent);
  backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  -webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  border:1px solid color-mix(in srgb,var(--md-sys-color-outline-variant) 42%,transparent);
}
body[data-matte="glass"] .mobile-chat-header-info:hover,
body[data-matte="glass"] .mobile-chat-header-info:active{
  background:color-mix(in srgb,var(--md-sys-color-surface-variant) 45%,transparent);
}

body[data-matte="glass"] .mobile-input-dock{
  background:color-mix(in srgb,var(--md-sys-color-surface) 16%,transparent);
  backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  -webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  box-shadow:none;
}
body[data-matte="glass"] .mobile-dock-tools{
  background:color-mix(in srgb,var(--md-sys-color-surface-container) 48%,transparent);
  backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  -webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  border:1px solid color-mix(in srgb,var(--md-sys-color-outline-variant) 42%,transparent);
}
body[data-matte="glass"] .mobile-dock-divider{
  background:color-mix(in srgb,var(--md-sys-color-outline-variant) 60%,transparent);
}
body[data-matte="glass"] .mobile-dock-tools .mobile-dock-btn{
  border:none;
  background:transparent;
  color:var(--md-sys-color-on-surface);
}
body[data-matte="glass"] .mobile-dock-tools .mobile-dock-btn:hover{
  background:color-mix(in srgb,var(--md-sys-color-surface-variant) 50%,transparent);
}
body[data-matte="glass"] .mobile-dock-tools .mobile-dock-btn:active{
  background:color-mix(in srgb,var(--md-sys-color-primary) 25%,transparent);
  color:var(--md-sys-color-on-primary);
}
body[data-matte="glass"] .mobile-dock-input{
  background:color-mix(in srgb,var(--md-sys-color-surface-container) 48%,transparent);
  backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  -webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  border-color:color-mix(in srgb,var(--md-sys-color-outline-variant) 42%,transparent);
}
body[data-matte="glass"] .mobile-dock-send{
  backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  -webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
}
body[data-matte="glass"] .mobile-input-dock .channel-locked-notice{
  background:color-mix(in srgb,var(--md-sys-color-surface-variant) 48%,transparent);
  backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  -webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
}

/* Mobile адаптации */
@media (max-width: 480px){
  /* Отступ к 480 — та же логика, только offset 8px. */
  .mobile-chat-header{padding:8px 10px;padding-top:calc(env(safe-area-inset-top, 0px) + 8px);gap:6px}
  .mobile-circle-btn{width:40px;height:40px;min-width:40px}
  .mobile-circle-btn .material-symbols-outlined{font-size:20px}
  .mobile-chat-header-info{padding:3px 14px 3px 4px;gap:8px}
  .mobile-chat-header-info .chat-avatar-btn{width:32px;height:32px;min-width:32px;font-size:12px}
  .mobile-chat-header-text h3{font-size:14px}
  .mobile-chat-header-text .chat-sub-line span{font-size:10.5px}
  .mobile-dock-tools .mobile-dock-btn{width:34px;height:34px}
  .mobile-dock-tools .mobile-dock-btn .material-symbols-outlined{font-size:20px}
  .mobile-dock-input{padding:10px 14px;font-size:14px;min-height:42px}
  .mobile-dock-send{width:42px;height:42px;min-width:42px}
  .mobile-dock-send .material-symbols-outlined{font-size:20px}
  .mobile-input-dock{gap:6px;padding:8px}
}

/* ================================================================
   CHAT AVATARS
   ================================================================ */
.chat-avatar-btn{width:38px;height:38px;border-radius:50%;border:none;cursor:pointer;background:color-mix(in srgb,var(--md-sys-color-primary) 16%,var(--md-sys-color-surface-container));color:var(--md-sys-color-primary);font-family:inherit;font-weight:600;font-size:15px;display:flex;align-items:center;justify-content:center;flex-shrink:0;overflow:hidden;padding:0;transition:transform .2s}
.chat-avatar-btn:active{transform:scale(.9)}
.chat-avatar-btn img{width:100%;height:100%;object-fit:cover;border-radius:50%}
/* Типы чата без своей картинки — тот же акцентный тон, но чуть
   насыщеннее, чтобы аватар группы/канала отличался от личного. */
.chat-avatar-btn.group{background:color-mix(in srgb,var(--md-sys-color-primary) 24%,var(--md-sys-color-surface-container));color:var(--md-sys-color-primary)}
.chat-avatar-btn.channel{background:color-mix(in srgb,var(--md-sys-color-primary) 30%,var(--md-sys-color-surface-container));color:var(--md-sys-color-primary)}
.chat-avatar-btn.private{background:color-mix(in srgb,var(--md-sys-color-primary) 16%,var(--md-sys-color-surface-container));color:var(--md-sys-color-primary)}
.chat-avatar-btn.favorites{background:linear-gradient(135deg,#c8a865,#e0c078);color:#1a1a1a}

.chat-sub-line{display:flex;align-items:center;gap:6px}
.online-dot{width:8px;height:8px;border-radius:50%;background:#22c55e;box-shadow:0 0 6px rgba(34,197,94,.6);flex-shrink:0;animation:onlinePulse 2s ease-in-out infinite}
.online-dot.offline{background:#9a9a9a;box-shadow:none;animation:none}
.online-dot.hidden{display:none}

.list-item-wrap{position:relative;overflow:hidden;border-radius:20px;margin-bottom:6px;touch-action:pan-y}
/* will-change здесь не нужен постоянно: он держит композитный слой на
   КАЖДОЙ строке списка (десятки слоёв впустую). Включаем его классом
   .card-swiping только на время свайпа (см. attachCardSwipe). */
.list-item-wrap .list-item{margin-bottom:0;position:relative;z-index:2}
.list-item-wrap .list-item.card-swiping{will-change:transform}
.list-item{display:flex;align-items:center;padding:12px 14px;background:var(--md-sys-color-surface-container);border-radius:20px;gap:12px;cursor:pointer;transition:background .25s,transform .22s,box-shadow .25s;animation:listItemIn .5s var(--ease-out-quint) backwards;box-shadow:0 1px 2px rgba(0,0,0,.18),0 3px 8px -4px rgba(0,0,0,.28)}
.list-item-wrap:hover .list-item{box-shadow:0 2px 5px rgba(0,0,0,.22),0 6px 16px -6px rgba(0,0,0,.36)}
.list-item:hover{background:var(--md-sys-color-surface-variant)}
.list-item:active{transform:scale(.98)}
/* Неустановленная аватарка (буквы вместо фото) — тон берётся от
   акцентного цвета, а не от фиксированного серого. */
.list-item-avatar{width:46px;height:46px;min-width:46px;border-radius:50%;background:color-mix(in srgb,var(--md-sys-color-primary) 16%,var(--md-sys-color-surface-container));display:flex;align-items:center;justify-content:center;color:var(--md-sys-color-primary);font-weight:600;flex-shrink:0;font-size:15px;overflow:visible;position:relative}
.list-item-avatar img{width:100%;height:100%;object-fit:cover;border-radius:50%;display:block}
.list-item-avatar.group{background:color-mix(in srgb,var(--md-sys-color-primary) 24%,var(--md-sys-color-surface-container));color:var(--md-sys-color-primary)}
.list-item-avatar.channel{background:color-mix(in srgb,var(--md-sys-color-primary) 30%,var(--md-sys-color-surface-container));color:var(--md-sys-color-primary)}
.list-item-avatar.favorites{background:linear-gradient(135deg,#c8a865,#e0c078);color:#1a1a1a}
.list-item-avatar .avatar-online-dot{position:absolute;right:-2px;bottom:-2px;width:14px;height:14px;border-radius:50%;background:#22c55e;border:2.5px solid var(--md-sys-color-surface-container);box-shadow:0 0 6px rgba(34,197,94,.55);z-index:3;animation:onlinePulse 2s ease-in-out infinite}

.list-item-content{flex:1;min-width:0}
.list-item-title{font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:flex;align-items:center;gap:6px}
.list-item-subtitle{font-size:12px;color:var(--md-sys-color-on-surface-variant);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px}
.list-item-badge{min-width:22px;height:22px;padding:0 7px;border-radius:11px;background:var(--md-sys-color-primary);color:var(--md-sys-color-on-primary);display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:700;animation:popIn .35s cubic-bezier(.34,1.56,.64,1)}
.admin-badge{display:inline-flex;align-items:center;justify-content:center;font-size:9px;padding:2px 6px;border-radius:6px;font-weight:700;text-transform:uppercase;background:color-mix(in srgb,var(--md-sys-color-primary) 85%,transparent);color:var(--md-sys-color-on-primary)}
/* Владелец — градиент того же акцентного цвета (админ — плоская
   заливка), оба зависят от выбранного акцента. */
.owner-badge{background:linear-gradient(135deg,color-mix(in srgb,var(--md-sys-color-primary) 60%,#fff),var(--md-sys-color-primary));color:var(--md-sys-color-on-primary)}
.swipe-delete-bg{position:absolute;top:0;right:0;bottom:0;width:100px;background:linear-gradient(135deg,#ef4444,#dc2626);display:flex;align-items:center;justify-content:center;color:#fff;z-index:1;border-radius:20px;transform:translateX(100%);transition:transform .25s cubic-bezier(.22,1,.36,1)}
.swipe-delete-bg .material-symbols-outlined{font-size:28px;animation:iconBounce .8s ease-in-out infinite}
.list-item-wrap.revealing .swipe-delete-bg{transform:translateX(0)}
.list-item-wrap.revealing .list-item{transform:translateX(-100px);transition:transform .3s cubic-bezier(.22,1,.36,1)}

/* ================================================================
   СПИСОК ЧАТОВ — «ВИДЖЕТ» (по макету Main.dc.html)
   Один скруглённый блок (radius 28) с отступами 16px от краёв панели.
   Внутри — строки без собственных скруглений; между строками разделитель,
   который начинается на уровне текста (отступ 82px под аватар).
   ================================================================ */
.chat-list-widget{
  --clw-bg:rgba(255,255,255,.055);
  --clw-border:rgba(255,255,255,.1);
  --clw-line:rgba(255,255,255,.08);
  --clw-hover:rgba(255,255,255,.04);
  --clw-press:rgba(255,255,255,.07);
  --clw-sub:#9b9ba8;
  --clw-avatar:#3f3f46;
  --clw-avatar-ring:#26262a;
  margin:0;
  border-radius:28px;
  overflow:hidden;
  background:var(--clw-bg);
  border:1px solid var(--clw-border);
  display:flex;flex-direction:column;
}
body.light-theme .chat-list-widget{
  --clw-bg:rgba(0,0,0,.035);
  --clw-border:rgba(0,0,0,.07);
  --clw-line:rgba(0,0,0,.07);
  --clw-hover:rgba(0,0,0,.035);
  --clw-press:rgba(0,0,0,.055);
  --clw-sub:#6f6f79;
  --clw-avatar:#dcdce2;
  --clw-avatar-ring:#f2f2f4;
}
.chat-list-widget .list-item-wrap{border-radius:0;margin-bottom:0;background:transparent}
/* Разделитель — не рамка строки, а линия с отступом под аватар:
   тянется от текста до правого края, как в макете. */
.chat-list-widget .list-item-wrap + .list-item-wrap::before{
  content:'';position:absolute;top:0;left:84px;right:0;height:1px;
  background:var(--clw-line);z-index:4;pointer-events:none;
}
.chat-list-widget .list-item{
  min-height:76px;padding:12px 16px;gap:14px;
  border-radius:0;background:transparent;box-shadow:none;
}
.chat-list-widget .list-item:hover{background:var(--clw-hover);box-shadow:none}
.chat-list-widget .list-item:active{transform:none;background:var(--clw-press)}
/* Аватар без фото — акцентный тон: 16% первичного цвета по
   поверхности. Тёмная/светлая тема учитывается автоматически
   (primary = --a в тёмной, --a-deep в светлой). */
.chat-list-widget .list-item-avatar{
  width:52px;height:52px;min-width:52px;font-size:18px;font-weight:700;
  background:color-mix(in srgb,var(--md-sys-color-primary) 16%,var(--md-sys-color-surface-container));
  color:var(--md-sys-color-primary);
}
.chat-list-widget .list-item-avatar.group{
  background:color-mix(in srgb,var(--md-sys-color-primary) 24%,var(--md-sys-color-surface-container));
  color:var(--md-sys-color-primary);
}
.chat-list-widget .list-item-avatar.channel{
  background:color-mix(in srgb,var(--md-sys-color-primary) 30%,var(--md-sys-color-surface-container));
  color:var(--md-sys-color-primary);
}
/* Избранное сохраняет фирменный золотой тон. */
.chat-list-widget .list-item-avatar.favorites{
  background:linear-gradient(135deg,#c8a865,#e0c078);
  color:#1a1a1a;
}
.chat-list-widget .list-item-avatar .avatar-online-dot{
  width:14px;height:14px;right:0;bottom:0;
  border:3px solid var(--clw-avatar-ring);
}
.chat-list-widget .list-item-content{display:flex;flex-direction:column;gap:5px;min-width:0}
.chat-list-widget .list-item-title{font-size:15px;font-weight:700;gap:8px;min-width:0}
.chat-list-widget .list-item-name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chat-list-widget .list-item-subtitle{
  font-size:13px;margin-top:0;color:var(--clw-sub);
  display:flex;align-items:center;gap:6px;min-width:0;
}
.chat-list-widget .list-item-meta{
  display:flex;flex-direction:column;align-items:flex-end;gap:7px;
  flex:none;font-size:12px;color:var(--clw-sub);
}
.chat-list-widget .list-item-time{white-space:nowrap}
.chat-list-widget .list-item-meta-bottom{display:flex;align-items:center;gap:6px;min-height:22px}
.chat-list-widget .list-item-badge{
  min-width:22px;height:22px;padding:0 7px;border-radius:11px;
  font-size:11px;font-weight:700;
}
/* Роли в строке списка — компактная иконка-пилюля в стиле макета
   (полный текст остаётся в title). Тон — от акцентного цвета. */
.chat-list-widget .admin-badge{
  display:inline-flex;align-items:center;justify-content:center;
  width:18px;height:18px;padding:0;border-radius:99px;flex:0 0 auto;
  background:color-mix(in srgb,var(--md-sys-color-primary) 18%,transparent);
  color:var(--md-sys-color-primary);
}
.chat-list-widget .admin-badge .material-symbols-outlined{font-size:12px;line-height:1}
.chat-list-widget .owner-badge{
  background:linear-gradient(135deg,
    color-mix(in srgb,var(--md-sys-color-primary) 60%,#fff),
    var(--md-sys-color-primary));
  color:var(--md-sys-color-on-primary);
}
.chat-list-widget .swipe-delete-bg{border-radius:0}
/* Отступы панели под виджет списка. */
body.panel-list .panel-content{padding:16px 16px 12px}
@media (max-width:768px){
  body.panel-list .panel-content{padding:16px 16px 140px}
}

.message-bubble{max-width:min(78%,620px);padding:10px 16px;border-radius:18px;background:var(--bubble-other-bg);color:var(--bubble-other-text);align-self:flex-start;position:relative;cursor:pointer;margin-bottom:4px;margin-left:3px;word-break:break-word;box-shadow:0 1px 2px rgba(0,0,0,.08);transition:transform .22s cubic-bezier(.34,1.56,.64,1),box-shadow .28s;touch-action:pan-y;font-size:var(--msg-font-size);line-height:1.35;z-index:5;flex-shrink:0;pointer-events:auto}
.message-bubble:hover{transform:translateY(-1px);box-shadow:0 8px 20px -12px rgba(0,0,0,.5)}
.message-bubble.own{background:var(--bubble-own-bg);color:var(--bubble-own-text);align-self:flex-end;border:1px solid rgba(0,0,0,.06);margin-right:3px}
body.dark-theme .message-bubble.own{border-color:rgba(255,255,255,.08)}
.message-bubble.animate-in.own{animation:bubbleInOwn .52s var(--ease-spring)}
.message-bubble.animate-in:not(.own){animation:bubbleInOther .52s var(--ease-spring)}
.message-bubble.selected{box-shadow:0 0 0 2px var(--md-sys-color-primary)}
.message-bubble.deleting{animation:msgDel .42s cubic-bezier(.34,1.2,.64,1) forwards;pointer-events:none;overflow:hidden}
.message-sender{font-size:11px;font-weight:600;color:var(--md-sys-color-primary);margin-bottom:3px;display:flex;align-items:center;gap:4px}
/* Время + замок + галочки — одна строка в правом нижнем углу пузыря.
   flex + nowrap: строка не переносится, если помещается; иконки одного
   размера (14px), цвет приглушённый, всё выровнено по одной базовой линии. */
.message-time{display:flex;align-items:center;justify-content:flex-end;gap:4px;font-size:10px;line-height:1;opacity:.65;margin-top:4px;text-align:right;white-space:nowrap}
.message-time .message-lock{font-size:14px;line-height:1;opacity:.7;flex-shrink:0}
.message-time .tick{margin-left:0;flex-shrink:0}
.message-reply-quote{border-left:3px solid currentColor;padding:5px 10px;margin-bottom:6px;font-size:12px;border-radius:6px;background:rgba(128,128,128,.15);max-width:100%;overflow:hidden;cursor:pointer}
.message-reply-quote .reply-quote-name{font-weight:600;margin-bottom:2px;font-size:11px}
.message-reply-quote .reply-quote-text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;opacity:.8}
.message-bubble.pinned-highlight{box-shadow:0 0 0 2px var(--md-sys-color-primary)}
.message-bubble.jump-highlight{box-shadow:0 0 0 2px var(--md-sys-color-primary)}

/* ================================================================
   ХВОСТИКИ СООБЩЕНИЙ
   Хвост — часть самого пузыря, а не отдельный элемент: нижний угол
   со стороны отправителя почти прямой, пузырь «стекает» в него.
   Классы tail-in (чужие, угол слева) / tail-own (свои, справа)
   проставляет рендер, и только последнему сообщению серии.
   ================================================================ */
.message-bubble.tail-in{border-bottom-left-radius:6px}
.message-bubble.tail-own{border-bottom-right-radius:6px}

/* ================================================================
   ГРУППИРОВКА ПОДРЯД ИДУЩИХ СООБЩЕНИЙ
   Классы run-first / run-middle / run-last проставляет рендер: серия —
   это сообщения одного отправителя без разделителей между ними.
   Серия только сжимает отступ между пузырями. Скругление у всех
   сообщений одинаковое — стандартные 18px; единственный «острый»
   угол задаёт tail-own / tail-in у ПОСЛЕДНЕГО сообщения серии:
   нижний правый у своих, нижний левый у чужих.
   ================================================================ */
/* Плотнее внутри серии, обычный отступ — после её последнего пузыря. */
.message-bubble.run-first,
.message-bubble.run-middle{margin-bottom:2px}

/* ================================================================
   БОЛЬШЕ АНИМАЦИЙ В СПИСКЕ СООБЩЕНИЙ
   Все эффекты — короткие и недорогие; body.no-animations и
   prefers-reduced-motion их полностью отключают.
   ================================================================ */
/* Переход к сообщению / закреп: мягкий пульс рамки вместо резкой. */
@keyframes msgHighlightIn{
  0%{box-shadow:0 0 0 0 color-mix(in srgb,var(--md-sys-color-primary) 60%,transparent)}
  38%{box-shadow:0 0 0 6px color-mix(in srgb,var(--md-sys-color-primary) 20%,transparent),0 0 0 2px var(--md-sys-color-primary)}
  100%{box-shadow:0 0 0 2px var(--md-sys-color-primary)}
}
.message-bubble.jump-highlight,
.message-bubble.pinned-highlight{animation:msgHighlightIn .84s var(--ease-out-quint)}
/* Тик прочтения: короткий пружинный подскок, когда статус меняется. */
@keyframes tickReadPop{0%{transform:scale(.55);opacity:.45}55%{transform:scale(1.24)}100%{transform:scale(1);opacity:1}}
.message-bubble .tick.tick-pop{display:inline-block;animation:tickReadPop .44s var(--ease-spring)}
/* Реакции «поп»-ают только у сообщения, где реакцию только что
   изменили (класс reactions-fresh), а не у всех при перерисовке. */
.message-bubble:not(.reactions-fresh) .reaction-chip{animation:none}
.message-bubble.reactions-fresh .reaction-chip{animation:reactionPop .34s cubic-bezier(.34,1.56,.64,1)}
/* Плавная подгрузка снимков: место держит рамка пузыря, картинка
   проявляется, когда файл пришёл (класс is-loaded ставит JS). */
.message-bubble .media-image,
.media-group .mg-cell img{opacity:0;transition:opacity .34s ease}
.message-bubble .media-image.is-loaded,
.media-group .mg-cell img.is-loaded{opacity:1}
/* Удаление сообщения: к масштабу добавляем лёгкое размытие — уход
   выглядит мягче, чем просто схлопывание. */
@keyframes msgDelSoft{
  0%{opacity:1;transform:scale(1);filter:blur(0)}
  26%{opacity:1;transform:scale(1.06);filter:blur(0)}
  62%{opacity:.6;transform:scale(.92);filter:blur(1px)}
  100%{opacity:0;transform:scale(.42);filter:blur(2.5px)}
}
.message-bubble.deleting{animation:msgDelSoft .46s cubic-bezier(.34,1.2,.64,1) forwards}
@media (prefers-reduced-motion:reduce){
  .message-bubble.jump-highlight,.message-bubble.pinned-highlight,
  .message-bubble .tick.tick-pop,
  .message-bubble.reactions-fresh .reaction-chip{animation:none}
  .message-bubble .media-image,.media-group .mg-cell img{opacity:1;transition:none}
}
body.no-animations .message-bubble .media-image,
body.no-animations .media-group .mg-cell img{opacity:1;transition:none !important}
.msg-reply-hint{position:absolute;top:50%;transform:translateY(-50%) scale(.5);opacity:0;color:var(--md-sys-color-primary);pointer-events:none;transition:opacity .2s,transform .2s;display:flex;align-items:center;justify-content:center;width:34px;height:34px;border-radius:50%;background:color-mix(in srgb,var(--md-sys-color-primary) 15%,transparent)}
.msg-reply-hint.left{left:-52px}
.msg-reply-hint.right{right:-52px}
.msg-reply-hint.visible{opacity:1;transform:translateY(-50%) scale(1)}
.msg-reply-hint.armed{opacity:1;transform:translateY(-50%) scale(1.25);background:var(--md-sys-color-primary);color:var(--md-sys-color-on-primary)}
.msg-reply-hint .material-symbols-outlined{font-size:20px}

/* --- Анимация свайпа-ответа ---
   Пузырь идёт за пальцем, вокруг него растёт акцентное «гало», стрелка
   появляется пружинно и пульсирует на пороге. При срабатывании пузырь
   «всасывается» влево, а превью внизу «прилетает» из его исходной точки. */
@keyframes replyHintPop{
  0%{opacity:0;transform:translateY(-50%) scale(.35) rotate(-55deg)}
  55%{opacity:1;transform:translateY(-50%) scale(1.25) rotate(10deg)}
  100%{opacity:1;transform:translateY(-50%) scale(1) rotate(0)}
}
@keyframes replyHintArm{
  0%,100%{transform:translateY(-50%) scale(1.22) rotate(0)}
  50%{transform:translateY(-50%) scale(1.4) rotate(-12deg)}
}
@keyframes replyBubbleSend{
  from{opacity:1;transform:translateX(var(--reply-x,-54px)) scale(1)}
  to{opacity:0;transform:translateX(-150px) scale(.84)}
}
@keyframes replyBubbleArm{
  0%,100%{box-shadow:0 12px 30px -14px color-mix(in srgb,var(--md-sys-color-primary) 60%,transparent),0 0 0 calc(var(--reply-progress,0) * 7px) color-mix(in srgb,var(--md-sys-color-primary) 14%,transparent)}
  50%{box-shadow:0 14px 34px -14px color-mix(in srgb,var(--md-sys-color-primary) 78%,transparent),0 0 0 calc(var(--reply-progress,0) * 11px) color-mix(in srgb,var(--md-sys-color-primary) 20%,transparent)}
}
@keyframes replySourcePulse{
  0%{box-shadow:0 0 0 0 color-mix(in srgb,var(--md-sys-color-primary) 55%,transparent)}
  100%{box-shadow:0 0 0 12px color-mix(in srgb,var(--md-sys-color-primary) 0%,transparent)}
}
/* Содержимое превью чуть приподнимается внутри уже закреплённой панели —
   ощущение выезда без сдвига самой панели и щели под ней. */
@keyframes replyPreviewFly{
  from{opacity:0;transform:translateY(14px)}
  to{opacity:1;transform:none}
}
.message-bubble.reply-swiping{
  z-index:7;
  box-shadow:0 12px 30px -14px color-mix(in srgb,var(--md-sys-color-primary) 60%,transparent),
             0 0 0 calc(var(--reply-progress,0) * 7px) color-mix(in srgb,var(--md-sys-color-primary) 14%,transparent);
}
.message-bubble.reply-swiping.armed{animation:replyBubbleArm .8s ease-in-out infinite}
/* Ответ обозначается отчётливой стрелкой arrow_back. Ключевое: подсказка
   рисуется ВНУТРИ пузыря. У .message-bubble включён content-visibility:auto
   (paint containment), поэтому всё, что вынесено за его границы, обрезается —
   наружу стрелку ставить нельзя. right:8px держит её в пределах пузыря и у
   чужих, и у своих сообщений. */
.message-bubble:not(.circle-bubble) .msg-reply-hint{
  left:auto!important;right:8px!important;
  width:38px;height:38px;
  background:color-mix(in srgb,var(--md-sys-color-primary) 62%,transparent);
  box-shadow:0 4px 14px -6px color-mix(in srgb,var(--md-sys-color-primary) 75%,transparent);
  backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px);
}
.message-bubble:not(.circle-bubble) .msg-reply-hint .material-symbols-outlined{font-size:22px}
.message-bubble:not(.circle-bubble).reply-swiping .msg-reply-hint.visible{animation:replyHintPop .34s var(--ease-spring)}
.message-bubble:not(.circle-bubble).reply-swiping .msg-reply-hint.armed{animation:replyHintArm .6s ease-in-out infinite}
.message-bubble.reply-sent{animation:replyBubbleSend .24s var(--ease-out-quint) forwards;pointer-events:none}
.message-bubble.reply-source-pulse{animation:replySourcePulse .5s var(--ease-out-quint)}
/* Превью и поле ввода — ОДНА панель. Стеклянный фон лежит не на превью и
   не на доке по отдельности (из-за этого они читались как два объекта),
   а на общем нижнем стеке. Дочерние элементы прозрачны. */
/* Панель остаётся прижатой к низу экрана: никакого translate, иначе на
   время анимации под ней образовывалась щель. Движение только у содержимого. */
@keyframes replyPanelIn{
  from{opacity:.55}
  to{opacity:1}
}
body.reply-open #mobileChatBottom,
body.reply-open #desktopChatBottom,
body.chat-overlay-layout.reply-open #mobileChatBottom,
body.chat-overlay-layout.reply-open #desktopChatBottom{
  background:color-mix(in srgb,var(--md-sys-color-surface) 34%,transparent);
  backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  -webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  border-radius:18px 18px 0 0;
  box-shadow:none;
  animation:replyPanelIn .34s var(--ease-spring);
}
body.reply-open .reply-preview,
body.chat-overlay-layout.reply-open #mobileChatBottom .reply-preview,
body.reply-open .mobile-input-dock,
body.chat-overlay-layout.reply-open #mobileChatBottom .mobile-input-dock,
body.reply-open .desktop-input-area,
body.reply-open .attachments-bar,
body.reply-open .typing-indicator,
body[data-matte="glass"].reply-open .reply-preview,
body[data-matte="glass"].reply-open .mobile-input-dock{
  background:transparent;
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
  box-shadow:none;
  border-radius:0;
}
/* Движение содержимого превью идёт внутри неподвижной стеклянной панели. */
.reply-preview.reply-fly{animation:replyPreviewFly .3s var(--ease-spring)}
body[data-matte="glass"].reply-open #mobileChatBottom,
body[data-matte="glass"].reply-open #desktopChatBottom{
  background:color-mix(in srgb,var(--md-sys-color-surface) 16%,transparent);
}
.msg-link{color:inherit;text-decoration:underline;word-break:break-all;font-weight:500}
.msg-link:hover{opacity:.85}
.link-card{display:flex;gap:10px;align-items:center;padding:10px 12px;margin-top:8px;border-radius:14px;background:rgba(128,128,128,.15);text-decoration:none;color:inherit;border:1px solid rgba(128,128,128,.22);transition:background .2s,transform .15s,border-color .2s;max-width:100%;cursor:pointer}
.link-card:hover{background:rgba(128,128,128,.25);border-color:rgba(128,128,128,.4)}
.link-card:active{transform:scale(.98)}
.link-card .lc-icon{width:36px;height:36px;border-radius:10px;background:rgba(128,128,128,.2);display:flex;align-items:center;justify-content:center;flex-shrink:0;overflow:hidden}
.link-card .lc-icon img{width:24px;height:24px;object-fit:contain}
.link-card .lc-body{flex:1;min-width:0}
.link-card .lc-domain{font-size:12px;font-weight:600;opacity:.9;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.link-card .lc-url{font-size:11px;opacity:.6;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px}

.message-reactions{display:flex;flex-wrap:wrap;gap:4px;margin-top:6px;position:relative;z-index:1}
.reaction-chip{display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border-radius:999px;background:color-mix(in srgb,var(--md-sys-color-primary) 15%,transparent);border:1px solid color-mix(in srgb,var(--md-sys-color-primary) 25%,transparent);font-size:13px;line-height:1;animation:reactionPop .3s cubic-bezier(.34,1.56,.64,1);cursor:pointer;transition:transform .18s,background .2s}
.reaction-chip:hover{transform:scale(1.06)}
.reaction-chip:active{transform:scale(.94)}
.reaction-chip .rc-count{font-size:10.5px;font-weight:700;color:var(--md-sys-color-primary)}
.reaction-chip.mine{background:var(--md-sys-color-primary);color:var(--md-sys-color-on-primary);border-color:var(--md-sys-color-primary)}
.reaction-chip.mine .rc-count{color:var(--md-sys-color-on-primary)}

.reactions-panel{position:fixed;left:50%;right:auto;bottom:max(82px,calc(var(--safe-bottom) + 82px));transform:translateX(-50%);width:max-content;max-width:calc(100vw - 24px);z-index:250;padding:8px;background:color-mix(in srgb,var(--md-sys-color-surface-container) 96%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));border:1px solid var(--md-sys-color-outline-variant);border-radius:24px;box-shadow:0 18px 42px -16px rgba(0,0,0,.62),0 4px 14px -8px rgba(0,0,0,.4);animation:reactionIslandIn .28s cubic-bezier(.22,1,.36,1);display:flex;flex-direction:column;gap:4px;overflow:hidden}
.reactions-panel.hidden{display:none!important}
.attachment-camera-overlay{position:fixed;inset:0;z-index:7000;display:none;align-items:center;justify-content:center;background:#050505;padding:0}
.attachment-camera-overlay.active{display:flex}
.attachment-camera-shell{position:relative;width:100%;height:100%;max-width:760px;overflow:hidden;background:#000;isolation:isolate}
.attachment-camera-shell video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;display:block;transform:scale(var(--attachment-camera-zoom,1)) scaleX(var(--attachment-camera-mirror,1));transform-origin:center center;transition:transform .08s linear;background:#111}
.attachment-camera-top{position:absolute;z-index:3;top:0;left:0;right:0;display:flex;align-items:center;justify-content:space-between;padding:max(14px,var(--safe-top)) 14px 18px;background:linear-gradient(to bottom,rgba(0,0,0,.68),transparent);pointer-events:none}
.attachment-camera-top>*{pointer-events:auto}
.attachment-camera-title{font-size:15px;font-weight:600;color:#fff;text-shadow:0 1px 5px rgba(0,0,0,.5)}
.attachment-camera-btn{width:42px;height:42px;border-radius:50%;border:1px solid rgba(255,255,255,.18);background:rgba(0,0,0,.42);color:#fff;display:flex;align-items:center;justify-content:center;cursor:pointer;backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));transition:transform .18s,background .2s}
.attachment-camera-btn:active{transform:scale(.9)}
.attachment-camera-btn .material-symbols-outlined{font-size:22px}
.attachment-camera-bottom{position:absolute;z-index:3;left:0;right:0;bottom:0;display:flex;flex-direction:column;align-items:center;gap:12px;padding:38px 18px max(24px,var(--safe-bottom));background:linear-gradient(to top,rgba(0,0,0,.82),transparent)}
.attachment-camera-zoom{width:min(320px,78vw);display:flex;align-items:center;gap:9px;color:rgba(255,255,255,.82)}
.attachment-camera-zoom .material-symbols-outlined{font-size:20px;flex-shrink:0}
.attachment-camera-zoom input{width:100%;accent-color:#fff;height:28px;cursor:pointer}
.attachment-camera-capture{width:78px;height:78px;border-radius:50%;border:4px solid rgba(255,255,255,.92);background:rgba(255,255,255,.2);display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:0 8px 28px rgba(0,0,0,.45);transition:transform .16s,background .2s}
.attachment-camera-capture span{width:60px;height:60px;border-radius:50%;background:#fff;display:block}
.attachment-camera-capture:active{transform:scale(.9);background:rgba(255,255,255,.35)}
.attachment-camera-hint{font-size:12px;color:rgba(255,255,255,.72);text-shadow:0 1px 4px #000;min-height:16px}
.attachment-camera-error{position:absolute;z-index:4;left:50%;top:50%;transform:translate(-50%,-50%);width:min(360px,calc(100% - 40px));padding:14px 16px;border-radius:16px;background:rgba(0,0,0,.7);color:#fff;text-align:center;font-size:13px;line-height:1.4;backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
.attachment-camera-error[hidden]{display:none}
@media (min-width:769px){.attachment-camera-overlay{padding:16px}.attachment-camera-shell{height:min(820px,calc(100dvh - 32px));border-radius:28px;box-shadow:0 30px 90px rgba(0,0,0,.7)}}
.reactions-strip::-webkit-scrollbar{display:none}
.reaction-btn{flex-shrink:0;width:48px;height:48px;border-radius:50%;border:none;background:var(--md-sys-color-surface-variant);font-size:26px;line-height:1;display:flex;align-items:center;justify-content:center;cursor:pointer;transition:transform .25s cubic-bezier(.34,1.56,.64,1),background .2s}
.reaction-btn:hover{transform:scale(1.14);background:var(--md-sys-color-secondary-container)}
.reaction-btn:active{transform:scale(.92)}
.reaction-btn.active{background:var(--md-sys-color-primary);color:var(--md-sys-color-on-primary);box-shadow:0 0 0 2px var(--md-sys-color-primary),0 6px 18px -6px color-mix(in srgb,var(--md-sys-color-primary) 70%,transparent)}
@keyframes reactionIslandIn{from{opacity:0;transform:translate(-50%,14px) scale(.94)}to{opacity:1;transform:translate(-50%,0) scale(1)}}
@media (max-width:768px){.reactions-panel{bottom:max(82px,calc(var(--safe-bottom) + 82px))}}

.pinned-bar{display:flex;align-items:center;gap:10px;padding:8px 14px;background:var(--md-sys-color-surface-container);border:1px solid var(--md-sys-color-outline-variant);border-radius:18px;margin:8px 10px 0;cursor:pointer;overflow:hidden;animation:slideInDown .3s ease}
.pinned-bar .material-symbols-outlined{color:var(--md-sys-color-primary);font-size:18px}
.pinned-bar .pin-text{flex:1;min-width:0;font-size:12px}
.pinned-bar .pin-author{font-weight:600;margin-bottom:2px;color:var(--md-sys-color-primary)}
.pinned-bar .pin-body{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;opacity:.85}
.group-call-bar{display:flex;align-items:center;gap:12px;padding:10px 14px;background:linear-gradient(135deg,rgba(34,197,94,.14),rgba(34,197,94,.06));border-bottom:1px solid rgba(34,197,94,.25);animation:slideInDown .3s ease}
.group-call-bar .gcb-icon{width:36px;height:36px;border-radius:50%;background:#22c55e;color:#fff;display:flex;align-items:center;justify-content:center;flex-shrink:0;animation:glowPulse 1.8s ease-in-out infinite}
.group-call-bar .gcb-icon .material-symbols-outlined{font-size:20px}
.group-call-bar .gcb-text{flex:1;min-width:0}
.group-call-bar .gcb-title{font-size:13px;font-weight:600}
.group-call-bar .gcb-sub{font-size:11.5px;opacity:.7;margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.group-call-bar .gcb-join{padding:8px 16px;border-radius:999px;border:none;background:#22c55e;color:#fff;font-family:inherit;font-size:12.5px;font-weight:600;cursor:pointer;transition:transform .15s}
.group-call-bar .gcb-join:active{transform:scale(.94)}
.typing-indicator{padding:6px 16px;font-size:12px;color:var(--md-sys-color-on-surface-variant);display:flex;align-items:center;gap:8px;animation:slideInUp .25s ease}
.typing-dots{display:inline-flex;gap:3px}
.typing-dots span{width:6px;height:6px;border-radius:50%;background:currentColor;animation:typingDot 1.4s var(--ease-out-quint) infinite both}
.typing-dots span:nth-child(2){animation-delay:.16s}
.typing-dots span:nth-child(3){animation-delay:.32s}

/* Вложение без подписи — только медиа, без пустой таблетки вокруг:
   у пузыря нет ни фона, ни рамки, ни отступов. Время и статус лежат
   на самом снимке маленькой плашкой в правом нижнем углу. */
.message-bubble.media-bubble{padding:0;background:transparent;border:none;box-shadow:none;max-width:min(85%,420px)}
.message-bubble.media-bubble.own{border:none}
/* Медиа в чате нельзя выделять, вызывать системное меню и таскать —
   этим занимается наш долгий тап. */
.media-wrap,.media-image,.media-video{
  display:block;max-width:100%;max-height:min(58vh,420px);width:auto;height:auto;object-fit:contain;border-radius:18px;
  -webkit-touch-callout:none;-webkit-user-drag:none;user-select:none;-webkit-user-select:none;
  touch-action:none;
}
.media-wrap{position:relative;display:block;border-radius:18px;overflow:hidden;background:#000;cursor:zoom-in}
/* object-fit:cover, а не contain: при contain и max-height высоты у
   портретного снимка по бокам оставалось пустое серое поле — контейнер
   шире самой картинки. cover заполняет блок и обрезает лишнее, поэтому
   рамка всегда точно по размеру изображения. */
/* Одиночное фото/видео — в натуральную величину, ограничиваем ТОЛЬКО
   габариты. width:auto + height:auto сохраняют пропорции, поэтому вокруг
   снимка не появляется пустой серый прямоугольник (было width:100% вместе
   с object-fit) и содержимое не вырезается. Полный размер — тапом. */
.media-image{display:block;max-width:100%;max-height:min(58vh,420px);width:auto;height:auto;object-fit:contain;border-radius:18px}
.media-video{display:block;max-width:100%;max-height:min(58vh,420px);width:auto;height:auto;border-radius:18px;background:#000;object-fit:contain}
.media-badge-time{position:absolute;bottom:8px;right:8px;display:inline-flex;align-items:center;gap:4px;background:rgba(0,0,0,.62);color:#fff;padding:3px 8px;border-radius:10px;font-size:10px;line-height:1;white-space:nowrap}
.media-badge-time .tick{margin-left:0;color:#fff}
.media-overlay-btn{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:56px;height:56px;border-radius:50%;background:rgba(0,0,0,.55);color:#fff;border:none;display:flex;align-items:center;justify-content:center;pointer-events:none}

.audio-message{display:flex;align-items:center;gap:10px;padding:2px 0;min-width:200px}
.audio-play-btn{background:rgba(0,0,0,.35)!important;color:#fff!important;border:1px solid rgba(255,255,255,.15);border-radius:50%;width:38px;height:38px;display:flex;align-items:center;justify-content:center;cursor:pointer;flex-shrink:0;backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));transition:transform .2s,background .2s}
.audio-play-btn:hover{background:#1a1a1a!important}
.audio-play-btn:active{transform:scale(.9)}
.audio-play-btn .material-symbols-outlined{color:#fff!important;font-size:22px;line-height:1}
.audio-track{flex:1;position:relative;height:28px;cursor:pointer;overflow:hidden;touch-action:none;display:flex;align-items:center}
.audio-wave{display:flex;align-items:center;gap:2px;width:100%;height:100%}
.audio-wave span{flex:1;background:currentColor;opacity:.35;border-radius:1px;min-height:3px}
.audio-wave span:nth-child(odd){height:55%}
.audio-wave span:nth-child(3n){height:85%}
.audio-wave span:nth-child(4n){height:30%}
.audio-wave span.passed{opacity:.95}
.audio-fill-bar{position:absolute;top:50%;left:0;height:3px;background:currentColor;border-radius:2px;transform:translateY(-50%);width:0%;pointer-events:none;opacity:.85}
.audio-fill-knob{position:absolute;top:50%;width:11px;height:11px;border-radius:50%;background:currentColor;transform:translate(-50%,-50%);pointer-events:none;box-shadow:0 0 6px rgba(0,0,0,.4);opacity:.95}
.audio-time{font-size:11px;opacity:.7;min-width:34px;text-align:right}

.message-bubble:has(.music-message){overflow:hidden;padding:10px 14px}
.music-message{display:flex;align-items:center;gap:10px;padding:0;width:100%;max-width:100%;min-width:0;box-sizing:border-box;overflow:hidden}
.music-cover{width:48px;height:48px;min-width:48px;min-height:48px;border-radius:12px;background:linear-gradient(135deg,var(--md-sys-color-primary-container),var(--md-sys-color-secondary-container));display:flex;align-items:center;justify-content:center;flex-shrink:0;overflow:hidden;position:relative}
.music-cover .material-symbols-outlined{font-size:24px;color:var(--md-sys-color-primary)}
.music-cover img{width:100%;height:100%;object-fit:cover}
.music-info{flex:1 1 0;min-width:0;overflow:hidden}
.music-title{font-size:13.5px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
.music-sub{font-size:11px;opacity:.7;margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
.music-controls{display:flex;align-items:center;gap:4px;flex-shrink:0;flex-grow:0;width:auto}
.music-play-btn{width:36px;height:36px;min-width:36px;min-height:36px;max-width:36px;border-radius:50%;background:#000;color:#fff;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:transform .18s,background .2s;flex-shrink:0;padding:0;box-sizing:border-box}
.music-play-btn:hover{background:#1a1a1a}
.music-play-btn:active{transform:scale(.9)}
.music-play-btn .material-symbols-outlined{font-size:22px;color:#fff;line-height:1}
.music-progress{margin-top:6px;height:3px;border-radius:2px;background:rgba(128,128,128,.25);position:relative;overflow:hidden;cursor:pointer;max-width:100%}
.music-progress-fill{height:100%;background:var(--md-sys-color-primary);border-radius:2px;width:0%;transition:width .15s linear}

.circle-bubble{background:transparent!important;padding:0!important;border:none!important;box-shadow:none!important;border-radius:0!important;overflow:visible!important;width:auto!important;height:auto!important;max-width:240px!important;min-width:0!important;min-height:0!important;display:flex;flex-direction:column;align-items:center;margin-bottom:4px;position:relative;align-self:flex-start;cursor:pointer;z-index:10;contain:layout style;transform:translateZ(0);backface-visibility:hidden;-webkit-backface-visibility:hidden}
.circle-bubble.own{align-self:flex-end}
.circle-bubble:hover{box-shadow:none!important}
.circle-bubble .circle-media{position:relative;width:240px;height:240px;border-radius:50%;flex-shrink:0}
.circle-bubble .circle-video{width:240px;height:240px;border-radius:50%;object-fit:cover;display:block;background:#000;cursor:pointer;box-shadow:0 4px 16px -6px rgba(0,0,0,.4);flex-shrink:0}
/* Кнопка play/pause по центру: круглая, полупрозрачная, без квадратной
   подложки. Клики пропускаем к <video> — обработчик контейнера сам
   переключает воспроизведение. */
.circle-bubble .circle-progress{position:absolute;inset:0;width:100%;height:100%;transform:rotate(-90deg);pointer-events:none;z-index:2}
.circle-bubble .circle-progress circle{fill:none;stroke-width:1.6}
.circle-bubble .cp-track{stroke:rgba(255,255,255,.22)}
.circle-bubble .cp-fill{stroke:#fff;stroke-linecap:round;stroke-dasharray:301.6;stroke-dashoffset:301.6;transition:stroke-dashoffset .15s linear}
/* Плашки лежат внутри круга, а не в прозрачных углах квадрата:
   отступ 36px удерживает их на дуге при диаметре 240px. */
.circle-bubble .circle-dur{position:absolute;left:36px;bottom:36px;background:rgba(0,0,0,.62);color:#fff;padding:3px 8px;border-radius:10px;font-size:10px;line-height:1;z-index:3;pointer-events:none}
.circle-bubble .message-time{position:absolute!important;right:36px;bottom:36px;left:auto!important;top:auto!important;display:inline-flex;align-items:center;gap:3px;background:rgba(0,0,0,.62);color:#fff;padding:3px 8px;border-radius:10px;font-size:10px;line-height:1;margin:0!important;opacity:1!important;backdrop-filter:none!important;z-index:3;pointer-events:none}
.circle-bubble .message-time .tick,
.circle-bubble .message-time .tick.read{color:#fff}
.circle-bubble .message-reactions{margin-top:4px;justify-content:center;display:flex;flex-wrap:wrap;gap:4px;width:100%;max-width:220px;position:relative;z-index:2}
.circle-bubble .msg-reply-hint{top:auto;bottom:0;transform:translateY(0) scale(.5)}
.circle-bubble .msg-reply-hint.left{left:-46px;bottom:50%;transform:translateY(50%) scale(.5)}
.circle-bubble .msg-reply-hint.right{right:-46px;bottom:50%;transform:translateY(50%) scale(.5)}
.circle-bubble .msg-reply-hint.visible{transform:translateY(50%) scale(1)}
.circle-bubble .msg-reply-hint.armed{transform:translateY(50%) scale(1.25)}

.file-bubble{padding:12px 14px}
.file-row{display:flex;align-items:center;gap:12px}
.file-icon{font-size:36px;color:var(--md-sys-color-primary)}
.file-info{flex:1;min-width:0}
.file-name{font-size:13px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.file-size{font-size:11px;opacity:.7;margin-top:2px}
.incoming-file-message .file-row{position:relative;overflow:hidden;border-radius:13px}
.file-receive-badge{display:none;position:absolute;right:51px;top:7px;z-index:3;width:27px;height:27px;align-items:center;justify-content:center;border-radius:50%;background:#22c55e;color:#fff;box-shadow:0 7px 17px -7px rgba(34,197,94,.95);pointer-events:none}
.file-receive-badge .material-symbols-outlined{font-size:17px;line-height:1}
.message-bubble.incoming-file-message.file-arrival-play{animation:fileArrivalBubble 1.18s cubic-bezier(.22,1.18,.36,1) both;transform-origin:left bottom}
.message-bubble.circle-bubble.incoming-file-message.file-arrival-play{animation:fileArrivalBubble 1.18s cubic-bezier(.22,1.18,.36,1) both;transform-origin:center bottom}
.file-arrival-play .file-icon{display:inline-block;animation:incomingFileIconDrop 1.02s cubic-bezier(.2,1.25,.36,1) both;transform-origin:center bottom}
.file-arrival-play .file-info{animation:incomingFileInfoIn .78s cubic-bezier(.22,1,.36,1) .08s both}
.file-arrival-play .file-download{animation:incomingFileButtonReceive .72s cubic-bezier(.34,1.56,.64,1) .24s both}
.file-arrival-play .file-receive-badge{display:flex;animation:incomingFileBadge .9s cubic-bezier(.22,1,.36,1) .2s both}
.file-arrival-play .file-row::before{content:'';position:absolute;z-index:4;left:0;right:0;bottom:0;height:3px;background:linear-gradient(90deg,var(--md-sys-color-primary),var(--md-sys-color-secondary-container));transform:scaleX(0);transform-origin:left center;box-shadow:0 0 10px color-mix(in srgb,var(--md-sys-color-primary) 55%,transparent);pointer-events:none;animation:fileArrivalProgress 1.08s cubic-bezier(.22,1,.36,1) both}
.file-arrival-play .file-row::after{content:'';position:absolute;z-index:2;inset:-30% -45%;background:linear-gradient(105deg,transparent 38%,color-mix(in srgb,var(--md-sys-color-on-surface) 12%,transparent) 50%,transparent 62%);transform:translateX(-80%);pointer-events:none;animation:fileArrivalShimmer .95s ease-in-out .08s both}
.incoming-image-message.file-arrival-play .media-wrap,
.incoming-video-message.file-arrival-play .media-wrap{animation:incomingMediaReveal 1.02s cubic-bezier(.2,1.15,.35,1) .06s both;transform-origin:center}
.message-bubble.circle-bubble.incoming-circle-message.file-arrival-play .circle-video{animation:incomingCircleMediaReveal 1.05s cubic-bezier(.2,1.2,.35,1) .05s both}
.incoming-audio-message.file-arrival-play .music-cover,
.incoming-audio-message.file-arrival-play .audio-play-btn{animation:incomingAudioBadge 1s cubic-bezier(.34,1.56,.64,1) .12s both}
.incoming-audio-message.file-arrival-play .music-info,
.incoming-audio-message.file-arrival-play .audio-track,
.incoming-audio-message.file-arrival-play .audio-time{animation:incomingFileInfoIn .8s cubic-bezier(.22,1,.36,1) .1s both}
@keyframes fileArrivalBubble{0%{opacity:0;transform:translateY(22px) scale(.72)}42%{opacity:1;transform:translateY(-4px) scale(1.025)}68%{transform:translateY(1px) scale(.992)}100%{opacity:1;transform:translateY(0) scale(1)}}
@keyframes incomingFileIconDrop{0%{opacity:0;transform:translateY(-34px) rotate(-13deg) scale(.62)}34%{opacity:1;transform:translateY(5px) rotate(3deg) scale(1.08)}58%{transform:translateY(-3px) rotate(-1deg) scale(.97)}78%,100%{opacity:1;transform:translateY(0) rotate(0) scale(1)}}
@keyframes incomingFileInfoIn{0%{opacity:0;transform:translateX(14px)}55%{opacity:1;transform:translateX(-2px)}100%{opacity:1;transform:translateX(0)}}
@keyframes incomingFileButtonReceive{0%{transform:scale(.7)}48%{transform:scale(1.16)}72%{transform:scale(.94)}100%{transform:scale(1)}}
@keyframes incomingFileBadge{0%{opacity:0;transform:scale(.25) rotate(-12deg)}38%{opacity:1;transform:scale(1.15) rotate(3deg)}62%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.86) translateY(-3px)}}
@keyframes fileArrivalProgress{0%{transform:scaleX(0)}72%{transform:scaleX(.88)}100%{transform:scaleX(1)}}
@keyframes fileArrivalShimmer{0%{transform:translateX(-80%)}100%{transform:translateX(80%)}}
@keyframes incomingMediaReveal{0%{opacity:0;transform:scale(.72) translateY(18px);filter:blur(8px)}48%{opacity:1;transform:scale(1.035) translateY(-2px);filter:blur(0)}74%{transform:scale(.99)}100%{opacity:1;transform:scale(1);filter:blur(0)}}
@keyframes incomingCircleMediaReveal{0%{opacity:0;transform:scale(.55) translateY(-24px);filter:blur(7px)}52%{opacity:1;transform:scale(1.08) translateY(3px);filter:blur(0)}76%{transform:scale(.97)}100%{opacity:1;transform:scale(1);filter:blur(0)}}
@keyframes incomingAudioBadge{0%{opacity:0;transform:scale(.55) rotate(-10deg)}55%{opacity:1;transform:scale(1.14) rotate(3deg)}78%{transform:scale(.96)}100%{opacity:1;transform:scale(1) rotate(0)}}
.file-download{color:inherit;width:38px;height:38px;border-radius:50%;display:flex;align-items:center;justify-content:center;text-decoration:none;background:color-mix(in srgb,var(--md-sys-color-on-surface) 8%,transparent);transition:transform .2s,background .25s,color .25s,box-shadow .25s;position:relative;overflow:hidden;cursor:pointer;flex-shrink:0}
.file-download .material-symbols-outlined{position:relative;z-index:1;line-height:1}
.file-download::before{content:'';position:absolute;left:50%;top:50%;width:12px;height:12px;border-radius:50%;background:currentColor;opacity:0;transform:translate(-50%,-50%) scale(0);pointer-events:none}
.file-download:hover{background:color-mix(in srgb,var(--md-sys-color-on-surface) 14%,transparent)}
.file-download:active{transform:scale(.9)}
.file-bubble .file-download.is-downloading{background:var(--md-sys-color-primary);color:var(--md-sys-color-on-primary);box-shadow:0 8px 20px -10px color-mix(in srgb,var(--md-sys-color-primary) 70%,transparent)}
.file-bubble .file-download.is-downloading::before{animation:fileDownloadRipple 1.2s ease-out infinite}
.file-bubble .file-download.is-downloading .material-symbols-outlined{animation:spin .78s linear infinite}
.file-bubble .file-download.is-downloaded{background:#22c55e;color:#fff;box-shadow:0 8px 22px -10px rgba(34,197,94,.9);animation:fileDownloadCheckPop .42s cubic-bezier(.34,1.56,.64,1)}
.file-bubble .file-download.is-download-error{background:var(--md-sys-color-error);color:var(--md-sys-color-on-error);box-shadow:0 8px 22px -10px color-mix(in srgb,var(--md-sys-color-error) 75%,transparent)}
.file-bubble.is-downloading{animation:fileBubbleDownloadPulse .8s ease-in-out infinite alternate}
.file-bubble.is-downloaded{box-shadow:0 0 0 2px rgba(34,197,94,.38),0 10px 24px -12px rgba(34,197,94,.75)}
.file-bubble.is-download-error{box-shadow:0 0 0 2px color-mix(in srgb,var(--md-sys-color-error) 35%,transparent),0 10px 24px -12px color-mix(in srgb,var(--md-sys-color-error) 65%,transparent)}

/* Ненавязчивая анимация скачивания входящего файла */
.file-download-feedback{
  position:fixed;left:50%;bottom:max(26px,calc(var(--safe-bottom) + 18px));z-index:10000;
  width:min(380px,calc(100vw - 24px));display:flex;align-items:center;gap:13px;
  padding:12px 15px 13px 12px;border-radius:22px;
  color:var(--md-sys-color-on-surface);font-family:inherit;
  background:color-mix(in srgb,var(--md-sys-color-surface-container) 92%,transparent);
  border:1px solid color-mix(in srgb,var(--md-sys-color-outline-variant) 80%,transparent);
  box-shadow:0 22px 54px -18px rgba(0,0,0,.6),0 3px 12px -6px rgba(0,0,0,.35);
  backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  opacity:0;transform:translate(-50%,22px) scale(.94);transform-origin:center bottom;
  pointer-events:auto;overflow:hidden;will-change:transform,opacity;
}
.file-download-feedback::after{content:'';position:absolute;inset:0;border-radius:inherit;background:radial-gradient(circle at 12% 50%,color-mix(in srgb,var(--md-sys-color-primary) 9%,transparent),transparent 42%);pointer-events:none}
.file-download-feedback.is-visible{opacity:1;transform:translate(-50%,0) scale(1);animation:fileFeedbackIn .42s cubic-bezier(.22,1.25,.36,1) both}
.file-download-feedback.is-leaving{animation:fileFeedbackOut .26s ease both}
.file-download-feedback-visual{position:relative;width:48px;height:48px;flex:0 0 48px;isolation:isolate}
.file-download-feedback-folder{position:absolute;z-index:3;inset:10px 1px 0;display:flex;align-items:center;justify-content:center;border-radius:14px;background:color-mix(in srgb,var(--md-sys-color-primary) 13%,transparent);color:var(--md-sys-color-primary);font-size:32px;line-height:1;transform-origin:center bottom}
.file-download-feedback-file{position:absolute;z-index:2;left:13px;top:0;width:24px;height:28px;display:flex;align-items:center;justify-content:center;border-radius:7px;background:var(--md-sys-color-surface);color:var(--md-sys-color-on-surface-variant);box-shadow:0 5px 12px -5px rgba(0,0,0,.55);opacity:0;transform-origin:center bottom}
.file-download-feedback-file .material-symbols-outlined{font-size:16px}
.file-download-feedback-check{position:absolute;z-index:4;left:50%;top:50%;width:30px;height:30px;display:flex;align-items:center;justify-content:center;border-radius:50%;background:#22c55e;color:#fff;font-size:20px;line-height:1;box-shadow:0 7px 16px -7px rgba(34,197,94,.95);opacity:0;transform:translate(-50%,-50%) scale(.2)}
.file-download-feedback.is-visible .file-download-feedback-folder{animation:fileFolderReceive 1.05s cubic-bezier(.22,1,.36,1) both}
.file-download-feedback.is-visible .file-download-feedback-file{animation:fileDownloadDrop 1.05s cubic-bezier(.3,.8,.3,1) both}
.file-download-feedback.is-complete .file-download-feedback-folder{background:rgba(34,197,94,.15);color:#22c55e;animation:fileFolderComplete .45s cubic-bezier(.34,1.56,.64,1) both}
.file-download-feedback.is-complete .file-download-feedback-file{opacity:0}
.file-download-feedback.is-complete .file-download-feedback-check{opacity:1;animation:fileDownloadCheckPop .48s cubic-bezier(.34,1.56,.64,1) both}
.file-download-feedback.is-error .file-download-feedback-file,
.file-download-feedback.is-canceled .file-download-feedback-file{opacity:0}
.file-download-feedback.is-error .file-download-feedback-folder{background:color-mix(in srgb,var(--md-sys-color-error) 14%,transparent);color:var(--md-sys-color-error);animation:none}
.file-download-feedback.is-error .file-download-feedback-check{opacity:1;background:var(--md-sys-color-error);color:var(--md-sys-color-on-error);box-shadow:0 7px 16px -7px color-mix(in srgb,var(--md-sys-color-error) 85%,transparent);animation:fileDownloadCheckPop .42s cubic-bezier(.34,1.56,.64,1) both}
.file-download-feedback.is-canceled .file-download-feedback-folder{background:color-mix(in srgb,var(--md-sys-color-on-surface) 9%,transparent);color:var(--md-sys-color-on-surface-variant);animation:none}
.file-download-feedback.is-canceled .file-download-feedback-check{opacity:1;background:var(--md-sys-color-surface-variant);color:var(--md-sys-color-on-surface-variant);box-shadow:none;animation:fileDownloadCheckPop .36s cubic-bezier(.34,1.56,.64,1) both}
.file-download-feedback.is-saving .file-download-feedback-folder{animation:fileFolderSaving .62s ease-in-out infinite alternate}
.file-download-feedback-action{position:relative;z-index:3;width:34px;height:34px;min-width:34px;display:flex;align-items:center;justify-content:center;padding:0;border:0;border-radius:50%;background:color-mix(in srgb,var(--md-sys-color-on-surface) 8%,transparent);color:var(--md-sys-color-on-surface-variant);font-family:inherit;cursor:pointer;transition:background .2s,color .2s,transform .2s}
.file-download-feedback-action:hover{background:color-mix(in srgb,var(--md-sys-color-on-surface) 14%,transparent);color:var(--md-sys-color-on-surface)}
.file-download-feedback-action:active{transform:scale(.9)}
.file-download-feedback-action .material-symbols-outlined{font-size:18px;line-height:1}
.file-download-feedback-copy{position:relative;z-index:1;flex:1;min-width:0}
.file-download-feedback-title{font-size:12.5px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-bottom:4px}
.file-download-feedback.is-complete .file-download-feedback-title{color:#22c55e}
.file-download-feedback.is-error .file-download-feedback-title{color:var(--md-sys-color-error)}
.file-download-feedback.is-canceled .file-download-feedback-title{color:var(--md-sys-color-on-surface-variant)}
.file-download-feedback-meta{display:flex;align-items:center;gap:10px;margin-bottom:7px}
.file-download-feedback-name{flex:1;min-width:0;font-size:10.5px;color:var(--md-sys-color-on-surface-variant);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.file-download-feedback-percent{font-size:9.5px;font-weight:700;color:var(--md-sys-color-on-surface-variant);font-variant-numeric:tabular-nums}
.file-download-feedback-track{height:3px;border-radius:999px;background:color-mix(in srgb,var(--md-sys-color-on-surface) 10%,transparent);overflow:hidden}
.file-download-feedback-fill{display:block;width:100%;height:100%;border-radius:inherit;background:linear-gradient(90deg,var(--md-sys-color-primary),var(--md-sys-color-secondary-container));transform:scaleX(0);transform-origin:left center}
.file-download-feedback.is-indeterminate .file-download-feedback-fill{animation:fileDownloadIndeterminate 1.05s ease-in-out infinite}
.file-download-feedback.is-complete .file-download-feedback-track{background:rgba(34,197,94,.14)}
.file-download-feedback.is-complete .file-download-feedback-fill{background:#22c55e}

@keyframes fileDownloadRipple{0%{opacity:.28;transform:translate(-50%,-50%) scale(.2)}100%{opacity:0;transform:translate(-50%,-50%) scale(4.5)}}
@keyframes fileDownloadCheckPop{0%{opacity:0;transform:scale(.25) rotate(-18deg)}65%{opacity:1;transform:scale(1.14) rotate(4deg)}100%{opacity:1;transform:scale(1) rotate(0)}}
@keyframes fileBubbleDownloadPulse{from{box-shadow:0 1px 2px rgba(0,0,0,.08),0 0 0 0 color-mix(in srgb,var(--md-sys-color-primary) 0%,transparent)}to{box-shadow:0 1px 2px rgba(0,0,0,.08),0 0 0 3px color-mix(in srgb,var(--md-sys-color-primary) 15%,transparent)}}
@keyframes fileFeedbackIn{0%{opacity:0;transform:translate(-50%,22px) scale(.94)}70%{opacity:1;transform:translate(-50%,-2px) scale(1.015)}100%{opacity:1;transform:translate(-50%,0) scale(1)}}
@keyframes fileFeedbackOut{from{opacity:1;transform:translate(-50%,0) scale(1)}to{opacity:0;transform:translate(-50%,14px) scale(.96)}}
@keyframes fileDownloadDrop{0%{opacity:0;transform:translateY(-20px) rotate(-10deg) scale(.72)}18%{opacity:1}68%{opacity:1;transform:translateY(8px) rotate(2deg) scale(1)}83%{transform:translateY(-2px) rotate(0) scale(.96)}100%{opacity:0;transform:translateY(14px) rotate(0) scale(.55)}}
@keyframes fileFolderReceive{0%,55%{transform:scale(1) rotate(0)}72%{transform:scale(1.1) rotate(-4deg)}88%{transform:scale(.97) rotate(1deg)}100%{transform:scale(1) rotate(0)}}
@keyframes fileFolderComplete{0%{transform:scale(1)}55%{transform:scale(1.16) rotate(-3deg)}100%{transform:scale(1) rotate(0)}}
@keyframes fileFolderSaving{from{transform:scale(1)}to{transform:scale(1.08) translateY(-1px)}}
@keyframes fileDownloadIndeterminate{0%{transform:translateX(-105%) scaleX(.22)}55%{transform:translateX(20%) scaleX(.48)}100%{transform:translateX(480%) scaleX(.22)}}
@media (max-width:768px){
  .file-download-feedback{bottom:max(92px,calc(var(--safe-bottom) + 82px));width:min(360px,calc(100vw - 24px));padding:10px 11px 11px 10px;border-radius:20px}
  .file-download-feedback-visual{width:44px;height:44px;flex-basis:44px}
  .file-download-feedback-action{width:32px;height:32px;min-width:32px}
  .file-download-feedback-action .material-symbols-outlined{font-size:17px}
  #profileDialog{padding:48px 8px 0!important;align-items:center!important;justify-content:center!important}
  #profileDialog>.menu-content{width:min(calc(100vw - 28px),440px)!important;max-width:440px!important;max-height:86vh!important;max-height:min(86dvh,calc(100dvh - 104px))!important;border-radius:28px 28px 22px 22px!important;transform-origin:center bottom}
}
@media (prefers-reduced-motion:reduce){
  .file-download.is-downloading .material-symbols-outlined{animation:none!important}
  .file-download-feedback.is-indeterminate .file-download-feedback-fill,
  .file-download-feedback.is-saving .file-download-feedback-folder{animation:none!important}
  .file-download-feedback.is-visible{animation:none!important}
  .file-download-feedback.is-visible .file-download-feedback-folder,
  .file-download-feedback.is-visible .file-download-feedback-file{animation:none!important}
  .file-download-feedback.is-visible .file-download-feedback-file{opacity:1;transform:none}
  .file-download-feedback.is-complete .file-download-feedback-file{opacity:0}
  .file-download-feedback.is-complete .file-download-feedback-check{animation:none!important;opacity:1;transform:translate(-50%,-50%) scale(1)}
}

.sticker-bubble{background:transparent!important;padding:0!important;box-shadow:none!important;border:none!important;max-width:min(50%,190px)!important;cursor:pointer;transition:transform .25s cubic-bezier(.34,1.56,.64,1);display:flex;flex-direction:column;align-items:flex-end;position:relative;z-index:1;margin-top:6px!important;margin-bottom:4px!important;flex-shrink:0!important;contain:layout style;transform:translateZ(0);backface-visibility:hidden;-webkit-backface-visibility:hidden}
.sticker-bubble:first-child{margin-top:0!important}
.sticker-bubble.own{align-self:flex-end}
.sticker-bubble:not(.own){align-self:flex-start;align-items:flex-start}
.sticker-bubble:hover{transform:scale(1.04)!important;box-shadow:none!important}
.sticker-bubble img{width:100%;aspect-ratio:1;border-radius:20px;display:block;object-fit:cover}
.sticker-bubble .sticker-hint{font-size:10px;opacity:.6;text-align:center;margin-top:4px}
.sticker-bubble .message-time{margin-top:4px;background:rgba(0,0,0,.4);color:#fff;padding:2px 8px;border-radius:10px;font-size:9px;backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:none!important}
.sticker-bubble .message-reactions{margin-top:6px;justify-content:center;width:100%}

#searchDialog{padding:0;align-items:stretch;justify-content:stretch;overflow:hidden}
.search-page{display:flex;flex-direction:column;width:100%;height:100dvh;max-height:100dvh;overflow:hidden;background:var(--md-sys-color-surface);position:relative}
@supports not (height:100dvh){.search-page{height:100vh;max-height:100vh}}
.search-page-header{padding:10px 12px;display:flex;align-items:center;gap:8px;border-bottom:1px solid var(--md-sys-color-outline-variant);padding-top:max(10px,var(--safe-top));flex-shrink:0}
.search-page-title{font-size:16px;font-weight:600;color:var(--md-sys-color-on-surface)}
.search-input-top{flex-shrink:0;padding:10px 14px 6px;background:var(--md-sys-color-surface);border-bottom:1px solid transparent;transition:border-color .25s}
.search-input-top .search-input-wrap{min-height:48px}
.search-page-body{flex:1;overflow-y:auto;padding:8px 10px 20px;-webkit-overflow-scrolling:touch;min-height:0;touch-action:pan-y}
.search-section-title{font-size:11px;font-weight:700;text-transform:uppercase;color:var(--md-sys-color-on-surface-variant);margin:14px 10px 8px;letter-spacing:.8px;display:flex;align-items:center;gap:6px}
.search-result-card{display:flex;align-items:center;padding:10px 12px;gap:12px;border-radius:14px;cursor:pointer;margin-bottom:4px;overflow:hidden;animation:cardIn .35s cubic-bezier(.22,1,.36,1) both;transition:transform .2s,background .2s}
.search-result-card:hover{background:var(--md-sys-color-surface-variant)}
.search-result-card:active{transform:scale(.98)}
.search-result-card .sr-avatar{width:42px;height:42px;min-width:42px;border-radius:12px;flex-shrink:0;display:flex;align-items:center;justify-content:center;font-weight:600;font-size:15px;background:color-mix(in srgb,var(--md-sys-color-primary) 16%,var(--md-sys-color-surface-container));color:var(--md-sys-color-primary);overflow:hidden}
.search-result-card .sr-avatar.channel{background:linear-gradient(135deg,#a8a8a8,#c8c8c8);color:#1a1a1a;border-radius:50%}
.search-result-card .sr-avatar img{width:100%;height:100%;object-fit:cover;border-radius:12px}
.search-result-card .sr-info{flex:1;min-width:0;overflow:hidden}
.search-result-card .sr-title{font-size:14px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.search-result-card .sr-sub{font-size:11.5px;opacity:.65;margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.search-result-card .sr-action{flex-shrink:0;padding:7px 14px;border-radius:999px;border:none;background:var(--md-sys-color-primary);color:var(--md-sys-color-on-primary);font-family:inherit;font-size:12px;font-weight:600;cursor:pointer;transition:transform .2s}
.search-result-card .sr-action:active{transform:scale(.92)}
.search-empty,.search-hint-main{text-align:center;padding:28px 16px;color:var(--md-sys-color-on-surface-variant);font-size:13px;opacity:.7}
.search-hint-main{display:flex;flex-direction:column;align-items:center;gap:14px;padding:60px 20px}
.search-hint-main .material-symbols-outlined{font-size:64px;opacity:.25;animation:breathe 3s ease-in-out infinite}
.search-filters{display:flex;gap:6px;padding:4px 12px 8px;overflow-x:auto;flex-shrink:0}
.search-chip{padding:6px 14px;border-radius:999px;border:1px solid var(--md-sys-color-outline-variant);background:transparent;color:var(--md-sys-color-on-surface-variant);font-family:inherit;font-size:12px;font-weight:500;cursor:pointer;white-space:nowrap;flex-shrink:0;transition:background .2s,color .2s,transform .2s}
.search-chip:active{transform:scale(.94)}
/* Выбранный фильтр выделяется фоном — лишний контур на нём не нужен.
   Border остаётся прозрачным, чтобы размеры кнопки не менялись. */
.search-chip.active{background:var(--md-sys-color-primary);color:var(--md-sys-color-on-primary);border-color:transparent}
.search-input-wrap{display:flex;align-items:center;gap:8px;background:var(--md-sys-color-surface-variant);border-radius:24px;padding:0 16px;border:1.5px solid transparent;transition:background .25s,box-shadow .25s;min-height:48px}
/* Активное поле отличается тоном и внутренней линией, а не внешним кольцом. */
.search-input-wrap:focus-within{background:color-mix(in srgb,var(--md-sys-color-surface-container) 80%,var(--md-sys-color-surface-variant));box-shadow:inset 0 1px 0 rgba(255,255,255,.06)}
.search-input-wrap .material-symbols-outlined{font-size:20px;color:var(--md-sys-color-on-surface-variant)}
.search-input-wrap input{flex:1;min-width:0;padding:12px 0;border:none;background:transparent;color:var(--md-sys-color-on-surface);font-family:inherit;font-size:15px;outline:none}

.chat-input{flex:1;min-width:0;padding:12px 18px;border-radius:26px;border:1.5px solid var(--md-sys-color-outline-variant);background:var(--md-sys-color-surface-container);color:var(--md-sys-color-on-surface);font-family:inherit;font-size:15px;outline:none;transition:border-color .25s,box-shadow .25s;min-height:44px}
.chat-input:focus{border-color:var(--md-sys-color-primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--md-sys-color-primary) 10%,transparent)}
.channel-locked-notice{flex:1;padding:12px 16px;border-radius:24px;background:var(--md-sys-color-surface-variant);color:var(--md-sys-color-on-surface-variant);text-align:center;font-size:13px;display:flex;align-items:center;justify-content:center;gap:6px}

#mobileSendBtn,#desktopSendBtn{transition:background .3s,color .3s,transform .2s cubic-bezier(.34,1.56,.64,1)}
#mobileSendBtn:active,#desktopSendBtn:active{transform:scale(.9)}
/* Триггеры записи: полупрозрачные, с чуть заметным акцентом и утемнённым
   тоном. Send-режим ниже остаётся сплошным акцентным. */
#mobileSendBtn.audio-mode,#desktopSendBtn.audio-mode{
  background:color-mix(in srgb,var(--md-sys-color-primary) 22%,rgba(12,12,16,.62))!important;
  color:color-mix(in srgb,#fff 86%,var(--md-sys-color-primary))!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.1)!important;
}
#mobileSendBtn.video-mode,#desktopSendBtn.video-mode{
  background:color-mix(in srgb,var(--md-sys-color-primary) 18%,rgba(255,255,255,.58))!important;
  color:color-mix(in srgb,#101014 85%,var(--md-sys-color-primary))!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.2)!important;
}
#mobileSendBtn.send-mode,#desktopSendBtn.send-mode{background:color-mix(in srgb,var(--md-sys-color-primary) 88%,transparent)!important;color:var(--md-sys-color-on-primary)!important}

/* Панель вложений. Миниатюры были 76px — панель занимала под 100px
   высоты, а крестик (22px) и иконка файла (32px) выглядели крупнее самой
   миниатюры. Единая система: чип 64px, зазор 6px, крестик 20px,
   иконка 26px. Горизонтальная прокрутка и запрет сжатия оставлены —
   при множестве вложений панель не растягивает экран. */
.attachments-bar{display:flex;gap:6px;padding:8px 10px;background:var(--md-sys-color-surface-container);border-top:1px solid var(--md-sys-color-outline-variant);overflow-x:auto;overflow-y:hidden;align-items:center;scrollbar-width:none;animation:slideUp .25s ease}
.attachments-bar::-webkit-scrollbar{display:none}
.attachment-chip{position:relative;flex-shrink:0;width:64px;height:64px;border-radius:12px;overflow:hidden;background:var(--md-sys-color-surface-variant);display:flex;align-items:center;justify-content:center;flex-direction:column;animation:popIn .28s cubic-bezier(.34,1.56,.64,1)}
.attachment-chip img,.attachment-chip video{width:100%;height:100%;object-fit:cover;display:block}
.attachment-chip .ac-file-icon{font-size:26px;color:var(--md-sys-color-on-surface-variant)}
.attachment-chip .ac-file-name{font-size:8.5px;text-align:center;padding:0 4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%;color:var(--md-sys-color-on-surface-variant)}
.attachment-chip .ac-close{position:absolute;top:3px;right:3px;width:20px;height:20px;border-radius:50%;background:rgba(0,0,0,.7);color:#fff;border:none;display:flex;align-items:center;justify-content:center;cursor:pointer;padding:0;z-index:2;transition:transform .2s}
.attachment-chip .ac-close:active{transform:scale(.85)}
.attachment-chip .ac-close .material-symbols-outlined{font-size:12px}
.attachment-chip .ac-progress{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,.45);z-index:1}
.attachment-chip .ac-progress .material-symbols-outlined{color:#fff;font-size:26px;animation:spin 1s linear infinite}

#circleRecordOverlay{position:fixed;inset:0;z-index:160;display:none;flex-direction:column;align-items:center;justify-content:center;background:rgba(0,0,0,.6);animation:circleOverlayIn .3s ease;touch-action:none;will-change:opacity}
/* Экран записи кружка не размывает фон: ни оверлей, ни его родители.
   Тёмное однотонное наложение поверх обоев — и всё. */
body.circle-recording #circleRecordOverlay,
body[data-matte="glass"] #circleRecordOverlay{backdrop-filter:none!important;-webkit-backdrop-filter:none!important}
#circleRecordOverlay.active{display:flex}
.circle-stage{position:relative;display:flex;flex-direction:column;align-items:center;gap:14px}
/* Квадрат со стороной D = min(72vw,320px), overflow:visible — кольцо
   прогресса выступает за круг и не обрезается. */
.circle-preview-wrap{position:relative;width:min(72vw,320px);height:min(72vw,320px);overflow:visible;animation:circleDropIn .5s cubic-bezier(.34,1.56,.64,1) both;will-change:transform,opacity}
.circle-preview-wrap.leaving{animation:circleLeave .45s cubic-bezier(.4,0,1,1) forwards;pointer-events:none}
.circle-video-box{position:absolute;inset:0;border-radius:50%;overflow:hidden;background:transparent;box-shadow:0 24px 70px -10px rgba(0,0,0,.7);cursor:grab;touch-action:none;contain:layout style paint}
.circle-video-box.zooming{cursor:grabbing}
/* Видео камеры — без filter/backdrop/mix-blend и полупрозрачных слоёв. */
.circle-video-box video{width:100%;height:100%;object-fit:cover;display:block;transform-origin:center;pointer-events:none;user-select:none;-webkit-user-drag:none;image-rendering:auto;filter:none;-webkit-filter:none;mix-blend-mode:normal;opacity:1}
/* Кольцо: R = D/2 + 8, inset -20px даёт 12px поля viewBox со всех сторон.
   viewBox, cx/cy/r и длину дуги выставляет JS (sizeCircleRing). */
.circle-ring{position:absolute;inset:-20px;pointer-events:none;transform:rotate(-90deg);overflow:visible}
.circle-ring circle{fill:none;stroke-width:3}
.circle-ring .ring-bg{stroke:rgba(255,255,255,.18)}
.circle-ring .ring-fg{stroke:#fff;stroke-linecap:round;stroke-dasharray:var(--ring-len,308);stroke-dashoffset:var(--ring-len,308);transition:stroke-dashoffset .18s linear,stroke .3s}
.circle-ring .ring-fg.warn{stroke:#ef4444}
.circle-timer{margin-top:14px;font-size:16px;font-weight:600;color:#fff;letter-spacing:1px;opacity:.9;font-variant-numeric:tabular-nums;background:transparent;border:none;box-shadow:none;padding:0;text-shadow:0 1px 6px rgba(0,0,0,.6)}
.circle-hint{margin-top:4px;font-size:12px;color:rgba(255,255,255,.55);text-align:center;max-width:80vw;background:transparent;border:none;box-shadow:none;text-shadow:0 1px 6px rgba(0,0,0,.6)}
.circle-controls{position:absolute;left:0;right:0;bottom:max(34px,var(--safe-bottom));display:flex;justify-content:center;align-items:center;gap:22px;padding:0 24px;overflow:visible}
/* Кнопки — настоящие круги: без подложек, блюра и обрезающих родителей. */
.circle-ctrl{width:56px;height:56px;border-radius:50%;border:none;background:rgba(255,255,255,.16);color:#fff;cursor:pointer;display:grid;place-items:center;padding:0;overflow:visible;transition:transform .2s cubic-bezier(.34,1.56,.64,1),background .2s;animation:popIn .35s cubic-bezier(.34,1.56,.64,1) both}
.circle-ctrl:active{transform:scale(.9)}
.circle-ctrl:hover{background:rgba(255,255,255,.28)}
.circle-ctrl svg{width:26px;height:26px;display:block}
.circle-ctrl.send{background:#e8e8e8;color:#1e1e1e;width:76px;height:76px}
.circle-ctrl.send svg{width:28px;height:28px}
.circle-ctrl.danger{background:#ff3b30;color:#fff}
.circle-lock-hint{position:absolute;top:max(30px,var(--safe-top));left:50%;transform:translateX(-50%) translateY(-10px);display:flex;flex-direction:column;align-items:center;gap:6px;color:rgba(255,255,255,.55);font-size:12px;opacity:0;pointer-events:none;z-index:6;transition:opacity .2s,transform .2s}
.circle-lock-hint>div{background:transparent;text-shadow:0 1px 6px rgba(0,0,0,.6)}
/* Замок — белая круглая кнопка 68px, иконка по центру. */
.circle-lock-hint .material-symbols-outlined{font-size:30px;width:68px;height:68px;display:grid;place-items:center;background:#fff;color:#1e1e1e;border-radius:50%;padding:0;box-shadow:0 8px 24px -8px rgba(0,0,0,.6);transition:background .2s,color .2s}
.circle-lock-hint.active{opacity:1;transform:translateX(-50%) translateY(0);color:#fff}
.circle-lock-hint.active .material-symbols-outlined{background:#fff;color:#1e1e1e;animation:iconBounce .5s ease}
.circle-cancel-hint{position:absolute;top:50%;left:max(30px,var(--safe-left));transform:translateY(-50%) translateX(-12px);display:flex;flex-direction:column;align-items:center;gap:6px;color:rgba(255,255,255,.55);font-size:12px;opacity:0;pointer-events:none;z-index:6;transition:opacity .2s,transform .2s}
.circle-cancel-hint>div{background:transparent;text-shadow:0 1px 6px rgba(0,0,0,.6)}
.circle-cancel-hint .material-symbols-outlined{font-size:30px;width:68px;height:68px;display:grid;place-items:center;background:rgba(255,255,255,.14);border-radius:50%;padding:0;transition:background .2s,color .2s}
.circle-cancel-hint.active{opacity:1;transform:translateY(-50%) translateX(0);color:#fff}
.circle-cancel-hint.active .material-symbols-outlined{background:#ff3b30;color:#fff;animation:iconBounce .5s ease}
#circleRecordOverlay.cancel-armed .circle-video-box{box-shadow:0 24px 70px -10px rgba(0,0,0,.7),0 0 0 4px rgba(255,59,48,.8)}
#circleRecordOverlay.cancel-armed .circle-ring .ring-fg{stroke:#ff3b30!important}

.emoji-picker{position:absolute;left:0;right:0;bottom:calc(100% + var(--composer-sheet-lift, 0px));width:min(520px,100%);max-width:520px;margin:0 auto;background:var(--md-sys-color-surface-container);border:1px solid var(--md-sys-color-outline-variant);border-bottom:0;border-radius:24px 24px 0 0;box-shadow:0 -18px 48px -18px rgba(0,0,0,.62);z-index:70;height:clamp(420px,calc(100dvh - 140px),650px);animation:composerSheetIn .3s cubic-bezier(.22,1,.36,1);transform-origin:bottom center;display:flex;flex-direction:column;padding:0;overflow:hidden}
.emoji-picker.hidden{display:none}
@media (min-width:769px){.emoji-picker{left:auto;right:8px;bottom:calc(100% + 8px);width:min(360px,calc(100vw - 24px));max-width:none;margin:0;border-radius:18px;border:1px solid var(--md-sys-color-outline-variant);box-shadow:0 16px 40px -12px rgba(0,0,0,.5);animation:popIn .3s cubic-bezier(.34,1.56,.64,1);transform-origin:bottom right}}
.composer-source-sheet{position:absolute;left:0;right:0;bottom:calc(100% + var(--composer-sheet-lift, 0px) + 3px);width:min(520px,100%);max-width:520px;margin:0 auto -1px;background:color-mix(in srgb,var(--md-sys-color-surface-container) 88%,transparent);backdrop-filter:blur(calc(var(--ui-blur, 16px) * 1.6)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(calc(var(--ui-blur, 16px) * 1.6)) saturate(var(--ui-blur-sat));border:1px solid var(--md-sys-color-outline-variant);border-bottom:0;border-radius:24px 24px 0 0;box-shadow:0 -18px 48px -18px rgba(0,0,0,.62);z-index:75;padding:0 12px 14px;overflow:hidden;animation:composerSheetIn .28s cubic-bezier(.22,1,.36,1)}
.composer-source-sheet.hidden{display:none!important}
.composer-source-sheet.closing{animation:composerSheetOut .18s ease forwards}
.composer-sheet-handle{width:38px;height:4px;border-radius:99px;background:var(--md-sys-color-outline-variant);opacity:.75;margin:8px auto 2px;flex-shrink:0}
.composer-sheet-head{display:flex;align-items:center;gap:10px;padding:4px 4px 8px;flex-shrink:0}
.composer-sheet-head>div{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.composer-sheet-head strong{font-size:15px;font-weight:700;color:var(--md-sys-color-on-surface)}
.composer-sheet-head small{font-size:11.5px;color:var(--md-sys-color-on-surface-variant)}
.composer-sheet-close{width:32px;height:32px;min-width:32px;border-radius:50%;border:none;background:var(--md-sys-color-surface-variant);color:var(--md-sys-color-on-surface);display:flex;align-items:center;justify-content:center;cursor:pointer;transition:transform .18s,background .2s}
.composer-sheet-close:active{transform:scale(.9)}
.composer-sheet-close .material-symbols-outlined{font-size:18px}
.composer-sheet-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;padding-top:4px}
.composer-sheet-action{min-height:76px;border:1px solid var(--md-sys-color-outline-variant);border-radius:18px;background:var(--md-sys-color-surface);color:var(--md-sys-color-on-surface);display:flex;align-items:center;gap:11px;padding:12px 13px;text-align:left;font-family:inherit;cursor:pointer;transition:transform .2s,background .2s,border-color .2s,box-shadow .2s}
.composer-sheet-action:hover{background:var(--md-sys-color-surface-variant);border-color:var(--md-sys-color-primary);box-shadow:0 8px 20px -14px color-mix(in srgb,var(--md-sys-color-primary) 70%,transparent)}
.composer-sheet-action:active{transform:scale(.97)}
.composer-sheet-action>.material-symbols-outlined{width:42px;height:42px;min-width:42px;border-radius:14px;background:color-mix(in srgb,var(--md-sys-color-primary) 14%,transparent);color:var(--md-sys-color-primary);display:flex;align-items:center;justify-content:center;font-size:25px}
.composer-sheet-action>span:last-child{min-width:0;display:flex;flex-direction:column;gap:3px}
.composer-sheet-action strong{font-size:13.5px;font-weight:700;white-space:nowrap}
.composer-sheet-action small{font-size:10.5px;line-height:1.2;color:var(--md-sys-color-on-surface-variant);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
@keyframes composerSheetIn{from{opacity:0;transform:translateY(18px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}
@keyframes composerSheetOut{from{opacity:1;transform:translateY(0) scale(1)}to{opacity:0;transform:translateY(12px) scale(.98)}}
@media (max-width:380px){.composer-sheet-actions,.attach-menu-actions{gap:6px}.composer-sheet-action,.attach-menu-action{padding:9px;gap:7px}.composer-sheet-action strong,.attach-menu-action>span:last-child{font-size:12px}.composer-sheet-action small{font-size:9.5px}}
.sp-tabs{display:flex;padding:4px 6px 6px;gap:4px;background:var(--md-sys-color-surface-variant);flex-shrink:0}
.sp-tab{flex:1;padding:9px 10px;border:none;border-radius:12px;background:transparent;font-family:inherit;font-size:12.5px;font-weight:600;cursor:pointer;color:var(--md-sys-color-on-surface-variant);transition:background .25s,color .25s,transform .15s;display:inline-flex;align-items:center;justify-content:center;gap:6px}
.sp-tab:active{transform:scale(.95)}
.sp-tab .material-symbols-outlined{font-size:18px}
.sp-tab.active{background:var(--md-sys-color-primary);color:var(--md-sys-color-on-primary)}
/* min-height:0 обязателен: без него пункт flex не сжимается ниже
   содержимого, .sp-body разрастается и его обрезает панель —
   прокрутка не появлялась, нижние ряды эмодзи уходили из виду. */
.sp-body{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:8px}
.sp-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:4px}
.sp-grid.sticker-grid{grid-template-columns:repeat(3,1fr);gap:8px}
.sp-item{background:transparent;border:none;padding:4px;cursor:pointer;border-radius:12px;transition:transform .2s cubic-bezier(.34,1.56,.64,1),background .2s;display:flex;align-items:center;justify-content:center;aspect-ratio:1}
.sp-item:hover{background:var(--md-sys-color-surface-variant);transform:scale(1.1)}
.sp-item:active{transform:scale(.92)}
.sp-item.sp-emoji{font-size:24px;line-height:1}
.sp-item img{width:100%;height:100%;object-fit:cover;border-radius:16px;display:block}
.sp-empty{text-align:center;padding:36px 16px;font-size:12.5px;color:var(--md-sys-color-on-surface-variant);opacity:.7;display:flex;flex-direction:column;align-items:center;gap:12px}
.sp-empty .material-symbols-outlined{font-size:48px;opacity:.35}
.sp-create-btn{display:flex;align-items:center;justify-content:center;gap:8px;margin:10px 6px 14px;padding:12px;width:calc(100% - 12px);border:2px dashed var(--md-sys-color-outline-variant);border-radius:16px;background:transparent;color:var(--md-sys-color-primary);font-family:inherit;font-weight:600;font-size:13px;cursor:pointer;transition:background .2s,border-color .2s,transform .2s}
.sp-create-btn:hover{background:var(--md-sys-color-surface-variant);border-color:var(--md-sys-color-primary)}
.sp-create-btn:active{transform:scale(.97)}
.sp-set-section{margin-bottom:14px}
.sp-set-header{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.6px;opacity:.6;padding:4px 6px 8px;display:flex;justify-content:space-between;align-items:center}
.sp-set-del{color:var(--md-sys-color-error);background:transparent;border:none;cursor:pointer;font-family:inherit;font-size:11px;font-weight:600;padding:2px 6px;border-radius:6px;display:inline-flex;align-items:center;gap:4px;transition:background .2s}
.sp-set-del .material-symbols-outlined{font-size:14px}
.sp-set-del:hover{background:color-mix(in srgb,var(--md-sys-color-error) 15%,transparent)}

#stickerEditor{position:fixed;inset:0;z-index:400;background:#212121;color:#fff;display:none;flex-direction:column;overflow:hidden}
#stickerEditor.active{display:flex;animation:fadeIn .25s ease}
.se-header{padding:12px 14px;padding-top:max(12px,var(--safe-top));display:flex;align-items:center;gap:10px;border-bottom:1px solid rgba(255,255,255,.08);background:rgba(30,30,30,.9);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));flex-shrink:0}
.se-header .se-title{flex:1;font-size:14px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:center}
.se-btn{padding:8px 16px;border-radius:999px;border:none;background:rgba(255,255,255,.1);color:#fff;font-family:inherit;font-size:13px;font-weight:600;cursor:pointer;white-space:nowrap;transition:background .2s,transform .2s}
.se-btn:active{transform:scale(.94)}
.se-btn.primary{background:linear-gradient(135deg,#a0a0a0,#c0c0c0);color:#1a1a1a}
.se-btn:disabled{opacity:.35;cursor:not-allowed}
.se-stage-wrap{flex:1;display:flex;align-items:center;justify-content:center;padding:20px;overflow:hidden;position:relative;touch-action:none;min-height:0}
.se-canvas{position:relative;width:min(88vw,88vh,440px);aspect-ratio:1;background:#2a2a2a;border-radius:20px;overflow:hidden;box-shadow:0 24px 60px rgba(0,0,0,.6);touch-action:none}
.se-canvas.empty{display:flex;align-items:center;justify-content:center;flex-direction:column;gap:14px;border:2px dashed rgba(255,255,255,.15);cursor:pointer}
.se-canvas.empty .material-symbols-outlined{font-size:56px;opacity:.4}
.se-canvas.empty .se-empty-text{font-size:13px;opacity:.6;text-align:center;padding:0 20px}
.se-canvas .se-base{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;transform-origin:center;user-select:none;-webkit-user-drag:none;pointer-events:auto;will-change:transform;touch-action:none}
.se-canvas .se-draw{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;touch-action:none}
.se-canvas.draw-mode .se-draw{pointer-events:auto;cursor:crosshair}
.se-text-el{position:absolute;left:50%;top:50%;padding:8px 14px;border-radius:20px;background:rgba(0,0,0,.5);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));color:#fff;font-family:inherit;font-size:18px;font-weight:600;cursor:move;user-select:none;white-space:nowrap;transform-origin:center;box-shadow:0 6px 20px rgba(0,0,0,.35);border:2px solid transparent;touch-action:none;will-change:transform;transition:border-color .2s}
.se-text-el.selected{border-color:#a0a0a0}
.se-text-el input{background:transparent;border:none;color:inherit;font:inherit;outline:none;text-align:center;min-width:40px;max-width:60vw;padding:0;user-select:text;pointer-events:auto}
.se-tools{padding:12px 14px;padding-bottom:max(12px,var(--safe-bottom));display:flex;justify-content:center;gap:10px;border-top:1px solid rgba(255,255,255,.08);background:rgba(30,30,30,.92);flex-shrink:0;flex-wrap:wrap}
.se-tool{width:52px;height:52px;border-radius:50%;border:none;background:rgba(255,255,255,.08);color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .22s cubic-bezier(.34,1.56,.64,1)}
.se-tool .material-symbols-outlined{font-size:24px}
.se-tool:hover{background:rgba(255,255,255,.18);transform:scale(1.06)}
.se-tool:active{transform:scale(.92)}
.se-tool.active{background:linear-gradient(135deg,#a0a0a0,#c0c0c0);color:#1a1a1a}
.se-tool:disabled{opacity:.3;cursor:not-allowed}
.se-palette{position:absolute;left:50%;transform:translateX(-50%);bottom:96px;display:none;gap:8px;padding:10px 14px;border-radius:999px;background:rgba(30,30,30,.94);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));box-shadow:0 12px 40px rgba(0,0,0,.6);z-index:10}
.se-palette.active{display:flex;animation:slideUp .25s cubic-bezier(.22,1,.36,1)}
.se-color{width:32px;height:32px;border-radius:50%;border:3px solid transparent;cursor:pointer;transition:transform .2s,border-color .2s;flex-shrink:0}
.se-color.active{border-color:#fff;transform:scale(1.15)}
.se-hint{position:absolute;left:50%;transform:translateX(-50%);top:74px;font-size:11.5px;padding:6px 14px;border-radius:999px;background:rgba(0,0,0,.6);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));pointer-events:none;opacity:.9;max-width:90%;text-align:center;color:#fff;z-index:5;transition:opacity .3s}
.se-sticker-count{position:absolute;right:12px;top:12px;background:rgba(160,160,160,.85);color:#1a1a1a;padding:4px 12px;border-radius:999px;font-size:11px;font-weight:600;backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}

#callScreen{position:fixed;inset:0;background:#000!important;color:#fff;z-index:100;display:none}
#callScreen.active{display:block}
.call-container{position:relative;width:100%;height:100%;overflow:hidden}
.call-video-stage{position:absolute;inset:0;background:#000;display:none}
.call-video-stage.active{display:block}
.remote-video-wrap{position:absolute;inset:0;background:#000;display:flex;align-items:center;justify-content:center}
.remote-video{width:100%;height:100%;object-fit:contain;background:#000;display:block}
.remote-expand-btn{position:absolute;top:14px;right:14px;width:42px;height:42px;border-radius:50%;background:rgba(0,0,0,.55);border:1px solid rgba(255,255,255,.18);color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;z-index:5;backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));transition:transform .2s,background .2s}
.remote-expand-btn:hover{background:rgba(0,0,0,.75)}
.remote-expand-btn:active{transform:scale(.9)}
.remote-expand-btn .material-symbols-outlined{font-size:22px}

.local-video-wrap{position:absolute;bottom:150px;right:14px;width:110px;height:150px;max-width:240px;max-height:240px;border-radius:20px;overflow:hidden;border:2px solid rgba(255,255,255,.35);box-shadow:0 10px 30px rgba(0,0,0,.6);cursor:pointer;transition:transform .25s cubic-bezier(.34,1.56,.64,1);z-index:2;background:#111}
.local-video-wrap:active{transform:scale(.96)}
.local-video-wrap video{width:100%;height:100%;object-fit:contain;transform:scaleX(-1);display:block;background:#000}
.local-video-wrap.rear video{transform:none}
.local-video-wrap.cam-off video{opacity:0}
.local-video-wrap .cam-off-icon{position:absolute;inset:0;display:none;align-items:center;justify-content:center;color:#fff;font-size:36px;background:linear-gradient(135deg,#2a2a2a,#3a3a3a)}
.local-video-wrap.cam-off .cam-off-icon{display:flex}

@media (min-width:769px){.local-video-wrap{width:200px;height:113px;bottom:110px;right:18px;border-radius:14px}}
@media (max-width:768px){.local-video-wrap{width:100px;height:178px;bottom:140px;right:12px;border-radius:16px}}

.call-audio-info{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:40px 20px 220px;z-index:1}
.call-avatar{width:120px;height:120px;border-radius:50%;background:linear-gradient(135deg,#7a7a7a,#9a9a9a);display:flex;align-items:center;justify-content:center;font-size:56px;color:#fff;box-shadow:0 20px 60px rgba(120,120,120,.5);animation:floatY 3s ease-in-out infinite,glowPulse 2s ease-in-out infinite;overflow:hidden}
.call-avatar img{width:100%;height:100%;object-fit:cover}
#remoteName{margin-top:18px;font-size:22px;font-weight:600;color:#fff}
.call-state{opacity:.75;margin-top:6px;font-size:14px;color:#fff;animation:breathe 2s ease-in-out infinite}
.ice-status{font-size:11px;opacity:.5;margin-top:4px;color:#fff}
.call-controls{position:absolute;left:50%;bottom:max(24px,var(--safe-bottom));transform:translateX(-50%);display:flex;gap:10px;justify-content:center;align-items:center;padding:10px 14px;border-radius:32px;background:rgba(30,30,30,.48);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));border:1px solid rgba(255,255,255,.14);box-shadow:0 24px 60px -12px rgba(0,0,0,.7),inset 0 1px 0 rgba(255,255,255,.08);z-index:10;flex-wrap:nowrap;max-width:calc(100vw - 24px)}
body.light-theme .call-controls{background:rgba(255,255,255,.55);border-color:rgba(0,0,0,.08);box-shadow:0 24px 60px -12px rgba(0,0,0,.25),inset 0 1px 0 rgba(255,255,255,.6)}
.call-ctrl{width:54px;height:54px;border-radius:50%;border:none;background:rgba(255,255,255,.16);color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:transform .22s cubic-bezier(.34,1.56,.64,1),background .25s;flex-shrink:0}
.call-ctrl:hover{background:rgba(255,255,255,.3);transform:scale(1.06)}
.call-ctrl:active{transform:scale(.9)}
.call-ctrl .material-symbols-outlined{font-size:25px}
.call-ctrl.muted{background:#fff;color:#000}
.call-ctrl.muted .material-symbols-outlined{color:#000}
.call-ctrl.end{background:#ff3b30;color:#fff;width:62px;height:62px}
.call-ctrl.end .material-symbols-outlined{font-size:28px}
.call-ctrl.accept{background:#22c55e;color:#fff;animation:ringPulse 1.5s infinite}
.call-ctrl.danger{background:#ff3b30;color:#fff}

.screen-share-viewer{position:fixed;inset:0;background:rgba(0,0,0,.97);z-index:120;display:none;flex-direction:column;opacity:0;transition:opacity .3s}
.screen-share-viewer.active{display:flex;opacity:1}
.ssv-close{position:absolute;top:max(14px,var(--safe-top));right:14px;width:44px;height:44px;border-radius:50%;border:none;background:rgba(255,255,255,.14);color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;z-index:5}
.ssv-close:hover{background:rgba(255,255,255,.24)}
.ssv-title{position:absolute;top:max(20px,calc(var(--safe-top) + 6px));left:20px;color:#fff;font-size:13px;opacity:.85;z-index:5;max-width:calc(100% - 90px);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ssv-stage{flex:1;display:flex;align-items:center;justify-content:center;padding:60px 20px 20px}
.ssv-stage video{max-width:100%;max-height:100%;object-fit:contain;background:#000;border-radius:12px}

#groupCallScreen{position:fixed;inset:0;background:#212121!important;color:#fff;z-index:110;display:none;flex-direction:column}
#groupCallScreen.active{display:flex;animation:fadeIn .3s ease}
.gc-header{padding:14px 16px;padding-top:max(14px,var(--safe-top));display:flex;align-items:center;gap:12px;background:linear-gradient(to bottom,rgba(0,0,0,.7),transparent);position:relative;z-index:5}
.gc-header .gc-title{flex:1;min-width:0}
.gc-header .gc-title h3{font-size:15px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.gc-header .gc-title .gc-sub{font-size:11.5px;opacity:.7;margin-top:2px;display:flex;align-items:center;gap:6px}
.gc-header .gc-live-dot{width:8px;height:8px;border-radius:50%;background:#22c55e;box-shadow:0 0 10px #22c55e;animation:glowPulse 1.5s ease-in-out infinite}
.gc-body{flex:1;position:relative;overflow:hidden;padding:12px;display:flex}
.gc-grid{flex:1;display:grid;gap:10px;align-content:start;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));overflow-y:auto;padding-bottom:120px}
.gc-grid.count-1{grid-template-columns:1fr;max-width:520px;margin:0 auto}
.gc-grid.count-2{grid-template-columns:repeat(2,minmax(140px,1fr))}
.gc-tile{position:relative;border-radius:20px;overflow:hidden;background:linear-gradient(135deg,#2a2a2a,#3a3a3a);aspect-ratio:1;display:flex;align-items:center;justify-content:center;transition:transform .3s cubic-bezier(.34,1.56,.64,1);animation:tileIn .4s cubic-bezier(.34,1.56,.64,1) both;cursor:pointer;contain:layout style}
.gc-tile.speaking{animation:speaking 1.6s ease-in-out infinite,tileIn .4s cubic-bezier(.34,1.56,.64,1) both}
.gc-tile.removing{animation:tileOut .35s ease forwards}
.gc-tile video{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;background:#000;z-index:2}
.gc-tile.mirror video{transform:scaleX(-1)}
.gc-tile:not(.video-off) .gc-avatar{display:none}
.gc-tile .gc-name{z-index:3}
.gc-tile .gc-mic-off{z-index:3}
.gc-tile .gc-avatar{width:74px;height:74px;border-radius:50%;background:linear-gradient(135deg,#7a7a7a,#9a9a9a);display:flex;align-items:center;justify-content:center;font-size:30px;font-weight:600;color:#fff;overflow:hidden}
.gc-tile .gc-avatar img{width:100%;height:100%;object-fit:cover;border-radius:50%}
.gc-tile .gc-name{position:absolute;left:10px;right:10px;bottom:10px;background:rgba(0,0,0,.55);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));padding:5px 10px;border-radius:12px;font-size:11.5px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:flex;align-items:center;gap:6px}
.gc-tile .gc-name .material-symbols-outlined{font-size:15px;opacity:.9}
.gc-tile .gc-mic-off{position:absolute;top:8px;right:8px;background:rgba(0,0,0,.6);border-radius:50%;width:28px;height:28px;display:none;align-items:center;justify-content:center}
.gc-tile.muted .gc-mic-off{display:flex}
.gc-tile.muted .gc-mic-off .material-symbols-outlined{color:#ef4444;font-size:16px}
.gc-tile.video-off video{display:none}
.gc-tile .gc-you{background:linear-gradient(135deg,#7a7a7a,#9a9a9a);padding:2px 7px;border-radius:8px;font-size:9px;font-weight:700}
.gc-tile .gc-tile-expand{position:absolute;top:8px;left:8px;width:32px;height:32px;border-radius:50%;background:rgba(0,0,0,.55);border:1px solid rgba(255,255,255,.18);color:#fff;cursor:pointer;display:none;align-items:center;justify-content:center;z-index:4;backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
.gc-tile.has-video .gc-tile-expand{display:flex}
.gc-tile .gc-tile-expand .material-symbols-outlined{font-size:16px}
.gc-controls{position:absolute;left:50%;bottom:max(24px,var(--safe-bottom));transform:translateX(-50%);display:flex;gap:10px;justify-content:center;align-items:center;padding:10px 14px;border-radius:32px;background:rgba(30,30,30,.48);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));border:1px solid rgba(255,255,255,.14);box-shadow:0 24px 60px -12px rgba(0,0,0,.7),inset 0 1px 0 rgba(255,255,255,.08);z-index:10}
.gc-ctrl{width:54px;height:54px;border-radius:50%;border:none;background:rgba(255,255,255,.16);color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:transform .22s cubic-bezier(.34,1.56,.64,1),background .25s}
.gc-ctrl:active{transform:scale(.9)}
.gc-ctrl:hover{background:rgba(255,255,255,.3)}
.gc-ctrl .material-symbols-outlined{font-size:24px}
.gc-ctrl.active{background:#fff;color:#000}
.gc-ctrl.active .material-symbols-outlined{color:#000}
.gc-ctrl.end{background:#ff3b30;width:62px;height:62px}
.gc-ctrl.end .material-symbols-outlined{font-size:28px}
.gc-participants-sheet{position:absolute;left:0;right:0;bottom:100%;max-height:60vh;background:var(--md-sys-color-surface);color:var(--md-sys-color-on-surface);border-radius:24px 24px 0 0;padding:16px;transform:translateY(100%);transition:transform .35s cubic-bezier(.22,1,.36,1);z-index:7;box-shadow:0 -20px 60px rgba(0,0,0,.5);overflow-y:auto}
.gc-participants-sheet.active{transform:translateY(0)}
.gc-participants-sheet h4{font-size:14px;font-weight:700;margin-bottom:10px;display:flex;justify-content:space-between;align-items:center}
.gc-part-row{display:flex;align-items:center;gap:12px;padding:10px 6px;border-radius:14px}
.gc-part-row:hover{background:var(--md-sys-color-surface-variant)}
.gc-part-row .gp-av{width:38px;height:38px;border-radius:50%;background:var(--md-sys-color-secondary-container);display:flex;align-items:center;justify-content:center;font-weight:600;overflow:hidden;flex-shrink:0}
.gc-part-row .gp-av img{width:100%;height:100%;object-fit:cover}
.gc-part-row .gp-name{flex:1;min-width:0;font-size:13.5px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.gc-part-row .gp-badge{font-size:10px;background:var(--md-sys-color-primary);color:var(--md-sys-color-on-primary);padding:2px 8px;border-radius:8px;font-weight:700;letter-spacing:.4px}
.gc-part-row .gp-action{padding:7px 12px;border-radius:999px;border:none;font-family:inherit;font-size:11.5px;font-weight:600;cursor:pointer;background:var(--md-sys-color-error);color:var(--md-sys-color-on-error);transition:transform .2s}
.gc-part-row .gp-action:active{transform:scale(.92)}

@media (min-width:769px){
  .gc-grid{grid-template-columns:repeat(auto-fit,minmax(110px,1fr));gap:8px;max-width:900px;margin:0 auto;padding-bottom:100px}
  .gc-grid.count-1{max-width:400px}
  .gc-grid.count-2{grid-template-columns:repeat(2,minmax(140px,220px));max-width:480px}
  .gc-tile{border-radius:16px}
  .gc-tile .gc-avatar{width:54px;height:54px;font-size:22px}
  .gc-tile .gc-name{left:6px;right:6px;bottom:6px;padding:3px 8px;font-size:10.5px}
}

.record-overlay{position:fixed;left:0;right:0;bottom:0;background:color-mix(in srgb,var(--md-sys-color-surface-container) 96%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));padding:24px 20px 28px;padding-bottom:max(28px,var(--safe-bottom));z-index:150;display:none;flex-direction:column;align-items:center;gap:20px;box-shadow:0 -20px 60px -12px rgba(0,0,0,.55);border-top-left-radius:28px;border-top-right-radius:28px;animation:slideUp .32s cubic-bezier(.22,1,.36,1)}
.record-overlay.active{display:flex}
.record-overlay.will-cancel{background:color-mix(in srgb,var(--md-sys-color-error) 25%,var(--md-sys-color-surface-container))}
.record-ring{width:160px;height:160px;position:relative;display:flex;align-items:center;justify-content:center}
.record-ring > svg{position:absolute;inset:0;transform:rotate(-90deg);pointer-events:none}
.record-ring circle{fill:none;stroke-width:5}
.record-ring .ring-bg{stroke:color-mix(in srgb,var(--md-sys-color-primary) 15%,transparent)}
.record-ring .ring-fg{stroke:var(--md-sys-color-primary);stroke-linecap:round;stroke-dasharray:283;stroke-dashoffset:283;transition:stroke-dashoffset .25s linear}
.record-preview{width:130px;height:130px;border-radius:50%;background:#000;overflow:hidden;display:flex;align-items:center;justify-content:center}
.record-preview video{width:100%;height:100%;object-fit:cover;border-radius:50%}
.record-preview .rec-audio-icon{color:#fff;font-size:52px}
.record-dot{width:10px;height:10px;border-radius:50%;background:#ff3b30;display:inline-block;animation:recDot 1s infinite}
.record-timer{font-size:28px;font-weight:600;letter-spacing:1px}
.record-hint{font-size:12px;color:var(--md-sys-color-on-surface-variant);text-align:center;min-height:16px}
.record-controls{display:flex;gap:28px;align-items:center;justify-content:center}
.record-btn-big{width:60px;height:60px;border-radius:50%;border:1px solid color-mix(in srgb,var(--md-sys-color-outline-variant) 60%,transparent);cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--md-sys-color-on-surface);background:color-mix(in srgb,var(--md-sys-color-surface-container) 40%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));transition:transform .2s}
.record-btn-big:active{transform:scale(.9)}
.record-btn-big.send{background:var(--md-sys-color-primary);color:var(--md-sys-color-on-primary);width:72px;height:72px}
.record-btn-big.send .material-symbols-outlined{font-size:28px}
.record-btn-big.danger{background:var(--md-sys-color-error);color:var(--md-sys-color-on-error)}

/* ==== ГОЛОСОВАЯ ЗАПИСЬ ВМЕСТО ПОЛЯ ВВОДА (как в TG) ====
   Панель монтируется JS внутрь активного композера и занимает ровно его
   площадь: полноэкранной шторки больше нет. Кружок остаётся отдельным
   полноэкранным оверлеем. */
.record-overlay.inline{
  position:absolute;inset:0;left:0;right:0;top:0;bottom:0;
  width:auto;height:100%;
  flex-direction:row;align-items:center;justify-content:space-between;
  gap:10px;padding:8px 12px;padding-bottom:max(8px,var(--safe-bottom));
  border-radius:18px 18px 0 0;
  background:var(--md-sys-color-surface-container);
  box-shadow:0 -4px 14px -8px rgba(0,0,0,.35);
  backdrop-filter:none;-webkit-backdrop-filter:none;
  animation:recordInlineIn .26s cubic-bezier(.22,1,.36,1);
  z-index:30;
}
.record-overlay.inline.active{display:flex}
.record-overlay.inline.will-cancel{background:color-mix(in srgb,var(--md-sys-color-error) 22%,var(--md-sys-color-surface-container))}
.record-overlay.inline .record-ring{display:none}
.record-inline-main{display:flex;align-items:center;gap:10px;flex:1;min-width:0}
.record-inline-mic{
  width:34px;height:34px;min-width:34px;border-radius:50%;
  display:grid;place-items:center;font-size:19px;
  background:color-mix(in srgb,var(--md-sys-color-primary) 20%,transparent);
  color:var(--md-sys-color-primary);
  animation:recMicPulse 1.1s ease-in-out infinite;
}
.record-inline-info{display:flex;flex-direction:column;gap:1px;min-width:0}
.record-inline-line{display:flex;align-items:center;gap:8px}
.record-overlay.inline .record-dot{width:8px;height:8px}
.record-overlay.inline .record-timer{font-size:15px;letter-spacing:.5px;font-variant-numeric:tabular-nums}
.record-overlay.inline .record-hint{
  font-size:10.5px;text-align:left;white-space:nowrap;
  overflow:hidden;text-overflow:ellipsis;min-height:0;
}
.record-overlay.inline .record-controls{gap:8px;flex-shrink:0}
.record-overlay.inline .record-btn-big{
  width:38px;height:38px;min-width:38px;border:none;
  background:color-mix(in srgb,var(--md-sys-color-surface-variant) 75%,transparent);
  backdrop-filter:none;-webkit-backdrop-filter:none;
}
.record-overlay.inline .record-btn-big .material-symbols-outlined{font-size:19px}
.record-overlay.inline .record-btn-big.send{width:44px;height:44px;min-width:44px}
.record-overlay.inline .record-btn-big.send .material-symbols-outlined{font-size:21px}
.record-overlay.inline .record-btn-big.danger{
  background:color-mix(in srgb,var(--md-sys-color-error) 24%,transparent);
  color:var(--md-sys-color-error);
}
@keyframes recordInlineIn{from{opacity:0;transform:translateY(10px) scale(.99)}to{opacity:1;transform:none}}
@keyframes recMicPulse{
  0%,100%{box-shadow:0 0 0 0 color-mix(in srgb,var(--md-sys-color-primary) 45%,transparent);transform:scale(1)}
  50%{box-shadow:0 0 0 6px color-mix(in srgb,var(--md-sys-color-primary) 0%,transparent);transform:scale(1.08)}
}

.attach-menu{position:absolute;left:0;right:0;bottom:0;width:min(520px,100%);max-width:520px;margin:0 auto;
  /* Меню выбора формата вложения (фото/видео/аудио/файл) — выраженное
     матовое стекло: чуть прозрачнее фона и заметно сильнее размытие,
     чтобы за панелью читалось размытое содержимое чата. */
  background:color-mix(in srgb,var(--md-sys-color-surface-container) 68%,transparent);
  -webkit-backdrop-filter:blur(calc(var(--ui-blur, 16px) * 1.6)) saturate(var(--ui-blur-sat));
  backdrop-filter:blur(calc(var(--ui-blur, 16px) * 1.6)) saturate(var(--ui-blur-sat));
  border:1px solid var(--md-sys-color-outline-variant);border-bottom:0;border-radius:24px 24px 0 0;padding:0 12px 14px;box-shadow:0 -18px 48px -18px rgba(0,0,0,.62);z-index:75;overflow:hidden;animation:composerSheetIn .28s cubic-bezier(.22,1,.36,1)}
@media (min-width:769px){
  .attach-menu{left:12px;right:auto;bottom:70px;width:auto;min-width:180px;max-width:none;margin:0;padding:8px;border-radius:18px;border:1px solid var(--md-sys-color-outline-variant);box-shadow:0 20px 50px -14px rgba(0,0,0,.5);display:flex;flex-direction:column;gap:2px;overflow:visible;animation:popIn .28s cubic-bezier(.34,1.56,.64,1)}
  .attach-menu>.composer-sheet-handle,.attach-menu>.composer-sheet-head{display:none}
  .attach-menu-actions{display:flex;flex-direction:column;gap:2px;padding:0}
  .attach-menu-action{min-height:0;padding:12px 14px;border:0;border-radius:12px;background:transparent;gap:12px}
  .attach-menu-action:hover{background:var(--md-sys-color-surface-variant);border-color:transparent}
  .attach-menu-action .material-symbols-outlined{width:auto;height:auto;min-width:0;border-radius:0;background:transparent;color:inherit;display:block;font-size:22px}
  .attach-menu-action>span:last-child{font-size:14px;font-weight:400}
}
.attach-menu-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;padding-top:4px}
.attach-menu-action{min-height:64px;padding:10px 12px;border-radius:17px;background:color-mix(in srgb,var(--md-sys-color-surface-container) 88%,transparent);border:1px solid var(--md-sys-color-outline-variant);gap:10px}
.attach-menu-action:hover{background:var(--md-sys-color-surface-variant);border-color:var(--md-sys-color-primary)}
.attach-menu-action .material-symbols-outlined{width:36px;height:36px;min-width:36px;border-radius:12px;background:color-mix(in srgb,var(--md-sys-color-primary) 13%,transparent);color:var(--md-sys-color-primary);display:flex;align-items:center;justify-content:center;font-size:22px}
.attach-menu-action>span:last-child{font-size:13.5px;font-weight:600}
.menu-action-btn{display:flex;align-items:center;gap:10px;width:100%;padding:8px 11px;background:transparent;border:none;color:var(--md-sys-color-on-surface);font-family:inherit;font-size:13px;cursor:pointer;border-radius:10px;text-align:left;transition:background .2s}
.menu-action-btn .material-symbols-outlined{font-size:20px}
.menu-action-btn:hover{background:var(--md-sys-color-surface-variant)}
.menu-action-btn:active{transform:scale(.98)}
.menu-action-btn.danger{color:var(--md-sys-color-error)}
/* Контекст-меню сообщений (реакция/ответ/копировать/...): ещё компактнее */
#messageMenuDialog .menu-content{padding:10px;min-width:min(210px,100%)}
/* ================================================================
   КОМПАКТНОЕ КОНТЕКСТНОЕ МЕНЮ СООБЩЕНИЯ
   Всплывает над сообщением по одиночному тапу. Слой на весь экран
   прозрачный: он только ловит тап мимо и держит позицию карточки.
   Карточка — Matte Glass: размытие фона, полупрозрачная
   заливка, скруглённые плашки, мягкая тень БЕЗ свечения.
   Светлая и тёмная темы берутся из --md-sys-color-*, поэтому
   отдельных правил под темы не нужно.
   ================================================================ */
#messageMenuDialog{
  background:transparent;
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
  padding:0;
  align-items:flex-start;
  justify-content:flex-start;
  z-index:5200;
}
#messageMenuDialog .menu-content{
  position:fixed;
  left:0;top:0;
  min-width:0;
  width:max-content;
  max-width:min(70vw,250px);
  max-height:min(62vh,420px);
  padding:5px;
  border-radius:19px;
  background:color-mix(in srgb,var(--md-sys-color-surface) 80%,transparent);
  -webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  border:1px solid color-mix(in srgb,var(--md-sys-color-outline-variant) 55%,transparent);
  box-shadow:0 16px 36px -18px rgba(0,0,0,.55),0 2px 6px -3px rgba(0,0,0,.3);
  overflow-x:hidden;overflow-y:auto;
  overscroll-behavior:contain;
  animation:msgMenuIn .26s var(--ease-out-quint) forwards;
  transform-origin:var(--mm-origin,center center);
  transform:scale(.86);
}
@keyframes msgMenuIn{
  from{opacity:0;transform:scale(.86) translateY(6px)}
  to{opacity:1;transform:none}
}
@keyframes msgMenuOut{
  from{opacity:1;transform:none}
  to{opacity:0;transform:scale(.9) translateY(4px)}
}
/* Меню «⋯» рядом с кнопкой звонка: появляется «расплываясь» —
   размытие уходит вместе с масштабом от точки кнопки (как в Telegram). */
@keyframes chatMenuIn{
  from{opacity:0;filter:blur(9px);transform:scale(.9) translateY(6px)}
  to  {opacity:1;filter:blur(0);transform:none}
}
@keyframes chatMenuOut{
  from{opacity:1;filter:blur(0);transform:none}
  to  {opacity:0;filter:blur(6px);transform:scale(.96) translateY(4px)}
}
/* Морфинг из капсулы «вызов / ⋯»: меню стартует ровно в её габаритах
   и разворачивается в карточку, накрывая капсулу. Координаты и масштаб
   считаются в JS из rect капсулы и задаются CSS-переменными. */
@keyframes chatMenuFlipIn{
  from{
    opacity:.82;
    filter:blur(3px);
    transform:translate(var(--flip-x,0px),var(--flip-y,0px)) scale(var(--flip-sx,.3),var(--flip-sy,.1));
    border-radius:999px;
  }
  60%{
    opacity:1;
    filter:blur(0);
    border-radius:22px;
  }
  to{
    opacity:1;
    filter:blur(0);
    transform:none;
    border-radius:19px;
  }
}
@keyframes chatMenuFlipOut{
  from{opacity:1;filter:blur(0);transform:none;border-radius:19px}
  to{
    opacity:0;
    filter:blur(4px);
    transform:translate(var(--flip-x,0px),var(--flip-y,0px)) scale(var(--flip-sx,.3),var(--flip-sy,.1));
    border-radius:999px;
  }
}
#messageMenuDialog .menu-action-btn{
  padding:9px 12px;
  font-size:13.5px;
  gap:11px;
  border-radius:14px;
  white-space:nowrap;
  -webkit-user-select:none;
  user-select:none;
  touch-action:manipulation;
}
#messageMenuDialog .menu-action-btn:active{
  background:color-mix(in srgb,var(--md-sys-color-on-surface) 12%,transparent);
}
#messageMenuDialog #closeMessageMenuBtn{display:none}
#messageMenuDialog .menu-action-btn .material-symbols-outlined{font-size:19px}
/* Строки компактных меню (контекст сообщения и «…» чата) без своей
   плашки: в Matte Glass каждая кнопка получала отдельный полупрозрачный
   прямоугольник с блюром, и меню читалось как стопка пилюль. Теперь
   строки лежат прямо на стекле карточки, подсветка — только при
   наведении и нажатии. Правило по id сильнее glass-правила. */
#messageMenuDialog .menu-action-btn,
#chatMoreDialog .menu-action-btn{
  background:transparent;
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
}
#messageMenuDialog .menu-action-btn:hover,
#chatMoreDialog .menu-action-btn:hover{
  background:color-mix(in srgb,var(--md-sys-color-on-surface) 9%,transparent);
}
/* ================================================================
   ВЫПАДАЮЩЕЕ МЕНЮ ДЕЙСТВИЙ ЧАТА («…» в шапке)
   Не модалка: карточка выезжает из-под кнопки «…», без кнопки
   «Отмена». Закрывается тапом мимо (фон-слой), свайпом вбок и
   системной кнопкой «назад». Позицию считает positionChatMoreDialog().
   ================================================================ */
#chatMoreDialog{
  background:transparent;
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
  padding:0;
  align-items:flex-start;
  justify-content:flex-start;
  z-index:5200;
}
#chatMoreDialog .menu-content{
  position:fixed;
  left:0;top:0;
  width:min(76vw,272px);
  max-height:min(64vh,460px);
  padding:5px;
  border-radius:19px;
  /* Матовое стекло в духе Telegram: плотный фон, мягкая граница,
     внутренняя светлая линия сверху и слоистая тень. */
  background:color-mix(in srgb,var(--md-sys-color-surface-container) 82%,transparent);
  -webkit-backdrop-filter:blur(22px) saturate(160%);
  backdrop-filter:blur(22px) saturate(160%);
  border:1px solid color-mix(in srgb,var(--md-sys-color-outline-variant) 42%,transparent);
  box-shadow:0 24px 60px -20px rgba(0,0,0,.62),0 6px 18px -8px rgba(0,0,0,.4),inset 0 1px 0 rgba(255,255,255,.07);
  overflow-x:hidden;
  overflow-y:auto;
  overscroll-behavior:contain;
  transform-origin:var(--cm-origin, top right);
}
body.light-theme #chatMoreDialog .menu-content{
  background:color-mix(in srgb,var(--md-sys-color-surface-container) 90%,transparent);
  box-shadow:0 24px 60px -20px rgba(24,16,48,.28),0 6px 18px -8px rgba(24,16,48,.18),inset 0 1px 0 #fff;
}
#chatMoreDialog .menu-content h3{
  margin:3px 7px 5px;
  font-size:12.5px;
  font-weight:600;
  color:var(--md-sys-color-on-surface-variant);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
#chatMoreDialog .menu-action-btn{
  padding:9px 11px;
  font-size:13.5px;
  gap:11px;
  border-radius:14px;
  -webkit-user-select:none;
  user-select:none;
  touch-action:manipulation;
}
#chatMoreDialog .menu-action-btn:active{
  background:color-mix(in srgb,var(--md-sys-color-on-surface) 12%,transparent);
}
#chatMoreDialog .menu-action-btn .material-symbols-outlined{font-size:19px}
/* ================================================================
   МИНИ-ЧАТ ПО УДЕРЖАНИЮ АВАТАРКИ
   Небольшая карточка рядом с аватаркой: шапка, прокручиваемый список
   последних сообщений, кнопка «Открыть чат». Только просмотр — чат не
   открывается сам. Позицию считает positionAvatarPeek().
   ================================================================ */
#avatarPeekDialog{
  background:transparent;
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
  padding:0;
  align-items:flex-start;
  justify-content:flex-start;
  z-index:5300;
}
#avatarPeekDialog .avatar-peek{
  position:fixed;
  left:0;top:0;
  width:min(86vw,336px);
  max-height:min(74vh,540px);
  display:flex;flex-direction:column;
  padding:0;border-radius:20px;
  background:color-mix(in srgb,var(--md-sys-color-surface-container) 92%,transparent);
  -webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  border:1px solid color-mix(in srgb,var(--md-sys-color-outline-variant) 60%,transparent);
  box-shadow:0 20px 44px -20px rgba(0,0,0,.6),0 2px 8px -3px rgba(0,0,0,.35);
  overflow:hidden;
  transform-origin:var(--peek-origin, top left);
}
.avatar-peek-head{display:flex;align-items:center;gap:10px;padding:10px 10px 10px 12px;border-bottom:1px solid color-mix(in srgb,var(--md-sys-color-outline-variant) 55%,transparent)}
.avatar-peek-titles{flex:1;min-width:0}
/* Закрытие — крестик в правом верхнем углу окна мини-чата. */
.avatar-peek-close{width:30px;height:30px;flex:0 0 auto;border:none;border-radius:50%;background:transparent;color:var(--md-sys-color-on-surface-variant);display:flex;align-items:center;justify-content:center;transition:background .18s}
.avatar-peek-close:hover{background:color-mix(in srgb,var(--md-sys-color-on-surface) 10%,transparent)}
.avatar-peek-close .material-symbols-outlined{font-size:18px}
.avatar-peek-av{width:36px;height:36px;flex:0 0 auto;border-radius:50%;overflow:hidden;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--md-sys-color-primary) 18%,transparent);font-size:15px;font-weight:600}
.avatar-peek-av img{width:100%;height:100%;object-fit:cover;display:block}
.avatar-peek-name{font-size:14px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.avatar-peek-sub{font-size:11px;color:var(--md-sys-color-on-surface-variant);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.avatar-peek-list{flex:1 1 auto;min-height:150px;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding:10px;display:flex;flex-direction:column;align-items:flex-start;gap:6px}
.peek-msg{max-width:86%;padding:6px 10px 5px;border-radius:14px;font-size:13px;line-height:1.35;background:color-mix(in srgb,var(--md-sys-color-surface-variant) 92%,transparent);overflow-wrap:anywhere}
.peek-msg.own{align-self:flex-end;background:color-mix(in srgb,var(--md-sys-color-primary) 90%,transparent);color:var(--md-sys-color-on-primary)}
.peek-msg-author{font-size:10.5px;font-weight:600;opacity:.7;margin-bottom:2px}
.peek-msg-meta{font-size:10px;opacity:.6;text-align:right;margin-top:2px}
.peek-msg-media{display:flex;align-items:center;gap:5px;font-size:12px;opacity:.85;margin-bottom:2px}
.peek-msg-media .material-symbols-outlined{font-size:15px}
.peek-empty{padding:26px 10px;text-align:center;font-size:12.5px;color:var(--md-sys-color-on-surface-variant)}
.avatar-peek-foot{padding:8px 10px;border-top:1px solid color-mix(in srgb,var(--md-sys-color-outline-variant) 55%,transparent);display:flex}
.avatar-peek-foot .md-btn{flex:1;width:100%}
/* Своя строка ввода мини-чата: пишем прямо здесь, отправка — кнопкой
   или Enter. Кнопка «Открыть чат» стоит ниже, под строкой ввода. */
.avatar-peek-composer{display:flex;align-items:center;gap:6px;padding:8px 10px;border-top:1px solid color-mix(in srgb,var(--md-sys-color-outline-variant) 55%,transparent)}
.avatar-peek-input{flex:1;min-width:0;height:36px;border-radius:18px;padding:0 12px;border:1px solid color-mix(in srgb,var(--md-sys-color-outline-variant) 60%,transparent);background:color-mix(in srgb,var(--md-sys-color-surface) 84%,transparent);color:var(--md-sys-color-on-surface);font-family:inherit;font-size:13px;outline:none;-webkit-tap-highlight-color:transparent}
.avatar-peek-input:focus{border-color:color-mix(in srgb,var(--md-sys-color-primary) 55%,transparent)}
.avatar-peek-input::placeholder{color:var(--md-sys-color-on-surface-variant);opacity:.8}
.avatar-peek-send{width:36px;height:36px;flex:0 0 auto;border:none;border-radius:50%;background:var(--md-sys-color-primary);color:var(--md-sys-color-on-primary);display:flex;align-items:center;justify-content:center;transition:opacity .18s}
.avatar-peek-send:disabled{opacity:.4;cursor:default}
.avatar-peek-send .material-symbols-outlined{font-size:18px}
/* Уменьшенное превью медиа: миниатюры фото, первый кадр видео. */
.peek-msg-thumbs{display:flex;flex-wrap:wrap;gap:4px;margin-bottom:3px}
.peek-msg-thumbs.multi{max-width:172px}
.peek-msg-thumb{position:relative;width:118px;height:88px;border-radius:12px;overflow:hidden;background:color-mix(in srgb,var(--md-sys-color-surface) 70%,transparent);flex:0 0 auto}
.peek-msg-thumb img,.peek-msg-thumb video{width:100%;height:100%;object-fit:cover;display:block}
.peek-msg-thumbs.multi .peek-msg-thumb{width:84px;height:64px}
.peek-thumb-fallback{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;gap:5px;font-size:12px;color:var(--md-sys-color-on-surface-variant)}
.peek-thumb-play{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:32px;height:32px;border-radius:50%;background:rgba(0,0,0,.55);color:#fff;display:flex;align-items:center;justify-content:center}
.peek-thumb-play .material-symbols-outlined{font-size:17px}
.peek-msg-thumb.is-broken .peek-thumb-play{display:none}
.peek-msg-sticker{width:112px;height:112px;object-fit:contain;border-radius:14px;background:color-mix(in srgb,var(--md-sys-color-surface) 60%,transparent)}
/* Аватарки с удержанием: без системного меню и выделения текста. */
.peek-avatar{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;cursor:pointer}
.attachment-picker-content{width:min(440px,calc(100vw - 28px));max-width:440px;padding:18px}
.attachment-picker-head,.media-gallery-head{display:flex;align-items:center;gap:12px}
.attachment-picker-head h3,.media-gallery-head h3{margin:0;font-size:18px}
.attachment-picker-head p,.media-gallery-head p{margin:3px 0 0;color:var(--md-sys-color-on-surface-variant);font-size:12px}
.attachment-picker-head>div:first-child,.media-gallery-head>div:nth-child(2){flex:1;min-width:0}
.icon-btn{width:38px;height:38px;border-radius:50%;border:none;background:var(--md-sys-color-surface-container);color:var(--md-sys-color-on-surface);display:inline-flex;align-items:center;justify-content:center;cursor:pointer;flex-shrink:0}
.icon-btn .material-symbols-outlined{font-size:21px}
.attachment-choice-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:18px 0}
.attachment-choice{min-height:116px;border:1px solid var(--md-sys-color-outline-variant);border-radius:20px;background:var(--md-sys-color-surface-container);color:var(--md-sys-color-on-surface);display:flex;flex-direction:column;align-items:flex-start;justify-content:center;gap:5px;padding:14px;cursor:pointer;font-family:inherit;text-align:left;transition:transform .2s,background .2s,border-color .2s}
.attachment-choice:hover{background:var(--md-sys-color-surface-variant);border-color:var(--md-sys-color-primary);transform:translateY(-2px)}
.attachment-choice:active{transform:scale(.97)}
.attachment-choice .material-symbols-outlined{font-size:30px;color:var(--md-sys-color-primary)}
.attachment-choice strong{font-size:14px}
.attachment-choice small{font-size:10.5px;color:var(--md-sys-color-on-surface-variant)}
.attachment-picker-cancel{width:100%}
.media-gallery-content{width:min(720px,calc(100vw - 20px));max-width:720px;height:min(720px,calc(100dvh - 28px));max-height:calc(100dvh - 28px);padding:14px;display:flex;flex-direction:column;overflow:hidden!important}
.media-gallery-head{flex-shrink:0}
.media-gallery-pick{display:inline-flex;align-items:center;gap:6px;padding:9px 13px;font-size:12px;white-space:nowrap}
.media-gallery-pick .material-symbols-outlined{font-size:18px}
.media-gallery-tabs{display:flex;gap:6px;padding:12px 0 10px;flex-shrink:0}
.media-gallery-tab{border:none;border-radius:999px;padding:8px 15px;background:var(--md-sys-color-surface-container);color:var(--md-sys-color-on-surface-variant);font-family:inherit;font-size:12px;font-weight:600;cursor:pointer}
.media-gallery-tab.active{background:var(--md-sys-color-primary);color:var(--md-sys-color-on-primary)}
.media-gallery-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(92px,1fr));gap:7px;overflow-y:auto;align-content:start;padding:2px 2px 8px;min-height:0;flex:1}
.media-gallery-grid:empty{display:none}
.media-gallery-item{position:relative;aspect-ratio:1;border-radius:14px;overflow:hidden;background:var(--md-sys-color-surface-container);border:2px solid transparent;cursor:pointer}
.media-gallery-item.selected{border-color:var(--md-sys-color-primary);box-shadow:0 0 0 2px color-mix(in srgb,var(--md-sys-color-primary) 25%,transparent)}
.media-gallery-item img,.media-gallery-item video{width:100%;height:100%;object-fit:cover;display:block}
.media-gallery-item video{pointer-events:none}
.media-gallery-check{position:absolute;right:6px;top:6px;width:24px;height:24px;border-radius:50%;background:rgba(0,0,0,.55);color:#fff;display:flex;align-items:center;justify-content:center;font-size:16px}
.media-gallery-item.selected .media-gallery-check{background:var(--md-sys-color-primary)}
.media-gallery-empty{display:none;flex:1;min-height:0;flex-direction:column;align-items:center;justify-content:center;gap:9px;color:var(--md-sys-color-on-surface-variant);text-align:center;padding:28px}
.media-gallery-empty .material-symbols-outlined{font-size:54px;opacity:.45}
.media-gallery-empty strong{font-size:14px;color:var(--md-sys-color-on-surface)}
.media-gallery-empty small{font-size:11.5px}
.media-gallery-empty.visible{display:flex}
.media-gallery-footer{display:flex;align-items:center;justify-content:space-between;gap:12px;padding-top:11px;border-top:1px solid var(--md-sys-color-outline-variant);flex-shrink:0;color:var(--md-sys-color-on-surface-variant);font-size:12px}
.media-gallery-footer .md-btn{min-width:120px}
@media (max-width:420px){.attachment-choice-grid{gap:8px}.attachment-choice{min-height:104px;padding:11px}.media-gallery-content{width:calc(100vw - 12px);max-height:calc(100dvh - 12px);border-radius:22px}.media-gallery-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
.menu-dialog{position:fixed;top:0;left:0;width:100vw;height:100vh;background:rgba(0,0,0,.55);z-index:5000;display:none;align-items:center;justify-content:center;padding:16px;padding-left:calc(16px + var(--safe-left));padding-right:calc(16px + var(--safe-right));backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));animation:fadeIn .2s ease}
.menu-content{background:var(--md-sys-color-surface);border-radius:24px;padding:16px;min-width:min(240px,100%);max-width:min(90vw,100%);max-height:85vh;overflow-y:auto;box-shadow:0 32px 80px -20px rgba(0,0,0,.6);animation:dialogIn .38s var(--ease-out-quint)}
.menu-content h3{margin-bottom:12px;font-weight:600;font-size:16px}
/* Единые окна настроек: одинаковая ширина и высота (образец — «Конфиденциальность») */
/* Ширина берётся от доступного места внутри диалога (100%),
   а не от 100vw: иначе полоса прокрутки/безопасные зоны устройства
   делают окно шире экрана и оно уезжает влево — левые элементы
   и кнопки обрезаются. */
.menu-content.settings-window{display:flex;flex-direction:column;width:min(100%,420px);max-width:min(420px,100%);height:min(78vh,520px);max-height:520px;overflow:hidden}
.settings-window h3{flex:0 0 auto}
.settings-window > .settings-sub-list,.settings-window .settings-window-body{flex:1 1 auto;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;padding-right:4px;margin-right:-4px}
.settings-window > [data-close-sub]{flex:0 0 auto}
@media (max-width:768px){
  .menu-content.settings-window{width:min(100%,420px);height:min(78vh,520px)}
}
#mobileSelectionBar,#desktopSelectionBar{position:relative;z-index:40;flex-shrink:0}
.selection-bar{position:relative;top:0;left:0;right:0;z-index:20;background:var(--md-sys-color-surface-container);border:1px solid var(--md-sys-color-outline-variant);border-radius:18px;margin:8px 12px 0;padding:12px 14px;display:flex;align-items:center;gap:12px;animation:slideInDown .25s ease}
.selection-bar .sel-count{font-weight:600;font-size:15px;flex:1}

.settings-menu-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
@media (max-width:360px){.settings-menu-grid{grid-template-columns:1fr}}
.settings-menu-card{display:flex;flex-direction:column;align-items:flex-start;gap:6px;padding:16px 14px;border-radius:18px;border:1.5px solid var(--md-sys-color-outline-variant);background:var(--md-sys-color-surface-container);color:var(--md-sys-color-on-surface);cursor:pointer;text-align:left;transition:transform .22s cubic-bezier(.34,1.56,.64,1),background .22s,border-color .22s;font-family:inherit}
.settings-menu-card:hover{background:var(--md-sys-color-surface-variant);border-color:var(--md-sys-color-primary);transform:translateY(-2px)}
.settings-menu-card:active{transform:scale(.97)}
.settings-menu-card .material-symbols-outlined{font-size:26px;color:var(--md-sys-color-primary);margin-bottom:4px}
.settings-menu-card .smc-title{font-size:14px;font-weight:600}
.settings-menu-card .smc-sub{font-size:11.5px;opacity:.65;line-height:1.3}
/* Длинные слова («Конфиденциальность») не должны растягивать колонки сетки */
.settings-menu-card{min-width:0}
.settings-menu-card .smc-title,.settings-menu-card .smc-sub{overflow-wrap:anywhere;max-width:100%}

/* Карточка раздела «Дополнительно» — в двое тоньше обычной карточки меню */
.settings-menu-card-compact{display:flex;flex-direction:row;align-items:center;gap:10px;padding:8px 10px;border-radius:14px;border:1px solid var(--md-sys-color-outline-variant);background:var(--md-sys-color-surface-container);color:var(--md-sys-color-on-surface);cursor:pointer;text-align:left;transition:background .2s;width:100%;min-width:0;max-width:100%;box-sizing:border-box;margin-top:14px}
.settings-menu-card-compact:hover{background:var(--md-sys-color-surface-variant)}
.settings-menu-card-compact:active{transform:scale(.97)}
.settings-menu-card-compact .material-symbols-outlined{font-size:22px;color:var(--md-sys-color-primary);margin-bottom:0}
.settings-menu-card-compact .smc-title{font-size:13px;font-weight:600}
.settings-menu-card-compact .smc-sub{font-size:10.5px;opacity:.65;line-height:1.3}

/* Кнопка «Дополнительно» — та же ширина, что и карточка подписки Select */
#extraOpenBtn{
  width:calc(100% - 8px) !important;
  margin:14px 4px 4px !important;
}

/* Раздел «Дополнительно» — растягивается на обе колонки grid */
.settings-section-extra{grid-column:1/-1;display:flex;flex-direction:column;gap:8px;margin-top:12px;min-width:0;width:100%;box-sizing:border-box}
.settings-section-title{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:1px;color:var(--md-sys-color-on-surface-variant);opacity:.65;margin:0 4px 6px;padding-left:4px}
.settings-extra-btn{width:100%;margin:0 0 8px;padding:10px 14px;border-radius:14px;border:1px solid var(--md-sys-color-outline-variant);background:transparent;color:var(--md-sys-color-on-surface);font-family:inherit;font-size:13.5px;cursor:pointer;text-align:left;transition:background .2s;box-sizing:border-box}
.settings-extra-btn:hover{background:var(--md-sys-color-surface-variant)}

/* Карточки в окне «Дополнительно»: иконка + текст + стрелочка в одну строку,
   компактные, текст до двух строк, не растягиваются «как попало» */
#extraDialog .settings-window-body .settings-menu-card{
  display:flex !important;
  flex-direction:row !important;
  align-items:center !important;
  justify-content:space-between !important;
  gap:10px !important;
  margin:0 auto 3px !important;
  width:335px !important;
  max-width:335px !important;
  padding:8px 12px !important;
  border-radius:12px !important;
}
#extraDialog .settings-window-body .settings-menu-card > div{
  flex:1 1 auto !important;
  min-width:0 !important;
  overflow-wrap:anywhere !important;
  white-space:normal !important;
}
#extraDialog .settings-window-body .settings-menu-card .material-symbols-outlined:first-child{
  font-size:20px !important;
  flex-shrink:0 !important;
  margin-bottom:0 !important;
}
#extraDialog .settings-window-body .settings-menu-card .material-symbols-outlined:last-child{
  font-size:18px !important;
  flex-shrink:0 !important;
  opacity:.5 !important;
  margin-bottom:0 !important;
}
#extraDialog .settings-window-body .settings-menu-card .smc-title{
  font-size:13px !important;
  line-height:1.2 !important;
  margin:0 0 2px 0 !important;
}
#extraDialog .settings-window-body .settings-menu-card .smc-sub{
  font-size:11px !important;
  line-height:1.2 !important;
  opacity:.7 !important;
  margin:0 !important;
}
#extraDialog .settings-window-body{overflow-x:hidden}
/* Вертикальный скролл в окнах настроек оставить, горизонтальный — убрать */
.menu-dialog.sw-full .settings-window-body{overflow-y:auto;overflow-x:hidden}

.favorites-button{display:flex;align-items:center;gap:14px;width:calc(100% - 8px);margin:10px 4px 4px;padding:14px 16px;border-radius:18px;border:1px solid var(--md-sys-color-outline-variant);background:var(--md-sys-color-surface-container);color:var(--md-sys-color-on-surface);font-family:inherit;cursor:pointer;text-align:left;transition:transform .22s cubic-bezier(.34,1.56,.64,1),background .22s,border-color .22s}
.favorites-button:hover{background:var(--md-sys-color-surface-variant);border-color:var(--md-sys-color-primary);transform:translateY(-1px)}
.favorites-button:active{transform:scale(.98)}
.favorites-button > .material-symbols-outlined:first-child{font-size:26px;color:var(--md-sys-color-primary);flex-shrink:0}
.favorites-button .fb-text{flex:1;min-width:0}
.favorites-button .fb-title{font-size:14px;font-weight:600}
.favorites-button .fb-sub{font-size:11.5px;opacity:.65;margin-top:2px;line-height:1.3}
.favorites-button .fb-arrow{color:var(--md-sys-color-on-surface-variant);font-size:22px;opacity:.55;flex-shrink:0;transition:transform .22s,opacity .22s}
/* Плитка подписки Select (профиль) */
/* Плитка подписки Select — плоский стиль (без градиентов) + анимации */
.select-plan-card{display:flex;align-items:center;gap:12px;width:calc(100% - 8px);margin:14px 4px 4px;padding:13px 14px;border-radius:18px;border:1px solid var(--md-sys-color-outline-variant);background:var(--md-sys-color-surface-container);color:var(--md-sys-color-on-surface);font-family:inherit;cursor:pointer;text-align:left;position:relative;overflow:hidden;transition:transform .24s cubic-bezier(.34,1.56,.64,1),box-shadow .25s,border-color .25s,background-color .25s;animation:profileCardIn .52s cubic-bezier(.22,1.15,.36,1) .3s both}
.select-plan-card:hover{transform:translateY(-3px);border-color:var(--md-sys-color-primary);box-shadow:0 14px 26px -18px rgba(0,0,0,.85)}
.select-plan-card:active{transform:translateY(-1px) scale(.985)}
.select-plan-card .select-plan-icon{position:relative;width:40px;height:40px;flex:0 0 auto;border-radius:13px;display:flex;align-items:center;justify-content:center;font-size:22px;color:#fff;background:var(--md-sys-color-primary);box-shadow:0 6px 14px -8px rgba(0,0,0,.7);animation:selectIconFloat 3.6s ease-in-out infinite;will-change:transform}
.select-plan-card .select-plan-icon::before,.select-plan-card .select-plan-icon::after{content:'';position:absolute;border-radius:2px;background:var(--md-sys-color-primary);opacity:0;animation:selectSpark 3.6s ease-in-out infinite}
.select-plan-card .select-plan-icon::before{width:6px;height:6px;top:-7px;right:-8px}
.select-plan-card .select-plan-icon::after{width:4px;height:4px;bottom:-6px;left:-7px;animation-delay:1.4s}
.select-plan-card .select-plan-text{flex:1;min-width:0}
.select-plan-card .select-plan-title{font-size:14.5px;font-weight:700;letter-spacing:.2px}
.select-plan-card .select-plan-sub{font-size:11.5px;opacity:.65;margin-top:2px;line-height:1.35}
.select-plan-card .select-plan-cta{flex:0 0 auto;display:flex;align-items:center;gap:2px;font-size:12.5px;font-weight:700;color:#fff;background:var(--md-sys-color-primary);border-radius:999px;padding:8px 13px;white-space:nowrap;transition:transform .22s cubic-bezier(.34,1.56,.64,1),background-color .25s}
.select-plan-card:hover .select-plan-cta{transform:translateX(3px)}
.select-plan-card .select-plan-cta .material-symbols-outlined{font-size:18px;display:block}
.select-plan-card.is-active{border-color:#22c55e}
.select-plan-card.is-busy{opacity:.7;pointer-events:none}
.select-plan-card.is-active .select-plan-icon{background:#16a34a;animation-duration:4.4s}
.select-plan-card.is-active .select-plan-icon::before,.select-plan-card.is-active .select-plan-icon::after{background:#16a34a}
.select-plan-card.is-active .select-plan-cta{background:#16a34a;padding:8px 11px}
.select-plan-card.just-activated{animation:selectActivated .75s cubic-bezier(.34,1.56,.64,1)}
.select-plan-card.just-activated .select-plan-cta .material-symbols-outlined{animation:selectCheckPop .55s cubic-bezier(.34,1.56,.64,1)}
@keyframes selectIconFloat{0%,100%{transform:translateY(0) rotate(0)}50%{transform:translateY(-3px) rotate(-6deg)}}
@keyframes selectSpark{0%,70%,100%{opacity:0;transform:scale(.4)}82%{opacity:.9;transform:scale(1)}}
@keyframes selectActivated{0%{transform:scale(1)}30%{transform:scale(1.045) translateY(-4px)}62%{transform:scale(.99)}100%{transform:scale(1)}}
@keyframes selectCheckPop{0%{transform:scale(.2) rotate(-35deg);opacity:0}60%{transform:scale(1.3);opacity:1}100%{transform:scale(1);opacity:1}}
body.no-animations #panelContent .select-plan-card,
body.no-animations #panelContent .select-plan-card .select-plan-icon,
body.no-animations #panelContent .select-plan-card .select-plan-icon::before,
body.no-animations #panelContent .select-plan-card .select-plan-icon::after,
body.no-animations #panelContent .select-plan-card.just-activated,
body.no-animations #panelContent .select-plan-card.just-activated .select-plan-cta .material-symbols-outlined{animation:none !important}
.favorites-button:hover .fb-arrow{transform:translateX(2px);opacity:.85}

.profile-panel-hero{display:flex;flex-direction:column;align-items:center;padding:24px 18px 10px;transform-origin:top center;will-change:transform,opacity,filter,height;backface-visibility:hidden;-webkit-backface-visibility:hidden;contain:layout style}
.profile-hero{transform-origin:top center;will-change:transform,opacity,filter;backface-visibility:hidden;-webkit-backface-visibility:hidden}
body.no-animations .profile-panel-hero,body.no-animations .profile-hero{will-change:auto}

.segmented-switch{position:relative;display:flex;width:100%;padding:4px;border-radius:999px;background:var(--md-sys-color-surface-variant);border:1px solid var(--md-sys-color-outline-variant);overflow:hidden;user-select:none}
.segmented-thumb{position:absolute;top:4px;bottom:4px;left:4px;width:calc(50% - 4px);border-radius:999px;background:var(--md-sys-color-primary);box-shadow:0 4px 12px -4px rgba(0,0,0,.5);transition:transform .32s cubic-bezier(.22,1,.36,1),background .3s ease;z-index:1;will-change:transform}
.segmented-switch[data-value="glass"] .segmented-thumb,.segmented-switch[data-value="rain"] .segmented-thumb,.segmented-switch[data-value="dark"] .segmented-thumb{transform:translateX(100%)}
.segmented-btn{position:relative;z-index:2;flex:1;padding:9px 14px;border:none;background:transparent;font-family:inherit;font-size:12.5px;font-weight:600;color:var(--md-sys-color-on-surface-variant);cursor:pointer;border-radius:999px;transition:color .25s ease,background .25s ease;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.segmented-btn.active{color:var(--md-sys-color-on-primary);background:var(--md-sys-color-primary)}
/* Переключатель (segmented-switch): «капля» при смене сегмента —
   деформация капсулы thumb через scale (transform занят translateX по
   позиции сегмента, поэтому scale не конфликтует и накладывается), как
   у тумблера дока. */
.segmented-thumb{transition:transform .32s cubic-bezier(.22,1,.36,1),scale .22s cubic-bezier(.32,.72,0,1),background .3s ease}
.segmented-thumb.dropping{animation:segmentDrop .46s cubic-bezier(.32,.72,0,1)}
@keyframes segmentDrop{
  0%{scale:1 1}
  35%{scale:1.07 .93}
  70%{scale:.97 1.03}
  100%{scale:1 1}
}
/* Пока «таблетка» переключателя едет к новому сегменту, активная кнопка
   на старом месте не гаснет под ней (и не исчезает на тёмном фоне). */
.segmented-switch.traveling .segmented-btn.active{
  color:var(--md-sys-color-on-surface-variant)
}

.profile-embedded-section{margin:8px 0 12px;padding:0 4px}
.profile-embedded-section .settings-menu-grid{grid-template-columns:1fr 1fr;gap:8px}
.profile-embedded-section .settings-menu-card{padding:12px 10px;border-radius:14px;gap:4px}
.profile-embedded-section .settings-menu-card .material-symbols-outlined{font-size:22px;margin-bottom:2px}
.profile-embedded-section .settings-menu-card .smc-title{font-size:12.5px}
.profile-embedded-section .settings-menu-card .smc-sub{font-size:10.5px}
.profile-section-title{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.8px;color:var(--md-sys-color-on-surface-variant);opacity:.65;margin:14px 10px 8px}
.settings-sub-list{display:flex;flex-direction:column;gap:2px}
.settings-section{padding:14px 0;border-bottom:1px solid var(--md-sys-color-outline-variant)}
.settings-section:last-child{border-bottom:none}
.settings-section h4{font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:1px;color:var(--md-sys-color-on-surface-variant);margin-bottom:10px;opacity:.7}
.settings-row{display:flex;align-items:center;gap:12px;padding:10px 8px;cursor:pointer;border-radius:12px;transition:background .2s,transform .15s}
.settings-row:hover{background:var(--md-sys-color-surface-variant)}
.settings-row .material-symbols-outlined{color:var(--md-sys-color-primary)}
/* min-width:0 + перенос: без этого широкий шрифт (Press Start 2P и т.п.)
   раздувает текстовую колонку и выталкивает .pt-switch за край карточки */
.settings-row>div{min-width:0}
.settings-row>.material-symbols-outlined{flex-shrink:0}
.settings-row .sr-title{flex:1;font-size:14px;min-width:0;overflow-wrap:anywhere}
.settings-row .sr-sub{font-size:11px;color:var(--md-sys-color-on-surface-variant);margin-top:2px;min-width:0;overflow-wrap:anywhere}
/* Пробел между карточками в разделе «Функции» */
#settingsFeaturesDialog .settings-window-body>*+*{margin-top:10px}
.settings-row.active{background:color-mix(in srgb,var(--md-sys-color-primary) 16%,transparent);box-shadow:inset 0 0 0 2px color-mix(in srgb,var(--md-sys-color-primary) 65%,transparent)}
.settings-row.settings-toggle{cursor:pointer}
.settings-row.settings-toggle .pt-switch{width:46px;height:28px;box-sizing:border-box;border-radius:999px;background:var(--md-sys-color-surface-variant);position:relative;transition:background .25s;flex-shrink:0;border:2px solid var(--md-sys-color-outline)}
.settings-row.settings-toggle .pt-switch:active{transform:scale(.96)}
/* Ползунок центрируется по вертикали и уезжает ровно на ширину
   свободного места: при 2px-рамке 46px он больше не сидел криво. */
.settings-row.settings-toggle .pt-switch::after{content:'';position:absolute;top:50%;left:3px;margin-top:-9px;width:18px;height:18px;border-radius:50%;background:var(--md-sys-color-on-surface);opacity:.7;transition:transform .32s cubic-bezier(.22,1,.36,1),background .3s,opacity .3s;box-shadow:0 1px 3px rgba(0,0,0,.35)}
.settings-row.settings-toggle.active .pt-switch{background:var(--md-sys-color-primary);border-color:var(--md-sys-color-primary)}
.settings-row.settings-toggle.active .pt-switch::after{transform:translateX(21px);background:var(--md-sys-color-on-primary);opacity:1}
/* Тумблер настроек — «переливание» при клике, как в док-баре: капсула
   кратковременно деформируется (scale), translateX ползунка (::after)
   остаётся нетронутым — свойства не конфликтуют и накладываются. */
@keyframes ptDrop{
  0%{scale:1 1}
  35%{scale:1.07 .93}
  70%{scale:.97 1.03}
  100%{scale:1 1}
}
.settings-row.settings-toggle .pt-switch.toggling,
.public-toggle-row .pt-switch.toggling{
  animation:ptDrop .46s cubic-bezier(.32,.72,0,1)
}
.chip-row{display:flex;gap:6px;flex-wrap:wrap}
.chip{display:inline-flex;align-items:center;justify-content:center;text-align:center;line-height:1.2;white-space:nowrap;padding:10px 14px;border-radius:999px;border:none;background:transparent;color:var(--md-sys-color-on-surface);font-family:inherit;font-weight:600;font-size:14px;cursor:pointer;transition:all .2s;flex:1;min-width:60px}
.chip:nth-child(1){font-size:12px}
.chip:nth-child(2){font-size:14px}
.chip:nth-child(3){font-size:16px}
.chip:nth-child(4){font-size:18px}
.chip:hover{border-color:var(--md-sys-color-primary)}
.chip.active{background:var(--md-sys-color-primary);color:var(--md-sys-color-on-primary);border-color:transparent}
/* Выбор шрифта интерфейса */
.font-list{display:flex;flex-direction:column;gap:6px}
.font-row{display:flex;align-items:center;gap:10px;width:100%;padding:11px 14px;border-radius:14px;border:1.5px solid var(--md-sys-color-outline-variant);background:transparent;color:var(--md-sys-color-on-surface);font-family:inherit;text-align:left;cursor:pointer;transition:border-color .2s,background .2s,transform .15s}
.font-row:hover{border-color:var(--md-sys-color-primary);transform:translateY(-1px)}
.font-row:active{transform:scale(.99)}
.font-row .font-name{flex:1;min-width:0;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.font-row[data-font="comfortaa"] .font-name{font-family:'Comfortaa',sans-serif}
.font-row[data-font="press"] .font-name{font-family:'Press Start 2P','Comfortaa',monospace;font-size:10.5px;letter-spacing:0}
.font-row[data-font="unbounded"] .font-name{font-family:'Unbounded','Comfortaa',sans-serif;font-weight:500}
.font-row[data-font="custom"] .font-name{font-family:'AvenCustomFont','Comfortaa',sans-serif}
.font-row[data-font="custom"] .font-name{font-family:'AvenCustomFont','Comfortaa',sans-serif}
.font-row .font-check{font-size:20px;opacity:0;transform:scale(.6);color:var(--md-sys-color-primary);transition:opacity .2s,transform .2s}
.font-row.active{border-color:transparent;background:color-mix(in srgb,var(--md-sys-color-primary) 12%,transparent)}
.font-row.active .font-check{opacity:1;transform:scale(1)}
body[data-matte="glass"] .font-row{background:color-mix(in srgb,var(--md-sys-color-surface-container) 40%,transparent);border-color:color-mix(in srgb,var(--md-sys-color-outline-variant) 55%,transparent)}
body[data-matte="glass"] .font-row.active{background:color-mix(in srgb,var(--md-sys-color-primary) 16%,transparent)}
@media (max-width:360px){.font-row{padding:10px 12px}.font-row .font-name{font-size:13px}}
.wallpaper-row{display:flex;gap:8px;flex-wrap:wrap}
/* У активного превью кольцо (box-shadow) выходит за пределы кнопки,
   а контейнер обрезает всё, что левее собственной границы — поэтому
   ряд кнопок сдвинут немного вправо, чтобы бордер не срезался. */
#wallpaperRow{padding-left:6px}
.wp-swatch{width:56px;height:56px;border-radius:14px;border:2px solid transparent;cursor:pointer;color:#fff;font-size:20px;display:flex;align-items:center;justify-content:center;transition:transform .2s,border-color .2s;position:relative;overflow:hidden}
.wp-swatch:hover{transform:scale(1.05)}
.wp-swatch.active{border-color:transparent;box-shadow:0 0 0 2px var(--md-sys-color-primary)}
.wp-swatch.active::after{content:'✓';position:absolute;right:4px;bottom:2px;font-size:12px;font-weight:700;color:var(--md-sys-color-primary);background:var(--md-sys-color-surface);border-radius:50%;width:16px;height:16px;display:flex;align-items:center;justify-content:center}

#mediaViewer{position:fixed;inset:0;background:rgba(0,0,0,.96);z-index:300;display:none;flex-direction:column;opacity:0;transition:opacity .3s}
#mediaViewer.active{display:flex;opacity:1}
#mediaViewer .mv-stage{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding:64px 68px calc(88px + var(--safe-bottom)) 68px;overflow:hidden}
#mediaViewer .mv-stage > img,#mediaViewer .mv-stage > .vp-wrap > video{max-width:92vw;max-height:82vh;width:auto;height:auto;object-fit:contain;display:block;border-radius:10px;background:#000}
#mediaViewer .vp-wrap{max-width:92vw;max-height:82vh;display:inline-flex;align-items:center;justify-content:center;position:relative}
#mediaViewer .mv-close{position:absolute;top:max(14px,var(--safe-top));right:14px;width:42px;height:42px;border-radius:50%;border:none;background:rgba(255,255,255,.12);color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;z-index:10}
#mediaViewer .mv-top{position:absolute;top:max(14px,var(--safe-top));left:14px;right:70px;display:flex;align-items:center;gap:12px;z-index:10;color:#fff;height:42px}
#mediaViewer .mv-title{font-size:13px;opacity:.85;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#mediaViewer .mv-nav{position:absolute;top:50%;transform:translateY(-50%);width:44px;height:44px;border-radius:50%;border:none;background:rgba(255,255,255,.12);color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;z-index:10}
#mediaViewer .mv-nav.prev{left:12px}
#mediaViewer .mv-nav.next{right:12px}
#mediaViewer .mv-bottom{position:absolute;left:0;right:0;bottom:0;padding:12px 16px;padding-bottom:max(12px,var(--safe-bottom));background:linear-gradient(to top,rgba(0,0,0,.9),transparent);display:flex;align-items:center;gap:12px;color:#fff;z-index:9}
#mediaViewer .mv-actions{display:flex;gap:8px}
#mediaViewer .mv-action{width:42px;height:42px;border-radius:50%;border:none;background:rgba(255,255,255,.14);color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center}
#mediaViewer .mv-counter{flex:1;text-align:center;font-size:12px;opacity:.7}

/* ================================================================
   ВСТРОЕННЫЙ ПРОСМОТР ССЫЛОК
   Карточка прижата к верху с отступом ~26px и не достаёт до низа:
   сверху и снизу видна лента чата, поэтому понятно, что сайт открыт
   «поверх» мессенджера, а не увёл пользователя из приложения.
   Верхние углы скруглены сильнее (28px), нижние — чуть меньше: окно
   читается как поднятый лист. Иконка и крестик в шапке, тело занято
   iframe — сайты подгружаются во весь оставшийся прямоугольник.
   ================================================================ */
#linkViewerOverlay{
  position:fixed;inset:0;z-index:310;display:none;opacity:0;transition:opacity .28s;
}
#linkViewerOverlay.active{display:block;opacity:1}
#linkViewerOverlay .link-viewer-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.58)}
#linkViewerOverlay .link-viewer-card{
  position:absolute;inset:26px 0 0 0;
  display:flex;flex-direction:column;
  border-radius:28px 28px 16px 16px;overflow:hidden;
  background:var(--md-sys-color-surface);
  box-shadow:0 32px 80px -20px rgba(0,0,0,.6);
  animation:linkViewerPop .28s cubic-bezier(.34,1.56,.64,1);
}
@keyframes linkViewerPop{from{opacity:0;transform:translateY(-10px) scale(.985)}to{opacity:1;transform:none}}
#linkViewerOverlay .link-viewer-head{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  padding:12px 12px 12px 16px;flex-shrink:0;
  background:var(--md-sys-color-surface-container-high);
}
#linkViewerOverlay .link-viewer-site{display:flex;align-items:center;gap:10px;min-width:0}
#linkViewerOverlay .link-viewer-fav{
  width:38px;height:38px;border-radius:11px;background:rgba(128,128,128,.16);
  display:flex;align-items:center;justify-content:center;flex-shrink:0;overflow:hidden;
}
#linkViewerOverlay .link-viewer-fav img{width:24px;height:24px;object-fit:contain}
#linkViewerOverlay .link-viewer-meta{min-width:0}
#linkViewerOverlay .link-viewer-name{
  font-size:14px;font-weight:600;line-height:1.25;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
#linkViewerOverlay .link-viewer-url{
  font-size:11px;opacity:.58;margin-top:1px;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
#linkViewerOverlay .link-viewer-actions{display:flex;gap:6px;flex-shrink:0}
#linkViewerOverlay .link-viewer-btn{
  width:36px;height:36px;border-radius:50%;border:none;cursor:pointer;flex-shrink:0;
  display:flex;align-items:center;justify-content:center;
  background:rgba(128,128,128,.16);color:inherit;
}
#linkViewerOverlay .link-viewer-btn:hover{background:rgba(128,128,128,.28)}
#linkViewerOverlay .link-viewer-btn .material-symbols-outlined{font-size:20px}
#linkViewerOverlay .link-viewer-body{
  flex:1;min-height:0;position:relative;
  background:var(--md-sys-color-surface-container-lowest);
}
#linkViewerOverlay .link-viewer-body iframe{
  position:absolute;inset:0;width:100%;height:100%;border:0;
  background:#fff;   /* сайты в подавляющем большинстве светлые */
}
/* На телефоне шапка компактнее, сама карточка оставляет меньше полей. */
@media (max-width:768px){
  #linkViewerOverlay .link-viewer-card{inset:26px 0 0 0;border-radius:28px 28px 14px 14px}
  #linkViewerOverlay .link-viewer-head{padding:10px 8px 10px 12px}
  #linkViewerOverlay .link-viewer-name{font-size:13px}
}
@media (prefers-reduced-motion:reduce){
  #linkViewerOverlay .link-viewer-card{animation:none}
}

.vp-controls{position:absolute;left:12px;right:12px;bottom:12px;padding:10px 12px;border-radius:14px;background:rgba(0,0,0,.55);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));display:flex;align-items:center;gap:10px;color:#fff;opacity:0;transition:opacity .3s;z-index:2}
.vp-wrap:hover .vp-controls,.vp-wrap.show-controls .vp-controls{opacity:1}
.vp-btn{width:34px;height:34px;border-radius:50%;border:none;background:rgba(255,255,255,.16);color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.vp-progress{flex:1;height:28px;background:transparent;cursor:pointer;position:relative;min-width:0;display:flex;align-items:center;touch-action:none;padding:8px 0}
.vp-progress::before{content:'';position:absolute;left:0;right:0;top:50%;transform:translateY(-50%);height:4px;background:rgba(255,255,255,.25);border-radius:3px}
.vp-progress > .vp-fill{position:relative;height:4px;background:#fff;border-radius:3px;width:0%}
.vp-time{font-size:11px;min-width:78px;text-align:center;opacity:.9}

.profile-view{display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden}
.profile-hero{padding:26px 20px 18px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;flex-shrink:0;text-align:center;width:100%;animation:slideInUp .4s ease}
.profile-hero .profile-avatar{position:relative;width:84px!important;height:84px!important;min-width:84px!important;max-width:84px!important;flex:0 0 84px!important;border-radius:50%!important;background:linear-gradient(135deg,var(--md-sys-color-primary-container),var(--md-sys-color-secondary-container));display:flex;align-items:center;justify-content:center;font-size:30px;font-weight:600;color:var(--md-sys-color-primary);overflow:hidden!important;box-shadow:0 10px 26px -10px rgba(0,0,0,.4);margin:0 auto 12px auto}
.profile-hero .profile-avatar img{width:84px!important;height:84px!important;object-fit:cover!important;border-radius:50%!important;display:block!important}
.profile-hero .profile-avatar.editable{cursor:pointer}
.profile-hero .profile-avatar.editable::after{content:'';position:absolute;inset:0;background:rgba(0,0,0,0);transition:background .2s;border-radius:50%}
.profile-hero .profile-avatar.editable:hover::after{background:rgba(0,0,0,.35)}
.profile-hero .profile-avatar .avatar-cam-badge{position:absolute;right:0;bottom:0;width:26px;height:26px;border-radius:50%;background:var(--md-sys-color-primary);color:var(--md-sys-color-on-primary);display:flex;align-items:center;justify-content:center;border:2px solid var(--md-sys-color-surface);z-index:2}
.profile-hero .profile-avatar .avatar-cam-badge .material-symbols-outlined{font-size:14px}
.profile-hero .profile-name{font-size:17px;font-weight:600;text-align:center;display:flex;align-items:center;justify-content:center;gap:8px;width:100%}
.profile-hero .profile-name .edit-icon-btn{width:26px;height:26px;border-radius:50%;border:none;background:transparent;color:var(--md-sys-color-on-surface-variant);cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:transform .2s}
.profile-hero .profile-name .edit-icon-btn .material-symbols-outlined{font-size:16px}
.profile-hero .profile-id{font-size:12px;color:var(--md-sys-color-on-surface-variant);text-align:center;opacity:.7}
.profile-hero .profile-desc{font-size:12.5px;opacity:.75;margin-top:4px;text-align:center;max-width:88%;margin-left:auto;margin-right:auto;display:flex;align-items:center;justify-content:center;gap:6px;flex-wrap:wrap}
.profile-hero .profile-desc-add{margin-top:4px;font-size:12.5px;color:var(--md-sys-color-primary);cursor:pointer;opacity:.8;display:inline-flex;align-items:center;gap:4px}
.profile-hero .profile-role{font-size:11.5px;color:var(--md-sys-color-primary);font-weight:500}
.profile-hero .profile-public-badge{font-size:10.5px;font-weight:600;padding:3px 10px;border-radius:999px;background:color-mix(in srgb,var(--md-sys-color-primary) 15%,transparent);color:var(--md-sys-color-primary);display:inline-flex;align-items:center;gap:4px}
.profile-hero .profile-public-badge .material-symbols-outlined{font-size:13px}
.profile-hero .profile-presence{font-size:11.5px;color:var(--md-sys-color-on-surface-variant);display:inline-flex;align-items:center;gap:6px;opacity:.85}
.profile-hero .profile-presence .online-dot{width:8px;height:8px}
.profile-tabs{display:flex;gap:2px;padding:3px;margin:6px 10px 0;border-radius:999px;background:var(--md-sys-color-surface-variant);overflow-x:auto;flex-shrink:0}
.profile-tab{flex:1;padding:5px 8px;border-radius:999px;border:none;background:transparent;color:var(--md-sys-color-on-surface-variant);font-family:inherit;font-size:11px;font-weight:600;white-space:nowrap;cursor:pointer;transition:background .25s,color .25s,transform .15s;min-width:0;letter-spacing:.01em}
.profile-tab.active{background:var(--md-sys-color-primary);color:var(--md-sys-color-on-primary)}
.profile-body{flex:1;min-height:0;overflow-y:auto;-webkit-overflow-scrolling:touch;padding:12px;touch-action:pan-y}
.media-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:4px}
.media-grid .mg-item{position:relative;width:100%;padding-bottom:100%;border-radius:10px;overflow:hidden;cursor:pointer;background:var(--md-sys-color-surface-variant);animation:popIn .35s cubic-bezier(.34,1.56,.64,1) both;transition:transform .2s}
.media-grid .mg-item > img,.media-grid .mg-item > video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.profile-empty{text-align:center;padding:40px 20px;color:var(--md-sys-color-on-surface-variant);font-size:13px;opacity:.65;display:flex;flex-direction:column;align-items:center;gap:10px}
.profile-empty .material-symbols-outlined{font-size:48px;opacity:.4}
.members-list{display:flex;flex-direction:column;gap:4px}
.member-row{display:flex;align-items:center;gap:12px;padding:10px;border-radius:14px;animation:listItemIn .3s ease}
.member-row:hover{background:var(--md-sys-color-surface-variant)}
.member-row .m-av{width:40px;height:40px;border-radius:50%;background:color-mix(in srgb,var(--md-sys-color-primary) 16%,var(--md-sys-color-surface-container));display:flex;align-items:center;justify-content:center;font-weight:600;overflow:hidden;flex-shrink:0;color:var(--md-sys-color-primary);position:relative}
.member-row .m-av img{width:100%;height:100%;object-fit:cover}
.member-row .m-info{flex:1;min-width:0}
.member-row .m-name{font-size:13.5px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.member-row .m-sub{font-size:11px;opacity:.6;margin-top:2px}
.member-row .m-role{font-size:10px;font-weight:700;text-transform:uppercase;padding:2px 8px;border-radius:8px;background:color-mix(in srgb,var(--md-sys-color-primary) 15%,transparent);color:var(--md-sys-color-primary)}
.member-row .m-remove{width:32px;height:32px;border-radius:50%;border:none;background:transparent;color:var(--md-sys-color-error);cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:transform .2s}
.member-row .m-role-btn{width:32px;height:32px;border-radius:50%;border:none;background:transparent;color:var(--md-sys-color-primary);cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:transform .2s}
.member-row .m-role-btn:hover{transform:scale(1.08)}

.hidden{display:none!important}
#connBanner{position:fixed;top:0;left:0;right:0;z-index:500;background:var(--md-sys-color-error);color:var(--md-sys-color-on-error);text-align:center;font-size:12px;padding:7px;transform:translateY(-100%);transition:transform .35s cubic-bezier(.22,1,.36,1);font-weight:500}
#connBanner.show{transform:translateY(0)}
::-webkit-scrollbar{width:8px;height:8px}
::-webkit-scrollbar-thumb{background:var(--md-sys-color-outline-variant);border-radius:4px}
/* Скроллбар в чате: тоньше и белым, видим всегда, но не за хедером/инпутом */
.chat-messages::-webkit-scrollbar{display:block;width:5px;height:5px}
.chat-messages::-webkit-scrollbar-thumb{background:rgba(255,255,255,.55);border-radius:2.5px}
.chat-messages::-webkit-scrollbar-thumb:hover{background:rgba(255,255,255,.85)}
.chat-messages::-webkit-scrollbar-track{background:transparent}
.chat-messages{scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.45) transparent}
.sync-banner{margin:6px 14px 0;padding:8px 12px;border-radius:12px;background:color-mix(in srgb,var(--md-sys-color-primary) 15%,var(--md-sys-color-surface-container));font-size:12px;display:flex;align-items:center;gap:8px;animation:slideInUp .3s ease}
.sync-banner .material-symbols-outlined{font-size:16px;color:var(--md-sys-color-primary)}
.reply-preview{display:flex;align-items:center;gap:8px;padding:10px 16px;background:var(--md-sys-color-surface-container);animation:slideInUp .25s ease}
.reply-preview .reply-preview-body{flex:1;min-width:0;font-size:12px}
.reply-preview .reply-preview-label{font-weight:600;color:var(--md-sys-color-primary);margin-bottom:2px}
.reply-preview .reply-preview-text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--md-sys-color-on-surface-variant)}
.public-toggle-row{display:flex;align-items:center;gap:12px;padding:12px 14px;border-radius:14px;background:var(--md-sys-color-surface-container);border:1.5px solid var(--md-sys-color-outline-variant);cursor:pointer;transition:border-color .2s,background .2s,transform .15s;margin:12px 0}
.public-toggle-row.active{border-color:transparent;background:color-mix(in srgb,var(--md-sys-color-primary) 8%,var(--md-sys-color-surface-container))}
.public-toggle-row .material-symbols-outlined{color:var(--md-sys-color-primary)}
.public-toggle-row .pt-text{flex:1}
.public-toggle-row .pt-title{font-size:14px;font-weight:500}
.public-toggle-row .pt-sub{font-size:11.5px;color:var(--md-sys-color-on-surface-variant);margin-top:2px}
.public-toggle-row .pt-switch{width:44px;height:26px;border-radius:999px;background:var(--md-sys-color-surface-variant);position:relative;transition:background .25s;flex-shrink:0}
.public-toggle-row .pt-switch::after{content:'';position:absolute;top:3px;left:3px;width:20px;height:20px;border-radius:50%;background:#fff;transition:transform .32s cubic-bezier(.22,1,.36,1)}
.public-toggle-row.active .pt-switch{background:var(--md-sys-color-primary)}

/* ===== OFFLINE / SERVER UNAVAILABLE — экран внутри приложения (в стиле мессенджера) ===== */
.offline-overlay{position:fixed;inset:0;z-index:9999;display:flex;align-items:center;justify-content:center;padding:20px;padding-bottom:max(20px,var(--safe-bottom));background:var(--md-sys-color-surface);color:var(--md-sys-color-on-surface);animation:fadeIn .25s ease}
.offline-overlay[hidden]{display:none!important}
.offline-card{width:min(100%,420px);background:var(--md-sys-color-surface);border-radius:24px;padding:28px 24px 22px;box-shadow:0 32px 80px -20px rgba(0,0,0,.6);text-align:center;animation:dialogIn .38s var(--ease-out-quint)}
.offline-icon{width:84px;height:84px;margin:0 auto 18px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:var(--md-sys-color-primary-container);color:var(--md-sys-color-primary);box-shadow:0 10px 26px -10px rgba(0,0,0,.4);position:relative}
.offline-icon .material-symbols-outlined{font-size:40px;opacity:.9;position:relative;z-index:1}
.offline-icon::after{content:'';position:absolute;inset:0;border-radius:50%;border:2px solid var(--md-sys-color-error);opacity:0;animation:offlineRing 1.8s ease-out infinite}
@keyframes offlineRing{0%{transform:scale(1);opacity:.7}100%{transform:scale(1.35);opacity:0}}
.offline-status{display:inline-flex;align-items:center;gap:7px;padding:6px 14px;border-radius:999px;background:var(--md-sys-color-surface-container);font-size:12px;color:var(--md-sys-color-on-surface-variant);margin-bottom:14px}
.offline-dot{width:8px;height:8px;border-radius:50%;background:var(--md-sys-color-error);animation:offlineBlink 1.4s ease-in-out infinite}
.offline-dot.ok{background:#4caf50;animation:none}
@keyframes offlineBlink{0%,100%{opacity:.35}50%{opacity:1}}
.offline-title{margin:0 0 10px;font-size:21px;font-weight:600;letter-spacing:-.2px}
.offline-lead{margin:0 0 18px;font-size:13.5px;line-height:1.6;color:var(--md-sys-color-on-surface-variant)}
.offline-details{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 0 18px;padding:12px 14px;border-radius:14px;background:var(--md-sys-color-surface-container);font-size:12px;color:var(--md-sys-color-on-surface-variant);text-align:left}
.offline-details>span:last-child{color:var(--md-sys-color-on-surface);font-weight:500;text-align:right;word-break:break-word}
.offline-actions{display:flex;gap:8px;flex-wrap:wrap}
.offline-actions .md-btn{flex:1 1 45%;min-height:46px}
.offline-actions .md-btn:disabled{opacity:.55;cursor:default}
.offline-note{margin-top:16px;padding-top:14px;border-top:1px solid var(--md-sys-color-outline-variant);font-size:11px;line-height:1.5;color:var(--md-sys-color-on-surface-variant);opacity:.75}
@media (max-width:420px){.offline-card{padding:24px 18px 18px}.offline-actions .md-btn{flex:1 1 100%}}
.public-toggle-row.active .pt-switch::after{transform:translateX(18px);background:var(--md-sys-color-on-primary)}

#confirmDialog .menu-content{padding:22px 20px 16px}
#confirmDialog h3{font-size:17px;font-weight:700;margin-bottom:6px}
#confirmDialog #confirmMessage{color:var(--md-sys-color-on-surface-variant);font-size:13.5px;line-height:1.5}
#confirmDialog #confirmCheckboxWrap{display:none;align-items:center;gap:10px;margin:14px 0 4px;cursor:pointer;padding:10px 12px;border-radius:12px;background:var(--md-sys-color-surface-container);border:1px solid var(--md-sys-color-outline-variant)}
#confirmDialog #confirmCheckboxWrap.visible{display:flex}
#confirmDialog #confirmCheckbox{width:20px;height:20px;cursor:pointer;accent-color:var(--md-sys-color-primary)}

[data-i18n]{transition:opacity .25s ease}
.lang-changing [data-i18n]{animation:langFade .35s ease both}

@media (min-width:769px){
  .mobile-screen{display:none!important}
  .dock-container{display:none!important}
  .chat-area{display:flex!important}
}
@media (max-width:768px){
  #app{flex-direction:column;min-height:0}
  .list-panel{width:100%!important;max-width:100%!important;border-right:none;display:grid;grid-template-rows:auto auto auto minmax(0,1fr) auto;grid-template-columns:minmax(0,1fr);height:100dvh;max-height:100dvh;min-height:0;overflow:hidden;padding-top:0}
  .panel-header{grid-row:1}
  #chatsTabsContainer{grid-row:2}
  #nowPlayingBar{grid-row:3}
  .panel-content{grid-row:4;min-height:0;overflow-y:auto;-webkit-overflow-scrolling:touch;touch-action:pan-y;overscroll-behavior:contain;padding-bottom:140px}
  .dock-desktop{grid-row:5;display:none}
  .panel-resizer{display:none}
  .dock-container{display:flex}
  .chat-area{display:none}
  .dock-bar{height:66px;padding:8px 6px;border-radius:999px}
  .dock-item-mobile{padding:10px 8px;font-size:11px;gap:3px}
  .dock-item-mobile .material-symbols-outlined{font-size:24px}
  .search-fab{width:56px;height:56px}
  /* Видеозвонки на телефоне: контролы дока — строго 2 ряда по горизонтали */
  .call-controls, .gc-controls{display:grid;grid-template-columns:repeat(3,auto);gap:7px 10px;justify-content:center;width:max-content;padding:10px 14px;border-radius:26px;bottom:max(16px,var(--safe-bottom));max-width:calc(100vw - 16px);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
  .call-ctrl, .gc-ctrl{width:46px;height:46px;flex-shrink:0;justify-self:center}
  .call-ctrl .material-symbols-outlined, .gc-ctrl .material-symbols-outlined{font-size:21px}
  .call-ctrl:active, .gc-ctrl:active{transform:scale(.92)}
  .call-ctrl.end, .gc-ctrl.end{width:54px;height:54px}
  .call-ctrl.end .material-symbols-outlined, .gc-ctrl.end .material-symbols-outlined{font-size:24px}
  .remote-video{object-fit:cover}
  .call-video-stage::after{content:'';position:absolute;top:0;left:0;right:0;height:120px;background:linear-gradient(to bottom,rgba(0,0,0,.5),transparent);pointer-events:none;z-index:1}
  .local-video-wrap{width:104px;height:184px;bottom:178px;right:10px;border-radius:20px;box-shadow:0 18px 44px -14px rgba(0,0,0,.8)}
  .call-audio-info{padding:56px 20px 250px}
  .call-audio-info h2{font-size:23px;font-weight:600;margin:10px 0 2px}
  .call-avatar{width:112px;height:112px}
  .call-state{font-size:13.5px;margin-top:8px}
  .ice-status{font-size:11.5px}
  .gc-header{padding-top:max(14px,var(--safe-top))}
  .gc-controls{bottom:max(16px,var(--safe-bottom))}
  .settings-menu-grid{grid-template-columns:1fr 1fr}
  .now-playing-bar{padding:7px 10px}
  .np-art{width:38px;height:38px}
  .np-title{font-size:12px}
  .np-artist{font-size:10px}
  .np-btn{width:32px;height:32px}
  .np-btn.np-play{width:36px;height:36px}
  .circle-bubble{padding:0!important;margin-bottom:2px!important;max-width:240px!important}
  .circle-bubble .circle-media{width:240px;height:240px}
  .circle-bubble .circle-video{width:240px;height:240px}
  .sticker-bubble{margin-top:4px!important;margin-bottom:2px!important;max-width:min(55%,170px)!important}
  .sticker-bubble img{border-radius:16px}
  .message-bubble{margin-bottom:3px}
}
@media (prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.01ms!important;transition-duration:.01ms!important}}

@media (max-width:768px){
  body.kb-open #mobileChatScreen.active{
    position: fixed !important;
    top: var(--vv-top, 0px) !important;
    left: 0 !important;
    right: 0 !important;
    bottom: auto !important;
    height: var(--vvh, 100dvh) !important;
    max-height: var(--vvh, 100dvh) !important;
    z-index: 100;
  }
  body.kb-open #mobileChatScreen.active #mobileChatMessages{overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
  body.kb-open #mobileChatScreen.active #mobileChatBottom,
  body.kb-open #mobileChatScreen.active #mobileInputArea,
  body.kb-open #mobileChatScreen.active #mobileReplyPreview,
  body.kb-open #mobileChatScreen.active #mobileAttachmentsBar{flex-shrink:0}
  body.kb-open .chat-area{padding-top:0}
}
@media (max-width:768px){
  body.kb-open .search-page{
    position: fixed !important;
    top: var(--vv-top, 0px) !important;
    left: 0 !important;
    right: 0 !important;
    bottom: auto !important;
    height: var(--vvh, 100dvh) !important;
    max-height: var(--vvh, 100dvh) !important;
  }
}

/* ================================================================
   MATTE GLASS — общие стили (blur 3.5px)
   ================================================================ */
body[data-matte="glass"]{--glass-blur: 3px; --glass-saturate: 130%;}
/* V58: blur НЕ отключаем на время эффектов погоды — без него матовое стекло
   теряет «дымку» и плашки выглядят прозрачными. Капли за панелью и так лежат
   под фоном .list-panel, лёгкий blur 3.5px просто смягчает их, не превращая
   интерфейс в прозрачный. */

body[data-matte="glass"] .menu-content{background:color-mix(in srgb,var(--md-sys-color-surface-container) 62%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));border:1px solid color-mix(in srgb,var(--md-sys-color-outline-variant) 55%,transparent);box-shadow:0 32px 80px -20px rgba(0,0,0,.55),inset 0 1px 0 rgba(255,255,255,.06)}
body.light-theme[data-matte="glass"] .menu-content{background:color-mix(in srgb,var(--md-sys-color-surface-container) 45%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));border:1px solid color-mix(in srgb,var(--md-sys-color-outline-variant) 45%,transparent);box-shadow:0 32px 80px -20px rgba(0,0,0,.25),inset 0 1px 0 rgba(0,0,0,.06)}
body[data-matte="glass"] .menu-dialog.sw-full .menu-content{background:var(--md-sys-color-surface);backdrop-filter:none;-webkit-backdrop-filter:none;border:none;box-shadow:none}
body.light-theme[data-matte="glass"] .menu-dialog.sw-full .menu-content{background:#f5f5f5;backdrop-filter:none;-webkit-backdrop-filter:none;border:none;box-shadow:none}
/* Окна настроек (sw-full) в matte glass — без блюра и прозрачности */
body[data-matte="glass"] .menu-dialog.sw-full{background:var(--md-sys-color-surface);backdrop-filter:none;-webkit-backdrop-filter:none}
body.light-theme[data-matte="glass"] .menu-dialog.sw-full{background:#f5f5f5;backdrop-filter:none;-webkit-backdrop-filter:none}
/* Обычные модальные окна в matte glass — блюр сзади и полупрозрачность */
body[data-matte="glass"] .menu-dialog:not(.sw-full){background:rgba(0,0,0,.45);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body.light-theme[data-matte="glass"] .menu-dialog:not(.sw-full){background:rgba(0,0,0,.25);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .menu-action-btn{background:color-mix(in srgb,var(--md-sys-color-surface-container) 32%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .attach-menu{background:color-mix(in srgb,var(--md-sys-color-surface-container) 55%,transparent);backdrop-filter:blur(calc(var(--ui-blur, 16px) * 1.6)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(calc(var(--ui-blur, 16px) * 1.6)) saturate(var(--ui-blur-sat)) saturate(var(--glass-saturate))}

body[data-matte="glass"] .search-page{background:color-mix(in srgb,var(--md-sys-color-surface) 68%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat)) saturate(var(--glass-saturate))}
body[data-matte="glass"] .search-page-header,
body[data-matte="glass"] .search-input-top{background:color-mix(in srgb,var(--md-sys-color-surface-container) 45%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .search-input-wrap{background:color-mix(in srgb,var(--md-sys-color-surface-variant) 48%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .search-result-card{background:color-mix(in srgb,var(--md-sys-color-surface-container) 42%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));border:1px solid color-mix(in srgb,var(--md-sys-color-outline-variant) 42%,transparent)}
body[data-matte="glass"] .search-chip{background:color-mix(in srgb,var(--md-sys-color-surface-container) 32%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}

body[data-matte="glass"] .dock-desktop .dock-item,
body[data-matte="glass"] .dock-item-mobile{background:color-mix(in srgb,var(--md-sys-color-surface-container) 34%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));border:1px solid color-mix(in srgb,var(--md-sys-color-outline-variant) 38%,transparent)}
body[data-matte="glass"] .dock-desktop .dock-item.active,
body[data-matte="glass"] .dock-item-mobile.active{background:color-mix(in srgb,var(--md-sys-color-primary) 78%,transparent);color:var(--md-sys-color-on-primary)}
body[data-matte="glass"] .dock-desktop .search-fab-mini,
body[data-matte="glass"] .search-fab{background:color-mix(in srgb,var(--md-sys-color-primary) 80%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .dock-bar{background:color-mix(in srgb,var(--md-sys-color-surface-container) 58%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat)) saturate(var(--glass-saturate))}

body[data-matte="glass"] .settings-menu-card{background:color-mix(in srgb,var(--md-sys-color-surface-container) 50%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .settings-row:hover{background:color-mix(in srgb,var(--md-sys-color-surface-variant) 48%,transparent)}
body[data-matte="glass"] .chip{background:color-mix(in srgb,var(--md-sys-color-surface-container) 40%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .wp-swatch{backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .settings-row .pt-switch,
body[data-matte="glass"] .public-toggle-row .pt-switch{background:color-mix(in srgb,var(--md-sys-color-surface-variant) 55%,transparent)}
body[data-matte="glass"] .segmented-switch{background:color-mix(in srgb,var(--md-sys-color-surface-variant) 55%,transparent);border-color:color-mix(in srgb,var(--md-sys-color-outline-variant) 50%,transparent)}
body[data-matte="glass"] .segmented-thumb{background:color-mix(in srgb,var(--md-sys-color-primary) 85%,transparent)}
body[data-matte="glass"] .public-toggle-row{background:color-mix(in srgb,var(--md-sys-color-surface-container) 50%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .favorites-button{background:color-mix(in srgb,var(--md-sys-color-surface-container) 50%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));border-color:color-mix(in srgb,var(--md-sys-color-outline-variant) 45%,transparent)}
body[data-matte="glass"] .select-plan-card{background:color-mix(in srgb,var(--md-sys-color-surface-container) 58%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));border-color:color-mix(in srgb,var(--md-sys-color-outline-variant) 45%,transparent)}
body[data-matte="glass"] .select-plan-card.is-active{border-color:color-mix(in srgb,#22c55e 70%,transparent)}

body[data-matte="glass"] .message-bubble{background:color-mix(in srgb,var(--bubble-other-bg) 55%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));border:none}
body[data-matte="glass"] .message-bubble.own{background:color-mix(in srgb,var(--bubble-own-bg) 65%,transparent)}
body[data-matte="glass"] .message-reply-quote{background:color-mix(in srgb,currentColor 12%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .reaction-chip{backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .link-card{background:color-mix(in srgb,currentColor 10%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .message-bubble.media-bubble{background:color-mix(in srgb,var(--md-sys-color-surface-container) 45%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat)) saturate(var(--glass-saturate))}
body[data-matte="glass"] .media-badge-time{background:rgba(0,0,0,.55);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .file-bubble{background:color-mix(in srgb,var(--bubble-other-bg) 55%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat)) saturate(var(--glass-saturate))}
body[data-matte="glass"] .file-bubble.own{background:color-mix(in srgb,var(--bubble-own-bg) 65%,transparent)}
body[data-matte="glass"] .file-download{background:color-mix(in srgb,currentColor 14%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .message-bubble:has(.audio-message){background:color-mix(in srgb,var(--bubble-other-bg) 55%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat)) saturate(var(--glass-saturate))}
body[data-matte="glass"] .message-bubble.own:has(.audio-message){background:color-mix(in srgb,var(--bubble-own-bg) 65%,transparent)}
body[data-matte="glass"] .audio-play-btn{background:rgba(0,0,0,.35) !important;backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));border:1px solid rgba(255,255,255,.15) !important}
body[data-matte="glass"] .audio-play-btn:hover{background:rgba(0,0,0,.78) !important}
body[data-matte="glass"] .message-bubble:has(.music-message){background:color-mix(in srgb,var(--bubble-other-bg) 55%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat)) saturate(var(--glass-saturate))}
body[data-matte="glass"] .message-bubble.own:has(.music-message){background:color-mix(in srgb,var(--bubble-own-bg) 65%,transparent)}
body[data-matte="glass"] .music-cover{background:color-mix(in srgb,var(--md-sys-color-primary-container) 45%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));border:1px solid rgba(255,255,255,.1)}
body[data-matte="glass"] .music-play-btn{background:rgba(0,0,0,.62) !important;backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));border:1px solid rgba(255,255,255,.12) !important}
body[data-matte="glass"] .music-play-btn:hover{background:rgba(0,0,0,.78) !important}
body[data-matte="glass"] .music-progress{background:color-mix(in srgb,currentColor 25%,transparent)}
body[data-matte="glass"] .music-progress-fill{background:color-mix(in srgb,var(--md-sys-color-primary) 90%,transparent)}

body[data-matte="glass"] .list-item{background:color-mix(in srgb,var(--md-sys-color-surface-container) 50%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));border:1px solid color-mix(in srgb,var(--md-sys-color-outline-variant) 38%,transparent)}
body[data-matte="glass"] .list-item:hover{background:color-mix(in srgb,var(--md-sys-color-surface-variant) 55%,transparent)}
body[data-matte="glass"] .list-item-avatar{backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .list-item-badge{backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .admin-badge{backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}

body[data-matte="glass"] .panel-header{background:color-mix(in srgb,var(--md-sys-color-surface) 30%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .chat-tabs{background:color-mix(in srgb,var(--md-sys-color-surface-variant) 50%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .tab-item.active{background:color-mix(in srgb,var(--md-sys-color-primary) 80%,transparent)}
body[data-matte="glass"] .list-panel{background:color-mix(in srgb,var(--md-sys-color-surface) 55%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}

body[data-matte="glass"] .chat-avatar-btn{backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .chat-input{background:color-mix(in srgb,var(--md-sys-color-surface-container) 48%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"]{--glass-blur:3px;--glass-saturate:150%}
/* Слабый полноэкранный блюр фона в теме matte glass — за всеми панелями. */
body[data-matte="glass"]::before{
  content:'';
  position:fixed;
  inset:0;
  backdrop-filter:blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter:blur(var(--glass-blur)) saturate(var(--glass-saturate));
  z-index:-1;
  pointer-events:none;
}
body[data-matte="glass"] .channel-locked-notice{background:color-mix(in srgb,var(--md-sys-color-surface-variant) 50%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}

body[data-matte="glass"] .now-playing-bar{background:color-mix(in srgb,var(--md-sys-color-surface-container) 60%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat)) saturate(var(--glass-saturate))}
body[data-matte="glass"] .np-art{backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .np-btn:hover{background:color-mix(in srgb,var(--md-sys-color-surface-variant) 50%,transparent)}

body[data-matte="glass"] .pinned-bar,
body[data-matte="glass"] .reply-preview,
body[data-matte="glass"] .attachments-bar,
body[data-matte="glass"] .group-call-bar,
body[data-matte="glass"] .typing-indicator{background:color-mix(in srgb,var(--md-sys-color-surface-container) 48%,transparent);backdrop-filter:none;-webkit-backdrop-filter:none}
body[data-matte="glass"] .attachment-chip{background:color-mix(in srgb,var(--md-sys-color-surface-variant) 50%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .attachment-chip .ac-close{background:rgba(0,0,0,.55);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .selection-bar{background:color-mix(in srgb,var(--md-sys-color-surface-container) 48%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}

body[data-matte="glass"] .reactions-panel{background:color-mix(in srgb,var(--md-sys-color-surface-container) 65%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat)) saturate(var(--glass-saturate))}
body[data-matte="glass"] .reaction-btn{background:color-mix(in srgb,var(--md-sys-color-surface-variant) 50%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .reaction-btn.active{background:color-mix(in srgb,var(--md-sys-color-primary) 90%,transparent)}
body[data-matte="glass"] .emoji-picker,
body[data-matte="glass"] .composer-source-sheet{background:var(--md-sys-color-surface-container);backdrop-filter:none;-webkit-backdrop-filter:none}
body[data-matte="glass"] .composer-sheet-action{background:color-mix(in srgb,var(--md-sys-color-surface) 44%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .composer-sheet-action:hover{background:color-mix(in srgb,var(--md-sys-color-surface-variant) 58%,transparent)}
body[data-matte="glass"] .sp-tabs{background:color-mix(in srgb,var(--md-sys-color-surface-variant) 55%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .sp-tab.active{background:color-mix(in srgb,var(--md-sys-color-primary) 85%,transparent)}
body[data-matte="glass"] .sp-create-btn{backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .sp-item:hover{background:color-mix(in srgb,var(--md-sys-color-surface-variant) 55%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}

body[data-matte="glass"] .call-controls,
body[data-matte="glass"] .gc-controls{backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat)) saturate(var(--glass-saturate))}
body[data-matte="glass"] .gc-tile{background:color-mix(in srgb,#2a2a2a 55%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .gc-avatar,
body[data-matte="glass"] .gc-participants-sheet,
body[data-matte="glass"] .gc-part-row .gp-av,
body[data-matte="glass"] .call-ctrl,
body[data-matte="glass"] .remote-expand-btn{backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .gc-name{background:rgba(0,0,0,.42);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .call-ctrl,
body[data-matte="glass"] .gc-ctrl{background:rgba(255,255,255,.12);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}

body[data-matte="glass"] .profile-tab{backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .profile-tab.active{background:color-mix(in srgb,var(--md-sys-color-primary) 85%,transparent)}
body[data-matte="glass"] .member-row:hover{background:color-mix(in srgb,var(--md-sys-color-surface-variant) 50%,transparent)}
body[data-matte="glass"] .m-av{backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .media-grid .mg-item{background:color-mix(in srgb,var(--md-sys-color-surface-variant) 35%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:none !important}

body[data-matte="glass"] .mv-close,
body[data-matte="glass"] .mv-nav,
body[data-matte="glass"] .mv-action,
body[data-matte="glass"] .mv-bottom,
body[data-matte="glass"] .vp-controls{backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}

body[data-matte="glass"] .sync-banner,
body[data-matte="glass"] #connBanner,
body[data-matte="glass"] .record-overlay,
body[data-matte="glass"] .circle-ctrl,
body[data-matte="glass"] .ssv-close,
body[data-matte="glass"] .ssv-title,
body[data-matte="glass"] .sr-avatar,
body[data-matte="glass"] .gc-part-row{backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .se-palette,
body[data-matte="glass"] .se-hint,
body[data-matte="glass"] .se-sticker-count{backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .se-text-el{backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}

/* ================================================================
   СТЕКЛО: СПИСОК ПАНЕЛИ — ОДНИМ СЛОЁМ, ПУЗЫРИ — СВОИМ
   В списке чатов blur висит на прокручиваемой поверхности целиком: иначе
   соседние плитки размывали разные куски фона и стекло выглядело мозаикой.

   В переписке так делать нельзя: прокручиваемая поверхность лежит прямо
   на обоях, и общий backdrop размывал бы сами обои. По требованию обои
   остаются резкими, поэтому blur здесь только у пузырей — он размывает
   фон именно за пузырём, а не весь экран.
   ================================================================ */
body[data-matte="glass"] .panel-content{
  backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  -webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
}
/* Док и шапка панели размытия не держат — за ними нет прокручиваемого
   содержимого, и прямоугольник был бы виден отдельным пятном. У шапки
   чата и панели ввода своё мягкое размытие задано выше: полосы должны
   быть прозрачными, но текст под ними остаётся читаемым. */
body[data-matte="glass"] .mobile-dock-input,
body[data-matte="glass"] .mobile-dock-tools,
body[data-matte="glass"] .dock-bar,
body[data-matte="glass"] .panel-header{
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
}
/* Плитки внутри этих поверхностей свой backdrop-filter не держат. */
body[data-matte="glass"] .panel-content .list-item,
body[data-matte="glass"] .mobile-input-dock .dock-item-mobile,
body[data-matte="glass"] .dock-bar .dock-item-mobile,
body[data-matte="glass"] .dock-bar .dock-item,
body[data-matte="glass"] .panel-content .member-row,
body[data-matte="glass"] .chat-messages .audio-play-btn,
body[data-matte="glass"] .chat-messages .music-play-btn,
body[data-matte="glass"] .chat-messages .file-download,
body[data-matte="glass"] .chat-messages .reaction-chip{
  backdrop-filter:none;-webkit-backdrop-filter:none;
}
body[data-matte="glass"] .auth-shell{background:color-mix(in srgb,var(--md-sys-color-surface-container) 72%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat)) saturate(var(--glass-saturate))}
body[data-matte="glass"] .auth-field input{background:color-mix(in srgb,var(--md-sys-color-surface) 60%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .aerren-captcha{background:color-mix(in srgb,var(--md-sys-color-surface-variant) 60%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .auth-agree{background:color-mix(in srgb,var(--md-sys-color-surface) 50%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .auth-hint-box{backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .md-text-field-filled input{background:color-mix(in srgb,var(--md-sys-color-surface-variant) 65%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .profile-avatar{backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
body[data-matte="glass"] .link-card .lc-icon{backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}

/* Стекло на кружке/стикере — только у мелких «хром»: плашек времени и
   длительности, кнопки play. Раньше здесь был селектор `.circle-bubble *`,
   backdrop-filter попадал и на <video>, и на <img>, и на служебные псевдо-
   слои (.animate-in::after — кольцо, .circle-media — обёртка). Медиа в
   Chrome/WebView живёт в отдельном композитном слое (у кружка ещё и
   translateZ(0)), и вместо «матового стекла под пузырём» получалось
   размытие самого кадра: мыло и на обложке, и во время воспроизведения.
   Для самого кружка стекло всё равно ничего не давало: видео накрывает
   пузырь целиком, размывать под ним нечего. */
body[data-matte="glass"] .circle-bubble .circle-dur,
body[data-matte="glass"] .sticker-bubble .message-time{backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:none !important}
/* Любое медиа внутри пузыря — гарантированно без blur в обоих префиксах. */
body[data-matte="glass"] .circle-bubble,
body[data-matte="glass"] .circle-bubble::before,
body[data-matte="glass"] .circle-bubble::after,
body[data-matte="glass"] .circle-bubble .circle-media,
body[data-matte="glass"] .circle-bubble .circle-video,
body[data-matte="glass"] .circle-bubble .circle-progress,
body[data-matte="glass"] .sticker-bubble img,
body[data-matte="glass"] .message-bubble .media-image,
body[data-matte="glass"] .message-bubble .media-video,
body[data-matte="glass"] .message-bubble .media-wrap{backdrop-filter:none !important;-webkit-backdrop-filter:none !important}
body[data-matte="glass"] .circle-bubble,
body[data-matte="glass"] .sticker-bubble{background:transparent !important;border:none !important;box-shadow:none !important}
body[data-matte="glass"] .circle-bubble:hover,
body[data-matte="glass"] .sticker-bubble:hover{background:transparent !important;box-shadow:none !important}
body[data-matte="glass"] .circle-bubble .message-time,
body[data-matte="glass"] .sticker-bubble .message-time{backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:none !important}
body[data-matte="glass"] .circle-bubble .circle-video{will-change:auto;transform:translateZ(0)}

/* ================================================================
   MATTE GLASS — оптимизация
   У вложенных мелких элементов (они и так лежат внутри уже
   размытых плашек) свой backdrop-filter отключаем: визуально
   практически не отлично, а проходов по фону становится заметно
   меньше — это заметно при включённой погоде и в длинных списках.
   ================================================================ */
body[data-matte="glass"] .list-item .list-item-avatar,
body[data-matte="glass"] .list-item .list-item-badge,
body[data-matte="glass"] .list-item .admin-badge,
body[data-matte="glass"] .segmented-switch .segmented-thumb,
body[data-matte="glass"] .menu-content .chip,
body[data-matte="glass"] .menu-content .wp-swatch,
body[data-matte="glass"] .settings-row .pt-switch,
body[data-matte="glass"] .public-toggle-row .pt-switch,
body[data-matte="glass"] .search-page .search-page-header,
body[data-matte="glass"] .search-page .search-input-top,
body[data-matte="glass"] .search-page .search-input-wrap,
body[data-matte="glass"] .search-page .search-result-card,
body[data-matte="glass"] .search-page .search-chip,
body[data-matte="glass"] .dock-bar .dock-desktop .dock-item,
body[data-matte="glass"] .dock-bar .dock-desktop .search-fab-mini,
body[data-matte="glass"] .attach-menu .menu-action-btn,
body[data-matte="glass"] .message-bubble .message-reply-quote,
body[data-matte="glass"] .message-bubble .reaction-chip,
body[data-matte="glass"] .message-bubble .link-card,
body[data-matte="glass"] .message-bubble .link-card .lc-icon,
body[data-matte="glass"] .message-bubble .media-badge-time,
body[data-matte="glass"] .file-bubble .file-download,
body[data-matte="glass"] .message-bubble .audio-play-btn,
body[data-matte="glass"] .message-bubble .music-cover,
body[data-matte="glass"] .message-bubble .music-play-btn,
body[data-matte="glass"] .now-playing-bar .np-art,
body[data-matte="glass"] .mobile-chat-header .mobile-circle-btn,
body[data-matte="glass"] .mobile-chat-header .mobile-chat-header-info,
body[data-matte="glass"] .mobile-input-dock .mobile-dock-tools,
body[data-matte="glass"] .mobile-input-dock .mobile-dock-input,
body[data-matte="glass"] .mobile-input-dock .mobile-dock-send,
body[data-matte="glass"] .mobile-input-dock .channel-locked-notice,
body[data-matte="glass"] .chat-input .channel-locked-notice,
body[data-matte="glass"] .reactions-panel .reaction-btn,
body[data-matte="glass"] .emoji-picker .composer-sheet-action,
body[data-matte="glass"] .composer-source-sheet .sp-tabs,
body[data-matte="glass"] .composer-source-sheet .sp-create-btn,
body[data-matte="glass"] .composer-source-sheet .sp-item,
body[data-matte="glass"] .gc-tile .gc-name,
body[data-matte="glass"] .gc-tile .gc-avatar,
body[data-matte="glass"] .call-controls .call-ctrl,
body[data-matte="glass"] .gc-controls .gc-ctrl,
body[data-matte="glass"] .gc-participants-sheet .gp-av,
body[data-matte="glass"] .attachment-chip .ac-close,
body[data-matte="glass"] .auth-shell .auth-field input,
body[data-matte="glass"] .auth-shell .aerren-captcha,
body[data-matte="glass"] .auth-shell .auth-agree,
body[data-matte="glass"] .list-panel .panel-header,
body[data-matte="glass"] .list-panel .chat-tabs,
body[data-matte="glass"] .list-panel .settings-menu-card,
body[data-matte="glass"] .list-panel .favorites-button,
body[data-matte="glass"] .list-panel .select-plan-card,
body[data-matte="glass"] .list-panel .profile-tab,
body[data-matte="glass"] .settings-window .font-row{
  backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  -webkit-backdrop-filter:none !important
}

/* ================================================================
   CIRCLE BUBBLE — анимация появления
   ================================================================ */
@keyframes circleBubbleIn{0%{opacity:0;transform:scale(.35) rotate(-15deg);filter:blur(10px) brightness(1.5)}45%{opacity:1;transform:scale(1.09) rotate(4deg);filter:blur(0) brightness(1.06)}70%{transform:scale(.96) rotate(-1.5deg);filter:blur(0) brightness(1)}100%{opacity:1;transform:scale(1) rotate(0deg);filter:blur(0) brightness(1)}}
@keyframes circleBubbleInGlass{0%{opacity:0;transform:scale(.4) rotate(-10deg);filter:blur(12px) saturate(160%) brightness(1.35)}50%{opacity:1;transform:scale(1.07) rotate(5deg);filter:blur(0) saturate(110%) brightness(1.05)}78%{transform:scale(.97) rotate(-2deg);filter:blur(0) saturate(100%) brightness(1)}100%{opacity:1;transform:scale(1) rotate(0deg);filter:blur(0) saturate(100%) brightness(1)}}
@keyframes circleBubbleGlow{0%{box-shadow:0 0 0 0 rgba(255,255,255,0),0 0 0 0 rgba(255,255,255,0)}45%{box-shadow:0 0 26px 8px rgba(255,255,255,.20),0 0 60px 20px rgba(255,255,255,.08)}100%{box-shadow:0 0 0 0 rgba(255,255,255,0),0 0 0 0 rgba(255,255,255,0)}}
@keyframes circleBubbleGlowGlass{0%{box-shadow:0 0 0 0 rgba(255,255,255,0),0 0 0 0 rgba(255,255,255,0),inset 0 0 0 0 rgba(255,255,255,0)}40%{box-shadow:0 0 30px 10px rgba(255,255,255,.24),0 0 72px 24px rgba(255,255,255,.10),inset 0 0 26px 2px rgba(255,255,255,.16)}100%{box-shadow:0 0 0 0 rgba(255,255,255,0),0 0 0 0 rgba(255,255,255,0),inset 0 0 0 0 rgba(255,255,255,0)}}
@keyframes circleBubbleRing{0%{opacity:0;transform:translate(-50%,-50%) scale(.65)}45%{opacity:.85;transform:translate(-50%,-50%) scale(1.06)}100%{opacity:0;transform:translate(-50%,-50%) scale(1.4)}}

.message-bubble.circle-bubble.animate-in,
.message-bubble.circle-bubble.animate-in.own{animation:circleBubbleIn .62s cubic-bezier(.22,1.2,.36,1) both;transform-origin:center center;transform:translateZ(0);will-change:transform,opacity,filter}
.message-bubble.circle-bubble.animate-in .circle-video{animation:circleBubbleGlow .75s ease-out both;will-change:box-shadow}
.message-bubble.circle-bubble.animate-in::after{content:'';position:absolute;left:50%;top:50%;width:220px;height:220px;margin:0;border-radius:50%;border:1.5px solid rgba(255,255,255,.55);pointer-events:none;z-index:5;animation:circleBubbleRing .8s cubic-bezier(.22,1,.36,1) both;will-change:transform,opacity}
body[data-matte="glass"] .message-bubble.circle-bubble.animate-in,
body[data-matte="glass"] .message-bubble.circle-bubble.animate-in.own{animation:circleBubbleInGlass .68s cubic-bezier(.22,1.2,.36,1) both}
body[data-matte="glass"] .message-bubble.circle-bubble.animate-in .circle-video{animation:circleBubbleGlowGlass .9s ease-out both}
body[data-matte="glass"] .message-bubble.circle-bubble.animate-in::after{border-color:rgba(255,255,255,.78);border-width:2px;box-shadow:0 0 26px rgba(255,255,255,.40),inset 0 0 26px rgba(255,255,255,.22)}
@media (max-width:768px){
  .message-bubble.circle-bubble.animate-in,
  .message-bubble.circle-bubble.animate-in.own{animation-duration:.5s}
  .message-bubble.circle-bubble.animate-in::after{width:190px;height:190px}
  body[data-matte="glass"] .message-bubble.circle-bubble.animate-in,
  body[data-matte="glass"] .message-bubble.circle-bubble.animate-in.own{animation-duration:.56s}
}
@media (prefers-reduced-motion:reduce){
  .message-bubble.circle-bubble.animate-in,
  .message-bubble.circle-bubble.animate-in.own,
  .message-bubble.circle-bubble.animate-in .circle-video,
  .message-bubble.circle-bubble.animate-in::after{animation:none !important}
}
body.no-animations .message-bubble.circle-bubble.animate-in,
body.no-animations .message-bubble.circle-bubble.animate-in.own,
body.no-animations .message-bubble.circle-bubble.animate-in .circle-video,
body.no-animations .message-bubble.circle-bubble.animate-in::after{animation:none !important;filter:none !important}

/* ================================================================
   ОТКЛЮЧЕНИЕ АНИМАЦИЙ
   ================================================================ */
body.no-animations *,body.no-animations *::before,body.no-animations *::after{animation-duration:0.001ms !important;animation-delay:0ms !important;animation-iteration-count:1 !important;transition-duration:0.001ms !important;transition-delay:0ms !important;scroll-behavior:auto !important}
body.no-animations .chat-messages,
body.no-animations #loadingScreen,
body.no-animations .menu-dialog,
body.no-animations .menu-content{animation:none !important;transition:none !important}

@media (prefers-reduced-motion:reduce){
  .lang-shell,.brand-mark,.lang-heading-line,.lang-option,
  #panelContent .profile-panel-hero > .list-item-avatar,
  #panelContent .profile-panel-hero > div,
  #panelContent .favorites-button,
  #panelContent .profile-section-title,
  #panelContent .settings-menu-card,
  #panelContent #profileLogoutBtn{animation:none !important}
}
body.no-animations .lang-shell,
body.no-animations .brand-mark,
body.no-animations .lang-heading-line,
body.no-animations .lang-option,
body.no-animations #panelContent .profile-panel-hero > .list-item-avatar,
body.no-animations #panelContent .profile-panel-hero > div,
body.no-animations #panelContent .favorites-button,
body.no-animations #panelContent .profile-section-title,
body.no-animations #panelContent .settings-menu-card,
body.no-animations #panelContent #profileLogoutBtn{animation:none !important}

/* ================================================================
   MOBILE KB-OPEN — при открытой клавиатуре
   Шапку намеренно НЕ трогаем. Раньше здесь стояло жёсткое
   padding-top:10px, которое перебивало max(8px,var(--safe-top)):
   с открытой клавиатурой шапка съезжала вверх ровно на величину
   выреза и накрывала строку состояния и часы. Отступ задаёт сама
   шапка, она одинакова при любом состоянии нижней области.
   ================================================================ */
@media (max-width:768px){
  body.kb-open #mobileChatScreen.active .mobile-chat-header{
    flex-shrink:0;
  }
}

/* ================================================================
   ЭФФЕКТЫ ПОГОДЫ — снег/дождь на фоне интерфейса
   Холст лежит под #app; панели становятся полупрозрачными только пока
   эффект включён — базовый цвет фона при этом не меняется.
   ================================================================ */
#weatherFx{position:fixed;top:0;left:0;width:100%;height:100%;z-index:0;pointer-events:none;display:block;opacity:0;transition:opacity .55s ease}
body.fx-weather #weatherFx{opacity:1}
body.fx-weather:not([data-matte="glass"]) .list-panel,
body.fx-weather:not([data-matte="glass"]) .chat-area,
body.fx-weather:not([data-matte="glass"]) .mobile-screen,
body.fx-weather:not([data-matte="glass"]) #mobileChatScreen{
  background-color:color-mix(in srgb, var(--md-sys-color-surface) 70%, transparent);
}
.weather-fx-kind{margin:4px 0 6px;transition:opacity .25s ease,filter .25s ease}
.weather-fx-kind .sr-title{font-size:12px;text-transform:uppercase;letter-spacing:.8px;opacity:.6;margin-bottom:8px}
.weather-fx-kind.is-disabled{opacity:.42;pointer-events:none;filter:grayscale(1)}

/* ================================================================
   V52 — ЭМОДЗИ-СТАТУС · БАННЕР · SELECT · РЕДАКТОР · РАЗДЕЛЫ ЭМОДЗИ
   ================================================================ */

/* --- Эмодзи-статус рядом с именем --- */
/* вертикальное выравнивание — по базовой линии текста: emoji-шрифт даёт
   свой baseline внутри бокса, и vertical-align:middle уводил статус вниз */
.name-status{display:inline-block;margin-left:5px;line-height:1;vertical-align:baseline;animation:statusPop .35s cubic-bezier(.34,1.56,.64,1)}
.name-status:empty{display:none}
/* Подписка активна, а эмодзи не выбрано — в плитке/заголовке/профиле стоит метка Select */
.name-status.is-select{margin-left:6px;padding:2px 6px;border-radius:999px;background:linear-gradient(135deg,var(--md-sys-color-primary),color-mix(in srgb,var(--md-sys-color-primary) 45%,#a855f7));color:#fff;font-size:9px;font-weight:800;letter-spacing:.5px;text-transform:uppercase;line-height:1.4;box-shadow:0 3px 10px -5px var(--md-sys-color-primary);vertical-align:baseline}
body.no-animations .name-status.is-select{animation:none !important;opacity:1 !important;transform:none !important}
@keyframes statusPop{from{opacity:0;transform:scale(.4)}to{opacity:1;transform:scale(1)}}

/* --- Разделы эмодзи в пикере --- */
.sp-sections{display:flex;flex-direction:column;gap:2px;padding-bottom:8px}
.sp-section{scroll-margin-top:6px}
.sp-section-title{position:sticky;top:-8px;z-index:2;display:flex;align-items:center;gap:7px;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.7px;opacity:.7;background:var(--md-sys-color-surface-container);padding:9px 4px 6px;margin-bottom:3px}
.sp-section-title .material-symbols-outlined{font-size:15px}
.sp-cats{display:flex;gap:3px;overflow-x:auto;flex-shrink:0;padding:7px 8px 5px;background:var(--md-sys-color-surface-variant);scrollbar-width:none;-webkit-overflow-scrolling:touch}
.sp-cats::-webkit-scrollbar{display:none}
.sp-cat{flex:0 0 auto;width:36px;height:32px;border:none;border-radius:10px;background:transparent;color:var(--md-sys-color-on-surface-variant);display:flex;align-items:center;justify-content:center;cursor:pointer;font-family:inherit;transition:background .2s,color .2s,transform .15s}
.sp-cat .material-symbols-outlined{font-size:19px}
.sp-cat:active{transform:scale(.88)}
.sp-cat.active{background:color-mix(in srgb,var(--md-sys-color-primary) 22%,transparent);color:var(--md-sys-color-primary)}
@media (max-width:380px){.sp-grid{grid-template-columns:repeat(6,1fr)}.sp-cat{width:32px}}

/* --- Эмодзи-статус: мелкая кнопка справа от ника.
       Строка поднимается над баннером при прокрутке профиля (z-index), 
       чтобы фон баннера не перекрывал кнопку. --- */
#panelContent .profile-hero-name-row{display:flex;align-items:center;justify-content:center;gap:7px;max-width:100%;min-width:0;position:relative;z-index:3}
#panelContent .profile-hero-id,#panelContent .profile-hero-email{position:relative;z-index:3}
.hero-status-btn{min-width:26px;height:26px;padding:0 7px;border-radius:999px;border:1px dashed var(--md-sys-color-outline-variant);background:var(--md-sys-color-surface-variant);color:var(--md-sys-color-on-surface-variant);font-family:inherit;font-size:13px;line-height:1;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0;position:relative;z-index:4;transition:transform .18s,background .2s,border-color .2s,color .2s}
.hero-status-btn:hover{transform:scale(1.12);border-color:var(--md-sys-color-primary);color:var(--md-sys-color-primary);border-style:solid}
.hero-status-btn:active{transform:scale(.94)}
/* подписка активна, а эмодзи не выбрано — на месте статуса стоит Select */
.hero-status-btn.is-select{border-style:solid;border-color:transparent;background:linear-gradient(135deg,var(--md-sys-color-primary),color-mix(in srgb,var(--md-sys-color-primary) 45%,#a855f7));color:#fff;font-size:10px;font-weight:800;letter-spacing:.5px;text-transform:uppercase;padding:0 9px}
.hero-status-btn.is-select:hover{filter:brightness(1.08);color:#fff}

/* --- Баннер в собственном профиле: ложится фоном позади аватара.
       Вся зона баннера нажимна — по клику (и по Enter/пробелу)
       открывается выбор нового фото. --- */
#panelContent .profile-hero-banner{position:absolute;top:0;left:0;right:0;width:auto;margin:0;height:150px;flex:0 0 auto;border-radius:0 0 16px 16px;background:linear-gradient(135deg,color-mix(in srgb,var(--md-sys-color-primary) 16%,var(--md-sys-color-surface-container)),var(--md-sys-color-surface-container));border-bottom:1px dashed var(--md-sys-color-outline-variant);overflow:hidden;cursor:pointer;z-index:0;transition:filter .2s ease}
#panelContent .profile-hero-banner.has-img{height:150px;overflow:hidden;border-bottom:none}
#panelContent .profile-hero-banner.has-img img{width:100%;height:100%;object-fit:cover;display:block}
#panelContent .profile-hero-banner:hover{filter:brightness(1.07)}
#panelContent .profile-hero-banner:focus-visible{outline:2px solid var(--md-sys-color-primary);outline-offset:-3px}
.hero-banner-hint{position:absolute;right:14px;bottom:12px;width:30px;height:30px;border-radius:50%;background:rgba(0,0,0,.4);color:#fff;font-size:17px;display:flex;align-items:center;justify-content:center;pointer-events:none;opacity:.6;transition:opacity .2s,transform .2s;z-index:2;backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}
#panelContent .profile-hero-banner:not(.has-img) .hero-banner-hint{right:50%;bottom:50%;transform:translate(50%,50%);width:46px;height:46px;font-size:25px;opacity:.8;background:color-mix(in srgb,var(--md-sys-color-primary) 88%,transparent);border:none}
#panelContent .profile-hero-banner:hover .hero-banner-hint{opacity:.95;transform:scale(1.08)}
#panelContent .profile-hero-banner:not(.has-img):hover .hero-banner-hint{transform:translate(50%,50%) scale(1.08)}
#panelContent .profile-hero-avatar{position:relative;z-index:1}

/* --- Баннер в профиле собеседника: тоже фоном позади аватара --- */
.profile-hero{position:relative}
.profile-banner{position:absolute;top:0;left:0;right:0;width:auto;margin:0;flex:none;height:112px;overflow:hidden;border-radius:0 0 16px 16px;background:var(--md-sys-color-surface-container);z-index:auto}
.profile-banner img{width:100%;height:100%;object-fit:cover;display:block}
.profile-hero .profile-avatar{position:relative;z-index:1}

/* --- Строка настроек: эмодзи/галочка справа --- */
.settings-row-emoji{flex:0 0 auto;min-width:26px;height:26px;padding:0 7px;border-radius:999px;background:var(--md-sys-color-surface-variant);color:var(--md-sys-color-on-surface-variant);display:flex;align-items:center;justify-content:center;font-size:14px;font-weight:700;line-height:1}

/* --- Select: окно с функциями и тарифами --- */
#selectPlanDialog .menu-content{max-width:min(440px,92vw)}
.select-hero{display:flex;flex-direction:column;align-items:center;text-align:center;gap:6px;padding:4px 0 14px}
.select-hero-icon{width:56px;height:56px;border-radius:18px;background:linear-gradient(135deg,var(--md-sys-color-primary),color-mix(in srgb,var(--md-sys-color-primary) 45%,#a855f7));color:#fff;font-size:30px;display:flex;align-items:center;justify-content:center;box-shadow:0 14px 30px -16px var(--md-sys-color-primary);animation:selectHeroFloat 3.4s ease-in-out infinite}
@keyframes selectHeroFloat{0%,100%{transform:translateY(0) rotate(-3deg)}50%{transform:translateY(-7px) rotate(3deg)}}
.select-hero-title{font-size:19px;font-weight:800;letter-spacing:.5px}
.select-hero-sub{font-size:12px;opacity:.65;line-height:1.4}
#selectPlanDialog .settings-window-body>*+*{margin-top:8px}
.select-feature{display:flex;align-items:flex-start;gap:11px;padding:9px 10px;border-radius:14px;background:var(--md-sys-color-surface-container);border:1px solid var(--md-sys-color-outline-variant);opacity:0;animation:selectFeatureIn .5s cubic-bezier(.22,1,.36,1) forwards}
.select-feature:nth-child(1){animation-delay:.05s}
.select-feature:nth-child(2){animation-delay:.11s}
.select-feature:nth-child(3){animation-delay:.17s}
.select-feature:nth-child(4){animation-delay:.23s}
.select-feature:nth-child(5){animation-delay:.29s}
.select-feature:nth-child(6){animation-delay:.35s}
.select-feature>.material-symbols-outlined{width:34px;height:34px;min-width:34px;border-radius:11px;background:color-mix(in srgb,var(--md-sys-color-primary) 16%,transparent);color:var(--md-sys-color-primary);display:flex;align-items:center;justify-content:center;font-size:19px}
.sf-text{min-width:0}
.sf-title{font-size:13.5px;font-weight:700}
.sf-sub{font-size:11px;opacity:.6;margin-top:2px;line-height:1.35}
@keyframes selectFeatureIn{from{opacity:0;transform:translateX(-16px)}to{opacity:1;transform:translateX(0)}}
.select-billing-title{font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.8px;opacity:.6;padding:14px 0 8px}
.select-plans{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.select-plan-btn{position:relative;display:flex;flex-direction:column;align-items:flex-start;gap:3px;padding:15px 14px;border-radius:18px;border:1.5px solid var(--md-sys-color-outline-variant);background:var(--md-sys-color-surface-container);color:var(--md-sys-color-on-surface);font-family:inherit;cursor:pointer;text-align:left;transition:transform .2s cubic-bezier(.34,1.56,.64,1),border-color .2s,box-shadow .2s;animation:selectFeatureIn .5s cubic-bezier(.22,1,.36,1) .42s both}
.select-plan-btn.is-year{animation-delay:.5s;border-color:color-mix(in srgb,var(--md-sys-color-primary) 55%,transparent)}
.select-plan-btn:hover{transform:translateY(-3px);border-color:var(--md-sys-color-primary);box-shadow:0 14px 26px -18px var(--md-sys-color-primary)}
.select-plan-btn:active{transform:translateY(-1px) scale(.985)}
.select-plan-btn.is-busy{opacity:.6;pointer-events:none}
.select-plan-btn .sp-name{font-size:12.5px;opacity:.75}
.select-plan-btn .sp-price{font-size:18px;font-weight:800;letter-spacing:.2px}
.select-plan-btn .sp-badge{position:absolute;top:-9px;right:10px;font-size:9.5px;font-weight:800;letter-spacing:.4px;text-transform:uppercase;padding:3px 8px;border-radius:999px;background:var(--md-sys-color-primary);color:var(--md-sys-color-on-primary);animation:badgePulse 2.2s ease-in-out infinite}
@keyframes badgePulse{0%,100%{transform:scale(1)}50%{transform:scale(1.07)}}
.select-pay-hint{font-size:10.5px;opacity:.5;text-align:center;padding-top:2px}
#selectPlanCancel{margin-top:12px}
@media (max-width:360px){.select-plans{grid-template-columns:1fr}}

/* --- Диалог выбора эмодзи-статуса --- */
.status-emoji-window{width:min(460px,100%);max-width:460px;max-height:min(78vh,660px);display:flex;flex-direction:column;min-height:0}
.status-emoji-window h3{margin-bottom:10px;flex-shrink:0}
.status-emoji-window .sp-cats{border-radius:14px;margin-bottom:8px;flex-shrink:0}
.status-emoji-window .sp-body{flex:1 1 auto;min-height:0;max-height:52vh;border:1px solid var(--md-sys-color-outline-variant);border-radius:16px;background:var(--md-sys-color-surface-container)}
.status-emoji-window .dialog-btn-row{flex-shrink:0}
.status-emoji-window .dialog-btn-row .md-btn{flex:1}

/* --- Редактор изображения (аватар 1:1 / баннер 16:9) --- */
.image-editor-window{width:min(460px,100%);max-width:460px}
.img-editor-stage{display:flex;align-items:center;justify-content:center;padding:12px;margin-top:12px;border-radius:18px;background:repeating-conic-gradient(#252525 0% 25%,#1b1b1b 0% 50%) 50%/18px 18px;min-height:120px}
.img-editor-stage canvas{border-radius:12px;box-shadow:0 16px 36px -18px rgba(0,0,0,.95);touch-action:none;cursor:grab;max-width:100%;height:auto}
.img-editor-stage canvas:active{cursor:grabbing}
.img-editor-controls{display:flex;align-items:center;gap:10px;padding:14px 2px 4px}
.img-editor-controls .material-symbols-outlined{font-size:19px;opacity:.6}
.img-editor-controls input[type=range]{flex:1;min-width:0;accent-color:var(--md-sys-color-primary);height:22px}
.img-editor-hint{font-size:11px;opacity:.55;text-align:center;padding-bottom:12px}
#imgEditorApply.is-busy{opacity:.6;pointer-events:none}

/* --- Отключение анимаций нового блока --- */
body.no-animations .select-feature,
body.no-animations .select-plan-btn,
body.no-animations .select-hero-icon,
body.no-animations .select-plan-btn .sp-badge,
body.no-animations .name-status{animation:none !important;opacity:1 !important;transform:none !important}

/* --- Кнопка-индикатор баннера в настройках: «+» загрузить / «✓» убрать --- */
button.settings-row-emoji{border:0;appearance:none;-webkit-appearance:none;cursor:pointer;font-family:inherit;transition:background .15s,color .15s,transform .15s}
button.settings-row-emoji:hover{transform:scale(1.08)}
button.settings-row-emoji.is-clear{background:var(--md-sys-color-primary);color:var(--md-sys-color-on-primary)}

/* ================================================================
   V53 — SELECT: ОКНО ПРОКРУЧИВАЕТСЯ ЦЕЛИКОМ · ОТМЕНА ПОДПИСКИ
   Тарифные кнопки оказываются в самом низу прокрутки, а список
   функций больше не зажат в маленькую внутреннюю область.
   ================================================================ */
#selectPlanDialog .menu-content{
  display:flex;flex-direction:column;
  width:min(100%,440px);max-width:min(440px,92vw);
  height:auto;max-height:min(88vh,760px);
  overflow-x:hidden;overflow-y:auto;
  overscroll-behavior:contain;-webkit-overflow-scrolling:touch;
  padding-bottom:18px;
}
#selectPlanDialog .menu-content>*{flex:0 0 auto}
/* [hidden] должен побеждать авторские display (у .select-plans — display:grid) */
#selectPlanDialog [hidden]{display:none !important}
#selectPlanDialog .settings-window-body{flex:0 0 auto;min-height:auto;overflow:visible;padding-right:0;margin-right:0}
#selectPlanDialog .select-billing-title{padding-top:16px}
#selectPlanDialog .select-features .select-feature{padding:11px 12px}
#selectPlanDialog .sf-title{font-size:14px}
#selectPlanDialog .sf-sub{font-size:11.5px}

/* активный Select: вместо тарифов — статус и кнопка отмены подписки */
.select-active-block{display:flex;flex-direction:column;gap:10px;padding-top:6px}
.select-active-block[hidden]{display:none}
.select-active-note{display:flex;align-items:center;gap:9px;padding:11px 13px;border-radius:14px;background:color-mix(in srgb,var(--md-sys-color-primary) 14%,transparent);border:1px solid color-mix(in srgb,var(--md-sys-color-primary) 40%,transparent);font-size:13px;font-weight:700}
.select-active-note .material-symbols-outlined{font-size:19px;color:var(--md-sys-color-primary);flex:0 0 auto}

/* ================================================================
   V54 — ПОДПИСКА SELECT КАК РАБОЧАЯ ФУНКЦИЯ
   Баннер нажимается целиком, кнопка статуса выше баннера,
   префикс Select вместо пустого эмодзи-статуса.
   ================================================================ */

/* Уважаем системную настройку «меньше движения» — как и переключатель
   «Анимации», но без участия пользователя. */
@media (prefers-reduced-motion:reduce){
  body:not(.no-animations) *,
  body:not(.no-animations) *::before,
  body:not(.no-animations) *::after{
    animation-duration:.01ms !important;
    animation-iteration-count:1 !important;
    transition-duration:.01ms !important;
    scroll-behavior:auto !important;
  }
}

/* ================================================================
   V57 · док-бар = тумблер на 5 значений (как .segmented-switch)
   Единая капсула с рамкой и один ползунок, скользящий по сегментам.
   ================================================================ */
.dock-desktop{flex-direction:column;gap:8px;align-items:stretch}
/* Мобильная подложка — прозрачный держатель: капсулу несёт сам .dock-row */
.dock-bar{flex-direction:column;height:auto;gap:0;padding:0;border-radius:0;background:transparent;border:none;box-shadow:none;backdrop-filter:none;-webkit-backdrop-filter:none}
/* Капсула-тумблер: радиус/рамка как у .segmented-switch, но толще (V58) */
.dock-desktop .dock-row,.dock-bar .dock-row{position:relative;display:flex;align-items:center;justify-content:space-between;gap:0;width:100%;padding:8px;border-radius:999px;background:var(--md-sys-color-surface-variant);border:1px solid var(--md-sys-color-outline-variant);overflow:hidden;user-select:none;-webkit-user-select:none}
/* Ползунок: шириной ровно в один сегмент, сдвиг задаёт --dock-i из JS */
.dock-thumb{position:absolute;top:8px;bottom:8px;left:8px;width:calc((100% - 16px)/5);border-radius:999px;background:var(--md-sys-color-primary);box-shadow:0 4px 12px -4px rgba(0,0,0,.5);transition:transform .32s cubic-bezier(.68,-.55,.265,1.55),background .25s;z-index:1;pointer-events:none;transform:translateX(calc(var(--dock-i,0) * 100%))}
/* Сегменты: прозрачные и без рамок — только иконка и цвет поверх ползунка */
.dock-row > .dock-item,.dock-row > .dock-item-mobile{position:relative;z-index:2;flex:1;min-width:0;align-items:center;justify-content:center;padding:12px 8px;border-radius:999px;background:transparent !important;border:none !important;backdrop-filter:none;-webkit-backdrop-filter:none;color:var(--md-sys-color-on-surface-variant);transition:color .25s,transform .18s}
.dock-row > .dock-item > span,.dock-row > .dock-item-mobile > span{position:relative;z-index:1}
.dock-row > .dock-item.active,.dock-row > .dock-item-mobile.active{color:var(--md-sys-color-on-primary)}
/* Пока «таблетка» едет к новой вкладке, активная иконка ещё не лежит на
   ней и нарисована цветом «поверх плашки» — тёмная на тёмном фоне дока
   она пропадала примерно на 0,4 с. На это время возвращаем ей обычный
   цвет неактивной иконки: видно всегда, итоговый вид не меняется. */
.dock-row.traveling > .dock-item.active,
.dock-row.traveling > .dock-item-mobile.active{color:var(--md-sys-color-on-surface-variant)}
.dock-row > .dock-item:active,.dock-row > .dock-item-mobile:active{transform:scale(.93)}
/* Мобильная капсула «парит» над списком */
.dock-bar .dock-row{box-shadow:0 14px 38px -12px rgba(0,0,0,.55)}
/* Мини-виджет в шапке панели — вместо надписи «Чаты/Контакты/…» */
.panel-widget{display:none;flex:1;min-width:0;align-items:center;justify-content:center;padding:5px 10px;border-radius:14px;text-align:center;overflow:hidden;
  background:color-mix(in srgb,var(--md-sys-color-surface-container) 86%,transparent);
  border:1px solid color-mix(in srgb,var(--md-sys-color-outline-variant) 55%,transparent);
  box-shadow:0 6px 16px -14px rgba(0,0,0,.85)}
body.widget-in-header .panel-widget{display:flex}
body.widget-in-header .panel-header h2{display:none}
.panel-widget.empty{display:none !important}
/* V58: воздух между «время · дата · погода · батарея» */
.dw-inner{display:flex;align-items:center;justify-content:center;gap:9px;flex-wrap:nowrap;white-space:nowrap;font-size:11.5px;font-weight:600;letter-spacing:0;color:var(--md-sys-color-on-surface-variant);line-height:1.3}
.dw-item{display:inline-flex;align-items:center;gap:4px;white-space:nowrap}
.dw-item .material-symbols-outlined{font-size:14px;opacity:.85}
.dw-item .dw-ico{font-size:14px;line-height:1}
.dw-sep{opacity:.4}
.dw-item.dw-low{color:var(--md-sys-color-error)}
button.settings-row{width:100%;border:none;background:transparent;color:inherit;font-family:inherit;text-align:left;cursor:pointer}

/* ================================================================
   V55 · разделители дат в чате
   ================================================================ */
.day-separator{display:flex;justify-content:center;margin:16px 0 8px}
.day-separator:first-child{margin-top:4px}
.day-separator.animate-in{animation:separatorIn .42s var(--ease-out-quint) both}
.day-sep-capsule{font-size:11.5px;font-weight:600;letter-spacing:.3px;padding:4px 14px;border-radius:999px;background:color-mix(in srgb,var(--md-sys-color-surface-container) 92%,transparent);border:1px solid var(--md-sys-color-outline-variant);color:var(--md-sys-color-on-surface-variant);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));white-space:nowrap}

/* ================================================================
   ЖУРНАЛ ЗВОНКОВ В ПЕРЕПИСКЕ
   Запись не сообщение: она не выравнивается по краям как пузырь, а
   стоит по центру узкой строкой, и тап по ней звонит заново.
   ================================================================ */
.call-log-row{
  align-self:center;
  display:flex;align-items:center;gap:8px;
  max-width:min(86%,460px);
  margin:2px auto 6px;
  padding:7px 14px;border-radius:999px;
  background:color-mix(in srgb,var(--md-sys-color-surface-container) 88%,transparent);
  border:1px solid var(--md-sys-color-outline-variant);
  color:var(--md-sys-color-on-surface-variant);
  font-size:12.5px;
  cursor:pointer;user-select:none;
  -webkit-tap-highlight-color:transparent;
  transition:transform .16s ease,background .16s ease;
}
.call-log-row:active{transform:scale(.975)}
@media (hover:hover){ .call-log-row:hover{background:var(--md-sys-color-surface-container-high)} }
.call-log-icon{font-size:16px;flex-shrink:0;color:var(--md-sys-color-primary)}
.call-log-text{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.call-log-time{font-size:11px;opacity:.6;flex-shrink:0}
/* Пропущенный звонок — единственная запись, которая просится краснотой. */
.call-log-row.missed{color:var(--md-sys-color-error)}
.call-log-row.missed .call-log-icon{color:var(--md-sys-color-error)}

/* ================================================================
   V55 · живой аватар: «не беспокоить» · звонок · музыка
   ================================================================ */
.list-item-avatar.live-dnd,.chat-avatar-btn.live-dnd,.profile-avatar.live-dnd,
.profile-hero-avatar.live-dnd,.account-avatar.live-dnd,.search-result-card .sr-avatar.live-dnd{
  filter:brightness(.7) saturate(.8);transition:filter .3s
}
.live-call{
  box-shadow:0 0 0 2px var(--md-sys-color-primary)!important;
  transition:box-shadow .3s
}
@keyframes liveCallPulse{
  0%,100%{box-shadow:0 0 0 2px var(--md-sys-color-primary)}
  50%{box-shadow:0 0 0 3px var(--md-sys-color-primary),0 0 0 8px color-mix(in srgb,var(--md-sys-color-primary) 16%,transparent)}
}
.list-item-avatar.live-call,.chat-avatar-btn.live-call{animation:liveCallPulse 2.2s ease-in-out infinite}
.avatar-music-dot{
  position:absolute;left:-3px;bottom:-3px;width:17px;height:17px;border-radius:50%;
  background:var(--md-sys-color-primary);color:var(--md-sys-color-on-primary);
  border:2px solid var(--md-sys-color-surface-container);
  display:flex;align-items:center;justify-content:center;z-index:4;pointer-events:none;
  animation:popIn .25s cubic-bezier(.34,1.56,.64,1)
}
.avatar-music-dot .material-symbols-outlined{font-size:11px}
.chat-avatar-btn .avatar-music-dot{left:3px;bottom:3px;border-color:var(--md-sys-color-surface)}
.profile-hero .profile-avatar .avatar-music-dot,
.profile-avatar .avatar-music-dot{left:4px;bottom:4px;border-color:transparent}

/* ================================================================
   V55 · раздел «Музыка» и встроенный плеер
   ================================================================ */
.music-panel{display:flex;flex-direction:column;gap:10px;padding-bottom:4px}
.music-add{align-self:flex-start;display:inline-flex;align-items:center;gap:6px}
.music-list{display:flex;flex-direction:column;gap:6px}
.mt-row{
  display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:16px;
  background:color-mix(in srgb,var(--md-sys-color-surface-container) 68%,transparent);
  border:1px solid var(--md-sys-color-outline-variant);
  transition:background .2s,border-color .2s;touch-action:pan-y
}
.mt-row.active{background:color-mix(in srgb,var(--md-sys-color-primary) 16%,var(--md-sys-color-surface-container));border-color:transparent}
.mt-row.dragging{z-index:5;box-shadow:0 16px 32px -12px rgba(0,0,0,.6);border-color:var(--md-sys-color-primary)}
.mt-play{
  width:38px;height:38px;min-width:38px;border-radius:50%;border:none;background:var(--md-sys-color-primary);
  color:var(--md-sys-color-on-primary);display:flex;align-items:center;justify-content:center;cursor:pointer;flex-shrink:0;
  transition:transform .15s
}
.mt-play:active{transform:scale(.9)}
.mt-play .material-symbols-outlined{font-size:22px}
.mt-info{flex:1;min-width:0}
.mt-title{font-size:13.5px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mt-sub{font-size:11px;opacity:.6;margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mt-handle{cursor:grab;touch-action:none;padding:5px 3px;color:var(--md-sys-color-on-surface-variant);opacity:.7;flex-shrink:0}
.mt-handle:active{cursor:grabbing;opacity:1}
.mt-handle .material-symbols-outlined{font-size:20px}
.mt-del{
  width:32px;height:32px;min-width:32px;border-radius:50%;border:none;background:transparent;
  color:var(--md-sys-color-on-surface-variant);display:flex;align-items:center;justify-content:center;cursor:pointer;flex-shrink:0;
  transition:color .2s,background .2s
}
.mt-del:hover{color:var(--md-sys-color-error)}
.mt-del .material-symbols-outlined{font-size:19px}
.music-hint{font-size:11px;opacity:.5;text-align:center;margin-top:2px}
.music-empty{display:flex;flex-direction:column;align-items:center;gap:8px;padding:46px 16px;text-align:center;color:var(--md-sys-color-on-surface-variant)}
.music-empty .material-symbols-outlined{font-size:56px;opacity:.3;animation:breathe 3s ease-in-out infinite}
.music-empty .me-title{font-size:14.5px;font-weight:600}
.music-empty .me-sub{font-size:12px;opacity:.7;max-width:250px;line-height:1.45}
.music-dock{
  position:sticky;bottom:0;display:flex;align-items:center;gap:8px;padding:8px 10px;margin-top:8px;
  border-radius:20px;background:color-mix(in srgb,var(--md-sys-color-surface-container) 96%,transparent);
  border:1px solid var(--md-sys-color-outline-variant);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  box-shadow:0 -10px 26px -16px rgba(0,0,0,.7);z-index:3
}
.music-dock.hidden{display:none}
.music-dock .md-icon-btn{width:36px;height:36px}
.music-dock .md-play{background:var(--md-sys-color-primary);color:var(--md-sys-color-on-primary)}
.music-dock .md-play:hover{background:var(--md-sys-color-primary)}
.md-progress{flex:1;height:6px;min-width:40px;border-radius:999px;background:color-mix(in srgb,var(--md-sys-color-outline-variant) 62%,transparent);position:relative;cursor:pointer;touch-action:none}
.md-fill{height:100%;border-radius:999px;background:var(--md-sys-color-primary);width:0%;transition:width .15s linear}
.md-time{font-size:10.5px;opacity:.65;font-variant-numeric:tabular-nums;min-width:74px;text-align:right}

/* ================================================================
   V55 · раздел «Поиск»
   ================================================================ */
.search-panel{display:flex;flex-direction:column;padding-bottom:4px;min-height:100%}
.search-panel .search-input-top{padding:8px 0 4px;background:transparent;border-bottom:none}
.search-panel .search-filters{padding:2px 0 8px}
.search-panel .search-page-body{padding:0 0 12px;overflow:visible;flex:1 1 auto;min-height:0}
.search-clear{width:30px;height:30px;border-radius:50%;border:none;background:transparent;color:var(--md-sys-color-on-surface-variant);display:flex;align-items:center;justify-content:center;cursor:pointer;flex-shrink:0}
.search-clear .material-symbols-outlined{font-size:18px}
.search-clear:hover{background:var(--md-sys-color-surface-variant)}

/* ================================================================
   V55 · пин-код: полноэкранный ввод
   ================================================================ */
.pin-overlay{position:fixed;inset:0;z-index:10000;display:flex;align-items:center;justify-content:center;padding:18px;overflow-y:auto;
  background:radial-gradient(130% 90% at 50% 0%,color-mix(in srgb,var(--md-sys-color-primary) 24%,var(--md-sys-color-surface)) 0%,var(--md-sys-color-surface) 65%);
  animation:fadeIn .22s ease}
.pin-overlay[hidden]{display:none}
body.pin-locked{overflow:hidden;user-select:none;-webkit-user-select:none}
.pin-card{width:100%;max-width:300px;display:flex;flex-direction:column;align-items:center;gap:9px;text-align:center;animation:dialogIn .42s var(--ease-spring)}
.pin-icon{width:52px;height:52px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--md-sys-color-primary) 20%,transparent);color:var(--md-sys-color-primary)}
.pin-icon .material-symbols-outlined{font-size:26px}
.pin-title{font-size:17px;font-weight:600;color:var(--md-sys-color-on-surface)}
.pin-sub{font-size:12.5px;opacity:.65;min-height:15px;margin-top:-3px;color:var(--md-sys-color-on-surface-variant);line-height:1.35}
.pin-dots{display:flex;gap:10px;justify-content:center;min-height:14px;margin:1px 0 4px}
/* Вход по системной блокировке вместо набора пин-кода. */
.pin-bio{
  display:flex;align-items:center;gap:8px;
  padding:9px 16px;border-radius:999px;
  border:1px solid var(--md-sys-color-outline-variant);
  background:color-mix(in srgb,var(--md-sys-color-primary-container) 55%,transparent);
  color:var(--md-sys-color-on-primary-container);
  font-family:inherit;font-size:13px;cursor:pointer;
}
.pin-bio[hidden]{display:none}
.pin-bio:active{filter:brightness(.95)}
.pin-bio:disabled{opacity:.6}
.pin-bio .material-symbols-outlined{font-size:19px}
.pin-dot{width:12px;height:12px;border-radius:50%;border:2px solid color-mix(in srgb,var(--md-sys-color-on-surface) 42%,transparent);transition:transform .15s,background .15s,border-color .15s}
.pin-dot.filled{background:var(--md-sys-color-primary);border-color:var(--md-sys-color-primary);transform:scale(1.12)}
.pin-dots.shake{animation:pinShake .4s ease}
@keyframes pinShake{0%,100%{transform:translateX(0)}20%{transform:translateX(-9px)}40%{transform:translateX(9px)}60%{transform:translateX(-6px)}80%{transform:translateX(6px)}}
/* Клавиши строго квадратные → гарантированно ровные кружки */
.pin-pad{display:grid;grid-template-columns:repeat(3,auto);justify-content:center;gap:clamp(9px,3.2vw,14px);width:100%;margin-top:2px}
.pin-key{
  width:clamp(56px,19vw,70px);height:clamp(56px,19vw,70px);border-radius:50%;
  border:1px solid color-mix(in srgb,var(--md-sys-color-outline-variant) 75%,transparent);
  background:color-mix(in srgb,var(--md-sys-color-surface-container) 55%,transparent);
  color:var(--md-sys-color-on-surface);font-family:inherit;font-size:22px;font-weight:600;cursor:pointer;
  display:flex;align-items:center;justify-content:center;backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  transition:transform .12s,background .2s
}
.pin-key:active{transform:scale(.9);background:color-mix(in srgb,var(--md-sys-color-primary) 26%,transparent)}
.pin-key-fn{background:transparent;border-color:transparent;backdrop-filter:none;-webkit-backdrop-filter:none}
.pin-key-fn .material-symbols-outlined{font-size:24px;opacity:.75}
.pin-key[data-k="bio"].active{background:color-mix(in srgb,var(--md-sys-color-primary) 22%,transparent);border-color:transparent}
.pin-key[data-k="bio"].active .material-symbols-outlined{opacity:1;color:var(--md-sys-color-primary)}
/* «Забыли пин-код?» и «Отмена» — одна строка, равные половины */
.pin-actions{display:flex;gap:8px;width:100%;margin-top:6px;align-items:center}
.pin-actions .md-btn{flex:1 1 0;min-width:0;margin:0;padding:9px 6px;font-size:13px;text-align:center;justify-content:center;white-space:normal;line-height:1.25}
#pinForgotDialog{z-index:10010}
#pinLenChips,#pinDelayChips{display:grid;gap:6px;width:100%}
#pinLenChips{grid-template-columns:repeat(3,minmax(0,1fr))}
#pinDelayChips{grid-template-columns:repeat(5,minmax(0,1fr))}
#pinLenChips .chip,#pinDelayChips .chip{flex:none;min-width:0;width:100%;padding:9px 3px;font-size:13px}
#pinDelayChips .chip{font-size:12.5px;padding:9px 2px}

/* ================================================================
   V55 · свёрнутый звонок
   ================================================================ */
.call-mini{
  position:fixed;right:14px;bottom:calc(96px + var(--safe-bottom));z-index:4900;
  display:flex;align-items:center;gap:9px;padding:7px 8px 7px 7px;border-radius:22px;
  background:color-mix(in srgb,var(--md-sys-color-surface-container) 95%,transparent);
  border:1px solid var(--md-sys-color-outline-variant);
  box-shadow:0 18px 42px -14px rgba(0,0,0,.75);
  backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  cursor:pointer;touch-action:none;user-select:none;-webkit-user-select:none;
  max-width:min(240px,calc(100vw - 28px));
  animation:popIn .28s cubic-bezier(.34,1.56,.64,1)
}
.call-mini.hidden{display:none}
.call-mini.dragging{opacity:.96;box-shadow:0 28px 54px -12px rgba(0,0,0,.85);transform:scale(1.03)}
.call-mini-media{width:42px;height:42px;min-width:42px;border-radius:14px;overflow:hidden;background:var(--md-sys-color-secondary-container);color:var(--md-sys-color-on-secondary-container);display:flex;align-items:center;justify-content:center;flex-shrink:0}
.call-mini-media .material-symbols-outlined{font-size:22px}
.call-mini-media video{width:100%;height:100%;object-fit:cover}
.call-mini-info{min-width:0;flex:1}
.call-mini-name{font-size:12.5px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.call-mini-time{display:flex;align-items:center;gap:5px;font-size:11px;opacity:.72;margin-top:1px;font-variant-numeric:tabular-nums}
.call-mini-dot{width:7px;height:7px;border-radius:50%;background:#22c55e;animation:onlinePulse 1.6s ease-in-out infinite}
.call-mini-end{width:34px;height:34px;min-width:34px;border-radius:50%;border:none;background:var(--md-sys-color-error);color:#fff;display:flex;align-items:center;justify-content:center;cursor:pointer;flex-shrink:0}
.call-mini-end .material-symbols-outlined{font-size:19px}
@media (max-width:768px){
  .call-mini{bottom:calc(88px + var(--safe-bottom))}
}

/* ================================================================
   V56 · правки интерфейса
   ================================================================ */
/* 1. Диалоги, которые открываются поверх окон настроек — выше их */
#widgetCityDialog,#pinSettingsDialog{z-index:5100}

/* 2. Поле ввода: убираем лишний прямоугольник (матовое стекло — только подчёркивание) */
.md-text-field-filled input{border-radius:12px 12px 0 0}
body[data-matte="glass"] .md-text-field-filled input{background:transparent;backdrop-filter:none;-webkit-backdrop-filter:none}
body[data-matte="glass"] .md-text-field-filled input:focus{background:color-mix(in srgb,var(--md-sys-color-primary) 9%,transparent)}
body[data-matte="glass"] .md-text-field-filled input:focus + .md-text-field-label,
body[data-matte="glass"] .md-text-field-filled input:not(:placeholder-shown) + .md-text-field-label{background:transparent}

/* 3. Эмодзи-статус в профиле — чуть выше базовой линии имени */
#panelContent .profile-hero-name-row .hero-status-btn{top:-5px}

/* 4. Подтверждение (askConfirm) — выше экрана блокировки пин-кодом */
#confirmDialog{z-index:10100}

/* 5. Док-тумблер в monochrome и matte glass: капсула как у .segmented-switch */
body[data-matte="glass"] .dock-row > .dock-item,
body[data-matte="glass"] .dock-row > .dock-item-mobile{background:transparent !important;border:none !important;backdrop-filter:none;-webkit-backdrop-filter:none}
body[data-matte="glass"] .dock-desktop .dock-row,
body[data-matte="glass"] .dock-bar .dock-row{background:color-mix(in srgb,var(--md-sys-color-surface-variant) 55%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));border-color:color-mix(in srgb,var(--md-sys-color-outline-variant) 50%,transparent)}
body[data-matte="glass"] .dock-bar{background:transparent;border:none;box-shadow:none;backdrop-filter:none;-webkit-backdrop-filter:none}

/* 6. Matte glass: убираем прямоугольную подложку за полем поиска */
body[data-matte="glass"] .search-input-top{background:transparent;backdrop-filter:none;-webkit-backdrop-filter:none}

/* ================================================================
   V58 · толстый док · воздух в виджете · окна настроек на весь экран
   ================================================================ */

/* 1. Док-бар толще: капсула ~68px (было ~50px), иконки крупнее */
.dock-row > .dock-item .material-symbols-outlined,
.dock-row > .dock-item-mobile .material-symbols-outlined{font-size:26px}
/* Воздух между «время · дата · погода · батарея»; на узких экранах 14px
   ломало строку в три ряда и раздувало шапку — там хватает 10px */
@media (max-width:768px){ .dw-inner{gap:7px;font-size:11px} }

/* 2. Окна настроек — во весь экран, без кнопки «Закрыть» */
.menu-dialog.sw-full{padding:0;overflow:hidden}
.menu-dialog.sw-full > .settings-window{
  width:100%;max-width:none;height:100%;max-height:none;border-radius:0;box-shadow:none;
  padding:0 2px;
  /* низ — под жестовую зону, чтобы кнопки не прилипали к краю экрана */
  padding-bottom:max(16px,var(--safe-bottom));
  overflow-y:auto;overscroll-behavior:contain;
  overflow-x:hidden
}
#settingsBody{overflow-x:visible}
/* Небольшой отступ по бокам для элементов внутри окон настроек */
.settings-window-body,.settings-sub-list{padding-left:2px;padding-right:2px}
.settings-window > *{flex-shrink:0}
/* Прокручиваемые списки не сжимаются */
.settings-window > .settings-sub-list{flex-shrink:1}
/* Эмодзи-статус: шапка с «назад» вместо <h3> и список на всю высоту */
#statusEmojiDialog .sw-header h3{margin-bottom:0}
#statusEmojiDialog .sp-body{max-height:none}
/* Редактор изображения: холст занимает освободившуюся высоту */
#imageEditorDialog .img-editor-stage{flex:1 1 auto}
/* Select: у окна есть собственные #правила (440px) — они выше по
   специфичности, поэтому дублируем для полноэкранного режима */
#selectPlanDialog.sw-full > .settings-window{
  height:100%;max-height:none;
  padding-bottom:max(16px,var(--safe-bottom));
}
/* Шапка с кнопкой «назад» слева — вместо «Закрыть» внизу */
.sw-header{display:flex;align-items:center;gap:2px;flex:0 0 auto;margin:0 calc(-1 * var(--sw-pad,14px)) 8px;padding:6px 8px;border-bottom:1px solid var(--md-sys-color-outline-variant);background:var(--md-sys-color-surface)}
.sw-header h3{flex:1;min-width:0;margin:0 0 0 2px;font-size:16.5px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sw-header .md-icon-btn{flex:0 0 auto}
.settings-window > [data-close-sub]{display:none !important}
.settings-window-body{padding-bottom:max(20px,var(--safe-bottom))}
/* В glass-режиме шапка окна — тоже матовое стекло */
body[data-matte="glass"] .sw-header{background:color-mix(in srgb,var(--md-sys-color-surface) 62%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat)) saturate(var(--glass-saturate))}
body.light-theme[data-matte="glass"] .sw-header{background:color-mix(in srgb,var(--md-sys-color-surface) 45%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat)) saturate(var(--glass-saturate))}

/* ================================================================
   V59 · Aspect Chat · воздух в настройках виджета · чёткий дождь
   ================================================================ */

/* 1. Настройки мини-виджета — каждая строка отдельной панелью:
      между «Время / Дата / Погода / Батарея» появляется пробел */
.widget-toggles{display:flex;flex-direction:column;gap:12px}

/* 2. Matte glass + эффекты погоды: холст с дождём/снегом поднимается НАД
      матовыми панелями и модалками, иначе их backdrop-filter размазывает
      капли в кашу. Панели и окна при этом по-прежнему размывают фон —
      блюр остаётся. 5100 — выше .menu-dialog (5000), но ниже камеры (7000),
      экрана загрузки/офлайна (9999) и пина (10000). */
body[data-matte="glass"].fx-weather #weatherFx{z-index:5100;opacity:.9}
/* Поверх видеозвонка, просмотрщика медиа и редактора стикеров погоду
   гасим — эти экраны лежат ниже холста (см. WeatherFX.IMMERSIVE) */
#weatherFx.fx-under{opacity:0 !important}

/* 3. Шаг регистрации «имя и аватар»: круг-превью с подсказкой.
       Клик открывает выбор изображения, аватар грузится на сервер сразу —
       аккаунта ещё нет, поэтому эндпоинт /upload не требует токена. */
.reg-avatar-pick{display:flex;flex-direction:column;align-items:center;gap:8px;margin:0 auto 6px;padding:0;border:0;background:transparent;cursor:pointer;-webkit-tap-highlight-color:transparent}
.reg-avatar{position:relative;width:84px;height:84px;border-radius:50%;display:flex;align-items:center;justify-content:center;overflow:hidden;background:linear-gradient(135deg,color-mix(in srgb,var(--md-sys-color-primary) 38%,var(--md-sys-color-surface)),color-mix(in srgb,var(--md-sys-color-primary) 72%,var(--md-sys-color-surface)));border:2px solid color-mix(in srgb,var(--md-sys-color-primary) 50%,transparent);font-size:34px;font-weight:600;color:#fff;transition:transform .22s cubic-bezier(.34,1.56,.64,1),border-color .25s,box-shadow .25s,opacity .25s}
.reg-avatar-pick:hover .reg-avatar{transform:translateY(-2px);border-color:var(--md-sys-color-primary);box-shadow:0 8px 22px color-mix(in srgb,var(--md-sys-color-primary) 32%,transparent)}
.reg-avatar-pick:active .reg-avatar{transform:scale(.96)}
.reg-avatar img{width:100%;height:100%;object-fit:cover}
.reg-avatar-hint{font-size:11.5px;color:var(--md-sys-color-on-surface-variant);opacity:.8}
.reg-avatar-pick.loading .reg-avatar{opacity:.5;pointer-events:none}
.reg-avatar-pick.loading .reg-avatar-hint{color:var(--md-sys-color-primary);opacity:1}
/* Капча и согласие в шаге «Подтверждение» возвращаются в общий ритм шагов */
.auth-step[data-astep="reg-4"] .aerren-captcha,
.auth-step[data-astep="reg-4"] .auth-agree{margin-bottom:12px}

/* ================================================================
   V62 · Aspect Chat · поле ввода-текстареа · комбинированные
   сообщения · расшифровка аудио · окна настроек
   ================================================================ */

/* 1. Композер — textarea: растёт по содержимому, высота анимируется.
       (JS выставляет inline-height, max-height ограничивает рост) */
textarea.chat-input,
textarea.mobile-dock-input{
  resize:none;
  overflow-x:hidden;
  overflow-y:auto;
  line-height:1.4;
  max-height:132px;
  display:block;
  white-space:pre-wrap;
  transition:border-color .25s,box-shadow .25s,background .3s,height .18s cubic-bezier(.22,1,.36,1);
}
textarea.chat-input::-webkit-scrollbar,
textarea.mobile-dock-input::-webkit-scrollbar{display:none}
textarea.chat-input,
textarea.mobile-dock-input{scrollbar-width:none;-ms-overflow-style:none}
/* Композер в доке: кнопки прижаты к нижнему краю растущей строки */
.mobile-input-dock{align-items:flex-end}

/* 2. Текст сообщения сохраняет переводы строки (Enter теперь = перенос) */
.message-bubble{white-space:pre-wrap}
.message-bubble .msg-link{white-space:nowrap}

/* 3. Комбинированное сообщение: текст + вложение с границей.
       Под файлом фон темнее, вокруг — рамка. */
/* Текст рядом с файлом: отступы, чтобы текст, имя файла и время
   начинали��ь с одной линии по левому краю плашки. */
.combined-text{margin-bottom:2px;text-align:left;word-break:break-word}
.combined-under .combined-text{
  padding-left:0;margin-left:0;text-indent:0;
  line-height:1.42;
}
.combined-under .file-row,
.combined-under .combined-text{
  max-width:100%;
}
.combined-att{
  margin-top:8px;
  padding:7px;
  border-radius:16px;
  border:1px solid color-mix(in srgb,var(--md-sys-color-on-surface) 26%,transparent);
  background:color-mix(in srgb,#000 15%,var(--bubble-other-bg));
  touch-action:pan-y;
}
.message-bubble.own .combined-att{
  background:color-mix(in srgb,#000 10%,var(--bubble-own-bg));
  border-color:color-mix(in srgb,#000 18%,transparent);
}
.combined-att .media-wrap{border-radius:11px}
.combined-att .media-image,
.combined-att .media-video{width:100%;max-height:260px;object-fit:cover;border-radius:11px;display:block;touch-action:pan-y;}
.combined-att .file-row{gap:10px;padding:2px 2px;background:transparent;border:none}
.combined-att .file-row .file-icon{width:38px;height:38px;min-width:38px;border-radius:12px;padding:8px;background:color-mix(in srgb,var(--md-sys-color-primary) 22%,transparent);color:var(--md-sys-color-on-surface)}
.combined-att .file-name{font-size:13.5px}
.combined-att .file-size{font-size:11.5px;opacity:.75}
/* По отдельному снимку внутри группы: галочка и рамка, когда выбран. */
.combined-att[data-att-mid]{position:relative;cursor:pointer}
.combined-att.selected{
  border-color:var(--md-sys-color-primary);
  box-shadow:0 0 0 2px var(--md-sys-color-primary);
}
.combined-att.selected .media-image,
.combined-att.selected .media-video{opacity:.45}
.att-check{
  position:absolute;top:10px;right:10px;z-index:3;
  width:26px;height:26px;border-radius:50%;
  display:grid;place-items:center;
  font-size:17px;color:var(--md-sys-color-on-primary);
  background:var(--md-sys-color-primary);
  pointer-events:none;
}
.combined-att .file-download{color:inherit;opacity:.9}

/* 4. Расшифровка голосового: кнопка в самом пузыре аудио */
.audio-transcript{margin-top:9px;padding-top:7px;border-top:1px dashed color-mix(in srgb,var(--md-sys-color-on-surface) 30%,transparent)}
.audio-transcript-btn{
  display:flex;align-items:center;gap:6px;width:100%;
  border:none;background:transparent;padding:3px 2px;margin:0;
  color:var(--md-sys-color-primary);font:inherit;font-size:12.5px;
  cursor:pointer;border-radius:10px;text-align:left;
}
.audio-transcript-btn .material-symbols-outlined{font-size:16px}
.audio-transcript-btn .att-label{flex:1}
.audio-transcript-btn .att-chev{transition:transform .22s cubic-bezier(.22,1,.36,1)}
.audio-transcript.open .att-chev{transform:rotate(180deg)}
/* Раскрытие текста — плавная height-анимация. max-height с запасом:
   длинная расшифровка доезжает до 320px и дальше скроллится сама. */
.audio-transcript-body{
  max-height:0;overflow:hidden;opacity:0;
  font-size:13px;line-height:1.45;
  transition:max-height .3s cubic-bezier(.22,1,.36,1),opacity .22s ease,margin-top .22s ease;
}
.audio-transcript.open .audio-transcript-body{max-height:320px;overflow-y:auto;opacity:1;margin-top:6px}
.audio-transcript-text{white-space:pre-wrap;word-break:break-word}
/* Кнопка копирования расшифровки — под текстом, появляется вместе с ним */
.audio-transcript-copy{
  display:inline-flex;align-items:center;gap:5px;margin-top:7px;
  border:none;border-radius:999px;padding:4px 10px 4px 8px;
  background:color-mix(in srgb,var(--md-sys-color-primary) 12%,transparent);
  color:var(--md-sys-color-primary);font:inherit;font-size:11.5px;font-weight:600;
  cursor:pointer;transition:background .18s,transform .16s;
}
.audio-transcript-copy .material-symbols-outlined{font-size:15px}
.audio-transcript-copy:hover{background:color-mix(in srgb,var(--md-sys-color-primary) 20%,transparent)}
.audio-transcript-copy:active{transform:scale(.94)}
.audio-transcript-copy.copied{background:color-mix(in srgb,#22c55e 22%,transparent);color:#22c55e}
/* Пока распознавание идёт — аккуратная плашка «Расшифровка…» с
   бегущей полоской. Когда transcript-update придёт, рендер заменит
   её кнопкой с текстом. */
.audio-transcript-pending{margin-top:9px;padding-top:7px;border-top:1px dashed color-mix(in srgb,var(--md-sys-color-on-surface) 30%,transparent)}
.audio-transcript-status{
  position:relative;display:flex;align-items:center;gap:7px;
  padding:4px 2px;font-size:12px;font-weight:500;
  color:color-mix(in srgb,var(--md-sys-color-on-surface) 62%,transparent);
  border-radius:10px;overflow:hidden;
}
.audio-transcript-status .material-symbols-outlined{font-size:15px;animation:asrPulse 1.4s ease-in-out infinite}
.audio-transcript-status::after{
  content:'';position:absolute;inset:0;
  background:linear-gradient(100deg,transparent 20%,color-mix(in srgb,var(--md-sys-color-primary) 14%,transparent) 50%,transparent 80%);
  transform:translateX(-100%);animation:asrShimmer 1.5s ease-in-out infinite;pointer-events:none;
}
@keyframes asrPulse{0%,100%{opacity:.55;transform:scale(.94)}50%{opacity:1;transform:scale(1.06)}}
@keyframes asrShimmer{0%{transform:translateX(-100%)}60%,100%{transform:translateX(100%)}}
body.no-animations .audio-transcript-status .material-symbols-outlined,
body.no-animations .audio-transcript-status::after{animation:none}
@media (prefers-reduced-motion:reduce){
  .audio-transcript-status .material-symbols-outlined,
  .audio-transcript-status::after{animation:none}
}

/* 5. Окна настроек (settings-window): кнопки всегда досягаемы.
       Ряд кнопок липнет к низу окна — «Отмена» не уходит за экран,
       даже если содержимое длинное (окно прокручивается). */
.menu-dialog.sw-full .settings-window .dialog-btn-row{
  position:sticky;
  bottom:0;
  z-index:3;
  margin:auto calc(-1 * var(--sw-pad,16px)) 0;
  padding:10px var(--sw-pad) max(6px,var(--safe-bottom));
  background:var(--md-sys-color-surface);
  box-shadow:0 -10px 20px -16px rgba(0,0,0,.65);
  /* Горизонтальный ряд с переносом. flex-direction:column (узкие экраны)
     при переносе складывал кнопки в узкие высокие столбики — «Отмена»
     уезжала за правый край окна. Row + wrap: либо одна строка, либо
     вторая строка, но всегда внутри окна. */
  flex-direction:row;
  flex-wrap:wrap;
  height:auto !important;
  align-items:stretch;
}
body[data-matte="glass"] .menu-dialog.sw-full .settings-window .dialog-btn-row{
  /* Ряд кнопок лежит внутри уже размытого .menu-content — свой
     backdrop-filter создавал видимый прямоугольник поверх родителя. */
  background:color-mix(in srgb,var(--md-sys-color-surface-container) 78%,transparent);
}
/* Кнопки в ряду — скруглённые, делят строку и не шире окна */
.menu-dialog.sw-full .dialog-btn-row > *{
  flex:1 1 auto;
  min-width:76px;
  max-width:100%;
  border-radius:16px;
  padding:10px 12px;
  font-size:13.5px;
}
@media (max-width:520px){
  .menu-dialog.sw-full .dialog-btn-row > *{padding:11px 8px;font-size:13px}
}

/* 6. ПК: окна настроек не на весь экран — только в пределах области чата
       (список чатов остаётся видимым слева). */
@media (min-width:769px){
  .menu-dialog.sw-full{
    left:var(--panel-width,340px);
    align-items:center;
    justify-content:center;
    padding:24px;
    background:rgba(0,0,0,.45);
  }
  .menu-dialog.sw-full > .settings-window{
    width:min(100%,460px);
    max-width:460px;
    height:min(86vh,640px);
    max-height:640px;
    margin:0 auto;
    padding:0 16px;
    border-radius:24px;
    border:1px solid var(--md-sys-color-outline-variant);
    box-shadow:0 32px 80px -20px rgba(0,0,0,.6);
    overflow-y:hidden;
    overflow-x:hidden;
  }
  .menu-dialog.sw-full .settings-window .dialog-btn-row{margin-left:0;margin-right:0;padding-left:0;padding-right:0;border-radius:0 0 8px 8px}
  /* Matte glass снимает рамку и тень у sw-full окон (они полноэкранные на
     телефоне). На ПК это плавающая карточка — без рамки она читается как
     просто нагромождение текста. Возвращаем карточке контур и тень. */
  body[data-matte="glass"] .menu-dialog.sw-full .menu-content,
  body.light-theme[data-matte="glass"] .menu-dialog.sw-full .menu-content{
    border:1px solid color-mix(in srgb,var(--md-sys-color-outline-variant) 55%,transparent);
    box-shadow:0 32px 80px -20px rgba(0,0,0,.55),inset 0 1px 0 rgba(255,255,255,.06);
  }
}
@media (min-width:769px){
  #selectPlanDialog.sw-full > .settings-window{
    width:min(100%,460px);
    max-width:460px;
    max-height:640px;
    padding-bottom:max(16px,var(--safe-bottom));
  }
}

/* ================================================================
   V63 · Aspect Chat · правки по отзывам:
   1) поле ввода сообщения — без полосы прокрутки;
   2) Matte Glass — убраны «уродливые прямоугольники» за рядами кнопок
      (смена темы «Светлая/Тёмная», «Установить/Удалить» в пин-коде);
   3) телефон — обложки видео и кружки всегда видны.
   ================================================================ */

/* 1. Композер. Текст в поле ввода прокручивается (длинные сообщения), но
      полоса появляться не должна — даже в старых WebView на телефонах, где
      нет свойства scrollbar-width (там спасает только ::-webkit-scrollbar). */
textarea.chat-input,
textarea.mobile-dock-input{
  scrollbar-width:none!important;
  -ms-overflow-style:none!important;
}
textarea.chat-input::-webkit-scrollbar,
textarea.mobile-dock-input::-webkit-scrollbar{
  width:0!important;height:0!important;padding:0!important;margin:0!important;
  display:none!important;
}

/* 2. Ряд кнопок внутри окна настроек. Раньше в стекле это была сплошная
      тёмная плашка (78% непрозрачности, острые углы, тень) — «прямоугольник
      за элементами». Прозрачный фон + размытие: в покое плашка не видна
      вовсе, при прокрутке содержимое под кнопками мягко расплывается. */
body[data-matte="glass"] .menu-dialog.sw-full .settings-window .dialog-btn-row{
  background:transparent;
  backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  -webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  box-shadow:none;
}

/* 3а. Круглое видео (кружок). Пока кадр не декодирован — чёрный круг
      сливается с тёмным фоном чата, и «кружков не видно на телефоне».
      Градиент + светлая рамка делают его различимым всегда, а обложку
      подставляет JS (снимок первого кадра в canvas → poster). */
.circle-bubble .circle-video{
  background:radial-gradient(circle at 50% 35%,#404040 0%,#1c1c1c 72%);
  box-shadow:0 0 0 1px rgba(255,255,255,.14),0 4px 16px -6px rgba(0,0,0,.4);
}
/* 3б. Обычное видео: та же «подложка», чтобы чёрный прямоугольник с
      кнопкой play читался как медиа, а не как дыра в чате. */
.media-wrap,
.media-video{
  background:radial-gradient(circle at 50% 38%,#303030 0%,#131313 75%);
}
/* Кадра ещё нет: <video> прозрачен — не видно ни его собственного
   значка нечитаемого видео, ни нашего play_arrow. Видна только
   подложка. Значок появляется вместе с первым кадром. */
.media-wrap.media-no-cover .media-video,
.circle-bubble.media-no-cover .circle-video{
  opacity:0;
}
.media-wrap.media-no-cover .media-overlay-btn{
  display:none;
}
/* 3в. Файл не загрузился (сеть упала) или повреждён на сервере —
      показываем явную иконку вместо пустоты. */
.media-wrap.media-broken::after,
.circle-bubble.media-broken::after{
  content:'broken_image';
  font-family:'Material Symbols Outlined';
  font-weight:normal;font-style:normal;line-height:1;
  font-variation-settings:'FILL' 0,'wght' 400,'GRAD' 0,'opsz' 24;
  position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);
  color:rgba(255,255,255,.72);font-size:34px;pointer-events:none;
}
.circle-bubble.media-broken::after{font-size:42px}
.media-wrap.media-broken .media-video,
.circle-bubble.media-broken .circle-video{opacity:.22}
/* Плейсхолдер битого файла: ровно по размеру, с кнопкой повтора.
   Без неё контейнер просто оставался пустым серым прямоугольником —
   было непонятно, грузится картинка или уже нет. */
.media-broken{min-height:120px}
.media-broken .media-retry{
  position:absolute;top:50%;left:50%;transform:translate(-50%,22px);
  z-index:4;display:grid;place-items:center;
  width:38px;height:38px;padding:0;border-radius:50%;
  border:1px solid rgba(255,255,255,.22);
  background:rgba(0,0,0,.42);color:#fff;cursor:pointer;
  -webkit-tap-highlight-color:transparent;
}
.media-broken .media-retry span{font-size:22px}
.media-broken .media-retry:active{transform:translate(-50%,22px) scale(.92)}

/* ================================================================
   V64 · Aspect Chat · «прямоугольники» убраны окончательно.

   Корень: строка кнопок лежала ВНУТРИ прокручиваемой области окна и имела
   position:sticky; bottom:0. При freshly-открытом окне (скролл в начале)
   строка приклеивалась к нижней кромке и накладывалась на текст — любая
   заливка такой строки (непрозрачная в обычной теме, размытая в стекле)
   читалась прямоугольной плашкой с прямыми углами.

   Теперь: строка, которая является последним элементом содержимого,
   JS-ом (promoteDialogButtonRow) выносится из .settings-window-body в
   футер окна — она больше ничего не перекрывает. Остальные строки
   (например, «Светлая/Тёмная» в середине списка) становятся статичными:
   едут вместе с текстом, плашки не образуют.
   ================================================================ */

/* 1. Никакой плашки: прозрачно, без тени и размытия, без «липкости». */
.menu-dialog.sw-full .settings-window .dialog-btn-row{
  position:static;
  background:transparent;
  box-shadow:none;
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
  z-index:auto;
  margin-top:0;
}

/* 2. Футер окна (строка, вынесенная JS-ом из прокрутки): во всю ширину
      окна, строго под содержимым, всегда виден — «Отмена/Установить» не
      уходят за экран и ничего не накрывают. */
.menu-dialog.sw-full .settings-window > .dialog-btn-row{
  flex:0 0 auto;
  margin-left:calc(-1 * var(--sw-pad,16px));
  margin-right:calc(-1 * var(--sw-pad,16px));
  margin-bottom:0;
  padding:10px var(--sw-pad,16px) max(8px,var(--safe-bottom));
}

/* 3. Стеклянный селектор (выше по специфичности) тоже гасим: размытие
      под статичной строкой ничего не «мягчит» — строка-то больше не
      наложение, а просто элемент содержимого. Фон за кнопками теперь
      нигде и никогда не собирается в плашку. */
body[data-matte="glass"] .menu-dialog.sw-full .settings-window .dialog-btn-row{
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
  background:transparent;
  box-shadow:none;
}

/* P2P: плейсхолдер, пока файл ещё идёт по data channel */
img[src^="p2p:"], video[src^="p2p:"]{min-width:140px;min-height:90px;background:rgba(128,128,128,.15);border-radius:10px;}

/* ================================================================
   V66 · Aspect Chat · правки по отзывам:
   1) мягкое белое свечение снизу фона в категориях (Чаты/Контакты/
      Музыка/Поиск/Профиль);
   2) индикатор загрузки вложения — форма волны (Shape: Wavy);
   3) текст под фото/видео — бордер пузыря медиа не захватывает;
   4) pull-to-refresh: «Contained» круговой индикатор под шапкой;
   5) капельная анимация тумблера дока.
   ================================================================ */

/* 1. Свечение. list-panel — свой stacking-контекст (isolation), поэтому
      псевдоэлемент с z-index:-1 ложится НАД фоном панели, но ПОД всем
      содержимым — свет уходит в глубину, ничего не перекрывая.
      pointer-events:none — свет не ловит клики. */
.list-panel{isolation:isolate}
.list-panel::after{
  content:'';
  position:absolute;
  left:50%;
  bottom:0;
  width:150%;
  height:56%;
  transform:translateX(-50%);
  z-index:-1;
  pointer-events:none;
  background:radial-gradient(120% 62% at 50% 100%,
    rgba(255,255,255,.14) 0%,
    rgba(255,255,255,.065) 34%,
    rgba(255,255,255,.02) 58%,
    rgba(255,255,255,0) 74%);
}
body.light-theme .list-panel::after{
  background:radial-gradient(120% 62% at 50% 100%,
    rgba(255,255,255,.95) 0%,
    rgba(255,255,255,.55) 34%,
    rgba(255,255,255,.22) 58%,
    rgba(255,255,255,0) 76%);
}
/* Стекло: свет собирается на уже размытом фоне, чуть ярче. */
body[data-matte="glass"] .list-panel::after{
  background:radial-gradient(120% 62% at 50% 100%,
    rgba(255,255,255,.17) 0%,
    rgba(255,255,255,.08) 34%,
    rgba(255,255,255,.03) 58%,
    rgba(255,255,255,0) 76%);
}

/* 2. Загрузка вложения — M3 Expressive Wavy Linear Progress (Determinate):
      волнистая полоса-трек («кривая полоса») по низу чипа + активный
      сегмент, длина которого равна реальному проценту загрузки. */
.attachment-chip .ac-progress{
  position:absolute;
  inset:0;
  display:flex;
  align-items:flex-end;
  padding:6px;
  background:linear-gradient(to top, rgba(0,0,0,.6) 0%, rgba(0,0,0,.18) 34%, rgba(0,0,0,0) 62%);
  z-index:1;
}
.attachment-chip .ac-progress .ac-wavy{
  display:block;
  width:100%;
  height:14px;
  overflow:visible;
}
.attachment-chip .ac-progress .ac-wv-track{
  fill:none;
  stroke:color-mix(in srgb, var(--md-sys-color-on-surface) 34%, transparent);
  stroke-width:2.6;
  stroke-linecap:round;
}
.attachment-chip .ac-progress .ac-wv-active{
  fill:none;
  stroke:var(--md-sys-color-primary);
  stroke-width:2.6;
  stroke-linecap:round;
  filter:drop-shadow(0 0 4px color-mix(in srgb, var(--md-sys-color-primary) 55%, transparent));
  transition:stroke-dasharray .18s cubic-bezier(.2,0,0,1);
}
body.light-theme .attachment-chip .ac-progress .ac-wv-track{stroke:color-mix(in srgb, #fff 45%, transparent)}

/* 3. Медиа + текст в одном сообщении: снимок в узкой собственной рамке,
      пузырь под ним прозрачный, текст «прирастает» плашкой снизу.
      Раньше общий бордер обхватывал и фото, и пустоту вокруг. */
.message-bubble.combined-bubble.media-first{
  background:transparent;
  border:none;
  box-shadow:none;
  padding:0;
  margin-bottom:6px;
  /* Пузырь сжимается по содержимому: ширина задаётся медиа, текст-плашка
     прирастает точно под ним (раньше пузырь тянулся под широкий текст и
     справа от фото оставалась пустая полоса). */
  width:fit-content;
  max-width:min(78%,420px);
}
.message-bubble.combined-bubble.media-first .combined-att{
  margin-top:0;
  padding:3px;
  border-radius:18px;
  border:1px solid color-mix(in srgb,var(--md-sys-color-on-surface) 24%,transparent);
  background:color-mix(in srgb,#000 26%,transparent);
  width:100%;
  max-width:none;
  box-sizing:border-box;
}
.message-bubble.combined-bubble.media-first.own .combined-att{
  border-color:color-mix(in srgb,var(--md-sys-color-on-surface) 18%,transparent);
  background:color-mix(in srgb,#000 18%,transparent);
}
.message-bubble.combined-bubble.media-first .combined-att .media-wrap{border-radius:15px;overflow:hidden}
.message-bubble.combined-bubble.media-first .combined-att .media-image,
.message-bubble.combined-bubble.media-first .combined-att .media-video{border-radius:15px;max-height:320px;max-width:100%;width:100%;height:auto}

/* ---------- ГРУППА ВЛОЖЕНИЙ: компактная сетка ----------
   Раньше каждое вложение становилось отдельной карточкой во всю ширину
   пузыря и складывалось в столбик. Отсюда были все жалобы: сообщение
   с тремя фото занимало несколько экранов высотой, а у вертикальных
   скриншотов карточка была заметно выше самой картинки — по бокам
   оставался пустой чёрный прямоугольник, и рядом справа серая пустота.

   Теперь два и более вложения — равные квадратные ячейки: высота всего
   блока держится в разумных пределах, пропорции у всех одинаковые,
   ничего не растянуто и не срезано (cover здесь уместен — полный кадр
   всё равно открывается тапом через openMediaViewerFromChat). */
.message-bubble.combined-bubble.media-first.att-gallery{
  width:100%;
  max-width:min(78%,420px);
  display:grid;
  gap:3px;
}
.message-bubble.combined-bubble.media-first.att-gallery.cols-2{grid-template-columns:repeat(2,1fr)}
.message-bubble.combined-bubble.media-first.att-gallery.cols-3{grid-template-columns:repeat(3,1fr)}
.message-bubble.combined-bubble.media-first.att-gallery .combined-att{
  width:auto;max-width:none;
  margin-top:0;padding:0;
  border-radius:10px;
  aspect-ratio:1;
  overflow:hidden;
  min-width:0;
}
.message-bubble.combined-bubble.media-first.att-gallery .combined-att .media-wrap{
  width:100%;height:100%;border-radius:10px;
}
.message-bubble.combined-bubble.media-first.att-gallery .combined-att .media-image,
.message-bubble.combined-bubble.media-first.att-gallery .combined-att .media-video{
  position:absolute;inset:0;
  width:100%;height:100%;max-height:none;max-width:none;
  object-fit:cover;border-radius:10px;
}
/* Текст и время — под сеткой, во всю ширину, а не в одной колонке. */
.message-bubble.combined-bubble.media-first.att-gallery .combined-under{
  grid-column:1 / -1;
}

/* Одно вложение рядом с текстом: рамка идёт по размеру самой картинки,
   а не растягивается на всю ширину пузыря. Иначе вертикальный скриншот
   получал обрезанный по краям блок и пустые поля по бокам. */
.message-bubble.combined-bubble.media-first:not(.att-gallery) .combined-att{
  width:auto;max-width:none;display:inline-block;
}
.message-bubble.combined-bubble.media-first:not(.att-gallery) .combined-att .media-image,
.message-bubble.combined-bubble.media-first:not(.att-gallery) .combined-att .media-video{
  width:auto;height:auto;max-width:100%;max-height:min(58vh,360px);
  object-fit:contain;border-radius:15px;
}
/* Текст-плашка, приросшая снизу: общий фон, но уже медиа-рамки.
   Ширина — ровно ширина медиа-контейнера (пузырь fit-content), поэтому
   плашка «прилегает» к фото без полей по бокам. */
.message-bubble.combined-bubble.media-first .combined-under{
  margin-top:3px;
  padding:8px 14px 6px;
  border-radius:18px;
  background:var(--bubble-other-bg);
  color:var(--bubble-other-text);
  width:100%;
  max-width:none;
  box-sizing:border-box;
}
.message-bubble.combined-bubble.media-first.own .combined-under{
  background:var(--bubble-own-bg);
  color:var(--bubble-own-text);
}
.message-bubble.combined-bubble.media-first .combined-under .combined-text{margin-bottom:0}
.message-bubble.combined-bubble.media-first .combined-under .message-time{
  margin-top:2px;
  text-align:right;
  opacity:.7;
}
body[data-matte="glass"] .message-bubble.combined-bubble.media-first{background:transparent}
body[data-matte="glass"] .message-bubble.combined-bubble.media-first .combined-att{
  background:color-mix(in srgb,#000 22%,transparent);
  border-color:color-mix(in srgb,var(--md-sys-color-outline-variant) 45%,transparent);
}
body[data-matte="glass"] .message-bubble.combined-bubble.media-first .combined-under{
  background:color-mix(in srgb,var(--bubble-other-bg) 55%,transparent);
  backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  -webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  border:1px solid color-mix(in srgb,var(--md-sys-color-outline-variant) 40%,transparent);
}
body[data-matte="glass"] .message-bubble.combined-bubble.media-first.own .combined-under{
  background:color-mix(in srgb,var(--bubble-own-bg) 55%,transparent);
}

/* 4. Pull-to-refresh — M3 Loading Indicator (contained):
      круглый тональный бейдж, внутри которого вращается фигура и
      перетекает из формы в форму (8 лепестков → 2 → круг → 6 → 4 → 7).
      Бейдж тянется за пальцем по натяжению (--pr-p); на пороге
      срабатывания заливается primary, фигура становится контрастной. */
.panel-refresh{
  position:absolute;
  left:50%;
  top:0;
  width:48px;
  height:48px;
  margin:0;
  transform:translate(-50%,0) scale(.55,.55);
  z-index:4;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:50%;
  background:color-mix(in srgb, var(--md-sys-color-primary) 24%, var(--md-sys-color-surface-container-high, var(--md-sys-color-surface-container, var(--md-sys-color-surface-variant))));
  box-shadow:0 4px 12px -4px rgba(0,0,0,.45), 0 1px 3px -1px rgba(0,0,0,.3);
  opacity:0;
  pointer-events:none;
  will-change:transform,opacity;
}
.panel-refresh .pr-gear{
  width:34px;
  height:34px;
  display:flex;
}
.panel-refresh .pr-gear svg{
  width:100%;
  height:100%;
  display:block;
  animation:prGearSpin 2.4s linear infinite;
}
/* Фигура перетекает между шестью формами (число лепестков меняется):
   все пути построены одной функцией, поэтому у них одинаковая структура
   (M + 63 L + Z) и CSS-свойство d корректно интерполирует их по точкам. */
.panel-refresh .pr-gear .pr-gear-p{
  fill:var(--md-sys-color-primary, #4f378b);
  transition:fill .18s ease;
  animation:prGearMorph 2.4s cubic-bezier(.4,0,.2,1) infinite;
}
/* Порог превышен — бейдж заливается primary, фигура становится
   контрастной: вращение не прерывается, состояние видно мгновенно. */
.panel-refresh.ready{
  background:var(--md-sys-color-primary, #6750a4);
}
.panel-refresh.ready .pr-gear .pr-gear-p{
  fill:var(--md-sys-color-on-primary, #fff);
}
@keyframes prGearSpin{ from{transform:rotate(0deg)} to{transform:rotate(360deg)} }
@keyframes prGearMorph{
  0%{d:path("M95.0 50.0L92.2 54.2L85.3 57.0L78.4 58.6L74.9 60.3L76.1 64.0L79.9 70.0L82.7 76.9L81.8 81.8L76.9 82.7L70.0 79.9L64.0 76.1L60.3 74.9L58.6 78.4L57.0 85.3L54.2 92.2L50.0 95.0L45.8 92.2L43.0 85.3L41.4 78.4L39.7 74.9L36.0 76.1L30.0 79.9L23.1 82.7L18.2 81.8L17.3 76.9L20.1 70.0L23.9 64.0L25.1 60.3L21.6 58.6L14.7 57.0L7.8 54.2L5.0 50.0L7.8 45.8L14.7 43.0L21.6 41.4L25.1 39.7L23.9 36.0L20.1 30.0L17.3 23.1L18.2 18.2L23.1 17.3L30.0 20.1L36.0 23.9L39.7 25.1L41.4 21.6L43.0 14.7L45.8 7.8L50.0 5.0L54.2 7.8L57.0 14.7L58.6 21.6L60.3 25.1L64.0 23.9L70.0 20.1L76.9 17.3L81.8 18.2L82.7 23.1L79.9 30.0L76.1 36.0L74.9 39.7L78.4 41.4L85.3 43.0L92.2 45.8Z")}
  16.6667%{d:path("M95.0 50.0L94.5 54.4L93.1 58.6L90.9 62.4L87.9 65.7L84.4 68.4L80.5 70.4L76.4 71.7L72.3 72.3L68.3 72.3L64.6 71.9L61.3 71.2L58.4 70.3L55.9 69.4L53.7 68.7L51.8 68.2L50.0 68.0L48.2 68.2L46.3 68.7L44.1 69.4L41.6 70.3L38.7 71.2L35.4 71.9L31.7 72.3L27.7 72.3L23.6 71.7L19.5 70.4L15.6 68.4L12.1 65.7L9.1 62.4L6.9 58.6L5.5 54.4L5.0 50.0L5.5 45.6L6.9 41.4L9.1 37.6L12.1 34.3L15.6 31.6L19.5 29.6L23.6 28.3L27.7 27.7L31.7 27.7L35.4 28.1L38.7 28.8L41.6 29.7L44.1 30.6L46.3 31.3L48.2 31.8L50.0 32.0L51.8 31.8L53.7 31.3L55.9 30.6L58.4 29.7L61.3 28.8L64.6 28.1L68.3 27.7L72.3 27.7L76.4 28.3L80.5 29.6L84.4 31.6L87.9 34.3L90.9 37.6L93.1 41.4L94.5 45.6Z")}
  33.3333%{d:path("M95.0 50.0L94.8 54.4L94.1 58.8L93.1 63.1L91.6 67.2L89.7 71.2L87.4 75.0L84.8 78.5L81.8 81.8L78.5 84.8L75.0 87.4L71.2 89.7L67.2 91.6L63.1 93.1L58.8 94.1L54.4 94.8L50.0 95.0L45.6 94.8L41.2 94.1L36.9 93.1L32.8 91.6L28.8 89.7L25.0 87.4L21.5 84.8L18.2 81.8L15.2 78.5L12.6 75.0L10.3 71.2L8.4 67.2L6.9 63.1L5.9 58.8L5.2 54.4L5.0 50.0L5.2 45.6L5.9 41.2L6.9 36.9L8.4 32.8L10.3 28.8L12.6 25.0L15.2 21.5L18.2 18.2L21.5 15.2L25.0 12.6L28.8 10.3L32.8 8.4L36.9 6.9L41.2 5.9L45.6 5.2L50.0 5.0L54.4 5.2L58.8 5.9L63.1 6.9L67.2 8.4L71.2 10.3L75.0 12.6L78.5 15.2L81.8 18.2L84.8 21.5L87.4 25.0L89.7 28.8L91.6 32.8L93.1 36.9L94.1 41.2L94.8 45.6Z")}
  50%{d:path("M95.0 50.0L92.9 54.2L87.3 57.4L80.2 59.2L73.8 59.9L70.0 60.7L69.4 63.0L71.3 67.4L73.9 73.9L75.4 80.9L74.5 86.7L71.1 89.5L66.0 88.5L60.4 84.4L55.7 78.9L52.4 74.3L50.0 72.5L47.6 74.3L44.3 78.9L39.6 84.4L34.0 88.5L28.9 89.5L25.5 86.7L24.6 80.9L26.1 73.9L28.7 67.4L30.6 63.0L30.0 60.7L26.2 59.9L19.8 59.2L12.7 57.4L7.1 54.2L5.0 50.0L7.1 45.8L12.7 42.6L19.8 40.8L26.2 40.1L30.0 39.3L30.6 37.0L28.7 32.6L26.1 26.1L24.6 19.1L25.5 13.3L28.9 10.5L34.0 11.5L39.6 15.6L44.3 21.1L47.6 25.7L50.0 27.5L52.4 25.7L55.7 21.1L60.4 15.6L66.0 11.5L71.1 10.5L74.5 13.3L75.4 19.1L73.9 26.1L71.3 32.6L69.4 37.0L70.0 39.3L73.8 40.1L80.2 40.8L87.3 42.6L92.9 45.8Z")}
  66.6667%{d:path("M95.0 50.0L93.8 54.3L90.3 58.0L85.1 60.6L79.1 62.1L73.2 62.4L68.3 62.2L64.7 62.1L62.7 62.7L62.1 64.7L62.2 68.3L62.4 73.2L62.1 79.1L60.6 85.1L58.0 90.3L54.3 93.8L50.0 95.0L45.7 93.8L42.0 90.3L39.4 85.1L37.9 79.1L37.6 73.2L37.8 68.3L37.9 64.7L37.3 62.7L35.3 62.1L31.7 62.2L26.8 62.4L20.9 62.1L14.9 60.6L9.7 58.0L6.2 54.3L5.0 50.0L6.2 45.7L9.7 42.0L14.9 39.4L20.9 37.9L26.8 37.6L31.7 37.8L35.3 37.9L37.3 37.3L37.9 35.3L37.8 31.7L37.6 26.8L37.9 20.9L39.4 14.9L42.0 9.7L45.7 6.2L50.0 5.0L54.3 6.2L58.0 9.7L60.6 14.9L62.1 20.9L62.4 26.8L62.2 31.7L62.1 35.3L62.7 37.3L64.7 37.9L68.3 37.8L73.2 37.6L79.1 37.9L85.1 39.4L90.3 42.0L93.8 45.7Z")}
  83.3333%{d:path("M95.0 50.0L92.5 54.2L86.1 57.2L78.8 58.7L73.6 59.8L72.2 61.9L74.3 66.3L77.7 72.8L79.7 79.7L78.5 84.7L74.1 86.0L67.8 83.3L61.9 78.6L57.5 74.8L54.9 74.5L52.8 78.3L50.0 84.9L46.0 91.1L41.3 93.9L37.3 91.9L35.2 85.8L34.9 78.2L35.3 72.0L34.3 69.2L30.4 69.6L23.8 71.5L16.3 72.5L10.7 71.0L9.1 66.9L12.1 61.5L17.7 56.4L23.1 52.7L25.2 50.0L23.1 47.3L17.7 43.6L12.1 38.5L9.1 33.1L10.7 29.0L16.3 27.5L23.8 28.5L30.4 30.4L34.3 30.8L35.3 28.0L34.9 21.8L35.2 14.2L37.3 8.1L41.3 6.1L46.0 8.9L50.0 15.1L52.8 21.7L54.9 25.5L57.5 25.2L61.9 21.4L67.8 16.7L74.1 14.0L78.5 15.3L79.7 20.3L77.7 27.2L74.3 33.7L72.2 38.1L73.6 40.2L78.8 41.3L86.1 42.8L92.5 45.8Z")}
  100%{d:path("M95.0 50.0L92.2 54.2L85.3 57.0L78.4 58.6L74.9 60.3L76.1 64.0L79.9 70.0L82.7 76.9L81.8 81.8L76.9 82.7L70.0 79.9L64.0 76.1L60.3 74.9L58.6 78.4L57.0 85.3L54.2 92.2L50.0 95.0L45.8 92.2L43.0 85.3L41.4 78.4L39.7 74.9L36.0 76.1L30.0 79.9L23.1 82.7L18.2 81.8L17.3 76.9L20.1 70.0L23.9 64.0L25.1 60.3L21.6 58.6L14.7 57.0L7.8 54.2L5.0 50.0L7.8 45.8L14.7 43.0L21.6 41.4L25.1 39.7L23.9 36.0L20.1 30.0L17.3 23.1L18.2 18.2L23.1 17.3L30.0 20.1L36.0 23.9L39.7 25.1L41.4 21.6L43.0 14.7L45.8 7.8L50.0 5.0L54.2 7.8L57.0 14.7L58.6 21.6L60.3 25.1L64.0 23.9L70.0 20.1L76.9 17.3L81.8 18.2L82.7 23.1L79.9 30.0L76.1 36.0L74.9 39.7L78.4 41.4L85.3 43.0L92.2 45.8Z")}
}
/* Контент подтягивается за пальцем — без «дерганий». */
.panel-content{will-change:transform}

/* 4а. Комментарии к сообщениям (канал/группа с включённой настройкой):
       кнопка-счётчик под сообщением + ветка в диалоге. */
.msg-comments-btn{
  display:inline-flex;
  align-items:center;
  gap:3px;
  margin-top:5px;
  padding:2px 9px 2px 6px;
  border:none;
  border-radius:999px;
  background:color-mix(in srgb, var(--md-sys-color-primary) 14%, transparent);
  color:var(--md-sys-color-primary);
  font-family:inherit;
  font-size:11px;
  font-weight:600;
  line-height:1.5;
  cursor:pointer;
  transition:background .2s;
}
.msg-comments-btn:hover{background:color-mix(in srgb, var(--md-sys-color-primary) 24%, transparent)}
.msg-comments-btn .material-symbols-outlined{font-size:14px}
.msg-comments-btn .mc-count{min-width:11px;text-align:center}
.comments-dialog{
  width:min(560px,94vw);
  max-height:82vh;
  display:flex;
  flex-direction:column;
  padding:0;
  overflow:hidden;
}
.comments-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:14px 16px 10px;
  border-bottom:1px solid color-mix(in srgb, var(--md-sys-color-outline-variant) 45%, transparent);
  flex-shrink:0;
}
.comments-head h3{margin:0;font-size:16px}
.comments-parent{
  padding:10px 16px;
  background:color-mix(in srgb, var(--md-sys-color-primary) 9%, transparent);
  border-bottom:1px solid color-mix(in srgb, var(--md-sys-color-outline-variant) 35%, transparent);
  font-size:13px;
  flex-shrink:0;
  max-height:96px;
  overflow-y:auto;
}
.comments-parent-time{margin-top:3px;font-size:11px;opacity:.6}
.comments-list{
  flex:1;
  min-height:120px;
  overflow-y:auto;
  padding:12px 16px;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.comment-row{display:flex;gap:8px;align-items:flex-end;max-width:88%}
.comment-row.own{align-self:flex-end;flex-direction:row-reverse}
.comment-av{
  width:26px;
  height:26px;
  min-width:26px;
  border-radius:50%;
  overflow:hidden;
  background:var(--md-sys-color-surface-variant);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:12px;
  font-weight:600;
}
.comment-av img{width:100%;height:100%;object-fit:cover}
.comment-bubble{
  padding:7px 12px;
  border-radius:16px;
  background:var(--bubble-other-bg);
  color:var(--bubble-other-text);
  word-break:break-word;
}
.comment-row.own .comment-bubble{background:var(--bubble-own-bg);color:var(--bubble-own-text)}
.comment-name{font-size:11.5px;font-weight:600;color:var(--md-sys-color-primary);margin-bottom:2px}
.comment-text{font-size:13.5px;line-height:1.35;white-space:pre-wrap}
.comment-text .msg-link{white-space:nowrap}
.comment-time{margin-top:2px;font-size:10.5px;opacity:.6;text-align:right}
.comments-input-row{
  display:flex;
  gap:8px;
  align-items:center;
  padding:10px 12px;
  border-top:1px solid color-mix(in srgb, var(--md-sys-color-outline-variant) 45%, transparent);
  flex-shrink:0;
}
.comments-input-row input{
  flex:1;
  min-width:0;
  padding:9px 14px;
  border-radius:999px;
  border:1px solid color-mix(in srgb, var(--md-sys-color-outline-variant) 60%, transparent);
  background:var(--md-sys-color-surface-container-high, var(--md-sys-color-surface-variant));
  color:inherit;
  font-family:inherit;
  font-size:13.5px;
  outline:none;
}
.comments-input-row input:focus{border-color:var(--md-sys-color-primary)}
.comments-input-row .md-btn-filled{
  width:38px;
  height:38px;
  min-width:38px;
  padding:0;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
}

/* 5. Капельная деформация тумблера дока. transform занят позицией
      (translateX по --dock-i), поэтому капля живёт на свойстве scale —
      они не конфликтуют и складываются. */
.dock-thumb{transition:transform .38s cubic-bezier(.68,-.55,.265,1.55),scale .22s cubic-bezier(.68,-.55,.265,1.55),background .25s}
.dock-thumb.dropping{animation:dockDrop .46s cubic-bezier(.68,-.55,.265,1.55)}
@keyframes dockDrop{
  0%{scale:1 1}
  35%{scale:1.07 .93}
  70%{scale:.97 1.03}
  100%{scale:1 1}
}

/* 6. Подвал окна профиля. Кнопки действий переехали в меню «…» в шапке
      чата (см. .menu-action-btn в разделе ниже), поэтому здесь остаётся
      одна «Закрыть» на всю ширину — профиль теперь только показывает. */
.profile-footer{padding:12px 16px;border-top:1px solid var(--md-sys-color-outline-variant)}
.profile-footer #closeProfileBtn{width:100%}
/* 7. Свайп-жесты. Плашка, которую тянут, поднимается над экраном:
      ведущий край подрезается, появляется тень. Подрезание мгновенное
      (без перехода) и живёт только на время жеста — в покое углы
      остаются такими, какими их задаёт основная вёрстка. */
/* will-change:transform УБРАН намеренно: он делает экран содержащим
   блоком для потомков с position:fixed. Из-за этого обои чата (::before,
   position:fixed) начинали считаться не от окна, а от самого экрана —
   фон вёл себя как absolute и подпрыгивал вместе с контейнером при
   открытии клавиатуры. Объявление было нужно для свайпа, но сама
   анимация свайпа на transform работает и без него. */
#mobileChatScreen{will-change:auto}
#mobileChatScreen:not(.active){pointer-events:none}
#mobileChatScreen.swiping{
  border-top-left-radius:30px;
  border-bottom-left-radius:30px;
  box-shadow:-26px 0 50px -14px rgba(0,0,0,.6);
}
#mobileChatScreen.swiping,
.menu-content.swiping,
#callScreen.swiping,
#groupCallScreen.swiping{transition:transform .3s cubic-bezier(.32,.72,0,1)}
.menu-content.swiping{
  border-top-right-radius:28px;
  border-bottom-right-radius:28px;
  box-shadow:-24px 0 44px -14px rgba(0,0,0,.55);
}
.menu-dialog.sw-full > .menu-content.swiping{
  border-radius:30px;
  box-shadow:-26px 0 50px -14px rgba(0,0,0,.6);
}
#callScreen.swiping,#groupCallScreen.swiping{
  border-radius:30px;
  box-shadow:0 22px 60px rgba(0,0,0,.6);
}

/* На телефоне окно настроек идёт в край экрана, поэтому углы прямые;
   скругление остаётся только на ПК (.settings-window в min-width:769px). */


/* ================================================================
   АКЦЕНТНЫЙ ЦВЕТ
   Одиннадцать пастельных тонов и белый (он же по умолчанию).
   Значения переопределяют --md-sys-color-primary, поэтому сразу
   подхватывают кнопки, переключатели, иконки и активные рамки.
   В тёмной теме берётся пастельный тон, в светлой — его насыщенный
   вариант: на белом фоне пастельный нечитаем.
   ================================================================ */
body[data-accent="white"]  { --a:#e8e8e8; --a-deep:#555555; --a-on:#1e1e1e }
body[data-accent="khaki"]  { --a:#cfcba4; --a-deep:#7d7742; --a-on:#23220f }
body[data-accent="violet"] { --a:#b9a6f2; --a-deep:#6a52c6; --a-on:#1d1630 }
body[data-accent="pink"]   { --a:#f2a8c4; --a-deep:#c44c85; --a-on:#33121f }
body[data-accent="blue"]   { --a:#9cb6f2; --a-deep:#4368c4; --a-on:#111a2e }
body[data-accent="sky"]    { --a:#a6d4f2; --a-deep:#3189c4; --a-on:#0f1d2e }
body[data-accent="teal"]   { --a:#92e0d4; --a-deep:#1f9a8c; --a-on:#0d2622 }
body[data-accent="yellow"] { --a:#f2dc92; --a-deep:#b0911f; --a-on:#2a2408 }
body[data-accent="green"]  { --a:#a6e0a0; --a-deep:#46923d; --a-on:#12260f }
body[data-accent="orange"] { --a:#f2be92; --a-deep:#c8822f; --a-on:#2e1d0a }

body[data-accent]{
  --md-sys-color-primary:var(--a);
  --md-sys-color-on-primary:var(--a-on);
  --md-sys-color-primary-container:color-mix(in srgb, var(--a) 22%, transparent);
  --md-sys-color-secondary-container:color-mix(in srgb, var(--a) 13%, var(--md-sys-color-surface-container));
}
body[data-accent].light-theme{
  --md-sys-color-primary:var(--a-deep);
  --md-sys-color-on-primary:#fff;
  --md-sys-color-primary-container:color-mix(in srgb, var(--a-deep) 16%, transparent);
}

/* Кружок выбора акцента в настройках внешнего вида */
.accent-row{display:grid;grid-template-columns:repeat(6,1fr);gap:10px}
.accent-dot{
  position:relative;width:100%;aspect-ratio:1;border-radius:50%;
  border:2px solid var(--md-sys-color-outline);
  cursor:pointer;padding:0;
  transition:transform .2s cubic-bezier(.34,1.56,.64,1),border-color .2s,box-shadow .2s;
}
.accent-dot:hover{transform:scale(1.12)}
.accent-dot.active{
  border-color:var(--md-sys-color-on-surface);
  box-shadow:0 0 0 3px color-mix(in srgb,var(--md-sys-color-on-surface) 28%,transparent);
  transform:scale(1.08);
}
.accent-dot.active::after{
  content:'\2713';position:absolute;inset:0;display:grid;place-items:center;
  font-size:14px;font-weight:800;color:#1e1e1e;line-height:1;
}

/* ================================================================
   ЧЁРНЫЙ СПИСОК — строки с поимённой разблокировкой
   ================================================================ */
.blocklist-items{display:flex;flex-direction:column;gap:8px;overflow-y:auto;min-height:0}
.blocklist-row{
  display:flex;align-items:center;gap:12px;
  padding:10px 12px;border-radius:14px;
  background:var(--md-sys-color-surface-container);
  border:1.5px solid var(--md-sys-color-outline-variant);
}
.blocklist-av{
  flex:0 0 auto;width:38px;height:38px;border-radius:50%;
  background:var(--md-sys-color-primary-container);
  color:var(--md-sys-color-on-surface);
  display:grid;place-items:center;font-weight:700;font-size:15px;
}
.blocklist-name{flex:0 1 auto;font-size:14px;font-weight:600;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.blocklist-id{flex:1 1 auto;font-size:11px;color:var(--md-sys-color-on-surface-variant);min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.blocklist-unblock{flex:0 0 auto;min-width:0;padding:8px 14px;font-size:13px}
.blocklist-empty{
  padding:26px 10px;text-align:center;color:var(--md-sys-color-on-surface-variant);
  font-size:14px;
}

/* ================================================================
   ПЕРЕХОД МЕЖДУ СТРАНИЦАМИ — сдвиг, а не резкая смена
   ================================================================ */
/* Только сдвиг: с прозрачностью содержимое мигало на каждой
   перерисовке панели. */
@keyframes pageEnterRight{from{transform:translate3d(7%,0,0)}to{transform:none}}
@keyframes pageExitLeft{from{transform:none}to{transform:translate3d(-5%,0,0)}}

body:not(.no-animations) #panelContent.page-enter{animation:pageEnterRight .34s cubic-bezier(.16,1,.3,1) both}
body:not(.no-animations) #panelContent.page-exit{animation:pageExitLeft .22s cubic-bezier(.4,0,1,1) both}

/* Экран чата открывает��я штатной анимацией .mobile-screen.active.
   Свою не добавляем: вторая анимация перебивала первую, и экран
   дёргался с 40px на 100% — это и было мигание при открытии. */

/* Подокна настроек: текущую страницу сдвигаем вправо, новую вводим слева */
@keyframes subInFromLeft{from{opacity:0;transform:translate3d(-6%,0,0)}to{opacity:1;transform:none}}
body:not(.no-animations) .settings-window.sub-enter{animation:subInFromLeft .3s cubic-bezier(.16,1,.3,1) both}

/* ================================================================
   КНОПКА ЭМОДЗИ И МЕНЮ НА МЕСТЕ КЛАВИАТУРЫ
   Кнопка выскакивает только при фокусе в поле ввода. Открытое меню
   занимает ровно ту высоту, которую держала клавиатура (её меряем по
   visualViewport), поэтому лента не прыгает при переключении.
   ================================================================ */
.mobile-dock-tools .mobile-dock-btn.is-keyboard,
#desktopEmojiBtn.is-keyboard{
  background:var(--md-sys-color-primary-container);
  color:var(--md-sys-color-on-surface);
}
/* Ручка-«хвостик» была сверху, когда панель выезжала над полем. */
.emoji-picker.as-keyboard .composer-sheet-handle{display:none}

/* ================================================================
   МЕНЮ ДЕЙСТВИЙ ЧАТА («…» в шапке)
   Строки того же вида, что и в контекст-меню сообщения
   (.menu-action-btn). У переключателя (комментарии) справа стоит
   отметка состояния: галочка — включено, пусто — выключено.
   ================================================================ */
.menu-action-btn .cm-state{margin-left:auto;font-size:18px;opacity:.9}

/* ================================================================
   ПУНКТИР В ОКНАХ НАСТРОЕК
   ================================================================ */
.settings-menu-card,
.settings-row.settings-toggle .pt-switch,
.settings-window .chip,
.chip-row .chip,
.accent-dot{
  border-style:dashed !important;
}
.settings-menu-card:hover{border-style:solid !important}
.accent-dot.active{border-style:solid !important}
.settings-row.settings-toggle.active .pt-switch{border-style:solid !important}
#pinDelayChips .chip,#pinLenChips .chip{border-style:solid !important}

/* ================================================================
   КРУЖОЧКИ АКЦЕНТА — ряд смещён вправо
   ================================================================ */
.accent-row{
  grid-template-columns:repeat(auto-fit, minmax(38px, 1fr));
  gap:12px;
  padding-left:18px;
}

/* ================================================================
   ЭКРАН ЭМОДЗИ — ПОД ПОЛЕМ ВВОДА, НА МЕСТЕ КЛАВИАТУРЫ
   Поле остаётся на месте и не опускается: панель растёт вниз на ту
   же высоту, которую занимала клавиатура.
   ================================================================ */
/* Панель на широком экране остаётся выносной: она лежит внутри строки
   ввода, и строкой flex-делать её нельзя — разъехались бы кнопки. */
.emoji-picker.as-keyboard{
  position:absolute;
  top:auto;
  bottom:0;
  left:0;
  right:0;
  width:100%;
  max-width:none;
  margin:0;
  height:var(--emoji-sheet-h, 300px);
  border-top:2px dashed var(--md-sys-color-outline);
  border-bottom:0;
  border-radius:0;
  box-shadow:0 -14px 34px -14px rgba(0,0,0,.75);
  z-index:200;
  /* Без анимации: панель встаёт на место клавиатуры и должна быть
     видна сразу. Пока кадр анимации не отыгран, элемент висит с
     opacity:0 — меню не открывалось вовсе. */
  animation:none;
  opacity:1;
  transform:none;
}
/* На телефоне панель занимает место в потоке экрана чата: строка
   flex-колонки ПОД композером. Раньше её позиционировали абсолютно и
   поднимали композер через position:fixed — поле ввода выпадало из
   раскладки и висело поверх сообщений, а при переходе «эмодзи →
   клавиатура» зависало посреди экрана.

   Высота РОВНО та, что занимала клавиатура (--emoji-sheet-h), поэтому
   при переключении эмодзи ⇄ клавиатуры суммарная высота низа не
   меняется: ни поле ввода, ни шапка не сдвигаются.

   Анимируем высоту только на открытии из закрытого состояния и на
   закрытии — тогда поле плавно опускается вниз. Переключение
   эмодзи ⇄ клавиатуры идёт без анимации (body.bottom-no-anim). */
#mobileChatScreen > .emoji-picker.as-keyboard{
  position:relative;
  flex:none;
  order:99;
  top:auto;
  bottom:auto;
  left:auto;
  right:auto;
  width:100%;
  /* Панель закрывает «домашнюю» полосу жестов, а не сама поднимается
     над ней: иначе между ней и краем оставалась щель. */
  /* Высота панели — СВОЯ, а не высота клавиатуры. Раньше здесь стояло
     calc(var(--emoji-sheet-h) + var(--safe-bottom)), то есть панель
     повторяла запомненную высоту клавиатуры. На телефоне с высокой
     клавиатурой панель выходила заметно выше своего содержимого и
     снизу оставалась пустая зона — выглядело как «не дорисовано». Теперь
     высота ограничена, а сетка эмодзи внутри прокручивается и заполняет
     панель целиком. */
  height:var(--emoji-sheet-h, 300px);
  /* Страховка на невозможный случай: на очень низком экране высота
     клавиатуры + шапка + композер не влезают, и низ панели (переключатель
     «Эмодзи/Стикеры») уезжал бы под край. На нормальном телефоне
     ограничение не срабатывает — там панель равна высоте клавиатуры. */
  max-height:calc(100% - 200px);
  overflow:hidden;
  /* Та же длительность, что у подъёма нижнего стека: при закрытии панель
     и композер едут синхронно, без щели и дёрганья. */
  transition:height .24s cubic-bezier(.22,1,.36,1);
}
body.bottom-no-anim #mobileChatScreen > .emoji-picker.as-keyboard{
  transition:none;
}
/* Ручная прокрутка переписки должна быть инерционной, а не «ступеньки».
   Явно разрешаем жест вдоль списка и включаем инерционную прокрутку;
   scroll-behavior:auto обязателен — иначе любая программная запись
   в scrollTop (а их несколько на каждое изменение нижнего блока)
   превращается в анимацию и рвёт палец посреди броска. */
.chat-messages{
  -webkit-overflow-scrolling:touch;
  scroll-behavior:auto;
  overscroll-behavior:contain;
  touch-action:pan-y;
}
@keyframes emojiSheetUp{from{opacity:0;transform:translateY(14%)}to{opacity:1;transform:none}}
/* Въезд панели стикеров/эмодзи при открытии из закрытого состояния.
   При переходе клавиатура → эмодзи класс НЕ ставится: панель должна сразу
   стоять на месте клавиатуры, без подскакивания. */
@keyframes emojiPanelEnter{
  from{opacity:0;transform:translateY(18px) scale(.985)}
  to{opacity:1;transform:none}
}
#mobileChatScreen > .emoji-picker.as-keyboard.emoji-panel-enter{
  animation:emojiPanelEnter .26s cubic-bezier(.22,1,.36,1) both;
}
body.bottom-no-anim #mobileChatScreen > .emoji-picker.as-keyboard{animation:none}
body.emoji-sheet-open .mobile-dock-input,
body.emoji-sheet-open .mobile-dock-tools,
body.emoji-sheet-open .mobile-dock-send{transform:none}

/* ================================================================
   ПОЛЕ ВВОДА СООБЩЕНИЯ
   Раньше здесь был пунктир с !important — поле выглядело как черновой
   контейнер и выпадало из интерфейса. Теперь оно часть нижней панели:
   мягкий тон и внутренняя подсветка — без дополнительного контура.
   ================================================================ */
/* Пунктир оставлен только на плашке профиля в шапке чата. */
@media (max-width:768px){
  .mobile-chat-header-info{
    border:2px dashed var(--md-sys-color-outline) !important;
  }
  .mobile-chat-header-info:hover{
    border-color:var(--md-sys-color-primary) !important;
  }
}
.mobile-dock-input,
.chat-input{
  /* Рамка прозрачна и нужна только для сохранения геометрии: форму
     задаёт фон и внутренняя подсветка, без «лишнего» ободка. */
  border:1px solid transparent;
  border-radius:22px;
  background:linear-gradient(180deg,
    color-mix(in srgb,var(--md-sys-color-surface-container) 94%,white 6%),
    var(--md-sys-color-surface-container));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.06),inset 0 -1px 2px rgba(0,0,0,.05);
  transition:border-color .25s,box-shadow .25s,background .3s;
}
.mobile-dock-input::placeholder,
.chat-input::placeholder{
  color:color-mix(in srgb,var(--md-sys-color-on-surface-variant) 65%,transparent);
}
.mobile-dock-input:focus,
.chat-input:focus{
  border-color:transparent;
  background:color-mix(in srgb,var(--md-sys-color-surface-container) 88%,white 12%);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.1),
             inset 0 0 0 1px color-mix(in srgb,var(--md-sys-color-primary) 12%,transparent);
}
/* В светлой теме внутренняя белая линия не читается — заменяем её
   на тонкую внешнюю тень; режим матового стекла не трогаем. */
body.light-theme:not([data-matte="glass"]) .mobile-dock-input,
body.light-theme:not([data-matte="glass"]) .chat-input{
  background:linear-gradient(180deg,#fff,var(--md-sys-color-surface-container));
  box-shadow:inset 0 1px 0 #fff,0 1px 3px rgba(24,16,48,.07);
}

/* ================================================================
   MOBILE CHAT SCREEN — высота видимой области
   100dvh не учитывает клавиатуру, когда WebView не ресайзится под
   неё. --app-height приходит из visualViewport, поэтому экран всегда
   ровно по видимой области, а раскладка внутри не прыгает.

   Экран начинается с самого края окна (top:0 из .mobile-screen):
   так фон чата идёт вверх под строку состояния. Отступ под неё
   задаёт сама шапка — один раз, см. .mobile-chat-header.
   ================================================================ */
#mobileChatScreen{
  bottom:auto;
  height:var(--app-height, 100dvh);
  /* --app-height обновляется на каждом кадре въезда клавиатуры. Короткий
     переход сглаживает шаги visualViewport, но почти не отстаёт от неё:
     композер быстро прижимается к верхней кромке клавиатуры, между ними
     не остаётся заметной щели. */
  transition:height .1s cubic-bezier(.22,1,.36,1);
}
/* При переключении клавиатура ⇄ эмодзи высота должна смениться мгновенно:
   панель уже стоит ровно на месте клавиатуры, анимация дала бы прыжок. */
body.bottom-no-anim #mobileChatScreen{transition:none}
/* Во время перехода клавиатура ⇄ эмодзи композер крутим покадрово вместе
   с клавиатурой: никаких CSS-переходов, иначе он отстаёт и подскакивает. */
body.bottom-bridging #mobileChatScreen{transition:none}
body.chat-overlay-layout.bottom-bridging #mobileChatScreen > #mobileChatBottom{
  bottom:var(--emoji-panel-h, 0px);
  transition:none;
}
body.bottom-bridging #mobileChatScreen > .emoji-picker.as-keyboard{transition:none}
/* Меню эмодзи занимает место клавиатуры. Панель — обычная строка
   flex-колонки под композером, поэтому композер остаётся в потоке и
   стоит прямо над ней. Раньше его поднимали position:fixed, из-за
   чего он выпадал из раскладки и нависал поверх сообщений.

   Нижний отступ safe-area убираем: полосу жестов теперь закрывает
   сама панель. */
/* safe-area учитываем только когда клавиатура закрыта: при открытой
   клавиатуре/панели эмодзи низ уже занят, лишний отступ даёт щель. */
body.kb-open .mobile-input-dock,
body.emoji-sheet-open .mobile-input-dock{
  padding-bottom:8px;
}
/* Композер над панелью: панель идёт в потоке, отступ не нужен. */
body.emoji-sheet-open #mobileChatMessages{
  padding-bottom:16px;
}

/* ================================================================
   СТРОКА СОСТОЯНИЯ
   Приложение растянуто под неё, поэтому сверху нужен свой отступ:
   --status-h приходит из нативной обёртки, в браузере он нулевой.
   ================================================================ */
:root{--status-h:0px}
#app{padding-top:var(--status-h)}
body.kb-open #app,
body.emoji-sheet-open #app{padding-top:var(--status-h)}

/* ================================================================
   ГАЛОЧКИ ПРОЧТАНИЯ
   Одна — отправлено, двойная одним знаком — прочитано. Знак рисуем
   двумя псевдоэлементами, поэтому двойная галочка выглядит цельной.
   ================================================================ */
.tick{
  display:inline-block;position:relative;
  width:14px;height:11px;margin-left:0;
  vertical-align:-1px;opacity:.75;
}
.tick::before,.tick::after{
  content:'';position:absolute;
  width:6px;height:9px;
  border:1.6px solid currentColor;
  border-top:0;border-left:0;
  border-radius:0 0 2px 0;
  transform-origin:center;
}
.tick::before{left:1px;top:0;transform:rotate(42deg)}
.tick::after{left:6px;top:0;transform:rotate(42deg);opacity:0}
.tick.read{width:22px}
.tick.read::after{opacity:1}
.message-bubble.own .message-time .tick{color:var(--md-sys-color-on-surface-variant)}
.message-bubble.own .message-time .tick.read{color:var(--md-sys-color-primary)}


/* ================================================================
   ПЕРЕХОД МЕЖДУ ГЛАВНЫМИ СТРАНИЦАМИ
   Страница рисуется ДО анимации (см. setActivePanel), поэтому уезжающей
   старой страницы больше нет — остаётся только короткий въезд новой.
   Сдвиг уменьшен с 9% до 4% и не доводится до полной прозрачности:
   раньше контент уезжал за край и обрезался, а на телефоне с прозрачным
   фоном за ним ещё и просвечивал пустой док.
   ================================================================ */
#panelContent.page-out{animation:pageOutL .15s cubic-bezier(.4,0,1,1) both}
#panelContent[data-dir="back"].page-out{animation:pageOutR .15s cubic-bezier(.4,0,1,1) both}
#panelContent.page-in{animation:pageInR .2s cubic-bezier(.16,1,.3,1) both}
#panelContent[data-dir="back"].page-in{animation:pageInL .2s cubic-bezier(.16,1,.3,1) both}
@keyframes pageOutL{from{transform:none}to{transform:translate3d(-4%,0,0);opacity:.5}}
@keyframes pageOutR{from{transform:none}to{transform:translate3d(4%,0,0);opacity:.5}}
@keyframes pageInR{from{transform:translate3d(4%,0,0);opacity:.5}to{transform:none;opacity:1}}
@keyframes pageInL{from{transform:translate3d(-4%,0,0);opacity:.5}to{transform:none;opacity:1}}
/* Старая однонаправленная пара больше не используется. */
#panelContent.page-enter{animation:none}

/* ================================================================
   КНОПКА «ВНИЗ»
   Появляется, когда переписка прокручена от конца.
   ================================================================ */
.chat-down-btn{
  /* От окна: от контейнера переписки кнопка на телефоне уезжала за
     левый край экрана. Высота нижнего блока (поле ввода, ответ,
     вложения) приходит из JS в --composer-h: жёсткие 96px не подходили
     — с открытой панелью эмодзи кнопка ложилась прямо на неё. */
  position:fixed;
  right:14px;
  bottom:calc(var(--chat-bottom-h, var(--composer-h, 96px)) + 12px);
  width:44px;height:44px;min-width:44px;
  border-radius:50%;
  border:none;
  background:var(--md-sys-color-primary);
  color:var(--md-sys-color-on-primary);
  display:grid;place-items:center;
  box-shadow:0 8px 22px -8px rgba(0,0,0,.65);
  cursor:pointer;z-index:45;
  opacity:0;transform:translateY(8px) scale(.9);
  transition:opacity .22s, transform .22s cubic-bezier(.34,1.56,.64,1);
}
.chat-down-btn:not(.hidden){opacity:1;transform:none}
.chat-down-btn .material-symbols-outlined{font-size:22px}

/* ================================================================
   ПОДСКАЗКА О СЛЕДУЮЩЕМ НЕПРОЧИТАННОМ
   Выезжает снизу, пока тянут палец вверх: стрелка и аватар.
   ================================================================ */
.chat-unread-hint{
  position:absolute;
  left:50%;bottom:0;
  transform:translate(-50%,120%);
  display:flex;align-items:center;gap:8px;
  padding:8px 14px 10px;
  border-radius:22px 22px 0 0;
  background:var(--md-sys-color-surface-container);
  border:1.5px solid var(--md-sys-color-outline-variant);
  border-bottom:0;
  box-shadow:0 -10px 30px -14px rgba(0,0,0,.6);
  opacity:0;pointer-events:none;
  transition:transform .2s cubic-bezier(.16,1,.3,1), opacity .2s;
  z-index:46;
}
.chat-unread-hint.show{
  opacity:1;
  transform:translate(-50%, calc(-1 * var(--pull, 0) * 74px));
}
.chat-unread-hint .material-symbols-outlined{
  font-size:20px;color:var(--md-sys-color-primary);
  animation:hintArrow 1.1s ease-in-out infinite;
}
@keyframes hintArrow{0%,100%{transform:translateY(2px)}50%{transform:translateY(-3px)}}
.chat-unread-hint .hint-av{
  width:30px;height:30px;border-radius:50%;
  background-size:cover;background-position:center;
  display:grid;place-items:center;
  font-size:13px;font-weight:700;color:var(--md-sys-color-on-surface);
}

/* ================================================================
   ПОДМЕНА ЧАТА: текущий уходит вверх, следующий выезжает снизу
   ================================================================ */
@keyframes chatSwapOut{from{transform:none;opacity:1}to{transform:translate3d(0,-100%,0);opacity:.4}}
@keyframes chatSwapIn{from{transform:translate3d(0,100%,0);opacity:.4}to{transform:none;opacity:1}}
body:not(.no-animations) .mobile-screen.swap-out{animation:chatSwapOut .16s cubic-bezier(.4,0,1,1) both}
body:not(.no-animations) .mobile-screen.swap-in{animation:chatSwapIn .22s cubic-bezier(.16,1,.3,1) both}


/* ================================================================
   СЕТКА ФОТО И ВИДЕО
   Пузыри скрыты, поэтому сетка — самостоятельный блок: раскладка
   зависит от числа снимков (2 в ряд, 4 квадратом, 8 по три).
   ================================================================ */
.media-group{
  position:relative;
  display:grid;
  /* Переписка — flex-колонка: без этого сетка сжимается по высоте
     до нуля и плитки обрезаются. */
  flex:0 0 auto;
  gap:2px;
  border-radius:18px;
  overflow:hidden;
  margin:4px 0;
  /* Максимальная ширина блока — примерно 75% экрана. */
  width:min(75%,420px);
  /* Заливки у самой сетки нет намеренно: в последнем неполном ряду
     остаются свободные ячейки, и она превращалась в заметное серое
     пятно справа. Пустота теперь просто прозрачна. */
  background:transparent;
  box-shadow:none;
}
.media-group.incoming{margin-right:auto}
.media-group.own{margin-left:auto}
/* Раскладки: 2 — рядом равной ширины; 3 — одно большое слева и два
   справа; 4 — сетка 2×2; 5+ — большая верхняя строка во всю ширину,
   ниже ряды равной высоты. */
.media-group[data-size="2"]{grid-template-columns:repeat(2,1fr)}
.media-group[data-size="3"]{grid-template-columns:2fr 1fr;grid-template-rows:1fr 1fr;grid-template-areas:"a b" "a c";aspect-ratio:1.5}
.media-group[data-size="4"]{grid-template-columns:repeat(2,1fr)}
.media-group[data-size="5"],
.media-group[data-size="6"],
.media-group[data-size="7"],
.media-group[data-size="8"],
.media-group[data-size="9"],
.media-group[data-size="10"]{grid-template-columns:repeat(3,1fr)}
/* Пять снимков: большая верхняя строка и ровно 2×2 под ней — с тремя
   колонками внизу оставалась бы одна плитка и пустая дыра. */
.media-group[data-size="5"]{grid-template-columns:repeat(2,1fr)}
.media-group[data-size="5"] .mg-cell:first-child,
.media-group[data-size="6"] .mg-cell:first-child,
.media-group[data-size="7"] .mg-cell:first-child,
.media-group[data-size="8"] .mg-cell:first-child,
.media-group[data-size="9"] .mg-cell:first-child,
.media-group[data-size="10"] .mg-cell:first-child{grid-column:1/-1;aspect-ratio:2.35}
.media-group .mg-cell{
  position:relative;
  display:block;padding:0;margin:0;border:0;
  aspect-ratio:1;width:100%;height:auto;min-height:0;
  border-radius:4px;
  background:var(--md-sys-color-surface-container-high);
  cursor:pointer;overflow:hidden;
  -webkit-tap-highlight-color:transparent;
  /* Плитка участвует в вертикальной прокрутке списка, но не должна
     запускать колебание браузера (pull-to-refresh) при длинном тапе
     по снимку — иначе удержание для поштучного выбора срывалось. */
  touch-action:pan-y;
}
/* «Медиа сверху» (три снимка): первый растягивается на двойную высоту
   слева, остальные — рядом справа. */
.media-group[data-size="3"] .mg-cell{aspect-ratio:auto;height:100%;min-height:0}
.media-group[data-size="3"] .mg-cell:nth-child(1){grid-area:a}
.media-group[data-size="3"] .mg-cell:nth-child(2){grid-area:b}
.media-group[data-size="3"] .mg-cell:nth-child(3){grid-area:c}
/* Картинка вынута из потока: высоту ячейки задаёт aspect-ratio, и
   содержимое снимка больше не влияет на высоту ни одной плитки. */
.media-group .mg-cell img,
.media-group .mg-cell video{
  position:absolute;inset:0;
  width:100%;height:100%;
  object-fit:cover;display:block;
}
.media-group .mg-time{
  position:absolute;right:6px;bottom:6px;
  display:inline-flex;align-items:center;gap:4px;
  padding:2px 8px;border-radius:10px;
  background:rgba(0,0,0,.55);color:#fff;
  font-size:10px;line-height:1.5;
  pointer-events:none;
}
.media-group .mg-time .tick{margin-left:0;color:#fff}
/* Выбор снимка внутри альбома: акцентная рамка + тинт фона и галочка,
   как в Telegram (выделение своих медиа в режиме выбора). */
.media-group .mg-cell.selected{
  box-shadow:inset 0 0 0 2px var(--md-sys-color-primary);
}
.media-group .mg-cell.selected img,
.media-group .mg-cell.selected video{
  opacity:.55;
}
.media-group .mg-cell .mg-check{
  position:absolute;top:8px;right:8px;z-index:3;
  width:22px;height:22px;border-radius:50%;
  display:grid;place-items:center;
  font-size:13px;color:var(--md-sys-color-on-primary);
  background:var(--md-sys-color-primary);
  box-shadow:0 2px 6px rgba(0,0,0,.35);
  pointer-events:none;
}

/* ================================================================
   ОТСТУПЫ ПОД ВЫРЕЗ ФРОНТАЛЬНОЙ КАМЕРЫ
   env(safe-area-inset-*) в WebView на Android всегда ноль — это
   возможности Safari. Нативная часть присылает настоящие отступы
   в --cutout-*, а ниже берём максимум из них и запасных
   значений, чтобы шапки и окна не заезжали под камеру.
   ================================================================ */
:root{
  --cutout-top:0px;
  --cutout-extra-top:0px;
  --cutout-bottom:0px;
  --cutout-left:0px;
  --cutout-right:0px;
  /* Внутри экрана сверху уже стоит --status-h, поэтому берём только
     выступ выреза над строкой состояния — иначе шапка уезжала вдвое
     ниже нужного. */
  --safe-top:max(var(--cutout-extra-top), env(safe-area-inset-top, 0px));
  /* Плавающим окнам вырез нужен целиком: они считаются от окна и
     отступа #app не наследуют. */
  --safe-top-full:max(var(--cutout-top), env(safe-area-inset-top, 0px));
  --safe-bottom:max(var(--cutout-bottom), env(safe-area-inset-bottom, 0px));
  --safe-left:max(var(--cutout-left), env(safe-area-inset-left, 0px));
  --safe-right:max(var(--cutout-right), env(safe-area-inset-right, 0px));
}

/* ================================================================
   ШАПКИ НАД ВЫРЕЗОМ ФРОНТАЛЬНОЙ КАМЕРЫ
   Шапка панели и мини-виджет со сменой аккаунта стояли под камерой:
   сверху не было ни отступа, ни учёта выреза. Поднимаем их на его
   высоту, а окнам настроек даём запас сверху, чтобы они не прижались
   к самому краю.
   ================================================================ */
.panel-header{
  /* Safe-area на главном экране учитывается РОВНО ОДИН РАЗ — здесь.
     Раньше он складывался ещё и на виджете, и блок с датой и
     батареей вытягивался втрое, а текст прижимался к его низу. */
  padding-top:calc(10px + var(--safe-top));
}
.panel-widget{
  padding-top:5px;
}
/* Окна: список и заголовок не должны липнуть к краю под вырезом. */
.menu-dialog{
  padding-top:calc(16px + var(--safe-top-full));
  padding-bottom:calc(16px + var(--safe-bottom));
}
.menu-content.settings-window > .settings-window-head,
.menu-content.settings-window > .mw-head{
  padding-top:calc(14px + var(--safe-top));
}

/* ================================================================
   ВХОД ПО QR
   Код рисует наш qrSvg: он сам скругляет рамку, поэтому здесь только
   контейнер и состояние ожидания.
   ================================================================ */
.qr-login-box{
  position:relative;
  /* Код рисуется крупно: чем больше модуль на экране, тем дальше его
     читает камера телефона. Раньше было 260px — модуль выходил меньше
     9 px, и код читался только вплотную.
     Потолок 360px задан шириной самой карточки входа (max-width 420px
     минус её поля), а 68vh страхует низкий экран в альбомной
     ориентации: .auth-overlay прокручивается, но листать ради кода
     неудобно. */
  width:min(360px, 86vw, 68vh);
  margin:14px auto 10px;
  aspect-ratio:1/1;
}
.qr-login-frame{
  width:100%;height:100%;
  border-radius:20px;
  overflow:hidden;
  /* Нейтральная светло-серая подложка: сам код и его фон приходят из
     qrPalette (только серые тона), здесь — чтобы не мигало белым. */
  background:#f2f2f2;
  box-shadow:0 14px 34px -16px rgba(0,0,0,.6);
}
.qr-login-frame svg{display:block}
.qr-login-wait{
  position:absolute;inset:0;
  display:grid;place-items:center;
  border-radius:20px;
  background:color-mix(in srgb,var(--md-sys-color-surface-container) 88%,transparent);
  color:var(--md-sys-color-primary);
}
.qr-login-wait.hidden{display:none}
.qr-login-status{
  text-align:center;
  font-size:13px;
  color:var(--md-sys-color-on-surface-variant);
  min-height:18px;
  margin-bottom:4px;
}

/* ================================================================
   ПЕРЕКЛЮЧАТЕЛЬ СПОСОБА ВХОДА — ВНИЗУ ЭКРАНА
   ================================================================ */
.auth-switch{
  display:flex;
  gap:6px;
  padding:6px;
  margin-top:14px;
  border-radius:999px;
  background:color-mix(in srgb,var(--md-sys-color-surface-container) 80%,transparent);
  border:1px solid var(--md-sys-color-outline-variant);
  flex-shrink:0;
}
.auth-switch-btn{
  flex:1 1 0;
  min-width:0;
  padding:9px 10px;
  border:none;
  border-radius:999px;
  background:transparent;
  color:var(--md-sys-color-on-surface-variant);
  font-family:inherit;
  font-size:13px;
  font-weight:500;
  cursor:pointer;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  transition:background .2s,color .2s;
}
.auth-switch-btn.active{
  background:var(--md-sys-color-primary);
  color:var(--md-sys-color-on-primary);
}
/* Показываем переключатель только на первом шаге: на остальных он сбивает. */
.auth-shell:has(.auth-step[data-astep="reg-1"].active) .auth-switch,
.auth-shell:has(.auth-step[data-astep="log-qr"].active) .auth-switch{display:flex}
.auth-shell:not(:has(.auth-step[data-astep="reg-1"].active)):not(:has(.auth-step[data-astep="log-qr"].active)) .auth-switch{display:none}

/* ================================================================
   ОКНО УСТРОЙСТВ
   ================================================================ */
.devices-scan{
  display:flex;flex-direction:column;align-items:center;gap:10px;
  padding:4px 0 16px;
}
/* Скруглённый квадрат под камеру — как и просили. */
.scan-frame{
  position:relative;
  width:min(240px, 66vw);
  aspect-ratio:1/1;
  border-radius:24px;
  overflow:hidden;
  background:var(--md-sys-color-surface-container-high);
}
.scan-frame video{width:100%;height:100%;object-fit:cover;display:block}
/* Уголки рамки поверх камеры. */
.scan-corners{
  position:absolute;inset:12px;pointer-events:none;
  border:2px solid color-mix(in srgb,var(--md-sys-color-outline) 80%,transparent);
  border-radius:16px;
  box-shadow:0 0 0 100vmax rgba(0,0,0,.28);
}
.scan-manual-toggle{
  border:none;background:transparent;cursor:pointer;
  font-family:inherit;font-size:12px;line-height:1.2;
  color:var(--md-sys-color-on-surface-variant);
  text-decoration:underline;text-underline-offset:3px;
  padding:7px 12px;border-radius:10px;opacity:.85;
  transition:background .18s,opacity .18s;
  -webkit-tap-highlight-color:transparent;
}
.scan-manual-toggle:hover{
  opacity:1;
  background:color-mix(in srgb,var(--md-sys-color-on-surface) 7%,transparent);
}
.scan-manual-toggle:active{opacity:1}
.scan-fallback{
  position:absolute;inset:0;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;
  padding:16px;text-align:center;
  color:var(--md-sys-color-on-surface-variant);
  background:var(--md-sys-color-surface-container);
}
.scan-fallback.hidden{display:none}
.scan-fallback .material-symbols-outlined{font-size:28px}
.scan-fallback p{font-size:12px;margin:0}
.scan-fallback input{
  width:100%;padding:9px 11px;border-radius:12px;
  border:1px solid var(--md-sys-color-outline-variant);
  background:var(--md-sys-color-surface);
  color:var(--md-sys-color-on-surface);
  font-family:inherit;font-size:13px;
}
.scan-fallback .auth-btn{width:100%;padding:9px}
.scan-hint{
  margin:0;font-size:12px;text-align:center;
  color:var(--md-sys-color-on-surface-variant);
}

/* Карточка того, кто сканирует. */
.devices-approve{
  display:none;
  align-items:center;gap:12px;
  padding:12px;border-radius:18px;
  background:var(--md-sys-color-surface-container-high);
  border:1px solid var(--md-sys-color-outline-variant);
  margin-bottom:16px;
}
.devices-approve.active{display:flex}
.da-av{
  width:44px;height:44px;min-width:44px;border-radius:50%;
  background:var(--md-sys-color-primary-container);
  color:var(--md-sys-color-on-primary-container);
  display:grid;place-items:center;
  font-weight:700;overflow:hidden;
}
.da-av img{width:100%;height:100%;object-fit:cover}
.da-info{flex:1;min-width:0}
.da-name{font-size:14px;font-weight:600}
.da-sub{font-size:11px;opacity:.7;word-break:break-all}
.da-actions{display:flex;gap:6px;flex-shrink:0}
.da-actions .auth-btn{padding:9px 12px;font-size:12px;min-width:0}

/* Блок «Активные устройства» — прямо в окне, под сканером. */
.devices-list-head{
  display:flex;align-items:center;justify-content:space-between;gap:8px;
  margin:2px 2px 8px;
  font-size:12.5px;font-weight:600;letter-spacing:.2px;
  color:var(--md-sys-color-on-surface-variant);
}
.devices-list-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.devices-refresh{
  border:none;background:transparent;color:inherit;cursor:pointer;
  width:34px;height:34px;border-radius:50%;flex-shrink:0;
  display:grid;place-items:center;
  transition:background .18s,transform .3s;
  -webkit-tap-highlight-color:transparent;
}
.devices-refresh .material-symbols-outlined{font-size:20px}
.devices-refresh:hover{background:color-mix(in srgb,var(--md-sys-color-on-surface) 8%,transparent)}
.devices-refresh:active{transform:scale(.92)}
.devices-refresh.spinning .material-symbols-outlined{animation:devicesSpin .9s linear infinite}
@keyframes devicesSpin{to{transform:rotate(360deg)}}
.devices-list{
  display:flex;flex-direction:column;gap:8px;
  max-height:min(46vh,340px);
  overflow-y:auto;overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
  padding-bottom:2px;
}
.dev-row{
  display:flex;align-items:center;gap:11px;
  width:100%;text-align:left;
  padding:12px;border-radius:18px;
  background:var(--md-sys-color-surface-container);
  border:1px solid transparent;
  font-family:inherit;font-size:inherit;color:inherit;cursor:pointer;
  transition:background .18s,border-color .18s,transform .12s;
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
}
.dev-row:hover{background:var(--md-sys-color-surface-container-high)}
.dev-row:active{transform:scale(.985)}
.dev-row.current{border-color:color-mix(in srgb,var(--md-sys-color-primary) 55%,transparent)}
.dev-icon{font-size:22px;color:var(--md-sys-color-primary);flex-shrink:0}
.dev-info{display:flex;flex-direction:column;flex:1;min-width:0}
.dev-name{
  display:flex;align-items:center;gap:6px;min-width:0;
  font-size:13.5px;font-weight:500;
}
.dev-name-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.dev-sub{font-size:11.5px;opacity:.65;margin-top:1px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.dev-me{
  font-size:10.5px;font-weight:600;flex-shrink:0;
  color:var(--md-sys-color-primary);
  background:color-mix(in srgb,var(--md-sys-color-primary) 14%,transparent);
  padding:2px 7px;border-radius:999px;
}
.dev-chevron{font-size:20px;opacity:.45;flex-shrink:0}
.devices-empty{
  padding:18px;text-align:center;font-size:13px;opacity:.7;
}

/* ================================================================
   МИНИ-ОКНО ВЫБРАННОГО УСТРОЙСТВА (внутри окна «Устройства»)
   Панель поднимается снизу в границах .settings-window, затемнение —
   только по самому окну, а не по всему сайту.
   ================================================================ */
#devicesDialog .menu-content.settings-window{position:relative}
.devices-detail{
  position:absolute;inset:0;z-index:20;
  display:flex;flex-direction:column;justify-content:flex-end;
  visibility:hidden;pointer-events:none;
  /* Панель уезжает за нижний край контейнера — обрезаем, чтобы
     translateY не растягивал прокрутку окна. */
  overflow:hidden;
  /* Прячем только после того, как панель уехала вниз. */
  transition:visibility 0s linear .3s;
}
.devices-detail.open{visibility:visible;pointer-events:auto;transition-delay:0s}
.devices-detail-backdrop{
  position:absolute;inset:0;
  background:rgba(0,0,0,.42);
  opacity:0;transition:opacity .24s ease;
}
.devices-detail.open .devices-detail-backdrop{opacity:1}
.devices-detail-panel{
  position:relative;
  display:flex;flex-direction:column;gap:12px;
  padding:8px 16px calc(18px + var(--safe-bottom));
  border-radius:24px 24px 0 0;
  background:var(--md-sys-color-surface-container-high);
  border-top:1px solid var(--md-sys-color-outline-variant);
  box-shadow:0 -18px 48px -20px rgba(0,0,0,.6);
  transform:translateY(105%);
  transition:transform .3s cubic-bezier(.22,1,.36,1);
  max-height:88%;
  overflow-y:auto;overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
}
.devices-detail.open .devices-detail-panel{transform:translateY(0)}
.devices-detail-grab{
  width:38px;height:4px;border-radius:2px;flex-shrink:0;
  background:var(--md-sys-color-outline);
  margin:2px auto 4px;
}
.devices-detail-head{display:flex;align-items:center;gap:12px;flex-shrink:0}
.devices-detail-icon{font-size:28px;color:var(--md-sys-color-primary);flex-shrink:0}
.devices-detail-titles{flex:1;min-width:0}
.devices-detail-name{
  font-size:16px;font-weight:600;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.devices-detail-badge{
  display:inline-flex;align-items:center;gap:4px;
  margin-top:4px;padding:2px 8px;border-radius:999px;
  font-size:10.5px;font-weight:600;
  color:var(--md-sys-color-primary);
  background:color-mix(in srgb,var(--md-sys-color-primary) 14%,transparent);
}
.devices-detail-close{flex-shrink:0}
.devices-detail-meta{display:flex;flex-direction:column;gap:8px;padding:2px 0}
.devices-detail-row{
  display:flex;align-items:flex-start;gap:10px;
  padding:10px 12px;border-radius:14px;
  background:var(--md-sys-color-surface-container);
}
.dd-icon{font-size:19px;color:var(--md-sys-color-on-surface-variant);flex-shrink:0;margin-top:1px}
.dd-text{flex:1;min-width:0}
.dd-key{font-size:11.5px;opacity:.65;margin-bottom:3px}
.dd-val{font-size:13.5px;font-weight:500;word-break:break-word}
.devices-detail-error{
  display:none;padding:9px 12px;border-radius:12px;
  font-size:12.5px;line-height:1.35;
  background:color-mix(in srgb,var(--md-sys-color-error) 14%,transparent);
  color:var(--md-sys-color-error);
}
.devices-detail-error.show{display:block}
.devices-detail-hint{
  padding:0 6px;text-align:center;
  font-size:11.5px;line-height:1.4;opacity:.62;
}
/* Кнопка «Завершить сеанс»: активна только для чужого входа. */
.devices-end-btn{
  display:flex;align-items:center;justify-content:center;gap:8px;
  width:100%;padding:14px;border-radius:16px;flex-shrink:0;
  font-family:inherit;font-size:14.5px;font-weight:500;
  border:1px solid transparent;cursor:pointer;
  background:color-mix(in srgb,var(--md-sys-color-error) 16%,transparent);
  color:var(--md-sys-color-error);
  transition:filter .15s,opacity .15s;
  -webkit-tap-highlight-color:transparent;
}
.devices-end-btn:disabled{
  opacity:.45;cursor:default;
  background:var(--md-sys-color-surface-container);
  color:var(--md-sys-color-on-surface-variant);
}
.devices-end-btn:not(:disabled):active{filter:brightness(.94)}
.devices-end-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
body[data-matte="glass"] .devices-detail-panel{
  background:color-mix(in srgb,var(--md-sys-color-surface-container-high) 82%,transparent);
  backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  -webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
}
@media (max-width:768px){
  /* На телефоне окно и так во весь экран: список листается вместе с телом
     окна, вложенный скролл не нужен. */
  .devices-list{max-height:none;overflow:visible}
  .devices-detail-panel{padding-bottom:calc(20px + var(--safe-bottom))}
}
/* Нижний блок НЕ поднимается вручную на высоту клавиатуры: подъёмом
   занимается штатный механизм visualViewport / --app-height. Лишний
   padding-bottom поверх него уводил поле ввода НАД клавиатурой. */
/* ================================================================
   ШАГ 1 РАСКЛАДКИ ПО СХЕМЕ TELEGRAM — лента во всю высоту, полосы поверх
   Раньше экран был флекс-колонкой, где шапка и композер — соседи списка
   по потоку. Список занимал полосу между ними и НИКОГДА не заезжал под
   них: сквозь прозрачные полосы был виден только фон экрана, поэтому
   прозрачность не давала эффекта.

   Теперь шапка и композер лежат ПОВЕРХ списка, а список растянут на всю
   высоту и отодвинут отступами, чтобы первое и последнее сообщения не
   уезжали под полосы.

   Всё спрятано за классом chat-overlay-layout: если поведёт себя не так,
   откат — убрать одну строку add класса в script.js, и старая раскладка
   вернётся целиком.
   ================================================================ */
body.chat-overlay-layout #mobileChatScreen{position:absolute;inset:0}
/* Специфичность выше, чем у «#mobileChatScreen > :not(...) {position:relative}»:
   иначе шапка и стеки остаются в потоке, а абсолютный композер
   позиционируется от #mobileChatBottom, который сидит под шапкой. */
body.chat-overlay-layout #mobileChatScreen > .mobile-chat-header{
  position:absolute;top:0;left:0;right:0;z-index:12;
}
body.chat-overlay-layout #mobileChatScreen > #mobileChatTopStack{
  position:absolute;left:0;right:0;z-index:12;
  top:var(--chat-header-h, 64px);
  display:flex;flex-direction:column;
}
body.chat-overlay-layout #mobileChatScreen > #mobileChatBottom{
  position:absolute;left:0;right:0;bottom:0;z-index:12;
  display:flex;flex-direction:column;
  /* Панель эмодзи выезжает/уезжает — нижний стек едет вместе с ней. */
  transition:bottom .24s cubic-bezier(.22,1,.36,1);
}
body.bottom-no-anim #mobileChatBottom{transition:none}
/* Ключевое: нижний стек поднимаем ПОСЕДЕЛИ только в emoji-режиме, поэтому
   селектор должен быть не строже иначе `bottom:0` из базового правила
   победит и панель эмодзи наезжала бы на композер. */
body.chat-overlay-layout.emoji-sheet-open #mobileChatScreen > #mobileChatBottom{
  bottom:var(--emoji-panel-h, 300px);
}
/* Композер больше не отдельный слой экрана: он строка нижнего стека. */
body.chat-overlay-layout #mobileInputArea{
  position:relative;left:auto;right:auto;bottom:auto;z-index:auto;
}
body.chat-overlay-layout #mobileChatMessages{
  position:absolute;top:0;left:0;right:0;bottom:0;
  box-sizing:border-box;
  /* Высоты измеряет measureChatChrome(); запасные 64px — до первого кадра. */
  padding-top:calc(var(--chat-header-h, 64px) + var(--chat-topbars-h, 0px));
  padding-bottom:var(--chat-bottom-h, var(--composer-h, 64px));
}
/* Панель эмодзи встаёт РOVНО ПОД композером, а не на его место.
   Раньше композер поднимался на высоту панели (min(--emoji-sheet-h,340px)),
   и стоило фактической высоте панели отличаться от переменной — между ними
   появлялась щель. Теперь низ панели = низ композера, поэтому зазор
   невозможен при любой высоте: панель растёт вверх от границы композера. */
body.chat-overlay-layout #mobileChatScreen > .emoji-picker.as-keyboard{
  position:absolute;left:0;right:0;bottom:var(--composer-h, 64px);z-index:11;
  /* База ограничивает панель 520px: при заданных left+right+width правый
     край игнорируется, и справа оставалась полоса, в которой просвечивала
     лента. Здесь панель занимает всю ширину. */
  width:100%;max-width:none;margin:0;
  /* Тот же блюр, что под клавиатурой и у панели ввода: та же доля
     surface (34%) и тот же blur/saturate. Раньше панель была плотнее
     (surface-container 84%), из-за чего на её фоне переписка не
     размывалась так, как под полем ввода. */
  background:color-mix(in srgb,var(--md-sys-color-surface) 34%,transparent);
  backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  -webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
}
/* Лента не должна уезжать под панель: снизу весь нижний стек + панель.
   Дублируется ниже с --emoji-panel-h (фактическая высота после подгонки рядов). */
body.chat-overlay-layout.emoji-sheet-open #mobileChatMessages{
  padding-bottom:calc(var(--emoji-sheet-h, 300px) + var(--chat-bottom-h, var(--composer-h, 64px)));
}
/* Полосы лежат поверх ленты, значит под ними должен идти размытый фон, а
   не резкие буквы. При прозрачности 16% и блюре 2px сквозь шапку и поле
   ввода читался текст переписки; 34% и 10px оказались слишком плотно.
   Остановились на 22% и 6px: переписка видна, но уже не мешает.
   Значения подобраны на глаз по скриншоту — если нужно прозрачнее или
   глуше, меняются только тут. */
body.chat-overlay-layout .mobile-chat-header::before,
body.chat-overlay-layout #mobileChatBottom,
body.chat-overlay-layout #mobileChatTopStack{
  background:color-mix(in srgb,var(--md-sys-color-surface) 34%,transparent);
  backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  -webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
}
body.chat-overlay-layout #mobileChatBottom .reply-preview,
body.chat-overlay-layout #mobileChatBottom .attachments-bar,
body.chat-overlay-layout #mobileChatBottom .typing-indicator{
  background:transparent;
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
  box-shadow:none;
}
/* Блюр под верхним стеком панелей в мобильном чате убираем: мини-плеер,
   панель закреплённого и панель удаления теперь острова со своей плотной
   заливкой, размытие ленты под ними не нужно (на ПК так и было — там у
   desktop-стека blur нет). */
body.chat-overlay-layout #mobileChatTopStack{
  background:transparent;
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
}
/* Сам блок ввода (tools → поле → кнопка) несёт теперь тёмную заливку:
   он ниже по потоку, поэтому его переопределение не должно заваливать
   прозрачный подхват. */
body.chat-overlay-layout .mobile-input-dock{
  background:color-mix(in srgb,var(--md-sys-color-surface) 34%,transparent);
  backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  -webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  box-shadow:none;
}
/* ДЫРЫ В БЛЮРЕ, отмеченные на скриншоте. Обе из-за того, что заливка
   начиналась НЕ С КРАЯ, а на 10 px ниже статус-бара и не доходила до
   нижней кромки — на этих полосах обои оставались резкими.

   1. Шапка: ::before начинается с top: env(safe-area-inset-top + 10px,
      то есть зона статус-бара (часы, батарея) оставалась без заливки и
      без размытия. Теперь заливка идёт от самого верха окна — top:-10px
      перекрывает и этот отступ.
   2. Композер: свой фон красил только сам dock, а нижние safe-bottom и
      зона под ним оставались резкими. Ниже отдельная подложка на весь
      блок #mobileInputArea, включая отступы. */
body.chat-overlay-layout .mobile-chat-header::before{
  top:-10px;
  /* Кромка теперь резкая и ровная — старый box-shadow давал полосу. */
  box-shadow:none;
}
body.chat-overlay-layout #mobileChatBottom{
  /* Подложка на весь нижний стек, включая safe-bottom под dock. */
  box-shadow:none;
}
.dev-revoke:disabled{opacity:.5}

/* Обои чата — слой, привязанный к ОКНУ, а не к контейнеру экрана.
   Раньше был position:absolute внутри #mobileChatScreen, а тот сжимается
   по --app-height: при открытии клавиатуры весь фон подпрыгивал вверх.
   position:fixed держит фон за вьюпортом, поэтому обои стоят на месте,
   а прозрачные полосы шапки и ввода лежат поверх него.

   Работает в паре с interactive-widget=resizes-content — вьюпорт
   сжимается вместе с клавиатурой, а fixed-слой всё равно считается от окна.
   ================================================================ */
#mobileChatScreen::before{position:fixed}

/* ================================================================
   ПРОЗРАЧНЫЕ ПОЛОСЫ ЧАТА — как в Telegram, В ЛЮБОМ РЕЖИМЕ МАТТЫ
   Важно: все прежние правки прозрачности жили под body[data-matte="glass"],
   а режим по умолчанию — mono, и там applyMatte() атрибут вообще снимает.
   В mono заливка была сплошной (--md-sys-color-surface) с тенью, поэтому
   шапка и панель ввода выглядели непрозрачными полосами поверх переписки, а
   изменения не были видны вообще. Правила ниже — без условия, работают
   всегда: и в mono, и в glass.
   ================================================================ */
.mobile-chat-header::before{
  background:color-mix(in srgb,var(--md-sys-color-surface) 34%,transparent);
  backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  -webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  box-shadow:none;
}
.mobile-input-dock{
  background:color-mix(in srgb,var(--md-sys-color-surface) 34%,transparent);
  backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  -webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  box-shadow:none;
}
/* Сам нижний стек НЕ красит фон — иначе его сплошная заливка перекрывает
   прозрачные скруглённые углы dock'а и они выглядят «непрозрачными».
   Размытие и тинт несёт сам dock, поэтому углы у него реально просвечивают.
   Дочерние подхваты (ответ/вложения/набор) и так transparent. */
body.chat-overlay-layout #mobileChatBottom,
body.chat-overlay-layout #mobileChatBottom .reply-preview,
body.chat-overlay-layout #mobileChatBottom .attachments-bar,
body.chat-overlay-layout #mobileChatBottom .typing-indicator{
  background:transparent;
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
  box-shadow:none;
}
/* Десктоп: шапка и композер того же тона (тёмнее, менее прозрачное), что и
   телефон — единая линия «тёмные полосы поверх ленты». */
body.chat-overlay-layout #desktopChatHeader,
body.chat-overlay-layout .desktop-chat-header{
  background:color-mix(in srgb,var(--md-sys-color-surface) 34%,transparent);
  backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  -webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
}
body.chat-overlay-layout #desktopChatBottom{
  background:color-mix(in srgb,var(--md-sys-color-surface) 34%,transparent);
  backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  -webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
}

/* ================================================================
   МОДАЛЬНОЕ ОКНО ЭМОДЗИ ДЛЯ ПК
   ================================================================ */
#desktopStickerPicker.desktop-emoji-modal{
  position:fixed;
  /* Не по центру экрана, а у композера: верхняя часть переписки остаётся
     читаемой. --panel-width задаёт сайдбар, --desktop-chat-bottom-h — высоту
     нижней панели чата. */
  left:max(16px, calc(var(--panel-width, 340px) + 20px));
  right:auto;
  bottom:calc(var(--desktop-chat-bottom-h, 72px) + 16px);
  top:auto;
  /* Базовая .emoji-picker несёт animation:popIn — она перебивает transform
     и opacity модалки. Для модального режима анимацию отключаем. */
  animation:none;
  transform:translateY(12px) scale(.97);
  transform-origin:bottom left;
  opacity:0;
  width:min(360px, calc(100vw - var(--panel-width, 340px) - 40px));
  max-width:none;
  max-height:min(560px,70vh);
  border-radius:18px;
  border:1px solid var(--md-sys-color-outline-variant);
  box-shadow:0 28px 70px -18px rgba(0,0,0,.65);
  z-index:1200;
  background:var(--md-sys-color-surface-container);
  overflow:hidden;
  display:flex;flex-direction:column;
  transition:opacity .2s ease, transform .22s cubic-bezier(.16,1,.3,1);
}
#desktopStickerPicker.desktop-emoji-modal.desktop-emoji-modal-open{
  opacity:1;
  transform:none;
}
#desktopStickerPicker.desktop-emoji-modal.closing{
  opacity:0;
  transform:translateY(12px) scale(.97);
}
/* Лёгкая затемнение без размытия: текст сообщений за окном читается. */
.emoji-modal-backdrop{
  position:fixed;inset:0;
  background:rgba(0,0,0,.22);
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
  z-index:1190;
  animation:emojiModalBackdropIn .18s ease both;
}
@keyframes emojiModalBackdropIn{from{opacity:0}to{opacity:1}}
/* Окно «вас отвязали». */
.revoked-card{
  width:min(92vw,360px);
  padding:26px 22px 22px;
  border-radius:24px;
  text-align:center;
  background:var(--md-sys-color-surface-container-high);
  border:1px solid var(--md-sys-color-outline-variant);
  display:flex;flex-direction:column;align-items:center;gap:10px;
}
.revoked-card h3{margin:0;font-size:19px}
.revoked-card .sub{margin:0 0 8px;font-size:13px;opacity:.75}
.revoked-card .auth-btn{width:100%}

/* ================================================================
   ВЕРХ ПАНЕЛИ ЧАТОВ И ШАПКА ОКНА НАСТРОЕК
   Отступ строки состояния #app уже учитывает, поэтому сверху шапки
   панели добавлять вырез второй раз не нужно — панель от этого
   уезжала вниз.
   Шапке окна настроек, наоборот, отступ нужен: она прижата к самому
   верхнему краю и налезала на строку состояния.
   ================================================================ */
/* ================================================================
   ВЕРХ ГЛАВНОГО ЭКРАНА
   #app резервирует строку состояния целиком (--status-h). На телефоне
   эта же высота приходит ещё и в --cutout-top, и когда WebView уже
   лежит под статус-баром, она учитывалась дважды — плюс к этому её
   добавляли и шапке, и виджету. Блок с датой и батареей вытягивался
   втрое, а текст прижимался к его низу.

   Поэтому на мобильном резервирование строки состояния снимается с
   #app целиком и кладётся ОДИН РАЗ на шапку: --status-h + 8..12 px.
   Вижет своего верхнего отступа не получает вовсе.
   Экран чата и окна настроек своё резервирование сохраняют.
   ================================================================ */
@media (max-width:768px){
  #app:not(.chat-open){padding-top:0}
  /* Safe-area — ровно один раз и только env(). --status-h из моста
     сюда класть нельзя: на устройстве, где окно уже под строкой
     состояния, верхняя строка уезжала вниз больше чем на 100 px.
     Вижет своего верхнего отступа не получает вовсе. */
  #app:not(.chat-open) .panel-header{
    padding-top:calc(env(safe-area-inset-top, 0px) + 6px);
  }
  /* Виджет компактный: ровно как аватарка справа. Никаких
     min-height/height/margin-top и никакого верхнего отступа —
     иначе блок снова растёт, а текст прижимается к низу. */
  #app:not(.chat-open) .panel-widget{
    padding:5px 10px;
    min-height:0;
    height:auto;
    margin-top:0;
    align-self:center;
    display:flex;
    align-items:center;
    justify-content:center;
  }
}
.menu-content.settings-window > .sw-header{
  padding-top:calc(10px + var(--safe-top-full));
}
.menu-content.settings-window > .settings-window-head,
.menu-content.settings-window > .mw-head{
  padding-top:calc(14px + var(--safe-top-full));
}

/* Окно «Устройства» открывается из окна настроек и должно быть
   поверх него: у .menu-dialog свой z-index 5000, поэтому поднимаем. */
#devicesDialog{z-index:5300}
#revokedDialog{z-index:5400}

/* Когда открыта панель эмодзи, кнопка «вниз» встаёт над всей нижней
   областью: поле ввода + панель. Раньше учитывалась только панель,
   поэтому кнопка наезжала на поле ввода. */
body.emoji-sheet-open .chat-down-btn{
  bottom:calc(var(--chat-bottom-h, var(--composer-h, 96px)) + var(--emoji-panel-h, 300px) + 12px);
}

/* ================================================================
   СПЛЭШ ЗАГРУЗКИ — по дизайну пользователя (splash.html).
   Раньше здесь была картинка icon.png и свои анимации. Теперь логотип
   inline-SVG, подпись Unbounded и бегущая волна.

   Важное отличие от исходного splash.html: .splash-sub показывает
   ТЕКСТ СОСТОЯНИЯ (setLoadingStatus), а не слово MESSENGER. Поэтому
   строка состояния не пропадает, а счётчик загрузки виден так же,
   как раньше. Иначе загрузка выглядела бы зависшей.
   ================================================================ */
.splash-host{position:fixed;inset:0;z-index:9999;
  background:radial-gradient(circle at center,#1c1c1e 0%,#0a0a0b 100%);color:#fcfcfc;
  display:flex;align-items:center;justify-content:center;overflow:hidden;
  transition:opacity .5s,visibility .5s}
.splash-screen{position:fixed;inset:0;display:flex;flex-direction:column;justify-content:center;align-items:center;z-index:9999;
  animation:fadeOutScale .4s cubic-bezier(.4,0,.2,1) 1.0s forwards}
.bg-glow{position:absolute;width:65vmin;height:65vmin;border-radius:50%;
  background:var(--splash-glow,rgba(255,255,255,.25));filter:blur(60px);z-index:1;opacity:0;transform:scale(.8);
  animation:glowAppear 1.43s ease-out forwards,glowPulse 2.86s ease-in-out 1.43s infinite alternate}
.logo-wrapper{width:70vmin;max-width:500px;z-index:2;animation:float 3.57s ease-in-out 2.5s infinite alternate}
.logo-path{fill:#fcfcfc}
.shape-a{opacity:0;transform-origin:center;animation:cinematicFocus 1.43s cubic-bezier(.16,1,.3,1) forwards}
.shape-s{-webkit-mask-image:radial-gradient(circle,black 30%,transparent 70%);mask-image:radial-gradient(circle,black 30%,transparent 70%);
  -webkit-mask-size:0% 0%;mask-size:0% 0%;-webkit-mask-position:center;mask-position:center;
  -webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;transform-origin:center;
  animation:bloomS 1.14s cubic-bezier(.34,1.56,.64,1) .64s forwards}
.splash-sub{position:relative;margin:8px 0 0;font-size:11px;letter-spacing:.42em;color:#8e8e8e;
  opacity:0;padding-left:.42em;text-align:center;min-height:1.2em;max-width:86vw;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;z-index:2}
@keyframes glowAppear{0%{opacity:0;transform:scale(.6)}100%{opacity:1;transform:scale(1)}}
@keyframes glowPulse{0%{transform:scale(1);opacity:.7}100%{transform:scale(1.1);opacity:1}}
@keyframes cinematicFocus{0%{opacity:0;transform:scale(1.05);filter:blur(12px)}100%{opacity:1;transform:scale(1);filter:blur(0)}}
@keyframes bloomS{0%{-webkit-mask-size:0% 0%;mask-size:0% 0%;opacity:0;transform:translateY(15px) scale(.9)}100%{-webkit-mask-size:300% 300%;mask-size:300% 300%;opacity:1;transform:translateY(0) scale(1)}}
@keyframes float{0%{transform:translateY(0)}100%{transform:translateY(-12px)}}
@keyframes fadeOutScale{0%{opacity:1;visibility:visible;transform:scale(1)}100%{opacity:0;visibility:hidden;transform:scale(.96)}}
@media(prefers-reduced-motion:reduce){.splash-screen *{animation-duration:.01s!important;animation-delay:0s!important;animation-iteration-count:1!important}}

/* ================================================================
   ПЕРЕКЛЮЧАТЕЛЬ ИКОНКИ ПРИЛОЖЕНИЯ — конец «Внешнего вида».
   Подписи на английском намеренно: data-i18n нет, иначе переводчик
   переведёт их на русский/китайский и выбор перестанет совпадать
   с тем, что показывает Android в настройках приложения.
   ================================================================ */

/* ================================================================
   ЗНАЧКИ ПОДСКАЗОК ЗАПИСИ ГОЛОСОВОГО

   Раньше круглая подложка «отмена»/«зафиксировать» рисовалась на
   самом теге через padding + border-radius, а размер значка брался из
   font-size. Когда внутри тега оказался вектор .ai размером 1em, высота
   строки перестала совпадать с размером значка — подложка уезжала, а
   значок вылезал за круг и выглядел срезанным.

   Теперь размеры заданы прямо: подложка 48px, значок 30px, оба по
   центру. Результат не зависит от того, отрисован значок шрифтом или
   вектором.
   ================================================================ */
.circle-lock-hint .material-symbols-outlined,
.circle-cancel-hint .material-symbols-outlined{
  display:flex;
  align-items:center;
  justify-content:center;
  width:48px;
  height:48px;
  min-width:48px;
  padding:0;
  line-height:1;
  overflow:visible;
}
.circle-lock-hint .material-symbols-outlined .ai,
.circle-cancel-hint .material-symbols-outlined .ai{
  display:block;
  width:30px;
  height:30px;
}
/* Подсказка не должна подниматься над кругом записи: раньше её
   позиция считалась от контейнера, который менял высоту. */
.circle-lock-hint{top:max(30px,var(--safe-top));z-index:3}
.circle-cancel-hint{top:50%;transform:translateY(-50%) translateX(-12px);z-index:3}
/* ================================================================
   ПОДСКАЗКИ КРУЖКОВ ТОЛЬКО В РЕЖИМЕ КРУЖКОВ

   По скриншоту: при обычной записи голоса значок микрофона в круге
   пропадал, а сверху-слева висел значок «удалить». Это подсказки
   .circle-cancel-hint и .circle-lock-hint из режима съёмки кружков:
   у них opacity:0, но position:absolute выносит их в отдельный слой,
   и при обычной записи они оказываются поверх экрана записи.

   Прежняя правка меняла им только размер — поэтому ничего не
   менялось. Теперь они скрыты по умолчанию и показываются лишь при
   body.circle-recording, который скрипт и так ставит на время съёмки
   кружков.
   ================================================================ */
.circle-lock-hint,
.circle-cancel-hint{
  display:none;
}
body.circle-recording .circle-lock-hint{
  display:flex;
}
body.circle-recording .circle-cancel-hint{
  display:flex;
}

/* ================================================================
   ЗНАЧОК МИКРОФОНА В ОКНЕ ЗАПИСИ АУДИО

   Правило кольца (.record-ring svg) задаёт поворот -90°, чтобы дуга
   прогресса начиналась сверху. Оно же попадало и на значок микрофона:
   после подмены Google Symbols на набор Aspect внутри тега оказывается
   <svg class="ai">, то есть тоже svg. Отсюда два дефекта разом: значок
   поворачивался на 90° и получал position:absolute; inset:0, из-за чего
   уезжал в угол круга.

   Поэтому правило кольца теперь цепляет только прямого потомка
   (.record-ring > svg), а значок остаётся обычным элементом flex.
   Размер берётся из font-size:52px в правиле .record-preview ниже,
   потому что иконка набора имеет width/height:1em.

   Проверено на стенде: до правки значок лежал на боку, после — стоит
   ровно и по центру.
   ================================================================ */
.record-preview{position:relative}
.rec-audio-icon{position:relative;z-index:2}
/* Видео-предпросмотр занимает весь круг и не должен перекрывать значок
   выключенной записи. */
.record-preview video{position:absolute;inset:0;z-index:1}

/* ================================================================
   ПАНЕЛЬ ЭМОДЗИ — ПОД ПОЛЕМ ВВОДА, КАК КЛАВИАТУРА

   Было так: панель стояла НАД полем (bottom: var(--composer-h)), а поле
   было прижато к низу экрана. Клавиатура всегда появляется ПОД полем,
   поэтому панель воспринималась перевёрнутой.

   Стало: панель прижата к низу экрана, а поле ввода поднято ровно на её
   высоту. Между ними нет ни зазора, ни нахлёста — поле стоит на верхней
   кромке панели. Высота берётся из --emoji-panel-h: её выставляет
   alignEmojiPanelToRows уже после подгонки панели под целое число рядов,
   поэтому кромки совпадают даже когда высота изменилась на несколько px.
   ================================================================ */
body.chat-overlay-layout #mobileChatScreen > .emoji-picker.as-keyboard{
  bottom:0;
  /* Панель сама закрывает полосу жестов — иначе её нижняя вкладка
     оказалась бы под системной полосой. */
  padding-bottom:var(--safe-bottom, 0px);
}
body.chat-overlay-layout.emoji-sheet-open #mobileChatBottom{
  bottom:var(--emoji-panel-h, 300px);
}
body.chat-overlay-layout.emoji-sheet-open #mobileInputArea{
  position:relative;
  left:auto;right:auto;bottom:auto;
}
/* Поле больше не держит отступ под домашнюю полосу: его закрывает панель.
   Иначе между полем и панелью появился бы пустой пояс высотой safe-bottom. */
body.chat-overlay-layout.emoji-sheet-open .mobile-input-dock{
  padding-bottom:8px;
}
/* Лента должна прокручиваться выше: снизу теперь весь стек И панель. */
body.chat-overlay-layout.emoji-sheet-open #mobileChatMessages{
  padding-bottom:calc(var(--chat-bottom-h, var(--composer-h, 64px)) + var(--emoji-panel-h, 0px));
}

/* ================================================================
   ПК: те же «полосы поверх ленты», что и на телефоне.
   HTML шапки/композера больше не несёт инлайновые стили — без этих
   правил чат на десктопе собирается в пустую колонку без композера.
   ================================================================ */
#desktopChatHeader,
.desktop-chat-header{
  display:flex;align-items:center;gap:10px;
  padding:12px 16px;
  flex-shrink:0;
  position:relative;z-index:5;
}
.desktop-chat-header-info{flex:1;cursor:pointer;min-width:0}
.desktop-chat-name{
  margin:0;font-size:15px;font-weight:500;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.desktop-chat-sub{font-size:11px;color:var(--md-sys-color-on-surface-variant)}
.desktop-chat-top-stack,.desktop-chat-bottom{display:flex;flex-direction:column}
.desktop-input-area{
  display:flex;gap:8px;padding:12px;align-items:flex-end;position:relative;
}
.desktop-input-area .chat-input{flex:1;min-width:0}
.desktop-dock-btn{flex:0 0 40px;width:40px;height:40px;margin-bottom:2px;border-radius:50%;border:none;background:transparent;color:var(--md-sys-color-on-surface-variant);display:flex;align-items:center;justify-content:center;cursor:pointer;transition:background .2s,color .2s,transform .2s}
.desktop-dock-btn:hover{background:color-mix(in srgb,var(--md-sys-color-surface-variant) 50%,transparent);color:var(--md-sys-color-on-surface)}
.desktop-dock-btn:active{transform:scale(.9);background:color-mix(in srgb,var(--md-sys-color-primary) 20%,transparent);color:var(--md-sys-color-primary)}
.desktop-dock-btn .material-symbols-outlined{font-size:22px}
body[data-matte="glass"] .desktop-dock-btn{
  border:none;
  background:transparent;
  color:var(--md-sys-color-on-surface);
}
body[data-matte="glass"] .desktop-dock-btn:hover{
  background:color-mix(in srgb,var(--md-sys-color-surface-variant) 50%,transparent);
}
body[data-matte="glass"] .desktop-dock-btn:active{
  background:color-mix(in srgb,var(--md-sys-color-primary) 25%,transparent);
  color:var(--md-sys-color-on-primary);
}
.desktop-input-area #desktopSendBtn{
  flex:0 0 44px;width:44px;height:44px;min-width:44px;padding:0;border-radius:50%;touch-action:none;
}
.desktop-input-area .channel-locked-notice{flex:1}
/* Капсула «эмодзи + вложение» на ПК: обе иконки видны сразу и не
   сворачиваются в одну кнопку до фокуса поля ввода. */
.desktop-dock-tools{
  display:flex;align-items:center;gap:0;flex-shrink:0;
  padding:2px;border-radius:22px;
  background:var(--md-sys-color-surface-container);
  align-self:center;margin-bottom:2px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.05);
}
.desktop-dock-divider{width:1px;height:18px;flex-shrink:0;margin:0 1px;background:var(--md-sys-color-outline-variant);opacity:.7}
.desktop-dock-tools .desktop-dock-btn{width:38px;height:38px;min-width:38px;margin-bottom:0}
body[data-matte="glass"] .desktop-dock-tools{background:color-mix(in srgb,var(--md-sys-color-surface-container) 55%,transparent);backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));-webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat))}

body.chat-overlay-layout #desktopChatContainer{position:relative}
body.chat-overlay-layout #desktopChatHeader{
  position:absolute;top:0;left:0;right:0;z-index:12;
  background:color-mix(in srgb,var(--md-sys-color-surface) 22%,transparent);
  backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  -webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
}
body.chat-overlay-layout #desktopChatTopStack{
  position:absolute;left:0;right:0;z-index:12;
  top:var(--desktop-chat-header-h, 56px);
}
body.chat-overlay-layout #desktopMessages{
  position:absolute;inset:0;box-sizing:border-box;
  padding:16px;
  padding-top:calc(var(--desktop-chat-header-h, 56px) + var(--desktop-chat-topbars-h, 0px) + 16px);
  padding-bottom:calc(var(--desktop-chat-bottom-h, 72px) + 16px);
}
body.chat-overlay-layout #desktopChatBottom{
  position:absolute;left:0;right:0;bottom:0;z-index:12;
  background:color-mix(in srgb,var(--md-sys-color-surface) 22%,transparent);
  backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  -webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
}
body.chat-overlay-layout #desktopChatBottom .reply-preview,
body.chat-overlay-layout #desktopChatBottom .attachments-bar,
body.chat-overlay-layout #desktopChatBottom .typing-indicator{
  background:transparent;
}

/* Модалки композера на ПК: разметка уже в index.html. */
.composer-modal{
  position:fixed;inset:0;z-index:80;
  display:flex;align-items:center;justify-content:center;
}
.composer-modal.hidden{display:none!important}
.composer-modal-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.45)}
.composer-modal-card{
  position:relative;z-index:1;
  width:min(440px,92vw);max-height:min(560px,82vh);
  display:flex;flex-direction:column;
  border-radius:20px;overflow:hidden;
  background:var(--md-sys-color-surface-container-high);
  box-shadow:0 24px 64px -16px rgba(0,0,0,.55);
}
.composer-modal-head{
  display:flex;align-items:center;justify-content:space-between;
  gap:12px;padding:14px 16px 10px;flex-shrink:0;
}
.composer-modal-body{flex:1;min-height:0;overflow:auto}

/* Карточки иконки приложения в настройках: два крупных «скруглённых
   квадрата» с превью значка, акцентным кольцом и галочкой у выбранного.
   Раньше это были маленькие плоские кнопки 56×56 — значок читался хуже
   подписи, и выбор было не разглядеть. */
.app-icon-cards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.app-icon-card{
  position:relative;display:flex;flex-direction:column;align-items:center;gap:10px;
  padding:14px 10px 12px;border-radius:22px;cursor:pointer;
  border:1px solid color-mix(in srgb,var(--md-sys-color-outline-variant) 75%,transparent);
  background:var(--md-sys-color-surface-container-low,var(--md-sys-color-surface-container));
  color:inherit;font-family:inherit;
  transition:border-color .2s,background .2s,transform .12s,box-shadow .2s;
  -webkit-tap-highlight-color:transparent;
}
.app-icon-card:hover{
  background:color-mix(in srgb,var(--md-sys-color-on-surface) 5%,var(--md-sys-color-surface-container-low,var(--md-sys-color-surface-container)));
}
.app-icon-card:active{transform:scale(.975)}
.app-icon-card.selected{
  border-color:color-mix(in srgb,var(--md-sys-color-primary) 70%,transparent);
  background:color-mix(in srgb,var(--md-sys-color-primary) 9%,var(--md-sys-color-surface-container-low,var(--md-sys-color-surface-container)));
  box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--md-sys-color-primary) 45%,transparent);
}
.app-icon-frame{position:relative;display:block;line-height:0}
.app-icon-preview{
  display:block;width:84px;height:84px;border-radius:22px;overflow:hidden;
  background:var(--md-sys-color-surface-container-highest);
  box-shadow:0 6px 18px -8px rgba(0,0,0,.55);
  transition:box-shadow .2s,transform .2s;
}
.app-icon-preview img{width:100%;height:100%;object-fit:cover;display:block}
/* Контраст превью: тёмная иконка — на светлом фоне, светлая — на тёмном,
   иначе значок сливается с подложкой и «не виден» в переключателе. */
.app-icon-card[data-icon-variant="dark"] .app-icon-preview{background:#121314}
.app-icon-card[data-icon-variant="light"] .app-icon-preview{background:#f5f6f8}
.app-icon-card.selected .app-icon-preview{
  box-shadow:0 0 0 2.5px var(--md-sys-color-primary),
             0 10px 24px -10px color-mix(in srgb,var(--md-sys-color-primary) 70%,transparent);
}
.app-icon-label{
  display:inline-flex;align-items:center;gap:5px;
  padding:4px 12px;border-radius:999px;
  font-size:12px;font-weight:600;letter-spacing:.2px;
  background:color-mix(in srgb,var(--md-sys-color-on-surface) 7%,transparent);
  color:var(--md-sys-color-on-surface-variant);
  transition:background .2s,color .2s;
}
.app-icon-card.selected .app-icon-label{
  background:var(--md-sys-color-primary);
  color:var(--md-sys-color-on-primary);
}
.app-icon-check{
  position:absolute;top:-5px;right:-5px;z-index:2;
  width:24px;height:24px;border-radius:50%;
  display:grid;place-items:center;
  background:var(--md-sys-color-primary);color:var(--md-sys-color-on-primary);
  box-shadow:0 2px 8px -1px rgba(0,0,0,.5);
  opacity:0;transform:scale(.4);
  transition:opacity .18s,transform .18s;
}
.app-icon-check .material-symbols-outlined{font-size:15px;font-weight:700}
.app-icon-card.selected .app-icon-check{opacity:1;transform:scale(1)}
.app-icon-note{font-size:12px;opacity:.6;margin-top:10px;text-align:center}
.audio-transcript-pending .material-symbols-outlined{animation:asrPulse 1.2s ease-in-out infinite}
@keyframes asrPulse{0%,100%{opacity:.4;transform:scale(.9)}50%{opacity:1;transform:scale(1.05)}}
/* На вебе моста нет и карточки неактивны, но превью значка всё равно
   должно читаться: раньше opacity:.5 превращала его в серое пятно. */
.app-icon-card.disabled{opacity:.72;cursor:not-allowed;pointer-events:none}
.app-icon-card:disabled{opacity:.72;cursor:not-allowed}

/* ================================================================
   СТРАХОВКА ДЛЯ SVG-ИКОНОК ASPECT
   Размер задаётся в icons.css, но если он не загрузился (404, старый
   кэш, оффлайн), <svg class="ai"> получал размер по умолчанию 300×150
   и разносил любую вёрстку — в том числе панель эмодзи на ПК. Держим
   базовый размер здесь, в основном файле стилей, чтобы он был всегда.
   ================================================================ */
.material-symbols-outlined > svg.ai,
.icon > svg.ai,
.devices-detail-icon > svg.ai,
.select-hero-icon > svg.ai{
  width:1em;height:1em;
  display:inline-block;
  vertical-align:-0.125em;
  flex:none;
  fill:none;
  color:inherit;
  pointer-events:none;
}

/* ================================================================
   MONOCHROME — ПОЛОСЫ БЕЗ РАЗМЫТИЯ, СПЛОШНОЙ ФОН
   Монохром — «строгий» режим: шапка и панель ввода в нём не стекло, а
   обычные непрозрачные полосы, как в нативной Material-разметке. Кроме
   вида это ещё и заметно дешевле: backdrop-filter под каждой полосой —
   отдельный проход по фону на каждый кадр прокрутки, а в mono их нет
   вовсе. Стекло (data-matte="glass") не затрагивается: у него те же
   элементы остаются полупрозрачными со своим блюром.

   Блок стоит В САМОМ КОНЦЕ файла намеренно: выше есть ещё правила для
   #desktopChatHeader/#desktopChatBottom с той же специфичностью и
   полупрозрачностью 34%, и любое из них перебило бы это. :not() держит
   режим стекла нетронутым.
   ================================================================ */
body:not([data-matte="glass"]) .mobile-chat-header::before,
body:not([data-matte="glass"]) .mobile-input-dock,
body:not([data-matte="glass"]) #mobileChatTopStack,
body:not([data-matte="glass"]) #desktopChatHeader,
body:not([data-matte="glass"]) #desktopChatBottom,
body:not([data-matte="glass"]) .desktop-chat-header{
  background:var(--md-sys-color-surface);
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
  box-shadow:none;
}

/* ================================================================
   ФОН ЗА ОКНАМИ НАСТРОЕК
   Телефон: сплошной фон (и в монохроме, и в стекле).
   ПК: полупрозрачная подложка с блюром — виден список чатов за карточкой.
   ================================================================ */
@media (max-width:768px){
  body:not([data-matte="glass"]) .menu-dialog.sw-full,
  body:not([data-matte="glass"]) .menu-dialog.sw-full .menu-content{
    background:var(--md-sys-color-surface);
    backdrop-filter:none;
    -webkit-backdrop-filter:none;
  }
  body.light-theme:not([data-matte="glass"]) .menu-dialog.sw-full,
  body.light-theme:not([data-matte="glass"]) .menu-dialog.sw-full .menu-content{
    background:#f5f5f5;
  }
}
/* На ПК ранние правила matte glass делали подложку сплошной. Перекрываем
   их здесь: и монохром, и матовое стекло получают прозрачность и размытие. */
@media (min-width:769px){
  body:not([data-matte="glass"]) .menu-dialog.sw-full,
  body[data-matte="glass"] .menu-dialog.sw-full{
    background:rgba(0,0,0,.45);
    backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
    -webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  }
  body.light-theme:not([data-matte="glass"]) .menu-dialog.sw-full,
  body.light-theme[data-matte="glass"] .menu-dialog.sw-full{
    background:rgba(245,245,245,.55);
  }
}

/* ================================================================
   РЕДАКТОР СТИКЕРОВ — тема вместо захардкоженного монохрома
   ================================================================ */
#stickerEditor{
  background:var(--md-sys-color-surface);
  color:var(--md-sys-color-on-surface);
}
.se-header{
  border-bottom-color:var(--md-sys-color-outline-variant);
  background:var(--md-sys-color-surface-container);
  color:var(--md-sys-color-on-surface);
}
.se-btn{
  background:color-mix(in srgb,var(--md-sys-color-surface-variant) 60%,transparent);
  color:var(--md-sys-color-on-surface);
}
.se-btn.primary{
  background:var(--md-sys-color-primary);
  color:var(--md-sys-color-on-primary);
}
.se-canvas{
  background:var(--md-sys-color-surface-container);
  box-shadow:0 24px 60px -18px rgba(0,0,0,.55);
}
.se-canvas.empty{border-color:var(--md-sys-color-outline-variant)}
.se-tools{
  border-top-color:var(--md-sys-color-outline-variant);
  background:var(--md-sys-color-surface-container);
}
.se-tool{
  background:color-mix(in srgb,var(--md-sys-color-surface-variant) 55%,transparent);
  color:var(--md-sys-color-on-surface);
}
.se-tool.active{
  background:var(--md-sys-color-primary);
  color:var(--md-sys-color-on-primary);
}
.se-palette{
  background:var(--md-sys-color-surface-container);
  border:1px solid var(--md-sys-color-outline-variant);
}
.se-color.active{border-color:var(--md-sys-color-primary)}
.se-hint{
  background:color-mix(in srgb,var(--md-sys-color-surface-variant) 90%,transparent);
  color:var(--md-sys-color-on-surface);
}
/* В matte glass панели редактора — те же полупрозрачные стеклянные
   полосы, что и остальной интерфейс. */
body[data-matte="glass"] #stickerEditor .se-header,
body[data-matte="glass"] #stickerEditor .se-tools,
body[data-matte="glass"] #stickerEditor .se-palette,
body[data-matte="glass"] #stickerEditor .se-hint{
  background:color-mix(in srgb,var(--md-sys-color-surface-container) 62%,transparent);
  backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  -webkit-backdrop-filter:blur(var(--ui-blur)) saturate(var(--ui-blur-sat));
  border-color:color-mix(in srgb,var(--md-sys-color-outline-variant) 55%,transparent);
}
body[data-matte="glass"] #stickerEditor{background:var(--md-sys-color-surface)}
