/* =========================================================
   Flashgram — стили (iOS-стиль, тёмная и светлая темы)
   ========================================================= */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  --emoji: "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.32, .72, 0, 1);
  --spring: cubic-bezier(.34, 1.36, .64, 1);
  --radius-group: 26px;
  --msg-size: 17px;
  --bubble-r: 18px;
  --bubble-r-small: 6px;

  /* тёмная тема (по умолчанию) */
  --bg: #000;
  --bg-elev: #1c1c1d;
  --cell: #1c1c1d;
  --cell-hl: #2c2c2e;
  --sep: rgba(84, 84, 88, .55);
  --text: #fff;
  --text2: #8d8e93;
  --text3: #5d5d62;
  --accent: #3e88f7;
  --accent-rgb: 62, 136, 247;
  --danger: #ff453a;
  --green: #34c759;
  --toggle-off: #39393d;
  --glass: rgba(37, 37, 39, .66);
  --glass-strong: rgba(30, 30, 32, .86);
  --glass-border: rgba(255, 255, 255, .09);
  --glass-hl: rgba(255, 255, 255, .13);
  --input-bg: #1c1c1d;
  --in-bubble: #262628;
  --in-text: #fff;
  --in-time: rgba(255, 255, 255, .45);
  --out-bubble: linear-gradient(180deg, #8a5cf7 0%, #6f4cf2 100%);
  --out-solid: #7b55f4;
  --out-text: #fff;
  --out-time: rgba(255, 255, 255, .62);
  --out-link: #fff;
  --out-accent: #fff;
  --out-accent-ink: var(--out-solid);
  --out-quote-bg: rgba(255, 255, 255, .14);
  --in-link: #6ab3ff;
  --reply-bar: #a98bff;
  --wall-bg: #08070c;
  --wall-line: rgba(140, 110, 255, .14);
  --badge: #3e88f7;
  --badge-muted: #5d5d62;
  --tab-badge: #ff3b30;
  --shadow: 0 10px 40px rgba(0, 0, 0, .55);
  --sheet-bg: #1c1c1d;
  --skeleton: #2c2c2e;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #fff;
  --bg-elev: #f2f2f7;
  --cell: #fff;
  --cell-hl: #e5e5ea;
  --sep: rgba(60, 60, 67, .22);
  --text: #000;
  --text2: #8a8a8e;
  --text3: #c4c4c7;
  --accent: #007aff;
  --accent-rgb: 0, 122, 255;
  --toggle-off: #e9e9eb;
  --glass: rgba(255, 255, 255, .72);
  --glass-strong: rgba(250, 250, 252, .92);
  --glass-border: rgba(0, 0, 0, .06);
  --glass-hl: rgba(0, 0, 0, .06);
  --input-bg: #fff;
  --in-bubble: #fff;
  --in-text: #000;
  --in-time: rgba(0, 0, 0, .4);
  --in-link: #007aff;
  --wall-bg: #d9d3f5;
  --wall-line: rgba(90, 60, 200, .13);
  --badge-muted: #b9b9be;
  --shadow: 0 10px 40px rgba(0, 0, 0, .18);
  --sheet-bg: #f2f2f7;
  --skeleton: #e5e5ea;
  color-scheme: light;
}
:root[data-theme="light"] .page.grouped, :root[data-theme="light"] .grouped-bg { background: #f2f2f7; }

/* светлые пузыри: исходящие светлые с цветными акцентами, текст тёмный */
:root[data-theme="light"] { --out-text: #000; --out-accent-ink: #fff; --out-quote-bg: rgba(0, 0, 0, .05); --unread-bg: rgba(255, 255, 255, .85); }
:root[data-theme="light"], :root[data-theme="light"][data-bubbles="purple"] { --out-bubble: #e6defe; --out-solid: #e6defe; --out-time: #7a5ad8; --out-link: #5b3ccc; --out-accent: #7a5ad8; --reply-bar: #7a5ad8; }
:root[data-theme="light"][data-bubbles="green"] { --out-bubble: #e1fec6; --out-solid: #e1fec6; --out-time: #4fae4e; --out-link: #2f8a2f; --out-accent: #4fae4e; --reply-bar: #4fae4e; }
:root[data-theme="light"][data-bubbles="blue"] { --out-bubble: #d9ecff; --out-solid: #d9ecff; --out-time: #3a87d9; --out-link: #1f6fc4; --out-accent: #3a87d9; --reply-bar: #3a87d9; }
:root[data-theme="light"][data-bubbles="pink"] { --out-bubble: #fbe1f6; --out-solid: #fbe1f6; --out-time: #c052b0; --out-link: #a93a98; --out-accent: #c052b0; --reply-bar: #c052b0; }
:root[data-theme="light"][data-bubbles="orange"] { --out-bubble: #ffe7cf; --out-solid: #ffe7cf; --out-time: #d97a24; --out-link: #b8600f; --out-accent: #d97a24; --reply-bar: #d97a24; }
:root[data-theme="light"] .msg.in .bubble { box-shadow: 0 1px 1px rgba(0, 0, 0, .08); }
:root[data-theme="light"] .msg.out .bubble:not(.media):not(.emoji-only):not(.sticker-b) { box-shadow: 0 1px 1px rgba(0, 0, 0, .08); }

/* цветовые темы переписки */
:root[data-bubbles="green"] { --out-bubble: linear-gradient(180deg, #4fb35a, #2f9a45); --out-solid: #3aa64f; --reply-bar: #7fe08b; --wall-line: rgba(90, 200, 100, .14); --wall-bg: #060a07; }
:root[data-bubbles="blue"] { --out-bubble: linear-gradient(180deg, #3d9bf5, #2a7fe0); --out-solid: #328ceb; --reply-bar: #86c3ff; --wall-line: rgba(80, 160, 255, .14); --wall-bg: #05080d; }
:root[data-bubbles="pink"] { --out-bubble: linear-gradient(180deg, #d66ec9, #8d6cf0); --out-solid: #b36de0; --reply-bar: #f2a8ea; --wall-line: rgba(230, 120, 220, .13); --wall-bg: #0c060c; }
:root[data-bubbles="orange"] { --out-bubble: linear-gradient(180deg, #f49b3c, #e9692c); --out-solid: #ef8234; --reply-bar: #ffd09b; --wall-line: rgba(255, 160, 80, .13); --wall-bg: #0c0805; }
:root[data-theme="light"][data-bubbles="green"] { --wall-bg: #cfe8c4; }
:root[data-theme="light"][data-bubbles="blue"] { --wall-bg: #c8dcf2; }
:root[data-theme="light"][data-bubbles="pink"] { --wall-bg: #f0d3ec; }
:root[data-theme="light"][data-bubbles="orange"] { --wall-bg: #f5dcc4; }

:root[data-anim="off"] *, :root[data-anim="off"] *::before, :root[data-anim="off"] *::after { transition-duration: 0s !important; animation-duration: 0s !important; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 17px; overscroll-behavior: none; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
body { overflow: hidden; position: fixed; inset: 0; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
input, textarea, [contenteditable="true"] { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
img, video { -webkit-user-drag: none; -webkit-touch-callout: none; }
:root.kb { --safe-bottom: 0px; }
@media (pointer: fine) { .bubble .txt, .bubble .caption, .info-cell .v, .fname { -webkit-user-select: text; user-select: text; } }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
svg { display: block; }
svg.chev { width: 9px; height: 15px; color: var(--text3); flex: none; }
[hidden] { display: none !important; }
::selection { background: rgba(var(--accent-rgb), .35); }
.scroll { overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; scrollbar-width: none; }
.scroll::-webkit-scrollbar { display: none; }
@media (pointer: fine) {
  .scroll { scrollbar-width: thin; scrollbar-color: rgba(127, 127, 127, .35) transparent; }
  .scroll::-webkit-scrollbar { display: block; width: 6px; }
  .scroll::-webkit-scrollbar-thumb { background: rgba(127, 127, 127, .35); border-radius: 3px; }
}

/* ---------------- раскладка ---------------- */
/* приложение всегда на весь экран (в т.ч. под полоской «домой» на iPhone);
   по высоте видимой области сжимается только при открытой клавиатуре */
#app { position: fixed; inset: 0; display: flex; background: var(--bg); }
:root.kb #app { bottom: auto; height: var(--app-h, 100%); }
:root.kb .overlay, :root.kb .viewer, :root.kb .editor, :root.kb .auth, :root.kb .ctx-overlay { height: var(--app-h, 100%) !important; bottom: auto !important; }
html { background: var(--bg); height: 100%; }
:root.standalone, :root.standalone body { height: 100vh; height: 100lvh; }
.col-left { position: relative; flex: 1; min-width: 0; height: 100%; }
.col-right { display: none; position: relative; flex: 1; min-width: 0; height: 100%; }
@media (min-width: 900px) {
  .col-left { flex: 0 0 400px; max-width: 400px; border-right: .5px solid var(--sep); }
  .col-right { display: block; }
  body.desktop .tabbar { width: 360px; }
}
.stack { position: absolute; inset: 0; overflow: hidden; background: var(--bg); }
.page { position: absolute; inset: 0; background: var(--bg); display: flex; flex-direction: column; will-change: transform; transform: translateX(0); transition: transform .5s var(--ease), filter .5s var(--ease); overflow: hidden; }
.page.grouped { background: #000; }
.page.enter { transform: translateX(100%); }
.page.under { transform: translateX(-28%); }
.page.under::after, .page.dim::after { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, .35); pointer-events: none; z-index: 50; }
.page.leave { transform: translateX(100%); }
.page.no-anim { transition: none !important; }
.page-shadow { box-shadow: -10px 0 30px rgba(0, 0, 0, .35); }

.empty-right { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.empty-right .pill { position: relative; z-index: 1; background: rgba(0, 0, 0, .35); color: #fff; padding: 6px 14px; border-radius: 16px; font-size: 15px; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }

/* ---------------- стекло и кнопки ---------------- */
.glass { background: var(--glass); backdrop-filter: blur(22px) saturate(180%); -webkit-backdrop-filter: blur(22px) saturate(180%); box-shadow: inset 0 0 0 .5px var(--glass-border), 0 4px 20px rgba(0, 0, 0, .22); }
.gbtn { width: 44px; height: 44px; border-radius: 22px; display: inline-flex; align-items: center; justify-content: center; flex: none; color: var(--text); transition: transform .2s var(--spring), background .2s; position: relative; }
.gbtn:active { transform: scale(.9); }
.gbtn.pill { width: auto; padding: 0 16px; font-size: 17px; font-weight: 500; }
.gbtn.accent { background: var(--accent); color: #fff; box-shadow: 0 4px 16px rgba(var(--accent-rgb), .35); backdrop-filter: none; }
.gbtn svg { width: 24px; height: 24px; }
.gbtn .count { font-size: 15px; font-weight: 600; margin-left: -2px; }
.gbtn.back { width: auto; min-width: 44px; padding: 0 10px 0 8px; gap: 1px; }

.nav { position: absolute; top: 0; left: 0; right: 0; z-index: 30; padding: calc(var(--safe-top) + 8px) 14px 8px; display: flex; align-items: center; gap: 10px; min-height: calc(var(--safe-top) + 60px); pointer-events: none; }
.nav > * { pointer-events: auto; }
.nav::before { content: ""; position: absolute; inset: 0 0 -24px 0; background: linear-gradient(var(--bg) 0%, rgba(0, 0, 0, .0) 100%); pointer-events: none; z-index: -1; opacity: .95; }
:root[data-theme="light"] .nav::before { background: linear-gradient(rgba(255, 255, 255, .95), rgba(255, 255, 255, 0)); }
.page.grouped .nav::before { background: linear-gradient(#000 20%, rgba(0, 0, 0, 0)); }
:root[data-theme="light"] .page.grouped .nav::before { background: linear-gradient(#f2f2f7 20%, rgba(242, 242, 247, 0)); }
.nav .title { position: absolute; left: 50%; transform: translateX(-50%); font-size: 17px; font-weight: 600; white-space: nowrap; max-width: 60%; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; pointer-events: none; }
.nav .spacer { flex: 1; }
.nav.clear::before { display: none; }

/* ---------------- аватары ---------------- */
.ava { position: relative; flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; overflow: hidden; user-select: none; background: var(--g, linear-gradient(#72d5fd, #2a9ef1)); }
.ava img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ava.saved { background: linear-gradient(#72d5fd, #2a9ef1); }
.ava svg { width: 52%; height: 52%; }
.ava-wrap { position: relative; flex: none; }
.ava-wrap .online-dot { position: absolute; right: 1px; bottom: 1px; width: 15px; height: 15px; border-radius: 50%; background: #34c759; border: 2.5px solid var(--bg); transform: scale(0); transition: transform .25s var(--spring); }
.ava-wrap.online .online-dot { transform: scale(1); }

/* ---------------- нижняя панель вкладок ---------------- */
.tabbar { position: absolute; z-index: 40; left: 50%; bottom: calc(var(--safe-bottom) + 10px); transform: translateX(-50%); height: 62px; border-radius: 31px; display: flex; align-items: stretch; padding: 4px; gap: 2px; width: min(380px, calc(100% - 32px)); transition: transform .45s var(--ease), opacity .3s; }
.tabbar.hide { transform: translate(-50%, 140%); opacity: 0; }
.tab { flex: 1; border-radius: 27px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10.5px; font-weight: 500; color: var(--text); position: relative; transition: background .25s, color .25s; }
.tab svg { width: 28px; height: 28px; }
.tab.active { background: var(--glass-hl); color: var(--accent); }
.tab .badge { position: absolute; top: 3px; left: calc(50% + 6px); }
.tab .tab-ava { width: 28px; height: 28px; border-radius: 50%; overflow: hidden; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--tab-badge); color: #fff; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; line-height: 1; box-shadow: 0 0 0 2px transparent; }
.badge.blue { background: var(--badge); }
.badge.muted { background: var(--badge-muted); }
.badge.pop { animation: pop .35s var(--spring); }
@keyframes pop { 0% { transform: scale(.4); } 100% { transform: scale(1); } }

/* ---------------- список чатов ---------------- */
.tabview { position: absolute; inset: 0; display: none; flex-direction: column; }
.tabview.active { display: flex; animation: fadeIn .22s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.list-scroll { position: absolute; inset: 0; padding-top: calc(var(--safe-top) + 64px); padding-bottom: calc(var(--safe-bottom) + 96px); }
.search-bar { margin: 4px 16px 8px; height: 40px; border-radius: 20px; background: var(--cell); display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--text2); font-size: 17px; cursor: text; transition: all .3s var(--ease); }
.search-bar svg { width: 18px; height: 18px; }
.chat-folders { display: flex; gap: 6px; padding: 2px 16px 8px; overflow-x: auto; scrollbar-width: none; }
.chat-folders::-webkit-scrollbar { display: none; }
.chat-folders button { flex: none; padding: 7px 14px; border-radius: 18px; font-size: 15px; font-weight: 500; color: var(--text2); background: var(--cell); }
.chat-folders button.active { background: var(--glass-hl); color: var(--text); box-shadow: inset 0 0 0 .5px var(--glass-border); }
.chat-folders button .badge { margin-left: 6px; height: 18px; min-width: 18px; font-size: 12px; }

.chat-row { display: flex; align-items: center; height: 76px; padding-left: 12px; position: relative; cursor: pointer; user-select: none; transition: background .15s; }
.chat-row:active, .chat-row.hl { background: var(--cell-hl); }
.chat-row.selected { background: rgba(var(--accent-rgb), .22); }
.chat-row.pinned { background: rgba(127, 127, 127, .08); }
.chat-row .ava-wrap { margin-right: 12px; }
.chat-row .body { flex: 1; min-width: 0; height: 100%; padding: 9px 14px 0 0; position: relative; }
.chat-row .body::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: .5px; background: var(--sep); }
.chat-row:last-child .body::after { display: none; }
.chat-row .top { display: flex; align-items: center; gap: 4px; height: 22px; }
.chat-row .name { font-size: 16.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 3px; min-width: 0; }
.chat-row .name .t { overflow: hidden; text-overflow: ellipsis; }
.chat-row .meta { margin-left: auto; display: flex; align-items: center; gap: 3px; color: var(--text2); font-size: 14px; flex: none; padding-left: 6px; }
.chat-row .meta svg { width: 17px; height: 17px; color: var(--accent); }
.chat-row .bottom { display: flex; align-items: flex-start; gap: 6px; margin-top: 1px; }
.chat-row .preview { flex: 1; min-width: 0; color: var(--text2); font-size: 15px; line-height: 20px; height: 40px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.chat-row .preview .from { color: var(--text); }
.chat-row .preview .typing { color: var(--accent); }
.chat-row .preview .media-thumb { display: inline-block; width: 20px; height: 20px; border-radius: 3px; vertical-align: -4px; margin-right: 4px; object-fit: cover; }
.chat-row .side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; padding-top: 10px; flex: none; }
.chat-row .side svg.pin { width: 16px; height: 16px; color: var(--text3); transform: rotate(45deg); }
.verified { width: 17px; height: 17px; flex: none; color: var(--accent); }
.muted-ic { width: 14px; height: 14px; color: var(--text2); flex: none; }

.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 60px 32px; color: var(--text2); gap: 10px; font-size: 15px; }
.empty .big { font-size: 64px; line-height: 1; }
.empty h3 { margin: 4px 0 0; color: var(--text); font-size: 20px; font-weight: 600; }
.empty .btn { margin-top: 10px; }

/* ---------------- сгруппированные списки (настройки) ---------------- */
.group-title { padding: 18px 32px 7px; font-size: 13px; color: var(--text2); text-transform: uppercase; letter-spacing: .1px; }
.group { margin: 0 16px; background: var(--cell); border-radius: var(--radius-group); overflow: hidden; }
.group + .group { margin-top: 24px; }
.group-footer { padding: 8px 32px 0; font-size: 13px; color: var(--text2); line-height: 1.35; }
.group-footer a { color: var(--accent); }
.gap { height: 24px; }
.cell { position: relative; display: flex; align-items: center; min-height: 52px; padding: 0 16px; gap: 14px; cursor: pointer; transition: background .12s; user-select: none; width: 100%; text-align: left; }
.cell:active { background: var(--cell-hl); }
.cell.static { cursor: default; }
.cell.static:active { background: none; }
.cell + .cell::before { content: ""; position: absolute; top: 0; right: 0; left: var(--sep-left, 60px); height: .5px; background: var(--sep); }
.cell.noicon + .cell::before, .group.noicons .cell::before { left: 16px; }
.cell .ic { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; flex: none; }
.cell .ic svg { width: 20px; height: 20px; }
.cell .label { flex: 1; min-width: 0; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell .label small { display: block; font-size: 13px; color: var(--text2); margin-top: 1px; }
.cell .value { color: var(--text2); font-size: 17px; white-space: nowrap; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.cell .chev { width: 9px; height: 15px; color: var(--text3); flex: none; margin-left: -4px; }
.cell.accent .label { color: var(--accent); }
.cell.danger .label { color: var(--danger); }
.cell.center .label { text-align: center; }
.cell .check { width: 22px; height: 22px; color: var(--accent); }
.cell .ava { margin: 8px 0; }
.cell.tall { min-height: 64px; }
.cell input.cell-input { flex: 1; border: 0; outline: 0; background: none; font-size: 17px; height: 50px; min-width: 0; }
.cell input.cell-input::placeholder, textarea::placeholder { color: var(--text3); }

/* переключатель iOS 26 */
.switch { position: relative; width: 63px; height: 28px; flex: none; border-radius: 14px; background: var(--toggle-off); transition: background .25s; cursor: pointer; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 37px; height: 24px; border-radius: 12px; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); transition: transform .32s var(--spring), width .2s; }
.switch.on { background: var(--green); }
.switch.on::after { transform: translateX(22px); }
.switch:active::after { width: 42px; }
.switch.on:active::after { transform: translateX(17px); }

/* сегменты */
.segment { display: flex; background: var(--cell); border-radius: 20px; padding: 3px; gap: 2px; margin: 0 16px; }
.segment button { flex: 1; height: 34px; border-radius: 17px; font-size: 15px; font-weight: 500; color: var(--text2); transition: all .25s var(--ease); }
.segment button.active { background: var(--glass-hl); color: var(--text); }

/* ---------------- кнопки ---------------- */
.btn { height: 52px; border-radius: 26px; background: var(--accent); color: #fff; font-size: 17px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; transition: transform .15s, opacity .2s; position: relative; overflow: hidden; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.secondary { background: var(--cell); color: var(--accent); }
.btn.small { height: 34px; border-radius: 17px; font-size: 15px; width: auto; padding: 0 16px; display: inline-flex; }
.btn .spinner { width: 22px; height: 22px; }
.link-btn { color: var(--accent); font-size: 17px; }
.open-btn { background: var(--accent); color: #fff; font-size: 14px; font-weight: 700; padding: 6px 14px; border-radius: 16px; letter-spacing: .3px; }

.spinner { width: 24px; height: 24px; border: 2.5px solid rgba(255, 255, 255, .3); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.spinner.dark { border-color: rgba(127, 127, 127, .3); border-top-color: var(--text2); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- авторизация ---------------- */
.auth { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: flex; flex-direction: column; align-items: center; overflow-y: auto; }
.auth-inner { width: 100%; max-width: 420px; padding: calc(var(--safe-top) + 56px) 24px calc(var(--safe-bottom) + 24px); min-height: 100%; display: flex; flex-direction: column; }
.auth .nav { position: fixed; }
.auth h1 { font-size: 28px; font-weight: 700; margin: 18px 0 10px; text-align: center; letter-spacing: -.2px; }
.auth p.sub { color: var(--text2); font-size: 16px; line-height: 1.4; text-align: center; margin: 0 0 26px; }
.auth .grow { flex: 1; }
.auth .footer { padding-top: 16px; }
.auth .terms { font-size: 13px; color: var(--text2); text-align: center; margin-top: 14px; line-height: 1.4; }
.auth-step { animation: authIn .45s var(--ease); }
.auth-step.back { animation: authBack .45s var(--ease); }
@keyframes authIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes authBack { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: none; } }

.welcome { justify-content: space-between; text-align: center; }
.welcome .logo-big { width: 160px; height: 160px; margin: 8vh auto 0; animation: logoIn .9s var(--spring); filter: drop-shadow(0 18px 40px rgba(110, 100, 255, .45)); }
@keyframes logoIn { from { transform: scale(.4) rotate(-20deg); opacity: 0; } to { transform: none; opacity: 1; } }
.welcome .carousel { overflow: hidden; margin-top: 28px; }
.welcome .slides { display: flex; transition: transform .5s var(--ease); }
.welcome .slide { flex: 0 0 100%; padding: 0 10px; }
.welcome .slide h2 { font-size: 26px; font-weight: 700; margin: 0 0 12px; }
.welcome .slide p { color: var(--text2); font-size: 16px; line-height: 1.45; margin: 0; }
.welcome .slide b { color: var(--text); font-weight: 600; }
.dots { display: flex; justify-content: center; gap: 8px; margin: 22px 0 0; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--text3); transition: background .3s, transform .3s; }
.dots i.on { background: var(--text); transform: scale(1.1); }

.phone-box { background: var(--cell); border-radius: 26px; overflow: hidden; }
.phone-box .row { display: flex; align-items: center; height: 56px; padding: 0 18px; gap: 10px; position: relative; }
.phone-box .row + .row::before { content: ""; position: absolute; top: 0; left: 18px; right: 0; height: .5px; background: var(--sep); }
.phone-box .country { cursor: pointer; justify-content: space-between; }
.phone-box .country .flag { font-size: 22px; }
.phone-box .country .cname { flex: 1; font-size: 17px; }
.phone-box .code-in { width: 70px; border: 0; outline: 0; background: none; font-size: 22px; padding: 0; border-right: .5px solid var(--sep); height: 34px; }
.phone-box .num-in { flex: 1; border: 0; outline: 0; background: none; font-size: 22px; letter-spacing: .5px; min-width: 0; }
.phone-box input::placeholder { color: var(--text3); }
.sync-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; font-size: 16px; }

.code-boxes { display: flex; gap: 8px; justify-content: center; margin: 4px 0 18px; position: relative; }
.code-boxes .box { width: 50px; height: 60px; border-radius: 14px; background: var(--cell); display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 500; box-shadow: inset 0 0 0 1.5px transparent; transition: box-shadow .2s, transform .2s; }
.code-boxes .box.focus { box-shadow: inset 0 0 0 1.5px var(--accent); }
.code-boxes .box.filled { animation: pop .25s var(--spring); }
.code-boxes.error .box { box-shadow: inset 0 0 0 1.5px var(--danger); color: var(--danger); }
.code-boxes.error { animation: shake .4s; }
.code-boxes.ok .box { box-shadow: inset 0 0 0 1.5px var(--green); }
.code-boxes input { position: absolute; inset: 0; opacity: 0; font-size: 16px; caret-color: transparent; letter-spacing: 40px; }
@keyframes shake { 0%, 100% { transform: none; } 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }
.dev-code { margin: 0 auto 18px; background: rgba(var(--accent-rgb), .14); color: var(--text); border-radius: 14px; padding: 10px 14px; font-size: 14px; text-align: center; line-height: 1.4; max-width: 340px; }
.dev-code b { font-size: 18px; letter-spacing: 2px; color: var(--accent); cursor: pointer; }
.code-icon { width: 110px; height: 110px; margin: 0 auto; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(var(--accent-rgb), .14); color: var(--accent); }
.code-icon svg { width: 54px; height: 54px; }
.resend { text-align: center; color: var(--text2); font-size: 15px; margin-top: 4px; }
.resend button { color: var(--accent); font-size: 15px; }
.err-text { color: var(--danger); font-size: 14px; text-align: center; min-height: 20px; margin-top: 8px; }

.name-head { display: flex; flex-direction: column; align-items: center; }
.ava-pick { width: 110px; height: 110px; border-radius: 50%; background: rgba(var(--accent-rgb), .14); color: var(--accent); display: flex; align-items: center; justify-content: center; cursor: pointer; overflow: hidden; margin: 0 auto 8px; position: relative; }
.ava-pick svg { width: 46px; height: 46px; }
.ava-pick img { width: 100%; height: 100%; object-fit: cover; }

/* ---------------- переписка ---------------- */
.chat-page { background: var(--wall-bg); }
.wallpaper { position: absolute; inset: 0; background-color: var(--wall-bg); overflow: hidden; z-index: 0; }
.wallpaper::before { content: ""; position: absolute; inset: -10%; background-image: var(--wall-pattern); background-size: 420px 420px; opacity: 1; }
.wallpaper::after { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 70% at 50% 0%, rgba(var(--wall-glow, 120, 90, 255), .10), transparent 60%), radial-gradient(100% 60% at 50% 100%, rgba(var(--wall-glow, 120, 90, 255), .08), transparent 60%); }
.chat-head { position: absolute; top: 0; left: 0; right: 0; z-index: 30; padding: calc(var(--safe-top) + 8px) 12px 8px; display: flex; align-items: center; gap: 8px; }
.chat-head::before { content: ""; position: absolute; inset: 0 0 -30px 0; background: linear-gradient(rgba(0, 0, 0, .55), transparent); pointer-events: none; z-index: -1; }
:root[data-theme="light"] .chat-head::before { background: linear-gradient(rgba(255, 255, 255, .5), transparent); }
.chat-head .who { flex: 1; min-width: 0; display: flex; justify-content: center; }
.chat-head .who-pill { max-width: 100%; border-radius: 22px; padding: 4px 18px; height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; min-width: 0; }
.chat-head .who-name { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 4px; max-width: 100%; white-space: nowrap; }
.chat-head .who-name .t { overflow: hidden; text-overflow: ellipsis; }
.chat-head .who-status { font-size: 12.5px; color: var(--text2); white-space: nowrap; line-height: 1.2; transition: color .2s; }
.chat-head .who-status.online, .chat-head .who-status.typing { color: var(--accent); }
.chat-head .ava { cursor: pointer; }
.chat-banner { position: absolute; top: calc(var(--safe-top) + 64px); left: 12px; right: 12px; z-index: 29; border-radius: 22px; padding: 10px 44px 10px 16px; text-align: center; animation: slideDown .45s var(--ease); }
.chat-banner .main { font-size: 15.5px; font-weight: 500; cursor: pointer; }
.chat-banner .main span { color: var(--accent); }
.chat-banner .sub { font-size: 12.5px; color: var(--text2); margin-top: 3px; }
.chat-banner .close { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; color: var(--text2); }
.chat-banner .close svg { width: 22px; height: 22px; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }

.messages { position: absolute; inset: 0; z-index: 1; padding: calc(var(--safe-top) + 70px) 0 calc(var(--safe-bottom) + 70px); display: flex; flex-direction: column; }
.messages.with-banner { padding-top: calc(var(--safe-top) + 136px); }
.messages .spacer-top { flex: 1 0 auto; }
.msg-list { display: flex; flex-direction: column; padding: 0 8px; }

.date-sep { position: sticky; top: calc(var(--safe-top) + 66px); z-index: 5; align-self: center; margin: 8px 0 6px; padding: 3px 10px; border-radius: 13px; font-size: 14px; font-weight: 500; color: #fff; background: rgba(0, 0, 0, .32); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); user-select: none; }
:root[data-theme="light"] .date-sep { background: rgba(0, 0, 0, .22); }
.service-msg { align-self: center; margin: 6px 0; padding: 4px 12px; border-radius: 14px; font-size: 14px; color: #fff; background: rgba(0, 0, 0, .32); backdrop-filter: blur(16px); text-align: center; max-width: 80%; }
.unread-sep { align-self: stretch; margin: 8px -8px; padding: 5px; text-align: center; font-size: 15px; color: var(--text2); background: var(--unread-bg, rgba(28, 28, 30, .85)); }

.msg { display: flex; align-items: flex-end; margin-top: 2px; position: relative; max-width: 100%; transition: transform .25s var(--ease); }
.msg.out { justify-content: flex-end; }
.msg.group-start { margin-top: 7px; }
.msg.anim-in { animation: msgIn .38s var(--spring); }
.msg.out.anim-in { transform-origin: 100% 100%; }
.msg.in.anim-in { transform-origin: 0 100%; }
@keyframes msgIn { from { opacity: 0; transform: translateY(18px) scale(.92); } to { opacity: 1; transform: none; } }
.msg.removing { animation: msgOut .35s var(--ease) forwards; }
@keyframes msgOut { to { opacity: 0; transform: scale(.6); height: 0; margin: 0; } }
.msg.highlight .bubble { animation: hl 1.4s ease; }
@keyframes hl { 0%, 60% { filter: brightness(1.45); } 100% { filter: none; } }
.msg .swipe-reply { position: absolute; right: -36px; bottom: 6px; width: 30px; height: 30px; border-radius: 50%; background: rgba(0, 0, 0, .35); color: #fff; display: flex; align-items: center; justify-content: center; opacity: 0; transform: scale(.5); transition: opacity .15s, transform .15s; }
.msg .swipe-reply svg { width: 18px; height: 18px; }
.msg .select-dot { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, .7); margin: 0 8px 6px 4px; flex: none; display: none; align-items: center; justify-content: center; }
.select-mode .msg .select-dot { display: flex; }
.select-mode .msg.out { justify-content: space-between; }
.msg.selected .select-dot { background: var(--accent); border-color: var(--accent); }
.msg.selected .select-dot::after { content: "✓"; color: #fff; font-size: 14px; font-weight: 700; }

.bubble { position: relative; max-width: min(78%, 480px); padding: 6px 12px 7px; border-radius: var(--bubble-r); font-size: var(--msg-size); line-height: 1.3; word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; cursor: default; }
.msg.in .bubble { background: var(--in-bubble); color: var(--in-text); }
.msg.out .bubble { background: var(--out-bubble); background-attachment: fixed; color: var(--out-text); }
.msg.in:not(.group-end) .bubble { border-bottom-left-radius: var(--bubble-r-small); }
.msg.in:not(.group-start) .bubble { border-top-left-radius: var(--bubble-r-small); }
.msg.out:not(.group-end) .bubble { border-bottom-right-radius: var(--bubble-r-small); }
.msg.out:not(.group-start) .bubble { border-top-right-radius: var(--bubble-r-small); }
/* хвостик */
.msg.group-end .bubble::before { content: ""; position: absolute; bottom: 0; width: 17px; height: 21px; background: inherit; background-attachment: inherit; }
.msg.in.group-end .bubble { border-bottom-left-radius: 4px; }
.msg.out.group-end .bubble { border-bottom-right-radius: 4px; }
.msg.in.group-end .bubble::before { left: -6px; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='17' height='21'%3E%3Cpath d='M6 0v15c0 3-2.5 5-6 6 4.5.3 9-.6 12.5-3.2C14 16.5 17 13 17 13V0z'/%3E%3C/svg%3E") no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='17' height='21'%3E%3Cpath d='M6 0v15c0 3-2.5 5-6 6 4.5.3 9-.6 12.5-3.2C14 16.5 17 13 17 13V0z'/%3E%3C/svg%3E") no-repeat; }
.msg.out.group-end .bubble::before { right: -6px; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='17' height='21'%3E%3Cpath d='M11 0v15c0 3 2.5 5 6 6-4.5.3-9-.6-12.5-3.2C3 16.5 0 13 0 13V0z'/%3E%3C/svg%3E") no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='17' height='21'%3E%3Cpath d='M11 0v15c0 3 2.5 5 6 6-4.5.3-9-.6-12.5-3.2C3 16.5 0 13 0 13V0z'/%3E%3C/svg%3E") no-repeat; }
.msg.no-tail .bubble::before { display: none !important; }
.msg.no-tail.group-end.in .bubble { border-bottom-left-radius: var(--bubble-r); }
.msg.no-tail.group-end.out .bubble { border-bottom-right-radius: var(--bubble-r); }

.bubble .txt { display: inline; }
.bubble a { color: var(--in-link); text-decoration: none; }
.msg.out .bubble a { color: var(--out-link); text-decoration: underline; text-underline-offset: 2px; }
.bubble .mention { color: var(--in-link); cursor: pointer; }
.msg.out .bubble .mention { color: var(--out-link); text-decoration: underline; }
.bubble b, .bubble strong { font-weight: 600; }
.bubble code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; background: rgba(0, 0, 0, .2); padding: 1px 4px; border-radius: 4px; }
.bubble .spoiler-text { color: transparent; border-radius: 4px; cursor: pointer; --dot: rgba(255, 255, 255, .8); background-image: radial-gradient(var(--dot) .7px, transparent 1.3px), radial-gradient(var(--dot) .6px, transparent 1.1px); background-size: 4px 4px, 5px 6px; background-position: 0 0, 2px 3px; animation: spdots 1.6s linear infinite; transition: color .3s; }
:root[data-theme="light"] .bubble .spoiler-text { --dot: rgba(0, 0, 0, .55); }
@keyframes spdots { to { background-position: 4px 4px, -3px 9px; } }
.bubble .spoiler-text.shown { color: inherit; background: none; animation: none; }
.bubble.emoji-only { background: none !important; padding: 0 4px; font-size: 52px; line-height: 1.1; }
.bubble.emoji-only::before { display: none !important; }
.bubble.emoji-only .meta { background: rgba(0, 0, 0, .3); color: #fff !important; border-radius: 10px; padding: 2px 6px; }

.meta { float: right; display: inline-flex; align-items: center; gap: 2px; font-size: 11.5px; line-height: 1; margin: 9px -4px -5px 10px; position: relative; top: 1px; white-space: nowrap; user-select: none; height: 15px; }
.msg.in .meta { color: var(--in-time); }
.msg.out .meta { color: var(--out-time); }
.meta svg { width: 16px; height: 11px; }
.meta .edited { margin-right: 2px; }
.meta.on-media { position: absolute; top: auto; right: 8px; bottom: 6px; margin: 0; padding: 2px 7px; border-radius: 10px; background: rgba(0, 0, 0, .4); color: #fff !important; float: none; height: 19px; }
.meta .clock { width: 12px; height: 12px; }
.meta .eye { width: 14px; height: 14px; margin-right: 2px; }

.fwd-head { font-size: 14.5px; margin-bottom: 2px; color: var(--reply-bar); }
.msg.in .fwd-head { color: var(--in-link); }
.msg.out .fwd-head { color: var(--out-accent); }
.fwd-head b { font-weight: 600; }
.reply-quote { display: block; margin: 2px -4px 5px; padding: 4px 8px 5px 10px; border-radius: 6px; position: relative; overflow: hidden; cursor: pointer; font-size: 14.5px; line-height: 1.3; background: rgba(255, 255, 255, .1); white-space: nowrap; }
.reply-quote::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--reply-bar); }
.msg.in .reply-quote { background: rgba(var(--accent-rgb), .12); }
.msg.in .reply-quote::before { background: var(--in-link); }
.msg.out .reply-quote { background: var(--out-quote-bg); }
.msg.out .reply-quote::before { background: var(--out-accent); }
.reply-quote .rq-name { font-weight: 600; color: var(--in-link); overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 3px; }
.msg.out .reply-quote .rq-name { color: var(--out-accent); }
.reply-quote .rq-text { overflow: hidden; text-overflow: ellipsis; opacity: .92; }

.reactions { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px -4px 0 -4px; clear: both; }
.reaction { height: 30px; border-radius: 15px; padding: 0 9px 0 7px; display: inline-flex; align-items: center; gap: 5px; font-size: 16px; cursor: pointer; background: rgba(var(--accent-rgb), .18); transition: transform .2s var(--spring); user-select: none; }
.reaction:active { transform: scale(.9); }
.reaction .n { font-size: 14px; font-weight: 600; color: var(--in-link); }
.reaction.mine { background: var(--accent); }
.reaction.mine .n { color: #fff; }
.msg.out .reaction { background: var(--out-quote-bg); }
.msg.out .reaction .n { color: var(--out-accent); }
.msg.out .reaction.mine { background: var(--out-accent); }
.msg.out .reaction.mine .n { color: var(--out-accent-ink); }
.reaction.pop { animation: reactPop .6s var(--spring); }
@keyframes reactPop { 0% { transform: scale(.2); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
.react-burst { position: fixed; z-index: 400; font-size: 46px; pointer-events: none; animation: burst 1s ease-out forwards; }
@keyframes burst { 0% { transform: translate(-50%, -50%) scale(.3); opacity: 0; } 25% { transform: translate(-50%, -80%) scale(1.5); opacity: 1; } 100% { transform: translate(-50%, -160%) scale(1); opacity: 0; } }

/* медиа */
.bubble.media { padding: 0; overflow: hidden; background: transparent !important; min-width: 120px; }
.bubble.media.has-caption { background: var(--in-bubble) !important; }
.msg.out .bubble.media.has-caption { background: var(--out-bubble) !important; background-attachment: fixed !important; }
.bubble.media::before { display: none !important; }
.msg.group-end .bubble.media { border-bottom-left-radius: var(--bubble-r); border-bottom-right-radius: var(--bubble-r); }
.media-box { position: relative; display: block; overflow: hidden; background: rgba(127, 127, 127, .15); cursor: pointer; }
.media-box img, .media-box video { display: block; width: 100%; height: 100%; object-fit: cover; }
.media-box .play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 52px; height: 52px; border-radius: 50%; background: rgba(0, 0, 0, .45); color: #fff; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(10px); }
.media-box .play svg { width: 26px; height: 26px; margin-left: 3px; }
.media-box .dur { position: absolute; left: 8px; top: 8px; padding: 2px 7px; border-radius: 10px; background: rgba(0, 0, 0, .45); color: #fff; font-size: 12.5px; }
.media-box .upload-ring { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 52px; height: 52px; border-radius: 50%; background: rgba(0, 0, 0, .45); }
.bubble.media .caption { padding: 6px 12px 7px; }

/* спойлер / исчезающее */
.spoiler-wrap { position: absolute; inset: 0; overflow: hidden; }
.spoiler-wrap .blurred { position: absolute; inset: -30px; background-size: cover; background-position: center; filter: blur(28px) brightness(.85) saturate(1.2); transform: scale(1.05); }
.spoiler-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.spoiler-wrap.revealing { animation: reveal .7s var(--ease) forwards; }
@keyframes reveal { to { opacity: 0; transform: scale(1.06); filter: blur(6px); } }
.ttl-badge { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 8px; color: #fff; text-align: center; font-size: 14px; font-weight: 500; text-shadow: 0 1px 4px rgba(0, 0, 0, .4); pointer-events: none; z-index: 2; }
.ttl-badge .ring { width: 54px; height: 54px; border-radius: 50%; background: rgba(0, 0, 0, .45); display: flex; align-items: center; justify-content: center; backdrop-filter: blur(10px); position: relative; }
.ttl-badge .ring svg { width: 28px; height: 28px; }
.ttl-badge .ring .sec { position: absolute; font-size: 12px; font-weight: 700; bottom: -2px; right: -4px; background: var(--accent); border-radius: 9px; padding: 1px 5px; }

/* файлы */
.file-row { display: flex; align-items: center; gap: 12px; padding: 4px 2px 2px 0; min-width: 220px; cursor: pointer; text-decoration: none; color: inherit; }
.file-row .fic { width: 50px; height: 50px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; text-transform: uppercase; position: relative; }
.msg.out .file-row .fic { background: var(--out-accent); color: var(--out-accent-ink); }
.file-row .fic svg { width: 26px; height: 26px; }
.file-row .finfo { min-width: 0; flex: 1; }
.file-row .fname { font-size: 16px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.file-row .fsize { font-size: 13.5px; opacity: .65; margin-top: 2px; }

/* голосовые */
.voice { display: flex; align-items: center; gap: 10px; min-width: 230px; padding: 3px 0 0; }
.voice .vplay { width: 46px; height: 46px; border-radius: 50%; flex: none; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; transition: transform .15s; }
.voice .vplay:active { transform: scale(.9); }
.msg.out .voice .vplay { background: var(--out-accent); color: var(--out-accent-ink); }
.msg.out .voice .wave { color: var(--out-accent); }
.voice .vplay svg { width: 22px; height: 22px; }
.voice .vbody { flex: 1; min-width: 0; }
.voice .wave { display: flex; align-items: center; gap: 2px; height: 24px; cursor: pointer; }
.voice .wave i { width: 3px; border-radius: 2px; background: currentColor; opacity: .35; flex: none; min-height: 3px; transition: opacity .1s; }
.voice .wave i.p { opacity: 1; }
.msg.in .voice .wave { color: var(--in-link); }
.voice .vinfo { font-size: 12.5px; opacity: .7; margin-top: 3px; display: flex; align-items: center; gap: 6px; }
.voice .vinfo .unl { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.voice .speed { font-size: 11px; font-weight: 700; padding: 1px 5px; border-radius: 6px; background: rgba(127, 127, 127, .25); cursor: pointer; }

/* геопозиция */
.geo-box { width: 260px; height: 150px; position: relative; overflow: hidden; display: block; background: #444; }
.geo-box img { position: absolute; width: 256px; height: 256px; }
.geo-box .pin { position: absolute; left: 50%; top: 50%; width: 36px; height: 36px; transform: translate(-50%, -95%); color: #ff3b30; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .4)); }
.geo-box .pin svg { width: 100%; height: 100%; }

/* ---------------- поле ввода ---------------- */
.composer { position: absolute; left: 0; right: 0; bottom: 0; z-index: 30; padding: 6px 10px calc(var(--safe-bottom) + 8px); display: flex; flex-direction: column; gap: 6px; }
.composer::before { content: ""; position: absolute; inset: -30px 0 0 0; background: linear-gradient(transparent, rgba(0, 0, 0, .45)); pointer-events: none; z-index: -1; }
:root[data-theme="light"] .composer::before { background: linear-gradient(transparent, rgba(255, 255, 255, .4)); }
.composer .row { display: flex; align-items: flex-end; gap: 8px; }
.composer .input-wrap { flex: 1; min-width: 0; border-radius: 22px; display: flex; align-items: flex-end; min-height: 44px; padding: 0 6px 0 16px; position: relative; transition: border-radius .2s; }
.composer textarea { flex: 1; border: 0; outline: 0; background: none; resize: none; font-size: 17px; line-height: 22px; padding: 11px 0; max-height: 154px; min-height: 44px; overflow-y: auto; scrollbar-width: none; }
.composer textarea::-webkit-scrollbar { display: none; }
.composer .in-btn { width: 36px; height: 44px; display: flex; align-items: center; justify-content: center; color: var(--text2); flex: none; }
.composer .in-btn svg { width: 26px; height: 26px; }
.composer .send-btn { background: var(--accent); color: #fff; backdrop-filter: none; box-shadow: 0 4px 14px rgba(var(--accent-rgb), .35); animation: pop .3s var(--spring); }
.composer .send-btn svg { width: 22px; height: 22px; }
.composer .ctx-bar { display: flex; align-items: center; gap: 10px; border-radius: 18px; padding: 6px 6px 6px 12px; animation: slideUp .3s var(--ease); }
.composer .ctx-bar .ic { color: var(--accent); width: 24px; height: 24px; flex: none; }
.composer .ctx-bar .ctx-body { flex: 1; min-width: 0; border-left: 2.5px solid var(--accent); padding-left: 8px; }
.composer .ctx-bar .ctx-title { color: var(--accent); font-size: 14px; font-weight: 600; }
.composer .ctx-bar .ctx-text { font-size: 14px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.composer .ctx-bar .x { width: 30px; height: 30px; color: var(--text2); }
.composer .ctx-bar .x svg { width: 22px; height: 22px; }
@keyframes slideUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.composer .blocked-bar { height: 50px; border-radius: 25px; display: flex; align-items: center; justify-content: center; color: var(--accent); font-size: 17px; cursor: pointer; }
.select-bar { display: flex; align-items: center; justify-content: space-between; height: 50px; border-radius: 25px; padding: 0 8px; }
.select-bar button { padding: 8px 14px; font-size: 17px; color: var(--accent); display: flex; align-items: center; gap: 6px; }
.select-bar button.danger { color: var(--danger); }
.select-bar button svg { width: 22px; height: 22px; }
.select-bar .cnt { font-size: 16px; font-weight: 600; }

/* запись голоса */
.rec-bar { position: absolute; left: 10px; right: 64px; bottom: calc(var(--safe-bottom) + 8px); height: 44px; border-radius: 22px; display: flex; align-items: center; padding: 0 16px; gap: 10px; z-index: 31; animation: slideUp .25s var(--ease); }
.rec-bar .dot { width: 10px; height: 10px; border-radius: 50%; background: #ff3b30; animation: blink 1s infinite; flex: none; }
@keyframes blink { 50% { opacity: .2; } }
.rec-bar .time { font-variant-numeric: tabular-nums; font-size: 16px; min-width: 70px; }
.rec-bar .hint { flex: 1; text-align: center; color: var(--text2); font-size: 15px; white-space: nowrap; overflow: hidden; transition: opacity .2s; display: flex; align-items: center; justify-content: center; gap: 4px; }
.rec-bar .hint svg { width: 14px; height: 14px; }
.rec-bar .cancel { color: var(--accent); font-size: 16px; display: none; }
.rec-bar.locked .hint { display: none; }
.rec-bar.locked .cancel { display: block; margin-left: auto; margin-right: auto; }
.rec-btn { position: absolute; right: 2px; bottom: calc(var(--safe-bottom) - 22px); width: 116px; height: 116px; border-radius: 50%; display: flex; align-items: center; justify-content: center; z-index: 32; pointer-events: none; }
.rec-btn .core { width: 84px; height: 84px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 24px rgba(var(--accent-rgb), .5); transition: transform .1s linear; pointer-events: auto; cursor: pointer; animation: recIn .3s var(--spring); }
.rec-btn .core svg { width: 32px; height: 32px; }
.rec-btn .halo { position: absolute; width: 84px; height: 84px; border-radius: 50%; background: rgba(var(--accent-rgb), .25); transition: transform .08s linear; }
@keyframes recIn { from { transform: scale(.3); } to { transform: scale(1); } }
.rec-lock { position: absolute; right: 22px; bottom: calc(var(--safe-bottom) + 130px); width: 40px; height: 76px; border-radius: 20px; display: flex; flex-direction: column; align-items: center; justify-content: space-around; padding: 8px 0; z-index: 32; color: var(--text2); animation: slideUp .3s var(--ease); }
.rec-lock svg { width: 22px; height: 22px; }
.rec-lock .arrow { width: 14px; height: 14px; animation: bob 1.2s infinite; }
@keyframes bob { 50% { transform: translateY(-4px); } }

/* панель эмодзи */
.emoji-panel { height: 300px; border-radius: 26px 26px 0 0; margin: 0 -10px calc(-8px - var(--safe-bottom)); padding-bottom: var(--safe-bottom); display: flex; flex-direction: column; animation: slideUp .3s var(--ease); background: var(--glass-strong); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); }
.emoji-panel .cats { display: flex; gap: 2px; padding: 8px 10px 4px; overflow-x: auto; scrollbar-width: none; flex: none; }
.emoji-panel .cats button { width: 36px; height: 32px; border-radius: 10px; font-size: 19px; flex: none; opacity: .55; }
.emoji-panel .cats button.active { background: var(--glass-hl); opacity: 1; }
.emoji-panel .grid { flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); padding: 0 8px 8px; align-content: start; }
.emoji-panel .grid .cat-title { grid-column: 1 / -1; font-size: 13px; color: var(--text2); padding: 10px 6px 4px; text-transform: uppercase; }
.emoji-panel .grid button { height: 44px; font-size: 30px; border-radius: 10px; }
.emoji-panel .grid button:active { background: var(--glass-hl); }

.scroll-down { position: absolute; right: 12px; bottom: calc(var(--safe-bottom) + 70px); width: 44px; height: 44px; border-radius: 50%; z-index: 29; display: flex; align-items: center; justify-content: center; color: var(--text2); transition: transform .3s var(--spring), opacity .2s; }
.scroll-down.hide { transform: scale(.4); opacity: 0; pointer-events: none; }
.scroll-down svg { width: 24px; height: 24px; }
.scroll-down .badge { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); background: var(--accent); }

/* ---------------- профиль собеседника ---------------- */
.profile-head { position: relative; padding: calc(var(--safe-top) + 64px) 16px 18px; text-align: center; overflow: hidden; }
.profile-head .bg { position: absolute; inset: 0; z-index: 0; }
.profile-head .bg img { width: 100%; height: 100%; object-fit: cover; filter: blur(0); }
.profile-head.big-photo { padding-top: 0; height: min(420px, 100vw); display: flex; flex-direction: column; justify-content: flex-end; }
.profile-head.big-photo .bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 50%, rgba(0, 0, 0, .55)); }
.profile-head > *:not(.bg) { position: relative; z-index: 1; }
.profile-head .ava { margin: 0 auto 12px; box-shadow: 0 8px 30px rgba(0, 0, 0, .3); cursor: pointer; }
.profile-head .p-name { font-size: 26px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 6px; letter-spacing: -.2px; }
.profile-head .p-name .emoji-status { font-size: 22px; }
.profile-head .p-sub { color: var(--text2); font-size: 16px; margin-top: 4px; }
.profile-head.colored .p-sub, .profile-head.big-photo .p-sub { color: rgba(255, 255, 255, .78); }
.profile-head.colored .p-name, .profile-head.big-photo .p-name { color: #fff; }
.profile-head .pattern { position: absolute; inset: 0; opacity: .25; background-image: var(--wall-pattern); background-size: 300px; z-index: 0; }
.p-actions { display: flex; gap: 8px; margin-top: 18px; }
.p-actions button { flex: 1; height: 58px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11.5px; color: var(--text); }
.profile-head.colored .p-actions button, .profile-head.big-photo .p-actions button { background: rgba(255, 255, 255, .16); color: #fff; backdrop-filter: blur(20px); box-shadow: none; }
.p-actions svg { width: 22px; height: 22px; }
.info-cell { padding: 10px 16px; position: relative; cursor: pointer; }
.info-cell:active { background: var(--cell-hl); }
.info-cell + .info-cell::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: .5px; background: var(--sep); }
.info-cell .k { font-size: 14px; color: var(--text); opacity: .9; }
.info-cell .v { font-size: 17px; margin-top: 2px; word-break: break-word; }
.info-cell .v.link { color: var(--accent); }
.info-cell .qr { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--accent); width: 26px; height: 26px; }
.media-tabs { display: flex; gap: 4px; padding: 4px; margin: 24px 16px 10px; border-radius: 22px; background: var(--cell); }
.media-tabs button { flex: 1; height: 34px; border-radius: 18px; font-size: 15px; font-weight: 500; color: var(--text2); }
.media-tabs button.active { background: var(--glass-hl); color: var(--text); }
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.media-grid .cellm { aspect-ratio: 1; position: relative; overflow: hidden; cursor: pointer; background: var(--skeleton); }
.media-grid .cellm img, .media-grid .cellm video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-grid .cellm .dur { position: absolute; right: 6px; bottom: 5px; color: #fff; font-size: 12px; font-weight: 600; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }

/* ---------------- профиль в настройках ---------------- */
.me-head { padding: calc(var(--safe-top) + 58px) 16px 22px; text-align: center; position: relative; overflow: hidden; }
.me-head > * { position: relative; }
.me-head .ava { margin: 0 auto 14px; }
.me-head .p-name { font-size: 26px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 6px; }
.me-head .p-sub { color: var(--text2); font-size: 16px; margin-top: 4px; }
.me-head.colored .p-sub { color: rgba(255, 255, 255, .78); }
.me-head.colored .pattern, .profile-head.colored .pattern { opacity: .22; }

/* ---------------- нижние шторки ---------------- */
.overlay { position: fixed; inset: 0; z-index: 200; }
.overlay .backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); animation: fadeIn .3s ease; }
.overlay.closing .backdrop { animation: fadeOut .3s ease forwards; }
@keyframes fadeOut { to { opacity: 0; } }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: calc(100% - var(--safe-top) - 40px); background: var(--sheet-bg); border-radius: 30px 30px 0 0; display: flex; flex-direction: column; animation: sheetIn .5s var(--ease); padding-bottom: var(--safe-bottom); box-shadow: 0 -10px 40px rgba(0, 0, 0, .3); touch-action: pan-y; }
.overlay.closing .sheet { animation: sheetOut .35s var(--ease) forwards; }
@keyframes sheetIn { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheetOut { to { transform: translateY(100%); } }
@media (min-width: 900px) {
  .sheet { left: 50%; right: auto; width: 440px; transform: translateX(-50%); bottom: 50%; translate: 0 50%; border-radius: 26px; animation: dlgIn .35s var(--spring); max-height: 86vh; }
  .overlay.closing .sheet { animation: dlgOut .25s ease forwards; }
  .sheet.full { height: 86vh; }
}
@keyframes dlgIn { from { opacity: 0; scale: .9; } to { opacity: 1; scale: 1; } }
@keyframes dlgOut { to { opacity: 0; scale: .92; } }
.sheet .grab { width: 36px; height: 5px; border-radius: 3px; background: var(--text3); margin: 7px auto 0; flex: none; opacity: .7; }
.sheet .sheet-head { display: flex; align-items: center; padding: 8px 12px; gap: 8px; min-height: 56px; flex: none; }
.sheet .sheet-head .t { flex: 1; text-align: center; font-size: 17px; font-weight: 600; }
.sheet .sheet-head .t small { display: block; font-size: 13px; color: var(--text2); font-weight: 400; }
.sheet .sheet-head .gbtn { background: var(--cell-hl); }
.sheet .sheet-body { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 16px; }
.sheet.full { height: calc(100% - var(--safe-top) - 40px); }

/* меню действий (action sheet) */
.action-sheet { position: absolute; left: 10px; right: 10px; bottom: calc(var(--safe-bottom) + 10px); animation: sheetIn .45s var(--ease); display: flex; flex-direction: column; gap: 8px; max-width: 460px; margin: 0 auto; }
.overlay.closing .action-sheet { animation: sheetOut .3s var(--ease) forwards; }
.action-sheet .as-group { border-radius: 22px; overflow: hidden; background: var(--glass-strong); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); }
.action-sheet .as-title { padding: 14px 16px; text-align: center; font-size: 13px; color: var(--text2); line-height: 1.35; }
.action-sheet .as-title b { display: block; font-size: 14px; color: var(--text2); font-weight: 600; margin-bottom: 2px; }
.action-sheet button { width: 100%; height: 56px; font-size: 19px; color: var(--accent); position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; }
.action-sheet button:active { background: var(--glass-hl); }
.action-sheet .as-group > * + button::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: .5px; background: var(--sep); }
.action-sheet button.danger { color: var(--danger); }
.action-sheet button.cancel { font-weight: 600; }

/* алерт */
.alert { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 280px; border-radius: 22px; background: var(--glass-strong); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); overflow: hidden; animation: alertIn .3s var(--spring); text-align: center; }
.overlay.closing .alert { animation: fadeOut .2s forwards; }
@keyframes alertIn { from { opacity: 0; transform: translate(-50%, -50%) scale(1.15); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
.alert .a-body { padding: 20px 16px 16px; }
.alert .a-title { font-size: 17px; font-weight: 600; }
.alert .a-text { font-size: 13.5px; margin-top: 4px; line-height: 1.35; color: var(--text); opacity: .9; }
.alert .a-input { margin-top: 14px; width: 100%; height: 34px; border-radius: 8px; border: .5px solid var(--sep); background: var(--input-bg); padding: 0 8px; outline: 0; font-size: 16px; }
.alert .a-check { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: 14px; font-size: 15px; cursor: pointer; }
.alert .a-check .box { width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--text3); display: flex; align-items: center; justify-content: center; }
.alert .a-check.on .box { background: var(--accent); border-color: var(--accent); color: #fff; }
.alert .a-check .box svg { width: 14px; height: 14px; }
.alert .a-btns { display: flex; border-top: .5px solid var(--sep); }
.alert .a-btns.vertical { flex-direction: column; }
.alert .a-btns button { flex: 1; height: 46px; font-size: 17px; color: var(--accent); }
.alert .a-btns:not(.vertical) button + button { border-left: .5px solid var(--sep); }
.alert .a-btns.vertical button + button { border-top: .5px solid var(--sep); }
.alert .a-btns button.bold { font-weight: 600; }
.alert .a-btns button.danger { color: var(--danger); }

/* контекстное меню сообщения */
.ctx-overlay { position: fixed; inset: 0; z-index: 250; }
.ctx-overlay .ctx-bg { position: absolute; inset: 0; background: rgba(0, 0, 0, .35); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); animation: fadeIn .25s ease; }
.ctx-overlay.closing .ctx-bg { animation: fadeOut .2s forwards; }
.ctx-clone { position: absolute; z-index: 1; transition: transform .35s var(--spring), top .35s var(--spring); pointer-events: none; }
.ctx-clone .msg { margin: 0 !important; }
.ctx-reactions { position: absolute; z-index: 2; display: flex; gap: 2px; padding: 5px 8px; border-radius: 28px; animation: ctxIn .35s var(--spring); overflow-x: auto; scrollbar-width: none; max-width: calc(100vw - 20px); }
.ctx-reactions button { width: 42px; height: 42px; font-size: 28px; border-radius: 50%; flex: none; transition: transform .15s; display: flex; align-items: center; justify-content: center; }
.ctx-reactions button:hover { transform: scale(1.25); }
.ctx-reactions button.mine { background: var(--glass-hl); }
.ctx-menu { position: absolute; z-index: 2; width: 250px; border-radius: 18px; overflow: hidden; animation: ctxIn .35s var(--spring); background: var(--glass-strong); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); box-shadow: var(--shadow); }
@keyframes ctxIn { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
.ctx-overlay.closing .ctx-menu, .ctx-overlay.closing .ctx-reactions { animation: fadeOut .15s forwards; }
.ctx-menu button { width: 100%; height: 46px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; font-size: 17px; position: relative; text-align: left; }
.ctx-menu button:active, .ctx-menu button:hover { background: var(--glass-hl); }
.ctx-menu button + button::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: .5px; background: var(--sep); }
.ctx-menu button svg { width: 22px; height: 22px; }
.ctx-menu button.danger { color: var(--danger); }
.ctx-menu .ctx-info { padding: 8px 16px; font-size: 13px; color: var(--text2); border-bottom: 6px solid rgba(0, 0, 0, .15); }

/* тост */
#toasts { position: fixed; left: 0; right: 0; top: calc(var(--safe-top) + 10px); z-index: 500; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { max-width: min(92vw, 420px); padding: 12px 16px; border-radius: 18px; background: var(--glass-strong); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); box-shadow: var(--shadow); font-size: 15px; display: flex; align-items: center; gap: 10px; animation: toastIn .45s var(--spring); pointer-events: auto; }
.toast.out { animation: toastOut .3s ease forwards; }
.toast svg { width: 24px; height: 24px; flex: none; color: var(--accent); }
.toast.error svg { color: var(--danger); }
.toast .t-action { color: var(--accent); font-weight: 600; margin-left: 8px; cursor: pointer; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-30px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-20px); } }

/* поиск */
.search-head { display: flex; align-items: center; gap: 8px; padding: calc(var(--safe-top) + 8px) 12px 8px; }
.search-head .sinput { flex: 1; height: 44px; border-radius: 22px; display: flex; align-items: center; gap: 6px; padding: 0 14px; background: var(--cell); }
.search-head .sinput svg { width: 18px; height: 18px; color: var(--text2); flex: none; }
.search-head .sinput input { flex: 1; border: 0; outline: 0; background: none; font-size: 17px; min-width: 0; }
.search-section { padding: 14px 16px 6px; font-size: 13px; color: var(--text2); text-transform: uppercase; display: flex; justify-content: space-between; }
.search-section button { color: var(--accent); text-transform: none; font-size: 14px; }
.recent-row { display: flex; gap: 14px; padding: 8px 16px; overflow-x: auto; scrollbar-width: none; }
.recent-row .ru { width: 64px; flex: none; text-align: center; font-size: 12px; cursor: pointer; }
.recent-row .ru .ava { margin: 0 auto 4px; }
.recent-row .ru div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-row { display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 60px; cursor: pointer; position: relative; }
.user-row:active { background: var(--cell-hl); }
.user-row .ub { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: center; position: relative; }
.user-row .ub::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: .5px; background: var(--sep); }
.user-row:last-child .ub::after { display: none; }
.user-row .un { font-size: 16.5px; font-weight: 500; display: flex; align-items: center; gap: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-row .us { font-size: 14px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-row .us.online { color: var(--accent); }
.user-row .us mark { background: none; color: var(--accent); }

/* ---------------- просмотр медиа ---------------- */
.viewer { position: fixed; inset: 0; z-index: 300; background: #000; display: flex; flex-direction: column; animation: fadeIn .25s ease; touch-action: none; }
.viewer.closing { animation: fadeOut .25s forwards; }
.viewer .v-top, .viewer .v-bottom { position: absolute; left: 0; right: 0; z-index: 2; display: flex; align-items: center; gap: 10px; padding: calc(var(--safe-top) + 8px) 12px 12px; transition: opacity .25s; }
.viewer .v-top { top: 0; background: linear-gradient(rgba(0, 0, 0, .6), transparent); }
.viewer .v-bottom { bottom: 0; padding: 12px 12px calc(var(--safe-bottom) + 12px); background: linear-gradient(transparent, rgba(0, 0, 0, .6)); flex-direction: column; align-items: stretch; }
.viewer.ui-hidden .v-top, .viewer.ui-hidden .v-bottom { opacity: 0; pointer-events: none; }
.viewer .v-who { flex: 1; text-align: center; color: #fff; }
.viewer .v-who b { display: block; font-size: 16px; font-weight: 600; }
.viewer .v-who span { font-size: 13px; opacity: .75; }
.viewer .gbtn { color: #fff; background: rgba(255, 255, 255, .14); backdrop-filter: blur(20px); }
.viewer .v-stage { flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
.viewer .v-stage img, .viewer .v-stage video { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform .3s var(--ease); user-select: none; -webkit-user-drag: none; }
.viewer .v-caption { color: #fff; font-size: 16px; line-height: 1.35; text-align: center; padding: 0 10px 10px; white-space: pre-wrap; }
.viewer .v-actions { display: flex; justify-content: space-between; }
.viewer .ttl-ring { position: absolute; top: calc(var(--safe-top) + 14px); right: 16px; z-index: 3; width: 40px; height: 40px; }
.viewer .ttl-ring svg { width: 40px; height: 40px; transform: rotate(-90deg); }
.viewer .ttl-ring span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 14px; font-weight: 700; }
.viewer .v-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; background: rgba(255, 255, 255, .12); color: #fff; display: flex; align-items: center; justify-content: center; z-index: 2; }
.viewer .v-nav svg { width: 24px; height: 24px; }
.viewer .v-nav.prev { left: 12px; }
.viewer .v-nav.next { right: 12px; }

/* ---------------- медиа-пикер / превью отправки ---------------- */
.attach-tabs { display: flex; justify-content: space-around; padding: 6px 8px 8px; margin: 0 12px 6px; border-radius: 30px; }
.attach-tabs button { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11.5px; color: var(--text2); padding: 6px 10px; border-radius: 20px; min-width: 64px; }
.attach-tabs button.active { color: var(--accent); background: var(--glass-hl); }
.attach-tabs svg { width: 28px; height: 28px; }
.attach-tabs .ati { width: 28px; height: 28px; }
.attach-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 0; }
.attach-grid .ag { aspect-ratio: 1; position: relative; overflow: hidden; cursor: pointer; background: var(--skeleton); }
.attach-grid .ag img, .attach-grid .ag video { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.attach-grid .ag.sel img, .attach-grid .ag.sel video { transform: scale(.88); border-radius: 6px; }
.attach-grid .ag .num { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; color: #fff; background: rgba(0, 0, 0, .15); box-shadow: 0 1px 4px rgba(0, 0, 0, .3); }
.attach-grid .ag.sel .num { background: var(--accent); border-color: var(--accent); animation: pop .3s var(--spring); }
.attach-grid .ag.camera { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--text); font-size: 13px; background: var(--cell-hl); }
.attach-grid .ag.camera svg { width: 34px; height: 34px; }
.attach-send { position: absolute; left: 12px; right: 12px; bottom: calc(var(--safe-bottom) + 92px); display: flex; gap: 8px; align-items: flex-end; animation: slideUp .3s var(--ease); z-index: 3; }
.attach-send .input-wrap { flex: 1; border-radius: 22px; min-height: 44px; display: flex; align-items: center; padding: 0 16px; }
.attach-send input { flex: 1; border: 0; outline: 0; background: none; font-size: 17px; height: 44px; }
.attach-send .gbtn.accent .cnt { position: absolute; top: -6px; right: -6px; background: #fff; color: var(--accent); min-width: 20px; height: 20px; border-radius: 10px; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
.location-card { margin: 12px 16px; border-radius: 22px; overflow: hidden; background: var(--cell); }
.location-card .geo-box { width: 100%; height: 220px; }

/* превью / редактор */
.editor { position: fixed; inset: 0; z-index: 320; background: #000; display: flex; flex-direction: column; color: #fff; animation: fadeIn .25s ease; user-select: none; -webkit-user-select: none; touch-action: none; }
.editor.closing { animation: fadeOut .2s forwards; }
.editor .e-top { display: flex; align-items: center; justify-content: space-between; padding: calc(var(--safe-top) + 8px) 12px 8px; gap: 8px; z-index: 3; }
.editor .e-top .gbtn { color: #fff; background: rgba(255, 255, 255, .14); backdrop-filter: blur(20px); }
.editor .e-top .ttl { font-size: 17px; font-weight: 600; }
.editor .e-stage { flex: 1; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.editor .e-canvas-wrap { position: relative; }
.editor canvas { display: block; }
.editor .e-canvas-wrap canvas.draw { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.editor .e-thumbs { display: flex; gap: 6px; justify-content: center; padding: 6px 12px; overflow-x: auto; scrollbar-width: none; }
.editor .e-thumbs .th { width: 44px; height: 44px; border-radius: 8px; overflow: hidden; flex: none; opacity: .55; cursor: pointer; box-shadow: inset 0 0 0 2px transparent; position: relative; }
.editor .e-thumbs .th.active { opacity: 1; box-shadow: 0 0 0 2px #fff; }
.editor .e-thumbs .th img { width: 100%; height: 100%; object-fit: cover; }
.editor .e-caption { display: flex; align-items: flex-end; gap: 8px; padding: 6px 12px; }
.editor .e-caption .input-wrap { flex: 1; min-height: 44px; border-radius: 22px; background: rgba(255, 255, 255, .12); backdrop-filter: blur(20px); display: flex; align-items: center; padding: 0 16px; }
.editor .e-caption input { flex: 1; border: 0; outline: 0; background: none; color: #fff; font-size: 17px; height: 44px; }
.editor .e-caption input::placeholder { color: rgba(255, 255, 255, .5); }
.editor .e-tools { display: flex; align-items: center; justify-content: space-between; padding: 6px 12px calc(var(--safe-bottom) + 10px); gap: 8px; }
.editor .e-tools .tool-pill { display: flex; gap: 2px; border-radius: 24px; padding: 3px; background: rgba(255, 255, 255, .12); backdrop-filter: blur(20px); }
.editor .e-tools .tool-pill button { width: 44px; height: 42px; border-radius: 21px; display: flex; align-items: center; justify-content: center; color: #fff; position: relative; }
.editor .e-tools .tool-pill button.on { color: var(--accent); background: rgba(255, 255, 255, .12); }
.editor .e-tools .tool-pill button svg { width: 24px; height: 24px; }
.editor .e-tools .tool-pill button .mini { position: absolute; bottom: 3px; right: 4px; font-size: 9px; font-weight: 800; background: var(--accent); color: #fff; border-radius: 6px; padding: 0 3px; line-height: 12px; }
.editor .send { width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; position: relative; }
.editor .send svg { width: 24px; height: 24px; }
.editor .round-btn { width: 44px; height: 44px; border-radius: 50%; background: rgba(255, 255, 255, .12); color: #fff; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(20px); flex: none; }
.editor .round-btn svg { width: 24px; height: 24px; }
.editor .round-btn.done { background: var(--accent); }
.editor .panel { padding: 8px 14px; animation: slideUp .25s var(--ease); }
.editor .adj-row { display: flex; align-items: center; gap: 12px; height: 40px; font-size: 14px; }
.editor .adj-row label { width: 96px; color: rgba(255, 255, 255, .85); flex: none; }
.editor .adj-row span { width: 36px; text-align: right; font-variant-numeric: tabular-nums; color: rgba(255, 255, 255, .7); }
.editor input[type=range] { flex: 1; -webkit-appearance: none; appearance: none; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .25); outline: 0; }
.editor input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .4); cursor: pointer; }
.editor input[type=range]::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 0; }
.editor .adj-scroll { max-height: 34vh; overflow-y: auto; }
.editor .colors { display: flex; gap: 10px; justify-content: center; padding: 6px 0 4px; flex-wrap: wrap; }
.editor .colors button { width: 30px; height: 30px; border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .25); transition: transform .2s var(--spring); }
.editor .colors button.on { transform: scale(1.2); box-shadow: 0 0 0 2.5px #fff; }
.editor .brush-row { display: flex; align-items: center; gap: 10px; justify-content: center; padding: 6px 0; }
.editor .brush-row button { padding: 6px 12px; border-radius: 16px; font-size: 14px; background: rgba(255, 255, 255, .1); color: #fff; display: flex; align-items: center; gap: 6px; }
.editor .brush-row button.on { background: #fff; color: #000; }
.editor .brush-row button svg { width: 18px; height: 18px; }
.editor .crop-ratios { display: flex; gap: 8px; justify-content: center; padding: 4px 0 8px; flex-wrap: wrap; }
.editor .crop-ratios button { padding: 6px 12px; border-radius: 16px; font-size: 13px; background: rgba(255, 255, 255, .1); color: #fff; }
.editor .crop-ratios button.on { background: #fff; color: #000; }
.editor .crop-tools { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 4px 0; }
.editor .crop-box { position: absolute; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .6); border: 1px solid rgba(255, 255, 255, .9); cursor: move; touch-action: none; }
.editor .crop-box.circle { border-radius: 50%; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .7); border-color: rgba(255, 255, 255, .5); }
.editor .crop-box .grid-l { position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(rgba(255, 255, 255, .35) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .35) 1px, transparent 1px); background-size: 33.33% 33.33%; background-position: -1px -1px; opacity: 0; transition: opacity .2s; }
.editor .crop-box.dragging .grid-l { opacity: 1; }
.editor .crop-box.circle .grid-l { display: none; }
.editor .crop-box .h { position: absolute; width: 26px; height: 26px; border-color: #fff; border-style: solid; border-width: 0; }
.editor .crop-box .h.tl { left: -3px; top: -3px; border-left-width: 3px; border-top-width: 3px; cursor: nwse-resize; }
.editor .crop-box .h.tr { right: -3px; top: -3px; border-right-width: 3px; border-top-width: 3px; cursor: nesw-resize; }
.editor .crop-box .h.bl { left: -3px; bottom: -3px; border-left-width: 3px; border-bottom-width: 3px; cursor: nesw-resize; }
.editor .crop-box .h.br { right: -3px; bottom: -3px; border-right-width: 3px; border-bottom-width: 3px; cursor: nwse-resize; }
.editor .crop-box.circle .h { display: none; }
.editor .text-item { position: absolute; transform: translate(-50%, -50%); font-weight: 700; font-size: 34px; white-space: pre; cursor: move; padding: 4px 10px; border-radius: 10px; line-height: 1.15; text-align: center; touch-action: none; }
.editor .text-item.editing { outline: 1.5px dashed rgba(255, 255, 255, .7); }
.editor .text-item[contenteditable="true"] { cursor: text; outline: 1.5px dashed #fff; }
.editor .e-flags { position: absolute; left: 12px; top: 8px; display: flex; gap: 6px; z-index: 4; }
.editor .e-flags span { padding: 4px 10px; border-radius: 12px; background: rgba(0, 0, 0, .5); font-size: 13px; backdrop-filter: blur(10px); display: flex; align-items: center; gap: 4px; }
.editor .e-flags svg { width: 14px; height: 14px; }
.editor .video-preview { max-width: 100%; max-height: 100%; }

/* ---------------- разное ---------------- */
.typing-dots { display: inline-flex; gap: 2px; margin-right: 3px; vertical-align: middle; }
.typing-dots i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; animation: tdot 1.2s infinite; }
.typing-dots i:nth-child(2) { animation-delay: .15s; }
.typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes tdot { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }
.promo { text-align: center; padding: calc(var(--safe-top) + 70px) 24px 10px; }
.promo .p-ic { width: 96px; height: 96px; border-radius: 28px; margin: 0 auto 18px; display: flex; align-items: center; justify-content: center; color: #fff; box-shadow: 0 12px 40px rgba(0, 0, 0, .35); }
.promo .p-ic svg { width: 56px; height: 56px; }
.promo h2 { font-size: 26px; margin: 0 0 8px; }
.promo p { color: var(--text2); font-size: 15.5px; line-height: 1.45; margin: 0 auto; max-width: 360px; }
.feature { display: flex; gap: 14px; padding: 12px 16px; align-items: flex-start; position: relative; }
.feature + .feature::before { content: ""; position: absolute; top: 0; left: 60px; right: 0; height: .5px; background: var(--sep); }
.feature .ic { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; flex: none; }
.feature .ic svg { width: 19px; height: 19px; }
.feature b { display: block; font-size: 16px; font-weight: 600; margin-bottom: 2px; }
.feature span { font-size: 14px; color: var(--text2); line-height: 1.35; }
.theme-previews { display: flex; gap: 10px; padding: 12px 16px; overflow-x: auto; scrollbar-width: none; }
.theme-previews .tp { flex: none; width: 92px; height: 132px; border-radius: 14px; position: relative; overflow: hidden; cursor: pointer; box-shadow: inset 0 0 0 2px transparent; background: #0b0b10; display: flex; flex-direction: column; justify-content: space-between; padding: 12px 8px 10px; transition: transform .2s var(--spring); }
.theme-previews .tp.on { box-shadow: 0 0 0 2.5px var(--accent); }
.theme-previews .tp:active { transform: scale(.95); }
.theme-previews .tp .b1 { height: 22px; width: 68px; border-radius: 11px; margin-left: auto; }
.theme-previews .tp .b2 { height: 22px; width: 58px; border-radius: 11px; background: #333; }
.theme-previews .tp .em { text-align: center; font-size: 22px; }
.chat-preview { position: relative; height: 200px; overflow: hidden; border-radius: 0; }
.chat-preview .msgs { position: absolute; inset: 0; padding: 18px 10px; display: flex; flex-direction: column; gap: 6px; z-index: 1; }
.color-dots { display: flex; gap: 14px; flex-wrap: wrap; padding: 16px; justify-content: center; }
.color-dots button { width: 44px; height: 44px; border-radius: 50%; position: relative; transition: transform .2s var(--spring); }
.color-dots button.on::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2.5px solid var(--text); }
.color-dots button:active { transform: scale(.9); }
.textsize-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.textsize-row input { flex: 1; accent-color: var(--accent); }
.qr-box { background: #fff; border-radius: 28px; padding: 24px; margin: 20px auto; width: 270px; text-align: center; color: #000; }
.qr-box canvas { margin: 0 auto 12px; display: block; }
.qr-box .qn { font-weight: 700; font-size: 20px; color: var(--accent); }
.emoji-status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 4px; padding: 12px 16px; }
.emoji-status-grid button { height: 48px; font-size: 30px; border-radius: 12px; }
.emoji-status-grid button:active, .emoji-status-grid button.on { background: var(--cell-hl); }
.call-row { display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 16px; }

/* светлая тема — несколько уточнений */
:root[data-theme="light"] .page.grouped { background: #f2f2f7; }
:root[data-theme="light"] .search-bar, :root[data-theme="light"] .segment, :root[data-theme="light"] .chat-folders button { background: rgba(118, 118, 128, .12); }
:root[data-theme="light"] .search-head .sinput { background: rgba(118, 118, 128, .12); }
:root[data-theme="light"] .gbtn.accent { color: #fff; }
:root[data-theme="light"] .phone-box, :root[data-theme="light"] .code-boxes .box { background: #f2f2f7; }
:root[data-theme="light"] .auth { background: #fff; }

/* десктоп мелочи */
@media (min-width: 900px) {
  .msg-list { padding: 0 max(12px, calc((100% - 760px) / 2)); }
  .composer { padding-left: max(10px, calc((100% - 780px) / 2)); padding-right: max(10px, calc((100% - 780px) / 2)); }
  .chat-banner { left: max(12px, calc((100% - 760px) / 2)); right: max(12px, calc((100% - 760px) / 2)); }
  .chat-row { cursor: default; }
  .chat-row:hover { background: var(--cell-hl); }
  .chat-row.selected { background: rgba(var(--accent-rgb), .25); }
  .cell:hover { background: var(--cell-hl); }
  .cell.static:hover { background: none; }
}
@media (hover: hover) {
  .msg .bubble:hover { filter: none; }
}

/* ================= v1.1 ================= */

/* эмодзи всегда в «нормальном» шрифте */
.emoji-panel .grid button, .emoji-status-grid button, .ctx-reactions button, .reaction, .bubble.emoji-only, .react-burst, .em, .emoji-status { font-family: var(--emoji); }
.bubble.emoji-only .meta, .reaction .n { font-family: var(--font); }

/* плашка «Заблокировать / Добавить» как в тг */
.chat-actionbar { position: absolute; top: calc(var(--safe-top) + 62px); left: 10px; right: 10px; z-index: 29; height: 46px; border-radius: 23px; display: flex; align-items: center; padding: 0 6px 0 4px; animation: slideDown .4s var(--ease); }
.chat-actionbar .ab { flex: 1; height: 100%; font-size: 17px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-actionbar .ab.danger { color: var(--danger); }
.chat-actionbar .ab:active { opacity: .5; }
.chat-actionbar .ab-x { width: 34px; height: 34px; color: var(--text2); display: flex; align-items: center; justify-content: center; flex: none; }
.chat-actionbar .ab-x svg { width: 24px; height: 24px; }
.messages.with-banner { padding-top: calc(var(--safe-top) + 118px); }
@media (min-width: 900px) { .chat-actionbar { left: max(12px, calc((100% - 760px) / 2)); right: max(12px, calc((100% - 760px) / 2)); } }

/* уведомление сверху (как баннер iOS) */
.ntf { position: fixed; z-index: 600; top: calc(var(--safe-top) + 8px); left: 8px; right: 8px; max-width: 440px; margin: 0 auto; border-radius: 24px; padding: 10px 14px 10px 10px; display: flex; gap: 11px; align-items: center; cursor: pointer; background: var(--glass-strong); backdrop-filter: blur(30px) saturate(180%); -webkit-backdrop-filter: blur(30px) saturate(180%); box-shadow: 0 10px 40px rgba(0, 0, 0, .35), inset 0 0 0 .5px var(--glass-border); animation: ntfIn .5s var(--spring); touch-action: none; }
.ntf.out { animation: ntfOut .3s var(--ease) forwards; }
.ntf .nt-body { flex: 1; min-width: 0; }
.ntf .nt-top { display: flex; align-items: baseline; gap: 8px; }
.ntf .nt-title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.ntf .nt-time { font-size: 13px; color: var(--text2); flex: none; }
.ntf .nt-text { font-size: 15px; line-height: 1.3; color: var(--text); opacity: .92; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
@keyframes ntfIn { from { transform: translateY(-140%); } to { transform: none; } }
@keyframes ntfOut { to { transform: translateY(-140%); opacity: 0; } }

/* подсказки над списком чатов */
.list-banner { position: relative; padding: 11px 48px 11px 16px; margin: 0 0 4px; cursor: pointer; display: flex; gap: 12px; align-items: center; }
.list-banner::after { content: ""; position: absolute; left: 16px; right: 0; bottom: 0; height: .5px; background: var(--sep); }
.list-banner .lb-ic { width: 42px; height: 42px; border-radius: 50%; background: rgba(var(--accent-rgb), .15); color: var(--accent); display: flex; align-items: center; justify-content: center; flex: none; }
.list-banner .lb-ic svg { width: 22px; height: 22px; }
.list-banner .lb-t { font-size: 16px; font-weight: 600; }
.list-banner .lb-s { font-size: 14px; color: var(--text2); line-height: 1.3; margin-top: 2px; }
.list-banner .lb-x { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; color: var(--text3); display: flex; align-items: center; justify-content: center; }
.list-banner .lb-x svg { width: 18px; height: 18px; }
.list-banner:active { background: var(--cell-hl); }

/* пустые состояния */
.empty-ic { width: 96px; height: 96px; border-radius: 50%; background: rgba(var(--accent-rgb), .12); color: var(--accent); display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.empty-ic svg { width: 46px; height: 46px; }

/* стикеры */
.stk { position: relative; display: flex; align-items: center; justify-content: center; flex: none; }
.stk img, .stk video { width: 100%; height: 100%; object-fit: contain; display: block; }
.stk svg { width: 100% !important; height: 100% !important; }
.stk.err { color: var(--text3); font-size: 12px; }
.bubble.sticker-b { background: none !important; padding: 0; box-shadow: none !important; width: max-content; }
.bubble.sticker-b::before { display: none !important; }
.bubble.sticker-b .stk { cursor: pointer; }
.bubble.sticker-b .reply-quote { background: var(--glass) !important; backdrop-filter: blur(20px); margin: 0 0 6px; }
.bubble.sticker-b .meta.on-media { right: 2px; bottom: 2px; }
.ep-tabs { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 6px 10px; flex: none; position: relative; }
.ep-tabs button { padding: 6px 14px; border-radius: 16px; font-size: 14px; font-weight: 600; color: var(--text2); }
.ep-tabs button.active { background: var(--glass-hl); color: var(--text); }
.ep-tabs .ep-gear { position: absolute; right: 10px; width: 36px; height: 36px; padding: 0; display: flex; align-items: center; justify-content: center; }
.ep-tabs .ep-gear svg { width: 22px; height: 22px; }
.stk-packs { display: flex; gap: 4px; padding: 8px 10px 4px; overflow-x: auto; scrollbar-width: none; flex: none; }
.stk-packs::-webkit-scrollbar { display: none; }
.stk-packs button { width: 40px; height: 40px; border-radius: 12px; flex: none; display: flex; align-items: center; justify-content: center; color: var(--text2); }
.stk-packs button.active { background: var(--glass-hl); }
.stk-packs button svg { width: 24px; height: 24px; }
.stk-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); align-content: start; padding: 0 8px 8px; }
.stk-grid .cat-title { grid-column: 1 / -1; font-size: 13px; color: var(--text2); padding: 10px 6px 4px; text-transform: uppercase; }
.stk-grid .si { aspect-ratio: 1; padding: 6px; border-radius: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; position: relative; }
.stk-grid .si:active { background: var(--glass-hl); transform: scale(.94); }
.stk-grid .si .stk { width: 100%; height: 100%; }
.stk-grid .si .del { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; border-radius: 50%; background: var(--danger); color: #fff; display: flex; align-items: center; justify-content: center; }
.stk-grid .si .del svg { width: 12px; height: 12px; }
.stk-grid .si.add { border: 1.5px dashed var(--text3); color: var(--text2); }
.stk-grid .si.add svg { width: 28px; height: 28px; }
.stk-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--text2); font-size: 15px; text-align: center; padding: 16px; }
.set-row-thumb { width: 40px; height: 40px; flex: none; }
.pack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 4px; padding: 0 12px 12px; }
.pack-grid .si { aspect-ratio: 1; padding: 6px; border-radius: 14px; position: relative; cursor: pointer; }
.pack-grid .si:active { background: var(--cell-hl); }
.pack-grid .si .stk { width: 100%; height: 100%; }
.pack-grid .si .del { position: absolute; top: 2px; right: 2px; width: 24px; height: 24px; border-radius: 50%; background: var(--danger); color: #fff; display: flex; align-items: center; justify-content: center; z-index: 2; }
.pack-grid .si .del svg { width: 13px; height: 13px; }
.pack-grid .si.add { border: 1.5px dashed var(--text3); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.pack-grid .si.add svg { width: 30px; height: 30px; }

/* сегмент выбора темы */
.theme-pick { display: flex; gap: 12px; padding: 14px 16px 6px; justify-content: center; }
.theme-pick button { flex: 1; max-width: 120px; display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 14px; color: var(--text2); }
.theme-pick .tpv { width: 100%; aspect-ratio: .62; border-radius: 16px; box-shadow: inset 0 0 0 1px var(--sep); position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; padding: 10px 8px; gap: 6px; }
.theme-pick .tpv i { display: block; height: 12px; border-radius: 6px; }
.theme-pick button.on { color: var(--accent); font-weight: 600; }
.theme-pick button.on .tpv { box-shadow: 0 0 0 2.5px var(--accent); }

/* iPhone в режиме приложения */
:root.standalone .auth-inner { padding-top: calc(var(--safe-top) + 64px); }
.composer .gbtn[data-a=mic] { touch-action: none; }
