:root {
  --fs: 1.15;                    /* стандарт - «крупный»; large 1.32, xlarge 1.5 */
  --bg: #f2f5f9;
  --card: #ffffff;
  --line: #e4e9f0;
  --line-strong: #d4dbe5;
  --text: #17222e;
  --muted: #67788a;
  --accent: #7567d8;
  --accent-d: #6254c5;
  --accent-soft: #efedff;
  --green: #27a95c;
  --red: #de5049;
  --red-soft: #fdecec;
  --bubble-my: #e3dfff;
  --bubble-their: #ffffff;
  /* --- дизайн-токены: единые радиусы, тени, размеры касания --- */
  --r-lg: 14px;                  /* карточки, крупные контейнеры */
  --r-md: 12px;                  /* кнопки, поля, строки меню */
  --r-sm: 8px;                   /* цитаты, чипы */
  --r-bubble: 14px;              /* пузыри сообщений */
  --shadow-1: 0 1px 2px rgba(23, 34, 46, .05);
  --shadow-2: 0 6px 18px rgba(23, 34, 46, .14);
  --shadow: var(--shadow-1);
  --tap: min(3rem, 60px);        /* базовая зона нажатия, растёт с текстом */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
html[data-ts="normal"] { --fs: 1.15; }
html[data-ts="large"] { --fs: 1.32; }
html[data-ts="xlarge"] { --fs: 1.5; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: calc(16px * var(--fs)); }
html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overscroll-behavior: none;
}
body {
  position: fixed; inset: 0; overflow: hidden; touch-action: manipulation;
  /* Долгое нажатие - это меню, а не выделение текста (и не iOS-callout). */
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
input, textarea { -webkit-user-select: text; user-select: text; }
input, button, textarea, select { font-family: inherit; font-size: 1rem; color: var(--text); }
img { display: block; }
button { cursor: pointer; }

/* ---------- screens ---------- */
.screen {
  position: absolute; top: 0; left: 0; right: 0;
  height: var(--vvh, 100%);
  display: none; flex-direction: column;
  background: var(--bg);
}
.screen.is-active { display: flex; }
.hidden { display: none !important; }

/* ---------- splash ---------- */
#screen-splash { align-items: center; justify-content: center; }
.splash { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.splash img { border-radius: 18px; }
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid var(--line-strong); border-top-color: var(--accent);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- login ---------- */
#screen-login {
  align-items: center; justify-content: flex-start;
  padding: calc(18px + var(--safe-t)) 22px calc(24px + var(--safe-b));
  overflow-y: auto;
}
.login-box { width: 100%; max-width: 420px; margin: auto; }
.brand { text-align: center; margin-bottom: 22px; }
.brand img { margin: 0 auto 10px; border-radius: 16px; }
.brand h1 { margin: 0; font-size: 1.7rem; }
.brand-sub { margin: 6px 0 0; color: var(--muted); }
#screen-login label { display: block; margin-bottom: 14px; }
#screen-login label > span { display: block; margin-bottom: 6px; font-weight: 600; font-size: .95rem; }
input[type=text], input[type=password], input[type=date], select, textarea {
  width: 100%; padding: 13px 15px; border-radius: var(--r-md);
  background: var(--card); border: 1.5px solid var(--line-strong); color: var(--text);
  outline: none; min-height: var(--tap);
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.form-error { margin-top: 12px; color: var(--red); font-size: .95rem; text-align: center; }
.linklike {
  display: block; margin: 14px auto 0; background: none; border: none;
  color: var(--accent); font-size: 1rem; font-weight: 600; padding: 8px;
}
.login-alt { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.invite-banner {
  background: var(--accent-soft); border: 1.5px solid var(--accent);
  border-radius: 14px; padding: 13px 16px; margin-bottom: 16px;
  font-size: 1rem; line-height: 1.45;
}
.invite-banner small { color: var(--muted); }
.hint { color: var(--muted); font-size: .9rem; line-height: 1.5; margin: 4px 0 12px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 18px; border-radius: var(--r-md); border: 1.5px solid transparent;
  font-weight: 700; color: var(--text); background: var(--card);
  min-height: var(--tap); font-size: 1rem; position: relative;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:active { background: var(--accent-d); }
.btn-ghost { background: var(--card); border-color: var(--line-strong); color: var(--text); }
.btn-ghost:active { background: var(--accent-soft); }
.btn-big { width: 100%; padding: 15px; font-size: 1.05rem; }
.btn-wide { width: 100%; }
.btn-slim { padding: 10px 14px; min-height: 42px; font-size: .95rem; flex: none; }
.btn[disabled] { opacity: .75; pointer-events: none; }
/* состояние загрузки: текст прячется, крутится спиннер */
.btn.loading { color: transparent !important; pointer-events: none; }
.btn.loading::after {
  content: ''; position: absolute; width: 1.15rem; height: 1.15rem; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.45); border-top-color: #fff;
  animation: spin .8s linear infinite;
}
.btn-ghost.loading::after { border-color: var(--line-strong); border-top-color: var(--accent); }

/* ---------- topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(8px + var(--safe-t)) 14px 8px; background: var(--card);
  border-bottom: 1px solid var(--line); flex: none;
}
.page-title { margin: 0; font-size: 1.22rem; letter-spacing: -.2px; }
.subbar { justify-content: flex-start; }
.subbar h2 { margin: 0; font-size: 1.05rem; }
.subbar input { min-height: 44px; padding: 8px 14px; }
.me { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.me-text { display: flex; flex-direction: column; min-width: 0; }
.me-text strong { font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text small { color: var(--muted); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { background: none; border: none; color: var(--muted); padding: 9px; border-radius: 12px; flex: none; }
.icon-btn svg { width: 1.6rem; height: 1.6rem; }
.icon-btn:active { background: var(--accent-soft); }
.chatbar { padding-left: 4px; }
.chatbar .call-ico { color: var(--accent); }
/* В шапке чата иконки компактные, а имени можно занять две строки -
   иначе длинное ФИО в крупных режимах сжимается до пары букв. */
.chatbar .icon-btn { padding: 6px; }
.chatbar .icon-btn svg { width: min(1.5rem, 30px); height: min(1.5rem, 30px); }
.chatbar .me { gap: 8px; }
.chatbar .me-text strong {
  white-space: normal; display: -webkit-box; -webkit-box-orient: vertical;
  -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
  font-size: 1rem; line-height: 1.18; word-break: break-word;
}

.conn-strip {
  flex: none; text-align: center; font-size: .85rem; font-weight: 600;
  padding: 6px 10px; background: #fff7e0; color: #8a6d1a; border-bottom: 1px solid #f0e4bb;
}
.conn-strip.bad { background: var(--red-soft); color: var(--red); border-color: #f5d2d0; }
.conn-strip.ok { background: #e6f7ec; color: var(--green); border-color: #cdeeda; }
.bday-banner {
  flex: none; display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 10px 12px 0; padding: 12px 14px; border: none; border-radius: 14px;
  background: linear-gradient(0deg, var(--accent-soft), var(--accent-soft));
  color: var(--text); font-size: 1rem; font-weight: 600; box-shadow: var(--shadow);
}

/* ---------- tabs + bottom nav ---------- */
.tab { flex: 1; min-height: 0; display: none; flex-direction: column; position: relative; }
.tab.is-active { display: flex; }
.tab-scroll {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 12px 12px calc(24px + var(--safe-b));
}
/* Мессенджеру полосы прокрутки не нужны - прокрутка работает, полоса скрыта. */
.tab-scroll, .chat-scroll, #msg-input, .sheet, .bottom-sheet { scrollbar-width: none; -ms-overflow-style: none; }
.tab-scroll::-webkit-scrollbar, .chat-scroll::-webkit-scrollbar, #msg-input::-webkit-scrollbar,
.sheet::-webkit-scrollbar, .bottom-sheet::-webkit-scrollbar { width: 0; height: 0; display: none; }
.bottomnav {
  flex: none; display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
.nav-btn {
  flex: 1; background: none; border: none; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 0 7px; font-size: .75rem; font-weight: 600;
}
.nav-btn.is-active { color: var(--accent); }
.nav-ico { position: relative; display: inline-flex; }
.nav-ico svg { width: 1.7rem; height: 1.7rem; }
.badge {
  position: absolute; top: -4px; right: -10px; min-width: 19px; height: 19px;
  border-radius: 10px; background: var(--red); color: #fff; font-size: .72rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; padding: 0 5px;
}

/* ---------- avatars ---------- */
.avatar {
  width: 52px; height: 52px; border-radius: 50%; flex: none; position: relative;
  display: grid; place-items: center; font-weight: 700; font-size: 1.3rem; color: #fff;
  background: var(--accent); overflow: visible;
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar-sm { width: 42px; height: 42px; font-size: 1.05rem; }
.avatar-xl { width: 76px; height: 76px; font-size: 1.9rem; }
.avatar-xxl { width: 104px; height: 104px; font-size: 2.5rem; }
.online-dot {
  position: absolute; right: 0; bottom: 0; width: 14px; height: 14px; border-radius: 50%;
  background: var(--green); border: 2.5px solid var(--card); display: none; z-index: 2;
}
.avatar.is-online .online-dot { display: block; }

/* ---------- chat list ---------- */
.chat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.chat-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); cursor: pointer;
  box-shadow: var(--shadow-1);
}
@keyframes rise { from { opacity: .4; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.chat-item:active { background: var(--accent-soft); }
.chat-item .avatar { width: 48px; height: 48px; font-size: 1.2rem; }
.ci-body { flex: 1; min-width: 0; }
.ci-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ci-top b { font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-time { color: var(--muted); font-size: .75rem; flex: none; }
.ci-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.ci-preview {
  color: var(--muted); font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0;
}
.ci-preview .you { color: var(--accent); }
.ci-preview .draft { color: var(--red); }
.ci-preview .typing { color: var(--green); }
.ci-badge {
  flex: none; min-width: 22px; height: 22px; border-radius: 11px; background: var(--accent);
  color: #fff; font-size: .8rem; font-weight: 700; display: flex; align-items: center;
  justify-content: center; padding: 0 6px;
}
.ci-pin { flex: none; color: var(--muted); margin-left: 4px; display: inline-flex; }
.ci-pin svg { width: .95rem; height: .95rem; }
.ci-badge.muted { background: #a9b6c4; }
.chat-item.family .avatar { background: #6c8bd8; }

/* ---------- profile tab ---------- */
.prof-card {
  display: flex; align-items: center; gap: 14px; padding: 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow); margin-bottom: 14px;
  flex-wrap: wrap; /* в крупных режимах кнопка уходит на свою строку, дата не ломается */
}
.prof-info { flex: 1 1 170px; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.prof-info b { font-size: 1.25rem; overflow-wrap: anywhere; }
.prof-info .muted { overflow-wrap: anywhere; }
.prof-card .btn-slim { margin-left: auto; }
.menu-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.menu-btn {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 13px 14px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-md); font-size: 1rem; font-weight: 600; text-align: left;
  box-shadow: var(--shadow-1); min-height: var(--tap);
}
.menu-btn:active { background: var(--accent-soft); }
.menu-btn .mi {
  flex: none; width: 1.9rem; height: 1.9rem; display: grid; place-items: center;
  color: var(--accent); font-size: 1.2rem;
}
.menu-btn .mi svg { width: 1.35rem; height: 1.35rem; }
/* Цветные подложки иконок (живее, как в системных настройках) */
.mi-pink, .mi-green, .mi-red, .mi-purple, .mi-orange, .mi-teal, .mi-gray, .mi-blue, .mi-redbg {
  border-radius: 9px; color: #fff !important;
}
.mi-pink { background: #ec5f9a; } .mi-green { background: #34a862; }
.mi-red { background: #e2574c; } .mi-purple { background: #8e63d6; }
.mi-orange { background: #f09a37; } .mi-teal { background: #14a2a8; }
.mi-gray { background: #64748b; } .mi-blue { background: var(--accent); }
.mi-redbg { background: #e2574c; }
.mi-pink svg, .mi-green svg, .mi-red svg, .mi-purple svg, .mi-orange svg,
.mi-teal svg, .mi-gray svg, .mi-blue svg, .mi-redbg svg { width: 1.15rem; height: 1.15rem; }
.profile-mi { border-radius: 10px !important; }
.profile-mi svg { width: 1.25rem; height: 1.25rem; }
.profile-mi.mi-pink { background: #fae8f0; color: #b85f7a !important; }
.profile-mi.mi-green { background: #e2f3eb; color: #338b68 !important; }
.profile-mi.mi-red { background: #fde9e6; color: #c76055 !important; }
.profile-mi.mi-purple { background: #eeebff; color: #7567d8 !important; }
.profile-mi.mi-gray { background: #e9eef4; color: #5f7082 !important; }
.profile-mi.mi-orange { background: #fff0da; color: #b87926 !important; }
.profile-mi.mi-redbg { background: #fde9e6; color: var(--red) !important; }
.menu-btn.danger { color: var(--red); }
.menu-btn.danger .mi { color: var(--red); }
.menu-btn .chev { margin-left: auto; color: var(--line-strong); flex: none; }
.menu-btn .chev svg { width: 1.1rem; height: 1.1rem; }

/* Группа строк в одной карточке - вместо стопки одинаковых белых плиток. */
.menu-group {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-1); overflow: hidden; margin-bottom: 12px;
}
.menu-group .menu-btn {
  background: none; border: none; border-radius: 0; box-shadow: none;
  border-bottom: 1px solid var(--line);
}
.menu-group .menu-btn:last-child { border-bottom: none; }
.menu-group .menu-btn:active { background: var(--accent-soft); }

/* ---------- seg control ---------- */
.seg { display: flex; background: var(--card); border-radius: 13px; padding: 4px; border: 1px solid var(--line); gap: 4px; }
.seg-pad { margin: 10px 12px 0; flex: none; }
.seg-btn {
  flex: 1; border: none; background: none; color: var(--muted);
  padding: 11px 6px; border-radius: 10px; font-weight: 700; font-size: .92rem;
}
.seg-btn.is-active { background: var(--accent); color: #fff; }

/* ---------- chat screen ---------- */
#screen-chat { background: #e9eef5; }
.chat-scroll {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
  padding: 10px 10px 6px; display: flex; flex-direction: column;
}
.messages { overflow-x: clip; }
.chat-more { text-align: center; color: var(--muted); font-size: .85rem; padding: 8px; }
.messages { display: flex; flex-direction: column; gap: 3px; }
.chat-bottom-anchor { width: 100%; height: 1px; flex: none; }
.chat-empty { margin: auto; text-align: center; padding: 30px 24px; }
.chat-empty .empty-emoji { font-size: 44px; margin-bottom: 10px; }
.chat-empty p { margin: 6px 0; }

.day-chip, .sys-chip {
  align-self: center; margin: 8px 0 4px; padding: 4px 12px; border-radius: 20px;
  background: rgba(255,255,255,.75); color: var(--muted); font-size: .78rem; font-weight: 600;
  max-width: 90%; text-align: center;
}
.sys-chip { background: var(--accent-soft); color: var(--accent-d); }
.unread-divider {
  align-self: stretch; text-align: center; margin: 10px 0 6px; color: var(--accent);
  font-size: .85rem; font-weight: 700; display: flex; align-items: center; gap: 10px;
}
.unread-divider::before, .unread-divider::after {
  content: ''; flex: 1; height: 1.5px; background: var(--accent);
}

/* msgin - только у живых новых сообщений (.msg-new), иначе полная
   перерисовка списка «мигает» всеми пузырями сразу. */
.msg { display: flex; margin: 1px 0; align-items: flex-end; gap: 7px; position: relative; }
.msg.msg-new { animation: msgin .15s ease; }
/* подсказка при свайпе: «ответить» */
.msg::before {
  content: '↩'; position: absolute; top: 50%;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-size: 1.1rem;
  opacity: 0; transform: translateY(-50%) scale(.5); transition: .15s ease;
  pointer-events: none;
}
.msg.mine::before { right: -44px; }
.msg:not(.mine)::before { right: -44px; }
.msg.swipe-ready::before { opacity: 1; transform: translateY(-50%) scale(1); }
.sys-chip.clickable { cursor: pointer; text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.sys-chip.clickable:active { background: var(--accent-soft); }
@keyframes msgin { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.msg.mine { justify-content: flex-end; }
.msg-ava { width: 30px; height: 30px; font-size: .8rem; align-self: flex-end; margin-bottom: 2px; }
.msg .bubble {
  max-width: 78%; border-radius: var(--r-bubble); padding: 7px 10px 6px;
  background: var(--bubble-their); position: relative;
  overflow-wrap: break-word; word-break: break-word;
  box-shadow: var(--shadow-1);
}
.msg.mine .bubble { background: var(--bubble-my); }
.msg .sender { font-size: .85rem; font-weight: 700; margin-bottom: 2px; }
.msg .text { font-size: 1.05rem; line-height: 1.4; white-space: pre-wrap; }
.msg .text a { color: var(--accent); }
.msg .meta {
  font-size: .72rem; color: rgba(23,34,46,.45); text-align: right;
  margin-top: 2px; margin-left: 24px; float: right; line-height: 1;
  position: relative; top: 5px; display: inline-flex; align-items: center; gap: 4px;
}
.tick { font-size: .8rem; letter-spacing: -2px; color: #8fa6bd; }
.tick.read { color: var(--accent); }
.meta .clock { font-size: .78rem; }
.msg .edited { font-style: normal; }
.msg.pending .bubble { opacity: .7; }
.msg.failed .bubble { outline: 1.5px solid var(--red); }
.msg .fail-note { color: var(--red); font-size: .85rem; margin-top: 5px; clear: both; }
.msg .fail-note b { cursor: pointer; text-decoration: underline; margin-right: 6px; }
.msg.deleted .text { color: var(--muted); font-style: italic; }

/* reply quote inside a bubble */
.quote {
  border-left: 3px solid var(--accent); background: var(--accent-soft);
  border-radius: 8px; padding: 6px 9px; margin-bottom: 5px; cursor: pointer;
}
.quote b { display: block; font-size: .82rem; color: var(--accent); }
.quote span { font-size: .88rem; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.fwd-note { font-size: .82rem; color: var(--accent); margin-bottom: 3px; font-weight: 600; }

/* reactions: солидные чипы с мини-аватарками, как в Telegram */
.rx-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; clear: both; }
.rx {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
  border-radius: 15px; padding: 3px 8px 3px 7px;
  font-size: .95rem; cursor: pointer;
}
.rx.mine { background: var(--accent-soft); border-color: var(--accent); }
.rx b { font-size: .78rem; font-weight: 700; color: var(--muted); }
.rx .rxe { line-height: 1; }
.rxa {
  width: 19px; height: 19px; border-radius: 50%; overflow: hidden; flex: none;
  display: inline-grid; place-items: center; color: #fff;
  font-size: .58rem; font-weight: 700; font-style: normal;
  border: 1.5px solid var(--card);
}
.rxa img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rxa + .rxa { margin-left: -7px; }
.msg .bubble.has-media .rx-row { padding: 0 4px 4px; }

/* call message: не даём тексту рваться по буквам в крупных режимах */
.msg .bubble.is-call { max-width: 92%; }
.callmsg { display: flex; align-items: center; gap: 10px; padding: 4px 2px; flex-wrap: wrap; }
.callmsg .cico { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.callmsg.missed .cico { background: var(--red-soft); color: var(--red); }
.callmsg .cbody { flex: 1; min-width: 9rem; }
.callmsg .cbody b { display: block; font-size: .98rem; word-break: normal; overflow-wrap: normal; white-space: nowrap; }
.callmsg .cbody span { font-size: .82rem; color: var(--muted); }
.callmsg .btn { margin-left: auto; }

/* file message */
.filemsg { display: flex; align-items: center; gap: 10px; padding: 4px 2px; min-width: 200px; }
.filemsg .fico { width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.filemsg b { display: block; font-size: .95rem; word-break: break-all; }
.filemsg span { font-size: .8rem; color: var(--muted); }

/* media bubbles */
.msg .bubble.has-media { padding: 4px; }
.msg .bubble.has-media .text { padding: 4px 8px 2px; }
.msg .bubble.has-media .meta {
  position: absolute; right: 8px; bottom: 6px; margin: 0; top: auto;
  background: rgba(0,0,0,.55); border-radius: 10px; padding: 3px 8px; color: #fff; z-index: 2;
}
.msg .bubble.has-media .meta .tick { color: #cfe3f7; }
.msg .bubble.has-media .meta .tick.read { color: #7fd4ff; }
.pbox { position: relative; display: inline-block; line-height: 0; }
.m-photo { border-radius: 12px; max-width: min(60vw, 260px); max-height: 300px; height: auto; object-fit: cover; cursor: pointer; background: #dde5ee; }
.m-videobox {
  position: relative; border-radius: 12px; overflow: hidden; cursor: pointer;
  max-width: min(60vw, 260px); background: #10161d;
}
.m-videobox img { width: 100%; height: auto; max-height: 300px; object-fit: cover; }
.m-videobox.noposter { width: min(55vw, 240px); height: 150px; }
.m-playover { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; }
.m-playover .pcirc {
  width: 54px; height: 54px; border-radius: 50%; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
}
.m-durchip {
  position: absolute; left: 8px; top: 8px; background: rgba(0,0,0,.55); color: #fff;
  font-size: .75rem; border-radius: 10px; padding: 3px 8px;
}

/* circle */
.msg .bubble.is-circle { background: transparent; padding: 0; box-shadow: none; }
.circlebox {
  position: relative; width: 12.5rem; aspect-ratio: 1 / 1; height: auto;
  max-width: 100%; border-radius: 50%;
  overflow: hidden; cursor: pointer; background: #10161d;
  transition: width .28s cubic-bezier(.22,.9,.3,1);
}
/* При воспроизведении кружок разворачивается почти на весь экран;
   базовый и развёрнутый размеры растут вместе с режимом текста. */
.circlebox.playing { width: min(88vw, 21rem); }
.msg .bubble.is-circle { max-width: min(92vw, 22rem); }
.circlebox video, .circlebox img { width: 100%; height: 100%; object-fit: cover; }
/* Время и таймер кружка - строкой под кругом (внутри круга их режет маска) */
.circle-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  margin-top: 6px; padding: 0 4px;
}
.circle-foot .circle-time { margin-right: auto; }
.circle-foot .circle-time, .circle-foot .cmeta {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(15, 25, 36, .55); color: #fff;
  border-radius: 10px; padding: 3px 8px; font-size: .75rem; line-height: 1;
}
.circle-foot .tick { color: #cfe3f7; }
.circle-foot .tick.read { color: #7fd4ff; }

/* voice bubble */
.voice { display: flex; align-items: center; gap: 10px; min-width: 210px; padding: 4px 6px 8px; }
.vplay {
  width: 2.9rem; height: 2.9rem; border-radius: 50%; border: none; flex: none;
  background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center;
}
.vplay svg { width: 1.4rem; height: 1.4rem; }
.vtrack { flex: 1; height: 5px; border-radius: 3px; background: rgba(23,34,46,.15); overflow: hidden; cursor: pointer; }
.vfill { width: 0%; height: 100%; background: var(--accent); border-radius: 3px; }
.vtime { font-size: .8rem; color: var(--muted); flex: none; min-width: 36px; }
.vspeed, .vtr {
  flex: none; border: 1px solid var(--line-strong); background: var(--card);
  border-radius: 10px; font-size: .78rem; font-weight: 700; padding: 4px 7px; color: var(--muted);
  min-height: 28px;
}
/* Волна голосового: как в Telegram - столбики, сыгранная часть подсвечена.
   min-width:0 + overflow:hidden: в тесном пузыре волна подрезается,
   а не наезжает на время и скорость. */
.wave {
  flex: 1 1 0; display: flex; align-items: center; gap: 2px; height: 30px;
  cursor: pointer; min-width: 0; overflow: hidden;
}
.wave i {
  flex: 1; min-width: 2px; max-width: 4px; border-radius: 2px;
  background: rgba(23,34,46,.25); pointer-events: none;
}
.wave i.on { background: var(--accent); }
.vtranscript {
  clear: both; margin-top: 6px; padding: 8px 10px; border-radius: 10px;
  background: var(--accent-soft); font-size: .95rem; line-height: 1.4; color: var(--text);
}
/* Живой уровень голоса при записи */
.voice-level {
  flex: 1; display: flex; align-items: center; gap: 3px; height: 30px; overflow: hidden;
}
.voice-level i {
  flex: 1; max-width: 5px; min-height: 4px; border-radius: 2px;
  background: var(--accent); transition: height .1s linear;
}

/* upload progress */
.upbox { min-width: 200px; padding: 8px 10px; }
.upbox .uplabel { font-size: .88rem; margin-bottom: 6px; }
.uptrack { height: 5px; border-radius: 3px; background: rgba(23,34,46,.15); overflow: hidden; }
.upfill { width: 0%; height: 100%; background: var(--accent); transition: width .2s; }

/* jump-down chip */
.jump-down {
  position: absolute; right: 14px; bottom: 96px; z-index: 6;
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--card); color: var(--accent); box-shadow: 0 4px 14px rgba(23,34,46,.18);
  display: grid; place-items: center;
}
.jump-count {
  position: absolute; top: -7px; left: 50%; transform: translateX(-50%);
  min-width: 22px; height: 22px; border-radius: 11px; background: var(--accent); color: #fff;
  font-size: .78rem; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 6px;
}

/* ---------- composer ---------- */
.composer-wrap { flex: none; background: var(--card); border-top: 1px solid var(--line); position: relative;
  padding-bottom: var(--safe-b); }
.composer { display: flex; align-items: flex-end; gap: 2px; padding: 7px 6px; }
/* Панель ввода растёт вместе с размером текста (для «очень крупного» режима). */
.comp-btn {
  width: min(3rem, 60px); height: min(3rem, 60px); border: none; background: none; color: var(--muted);
  display: flex; align-items: center; justify-content: center; border-radius: 50%; flex: none;
}
.comp-btn svg { width: 1.65rem; height: 1.65rem; }
.comp-btn:active { background: var(--accent-soft); }
.comp-btn.send { color: var(--accent); }
.comp-btn.danger { color: var(--red); }
.comp-field { flex: 1; min-width: 0; padding: 0; display: flex; }
#msg-input {
  width: 100%; border: 1.5px solid var(--line); background: var(--bg); resize: none;
  outline: none; max-height: 8.5rem; line-height: 1.4; padding: .75rem .9rem;
  font-size: 1.02rem; border-radius: 1.5rem; min-height: 3rem; display: block;
}
#msg-input:focus { border-color: var(--accent); }
#msg-input::placeholder { color: var(--muted); }

.composer-bar {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px 0;
}
.cbar-body { flex: 1; min-width: 0; border-left: 3px solid var(--accent); padding: 2px 10px; }
.cbar-body b { display: block; font-size: .85rem; color: var(--accent); }
.cbar-body span { display: block; font-size: .9rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.voice-bar {
  position: absolute; inset: 0; background: var(--card);
  display: flex; align-items: center; gap: 10px; padding: 6px 8px calc(6px + var(--safe-b));
}
.voice-bar.hidden { display: none; }
.rec-dot { width: 13px; height: 13px; border-radius: 50%; background: var(--red); animation: blink 1s infinite; flex: none; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
.voice-timer { font-variant-numeric: tabular-nums; font-weight: 700; }
.voice-hint { color: var(--muted); flex: 1; font-size: .9rem; }
#voice-preview .vtrack { flex: 1; }

/* ---------- media grid (album / gallery) ---------- */
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.media-grid .cell {
  position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden;
  background: #dde5ee; border: none; padding: 0; cursor: pointer;
}
.media-grid .cell img { width: 100%; height: 100%; object-fit: cover; }
.media-grid .cell .mdur {
  position: absolute; right: 5px; bottom: 5px; background: rgba(0,0,0,.6); color: #fff;
  font-size: .7rem; border-radius: 8px; padding: 2px 6px;
}

/* ---------- calendar ---------- */
.cal-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cal-item {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
}
.cal-item.today { border-color: var(--accent); background: var(--accent-soft); }
.cal-item .ce { font-size: 1.5rem; flex: none; }
.cal-item .cb { flex: 1; min-width: 0; }
.cal-item .cb b { display: block; font-size: 1rem; }
.cal-item .cb span { color: var(--muted); font-size: .85rem; }
.cal-item .del {
  border: none; background: var(--red-soft); color: var(--red);
  width: 2.4rem; height: 2.4rem; border-radius: 10px;
  display: grid; place-items: center; flex: none;
}
.cal-item .del svg { width: 1.1rem; height: 1.1rem; }

/* Свотчи обоев чата */
.wp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 6px 0 10px; }
.wp-swatch {
  height: 4.6rem; border-radius: 12px; border: 2px solid var(--line);
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px;
  cursor: pointer;
}
.wp-swatch span {
  font-size: .78rem; font-weight: 700; color: var(--text);
  background: rgba(255,255,255,.8); border-radius: 8px; padding: 2px 8px;
}
.wp-swatch.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.wp-custom {
  position: relative; background: linear-gradient(145deg, var(--accent-soft), var(--card));
  color: var(--accent); flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding-bottom: 5px;
}
.wp-custom i { font-style: normal; font-size: 1.8rem; line-height: 1; }
.appearance-card {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
.appearance-copy { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.appearance-copy b { font-size: 1rem; }
.appearance-copy span { color: var(--muted); font-size: .82rem; }
.accent-card {
  margin-top: 10px; padding: 13px 14px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1);
}
.accent-card > b { display: block; margin-bottom: 10px; font-size: 1rem; }
.accent-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.accent-choice {
  min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border: 1.5px solid var(--line); border-radius: 11px; background: var(--bg);
  color: var(--text); font-size: .82rem; font-weight: 700; text-align: left;
}
.accent-choice i {
  width: 20px; height: 20px; border-radius: 50%; flex: none; background: var(--swatch);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.5), 0 1px 3px rgba(23,34,46,.15);
}
.accent-choice.is-active { border-color: var(--accent); background: var(--accent-soft); }
.accent-choice:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }
.cal-form { display: flex; flex-direction: column; gap: 10px; }
.cal-form select { width: 90px; flex: none; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; margin-bottom: 7px; font-weight: 600; font-size: .9rem; color: var(--muted); }
.field-row { display: flex; gap: 8px; align-items: center; }
.field-row input { flex: 1; min-width: 0; }
.code-pill { display: inline-block; padding: 10px 16px; background: var(--accent-soft); border-radius: 12px; font-weight: 700; letter-spacing: 1.5px; font-size: 1.2rem; }
.code-pill.big { font-size: 1.9rem; letter-spacing: 4px; display: block; text-align: center; margin: 10px 0; }

/* ---------- relative profile ---------- */
.relv { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.relv-name { font-size: 1.4rem; margin-top: 8px; }
.relv-actions { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }

/* ---------- empty states ---------- */
.empty { text-align: center; padding: 40px 20px; }
.empty-emoji { font-size: 46px; margin-bottom: 10px; }
.empty p { margin: 6px 0; }
.muted { color: var(--muted); font-size: .92rem; line-height: 1.5; }
.empty .btn { margin-top: 16px; }

/* ---------- call screen ---------- */
.call { background: #0c1119; }
.remote-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #0c1119; }
.remote-placeholder {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px; background: #101826;
}
.remote-placeholder.hidden { display: none; }
.avatar-big {
  width: 110px; height: 110px; border-radius: 50%;
  display: grid; place-items: center; font-size: 2.6rem; font-weight: 700; color: #fff;
  background: var(--accent); position: relative; overflow: hidden;
}
.avatar-big img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.call-status { color: #9fb1c4; font-size: 1rem; }
.call-topinfo {
  position: absolute; top: calc(14px + var(--safe-t)); left: 0; right: 0;
  text-align: center; text-shadow: 0 1px 6px rgba(0,0,0,.7); pointer-events: none; color: #fff;
}
.call-topinfo strong { display: block; font-size: 1.25rem; }
.call-timer { color: #d6e2ee; font-size: .9rem; }
.call-quality { display: block; font-size: .82rem; color: #ffd479; margin-top: 3px; }
.local-video {
  position: absolute; top: calc(16px + var(--safe-t)); right: 12px;
  width: 118px; height: 158px; border-radius: 14px; object-fit: contain;
  background: #000; border: 2px solid rgba(255,255,255,.3); z-index: 3;
  transform: scaleX(-1);
}
.local-video.cam-off { display: none; }
.tap-to-sound {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: rgba(0,0,0,.75); color: #fff; padding: 12px 18px; border-radius: 30px; z-index: 5; cursor: pointer;
}
.video-resume {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(130px + var(--safe-b)); z-index: 5;
}
.call-controls {
  position: absolute; left: 0; right: 0; bottom: calc(18px + var(--safe-b));
  display: flex; align-items: flex-start; justify-content: center; gap: 16px; z-index: 4;
}
.ctrl-box { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.ctrl-label { color: #cdd9e6; font-size: .72rem; }
.ctrl {
  width: 62px; height: 62px; border-radius: 50%; border: none;
  background: rgba(255,255,255,.16); color: #fff; display: grid; place-items: center;
  backdrop-filter: blur(6px);
}
.ctrl:active { background: rgba(255,255,255,.3); }
.ctrl.off { background: #fff; color: #0c1119; }
.ctrl-end { background: var(--red); }

/* ---------- modals ---------- */
.modal { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; z-index: 20;
  background: rgba(13, 20, 28, .55); padding: 20px; }
.modal.show { display: flex; }
.incoming { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; color: #fff; }
.inc-name { font-size: 1.6rem; font-weight: 700; }
.inc-sub { color: #c2cfdd; }
.inc-actions { display: flex; gap: 56px; margin-top: 30px; }
.inc-actions.center { justify-content: center; }
.round { width: 76px; height: 76px; border-radius: 50%; border: none; color: #fff; display: grid; place-items: center; }
.round-red { background: var(--red); }
.round-green { background: var(--green); }
.round-gray { background: #33414f; }
#modal-incoming, #modal-outgoing, #rec-circle { background: rgba(13,20,28,.92); }

.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 var(--accent); }
  50% { transform: scale(1.05); box-shadow: 0 0 0 22px transparent; }
}

/* pre-call self preview */
.precall { background: var(--card); border-radius: 20px; padding: 18px; width: 100%; max-width: 400px; text-align: center; }
.precall h3 { margin: 4px 0 14px; }
.precall-wrap { border-radius: 16px; overflow: hidden; background: #0c1119; margin-bottom: 14px; }
.precall-wrap video { width: 100%; max-height: 46vh; object-fit: contain; transform: scaleX(-1); display: block; }

/* ---------- circle recorder ---------- */
.circle-rec { display: flex; flex-direction: column; align-items: center; gap: 14px; color: #fff; }
.circle-wrap {
  width: min(78vw, 340px); height: min(78vw, 340px); border-radius: 50%;
  background: #10161d; border: 3px solid rgba(255,255,255,.2);
  position: relative;
}
.circle-wrap video { border-radius: 50%; overflow: hidden; }

/* Кольцо прогресса вокруг кружка (запись и воспроизведение) */
.circle-ring {
  position: absolute; inset: -3px; width: calc(100% + 6px); height: calc(100% + 6px);
  transform: rotate(-90deg); pointer-events: none; transition: opacity .2s;
}
.circle-ring .ring-track { fill: none; stroke: rgba(255,255,255,.22); stroke-width: 3; }
.circle-ring .ring-bar {
  fill: none; stroke: #fff; stroke-width: 3.5; stroke-linecap: round;
  stroke-dasharray: 100; stroke-dashoffset: 100;
  transition: stroke-dashoffset .25s linear;
}
.circlebox .circle-ring { inset: 0; width: 100%; height: 100%; }
.circlebox .circle-time {
  position: absolute; left: 12px; bottom: 10px; background: rgba(0,0,0,.55);
  color: #fff; font-size: .75rem; border-radius: 10px; padding: 3px 8px;
}
.circle-wrap video { width: 100%; height: 100%; object-fit: cover; }
#circle-preview { transform: scaleX(-1); }
.circle-timer { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.circle-hint { color: #c2cfdd; font-size: .9rem; }
.circle-actions { display: flex; gap: 26px; margin-top: 8px; }
.ca { display: flex; flex-direction: column; align-items: center; gap: 7px; color: #c2cfdd; font-size: .85rem; font-weight: 600; }

/* ---------- lightbox ---------- */
.lb { background: rgba(0,0,0,.96); padding: 0; flex-direction: column; }
.lb.show { display: flex; animation: fadein .15s ease; }
.lb.show .lb-stage img, .lb.show .lb-stage video { animation: lbzoom .2s cubic-bezier(.22,.9,.3,1); }
@keyframes lbzoom { from { transform: scale(.92); opacity: .4; } to { transform: none; opacity: 1; } }
.lb-stage { flex: 1; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: none; }
.lb-stage img, .lb-stage video { max-width: 100%; max-height: 100%; }
.lb-close {
  position: absolute; top: calc(10px + var(--safe-t)); right: 12px; z-index: 5;
  width: 46px; height: 46px; border-radius: 50%; border: none;
  background: rgba(255,255,255,.14); color: #fff; display: grid; place-items: center;
}
.lb-actions {
  flex: none; display: flex; justify-content: center; gap: 26px;
  padding: 10px 10px calc(14px + var(--safe-b));
}
.lb-act {
  width: 52px; height: 52px; border-radius: 50%; border: none;
  background: rgba(255,255,255,.14); color: #fff; display: grid; place-items: center; text-decoration: none;
}

/* ---------- generic bottom sheet ---------- */
.sheet-modal { align-items: flex-end; padding: 0; }
.bottom-sheet {
  width: 100%; max-width: 520px; margin: 0 auto; background: var(--card);
  border-radius: 20px 20px 0 0; padding: 14px 16px calc(16px + var(--safe-b));
  max-height: calc(var(--vvh, 100vh) * .85); overflow-y: auto;
  animation: sheetup .26s cubic-bezier(.22,.9,.3,1);
}
@keyframes sheetup { from { transform: translateY(85%); opacity: .6; } to { transform: none; opacity: 1; } }
.bottom-sheet.closing { animation: sheetdown .18s ease forwards; }
@keyframes sheetdown { to { transform: translateY(100%); opacity: .4; } }
.sheet-modal.show { animation: fadein .18s ease; }
.sheet-title { font-size: 1.05rem; font-weight: 700; margin: 4px 2px 12px; }
.sheet-opt {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 15px 12px; background: none; border: none; border-radius: 12px;
  font-size: 1.02rem; font-weight: 600; text-align: left; min-height: 54px;
}
.sheet-opt:active { background: var(--accent-soft); }
.sheet-opt .mi { font-size: 1.2rem; width: 30px; text-align: center; flex: none; }
.sheet-opt.danger { color: var(--red); }
.sheet-cancel { margin-top: 8px; width: 100%; }
.rx-pick { display: flex; justify-content: space-around; padding: 6px 4px 12px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.rx-pick button {
  border: none; background: var(--bg); border-radius: 50%; width: 52px; height: 52px;
  font-size: 1.5rem; display: grid; place-items: center;
}
.rx-pick button.mine { background: var(--accent-soft); outline: 2px solid var(--accent); }
.presend-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 12px; }
.presend-grid img, .presend-grid .vph { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: #dde5ee; }
.presend-grid .vph { display: grid; place-items: center; color: var(--muted); font-size: 1.6rem; }
.sheet-sec {
  margin: 18px 0 10px; font-size: .8rem; text-transform: uppercase; letter-spacing: .7px;
  color: var(--accent); font-weight: 700;
}
.sheet-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }

.eprof-ava-row { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.diag { font-size: .78rem; color: var(--muted); background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 10px 0; white-space: pre-wrap; word-break: break-word; }

/* ---------- update banner ---------- */
.update-banner {
  position: absolute; top: calc(10px + var(--safe-t)); left: 50%; transform: translateX(-50%);
  z-index: 45; display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 10px 12px 10px 16px; box-shadow: 0 8px 24px rgba(23,34,46,.18); font-weight: 600;
}

/* ---------- toast ---------- */
.toast {
  position: absolute; left: 50%; bottom: calc(110px + var(--safe-b)); transform: translateX(-50%) translateY(20px);
  background: #22303e; color: #fff; border: none;
  padding: 13px 20px; border-radius: 30px; opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s; z-index: 60; max-width: 92%; text-align: center; font-size: .95rem;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- клавиатура открыта: без мёртвой полосы под композером ---------- */
html.kb-open .composer-wrap { padding-bottom: 2px; }
html.kb-open .bottomnav { padding-bottom: 0; }
html.kb-open .toast { bottom: 70px; }

/* ---------- живость интерфейса (спокойные короткие анимации) ---------- */
/* Слайд играет только при переходе ВПЕРЁД (класс ставит pushScreen),
   возврат назад и перерисовки не дёргают экран. */
.screen.anim-in { animation: slidein .22s cubic-bezier(.22,.9,.3,1); }
@keyframes slidein { from { transform: translateX(46px); opacity: .55; } to { transform: none; opacity: 1; } }
@keyframes fadein { from { opacity: .5; } to { opacity: 1; } }
.rx { animation: rxpop .3s cubic-bezier(.34,1.56,.64,1); }
@keyframes rxpop { from { transform: scale(.4); } to { transform: none; } }
.modal.show .incoming, .modal.show .precall, .modal.show .circle-rec {
  animation: popin .22s cubic-bezier(.22,.9,.3,1);
}
@keyframes popin { from { transform: scale(.93); opacity: .4; } to { transform: none; opacity: 1; } }
.btn, .menu-btn, .chat-item, .comp-btn, .icon-btn, .nav-btn, .seg-btn, .sheet-opt, .rx, .ctrl {
  transition: background-color .15s ease, color .15s ease, transform .12s ease;
}
.chat-item:active, .menu-btn:active, .sheet-opt:active { transform: scale(.985); }
.btn:active, .comp-btn:active, .round:active, .ctrl:active { transform: scale(.95); }
.jump-down { animation: rise .18s ease; }
.bday-banner { animation: rise .25s ease; }
.unread-divider { animation: fadein .3s ease; }
.avatar img { animation: fadein .2s ease; }
.msg .bubble { transition: transform .12s ease; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
