* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
/* размер текста сообщений — из настроек */
:root { --msg-scale: 1; }
body { font: 15px/1.38 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--text); background: var(--bg); overflow: hidden; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.app { display: flex; height: 100%; }

/* ---- боковая панель ---- */
.side { width: 340px; flex: none; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--bg); position: relative; }
.side-head { padding: 8px 10px; display: flex; gap: 6px; align-items: center; }
.icon-btn { border: 0; background: none; width: 40px; height: 40px; border-radius: 50%; font-size: 20px; color: var(--muted); flex: none; display: grid; place-items: center; }
.icon-btn:hover { background: var(--hover); }
.search { flex:1; min-width:0; outline:0; }
.list { flex: 1; overflow-y: auto; padding: 0 6px 6px; }
.item { display: flex; gap: 12px; padding: 8px 10px; cursor: pointer; align-items: center; border-radius: 10px; }
.item:hover { background: var(--hover); }


.ava { position: relative; width: 50px; height: 50px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 19px; user-select: none; }
.ava.online::after { content: ""; position: absolute; right: 1px; bottom: 1px; width: 12px; height: 12px; border-radius: 50%; background: #4dd964; border: 2px solid var(--bg); }

.meta { flex: 1; min-width: 0; }
.row { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.time { font-size: 12px; color: var(--muted); flex: none; }
.sub { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.typing { color: var(--accent); }
.badge { background: var(--badge); color: #fff; font-size: 12px; font-weight: 600; min-width: 22px; height: 22px; border-radius: 11px; padding: 0 7px; display: grid; place-items: center; flex: none; }
.item.active .badge { background: #fff; color: var(--active); }
.empty { padding: 24px; color: var(--muted); text-align: center; }

/* меню */
.menu { position: absolute; top: 52px; left: 10px; background: var(--bg); border-radius: 12px; box-shadow: 0 4px 24px rgba(0,0,0,.2); padding: 6px; z-index: 5; min-width: 220px; }
.menu .me { padding: 8px 12px 10px; display: flex; gap: 10px; align-items: center; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu .me .ava { width: 36px; height: 36px; font-size: 15px; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: 8px; }
.menu button:hover { background: var(--hover); }
.menu button.danger { color: var(--danger); }

/* ---- окно чата ---- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--chat-bg); }
.top { display: flex; gap: 12px; align-items: center; padding: 6px 14px; background: var(--bg); border-bottom: 1px solid var(--line); min-height: 56px; }

.top .status { font-size: 13px; color: var(--muted); }

.back { display: none; }
.msgs { flex: 1; overflow-y: auto; padding: 10px 0; }
.msgs-inner { max-width: 760px; margin: 0 auto; padding: 0 14px; display: flex; flex-direction: column; }
.day-group { display: flex; flex-direction: column; }
.day { align-self: center; position: sticky; top: 4px; z-index: 1; font-size: 13px; font-weight: 500; color: #fff; background: rgba(0,0,0,.28); padding: 3px 11px; border-radius: 12px; margin: 10px 0 6px; }
.bubble { max-width: min(520px, 82%); padding: 6px 10px 6px; border-radius: 14px; background: var(--in); align-self: flex-start; overflow-wrap: anywhere; white-space: pre-wrap; box-shadow: var(--shadow); margin-top: 2px; }

.bubble.mine { align-self: flex-end; background: var(--out); }
.bubble:not(.last):not(.mine) { border-bottom-left-radius: 6px; }
.bubble:not(.first):not(.mine) { border-top-left-radius: 6px; }
.bubble.mine:not(.last) { border-bottom-right-radius: 6px; }
.bubble.mine:not(.first) { border-top-right-radius: 6px; }
.bubble .who { font-size: 13px; font-weight: 600; display: block; }
.bubble .t { font-size: 11px; color: var(--muted); float: right; margin: 7px 0 -4px 10px; white-space: nowrap; user-select: none; }
.bubble .ck { color: var(--check); margin-left: 3px; letter-spacing: -4px; padding-right: 4px; }
.note { align-self: center; font-size: 13px; color: var(--muted); background: var(--bg); padding: 3px 11px; border-radius: 12px; margin: 8px 0; }
.blank { margin: 40vh auto 0; background: rgba(0,0,0,.25); color: #fff; padding: 4px 14px; border-radius: 14px; width: fit-content; }

/* ввод */
form.send { display: flex; gap: 8px; padding: 8px 14px 12px; align-items: flex-end; max-width: 788px; width: 100%; margin: 0 auto; }
.send textarea { flex: 1; resize: none; border: 0; outline: 0; background: var(--bg); border-radius: 20px; padding: 11px 16px; max-height: 180px; line-height: 1.35; box-shadow: var(--shadow); }
.send button { border: 0; background: var(--accent); color: #fff; width: 44px; height: 44px; border-radius: 50%; font-size: 18px; flex: none; box-shadow: var(--shadow); }
.send button:disabled, .send textarea:disabled { opacity: .55; cursor: default; }

/* ---- модальные окна ---- */
.overlay { position: fixed; inset: 0; background: var(--chat-bg); display: grid; place-items: center; z-index: 10; }
.overlay.dim { background: rgba(0,0,0,.45); }
.card { background: var(--bg); padding: 28px; border-radius: 16px; width: min(360px, 92vw); display: flex; flex-direction: column; gap: 12px; text-align: center; box-shadow: 0 6px 30px rgba(0,0,0,.2); }
.card h1 { margin: 0 0 4px; font-size: 22px; }
.card input { border: 1px solid var(--line); border-radius: 10px; padding: 11px 14px; background: var(--bg); outline: 0; }
.card input:focus { border-color: var(--accent); }
.card .primary { border:0; padding:11px; }
.card .secondary { border: 0; background: none; color: var(--accent); padding: 6px; }
.card .err { color: var(--danger); min-height: 1.3em; font-size: 14px; }
.card .ok { color: var(--badge); }

@media (max-width: 700px) {
  .side { width: 100%; border-right: 0; }
  .main { display: none; }
  .app.open .side { display: none; }
  .app.open .main { display: flex; }
  .back { display: grid; }
  .msgs-inner { padding: 0 8px; }
  form.send { padding: 6px 8px 8px; }
  /* шапка на узком экране: «В контакты» — в карточке профиля (тап по шапке) */
  .top { gap: 4px; padding: 6px 6px; }
  .top .icon-btn { width: 34px; }
  .top .meta { margin-left: 4px; }
  #contactBtn { display: none; }
}

.section { padding: 10px 12px 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.top-btn { flex:none; }
.top-btn.added { background: var(--hover); color: var(--muted); }
.bubble a { color: var(--accent); }
.bubble .ck.wait { letter-spacing: 0; font-size: 10px; }

/* цитата, пометки, реакции */
.quote { display: block; border-left: 3px solid var(--accent); padding: 2px 8px; margin: 2px 0 4px; border-radius: 4px; background: rgba(150,125,220,.08); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.quote b { display: block; font-size: 13px; color: var(--accent); }
.quote span { font-size: 14px; color: var(--muted); }
.quote.gone span { font-style: italic; }
.bubble .edited { font-size: 11px; color: var(--muted); margin-right: 4px; }
.reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; clear: both; }
.chip { border: 0; border-radius: 12px; padding: 1px 8px; font-size: 13px; background: rgba(150,125,220,.12); color: var(--text); }
.chip.mine { background: var(--accent); color: #fff; }
.bubble.flash { animation: flash 1.2s ease-out; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: var(--shadow); } }

/* контекстное меню */
.ctx { position: fixed; z-index: 20; background: var(--bg); border-radius: 12px; box-shadow: 0 4px 24px rgba(0,0,0,.25); padding: 6px; min-width: 200px; }
.ctx-reacts { display: flex; gap: 2px; padding: 2px 2px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.ctx-reacts button { border: 0; background: none; font-size: 20px; padding: 4px; border-radius: 8px; flex: 1; }
.ctx-reacts button:hover { background: var(--hover); transform: scale(1.15); }
.ctx > button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 12px; border-radius: 8px; }
.ctx > button:hover { background: var(--hover); }
.ctx > button.danger { color: var(--danger); }

/* полоска ответа/правки над вводом */
.compose { display: flex; align-items: center; gap: 10px; max-width: 788px; width: 100%; margin: 0 auto; padding: 6px 14px 0; }
.compose-icon { color: var(--accent); font-size: 20px; width: 24px; text-align: center; }
.compose-body { flex: 1; min-width: 0; border-left: 2px solid var(--accent); padding-left: 8px; }
.compose-title { font-size: 13px; font-weight: 600; color: var(--accent); }
.compose-text { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bubble { -webkit-touch-callout: none; }

/* поиск по сообщениям */
mark { background: rgba(255, 200, 0, .45); color: inherit; border-radius: 3px; padding: 0 1px; }
.item .sub mark { background: rgba(255, 200, 0, .45); }
.chat-search { position: relative; display: flex; align-items: center; gap: 8px; padding: 6px 14px; background: var(--bg); border-bottom: 1px solid var(--line); }
.chat-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: var(--hover); border-radius: 18px; padding: 8px 14px; }
.chat-search-info { font-size: 13px; color: var(--muted); white-space: nowrap; }
.chat-results { position: absolute; left: 0; right: 0; top: 100%; z-index: 4; background: var(--bg); max-height: 50vh; overflow-y: auto; box-shadow: 0 6px 16px rgba(0,0,0,.15); padding: 4px 6px; }
.chat-results .item .ava { width: 40px; height: 40px; font-size: 16px; }

/* кнопка «вниз» и черновики */
.main { position: relative; }
.down { position: absolute; right: 18px; bottom: 76px; z-index: 3; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--bg); color: var(--muted); font-size: 20px; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.down .badge { position: absolute; top: -6px; right: -4px; }
.sub .draft { color: var(--danger); }

/* вложения */
.send .attach { width: 40px; height: 44px; font-size: 20px; }
.attach-bar { display: flex; gap: 8px; overflow-x: auto; max-width: 788px; width: 100%; margin: 0 auto; padding: 8px 14px 0; }
.att { position: relative; flex: none; width: 72px; height: 72px; border-radius: 10px; background: var(--bg); box-shadow: var(--shadow); display: grid; place-items: center; overflow: hidden; font-size: 11px; text-align: center; color: var(--muted); padding: 4px; }
.att img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.att button { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border: 0; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; line-height: 20px; padding: 0; }
.photo { display: block; max-width: 100%; border-radius: 10px; margin: 2px 0 4px; cursor: zoom-in; background: rgba(0,0,0,.06); object-fit: cover; }
video.photo { cursor: auto; }
.bubble audio { display: block; width: 260px; max-width: 100%; margin: 2px 0 4px; }
.file-card { display: flex; align-items: center; gap: 10px; margin: 2px 0 4px; min-width: 200px; text-decoration: none; color: inherit; }
.file-card .ic { width: 42px; height: 42px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 18px; flex: none; }
.file-card .fn { font-weight: 500; overflow-wrap: anywhere; }
.file-card .fs { font-size: 13px; color: var(--muted); }
.upl { font-size: 12px; color: var(--muted); margin: 0 0 2px; }
.upl.err { color: var(--danger); cursor: pointer; }
.viewer { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.9); display: grid; place-items: center; cursor: zoom-out; }
.viewer img { max-width: 96vw; max-height: 90vh; object-fit: contain; }
.viewer-dl { position: fixed; right: 16px; top: 12px; color: #fff; background: rgba(255,255,255,.15); padding: 6px 14px; border-radius: 16px; text-decoration: none; }
.drop-hint { position: fixed; inset: 0; z-index: 25; background: rgba(150,125,220,.25); border: 3px dashed var(--accent); display: grid; place-items: center; font-size: 22px; color: var(--accent); pointer-events: none; }

/* голосовые */
.send #micBtn, .rec #recSend { border: 0; background: var(--accent); color: #fff; width: 44px; height: 44px; border-radius: 50%; font-size: 18px; flex: none; box-shadow: var(--shadow); }
form.send { position: relative; }
.rec { position: absolute; inset: 8px 14px 12px; display: flex; align-items: center; gap: 10px; background: var(--bg); border-radius: 22px; padding: 0 0 0 16px; box-shadow: var(--shadow); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.rec-hint { flex: 1; color: var(--muted); }
.voice { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.send .attach, .rec .icon-btn { background: none; box-shadow: none; color: var(--muted); }
.send .attach:hover, .rec .icon-btn:hover { background: var(--hover); }

/* группы */
.top .meta.clickable { cursor: pointer; }
.group-card { text-align: left; max-height: 86vh; overflow-y: auto; width: min(420px, 94vw); }
.group-card h1 { text-align: center; }
.group-card .label { font-size: 13px; color: var(--muted); margin-top: 6px; }
.pick { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: 8px; cursor: pointer; }
.pick:hover { background: var(--hover); }
.pick .ava { width: 36px; height: 36px; font-size: 15px; }
.pick .grow { flex: 1; min-width: 0; }
.pick .sub { font-size: 13px; }
.pick input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.pick .x { border: 0; background: none; color: var(--muted); font-size: 16px; padding: 4px 8px; border-radius: 6px; }
.pick .x:hover { background: var(--hover); color: var(--danger); }
.tag { font-size: 12px; color: var(--accent); }
.card .danger-btn { border: 0; background: none; color: var(--danger); padding: 10px; border-radius: 10px; }
.card .danger-btn:hover { background: var(--hover); }

/* упоминания */
.mention { color: var(--accent); font-weight: 500; }
.mention.me { background: rgba(150,125,220,.15); border-radius: 4px; padding: 0 2px; }
.bubble.mentioned { box-shadow: 0 0 0 2px rgba(150,125,220,.55), var(--shadow); }
.badge.at { background: var(--accent); }
.mention-box { position: absolute; left: 54px; bottom: 100%; z-index: 6; background: var(--bg); border-radius: 12px; box-shadow: 0 4px 18px rgba(0,0,0,.2); padding: 4px; min-width: 220px; max-width: 320px; }
.mention-box .pick { padding: 5px 8px; }
.mention-box .pick.sel { background: var(--hover); }

/* закреп, звук */
.pin-bar { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 14px; background: var(--bg); border-bottom: 1px solid var(--line); }
.pin-body { flex: 1; min-width: 0; border-left: 2px solid var(--accent); padding-left: 8px; cursor: pointer; }
.pin-title { font-size: 13px; font-weight: 600; color: var(--accent); }
.pin-text { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .muted-ic { font-size: 12px; margin-left: 4px; opacity: .7; }
.badge.quiet { background: var(--muted); }

/* приглашения */
.invite-link { display: flex; gap: 6px; }
.invite-link input { flex: 1; min-width: 0; font-size: 13px; }
.invite-link button, .invite-row button { border: 0; background: var(--hover); border-radius: 8px; padding: 0 12px; }
.invite-row { display: flex; align-items: center; gap: 8px; padding: 6px 2px; font-size: 14px; }
.invite-row code { flex: 1; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
#inviteHint { text-align: center; }

.ava { background-size: cover; background-position: center; }
.bubble, .send textarea { font-size: calc(15px * var(--msg-scale)); }
.bubble .who { font-size: calc(13px * var(--msg-scale)); }

/* профиль и настройки */
.menu .me .meta { text-align: left; }
.menu .me .sub { font-size: 13px; }
.top .ava { cursor: pointer; }
.sheet { position: relative; background: var(--bg); width: min(440px, 100vw); max-height: 92vh; overflow-y: auto; border-radius: 16px; box-shadow: 0 6px 30px rgba(0,0,0,.25); padding-bottom: 12px; overflow-x: hidden; }
.sheet-bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; padding: 6px 6px 6px 20px; background: var(--bg); }
.sheet-bar h2 { flex: 1; margin: 0; font-size: 17px; }
.hero { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 20px 18px; text-align: center; }
.hero-wrap { position: relative; margin-bottom: 10px; }
.hero-ava { width: 120px; height: 120px; font-size: 48px; }
.hero-ava.zoom { cursor: zoom-in; }
.hero-ava.online::after { width: 20px; height: 20px; right: 6px; bottom: 6px; border-width: 3px; }
.hero .cam { position: absolute; right: -4px; bottom: -4px; width: 42px; height: 42px; border-radius: 50%; border: 3px solid var(--bg); background: var(--accent); color: #fff; font-size: 17px; display: grid; place-items: center; padding: 0; }
.hero-name { font-size: 22px; font-weight: 600; overflow-wrap: anywhere; }
.hero-sub { color: var(--muted); font-size: 14px; }
.hero-sub.on { color: var(--accent); }
.hero .link { border: 0; background: none; color: var(--danger); font-size: 14px; padding: 6px; margin-top: 4px; }
.pf-sec { border-top: 8px solid var(--hover); padding: 4px 0; }
.pf-sec h3 { margin: 10px 20px 2px; font-size: 14px; font-weight: 600; color: var(--accent); }
.pf-row { display: flex; align-items: center; gap: 16px; width: 100%; min-height: 52px; padding: 6px 20px; border: 0; background: none; text-align: left; }
button.pf-row:hover { background: var(--hover); }
.pf-row .ic { width: 24px; text-align: center; font-size: 18px; color: var(--muted); flex: none; }
.pf-row .grow { flex: 1; min-width: 0; }
.pf-sec .val { color: var(--muted); font-size: 13px; }
.pf-sec .val.ok { color: var(--badge); }
.pf-bio { overflow-wrap: anywhere; }
.pf-right { display: flex; align-items: center; gap: 10px; }
.pf-note { padding: 12px 20px 0; font-size: 13px; color: var(--muted); text-align: center; border-top: 8px solid var(--hover); }
.field { display: block; padding: 8px 20px; }
.field .lbl { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input:not([type=range]), .field textarea, .pass-form input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--bg); outline: 0; resize: none; }
.field input:focus, .field textarea:focus, .pass-form input:focus { border-color: var(--accent); }
.field input[type=range] { width: 100%; accent-color: var(--accent); }
.seg { display: flex; gap: 3px; padding: 3px; border-radius: 10px; background: var(--hover); }
.seg button { flex: 1; border: 0; background: none; border-radius: 8px; padding: 7px 4px; font-size: 14px; color: var(--muted); }
.seg button.sel { background: var(--bg); color: var(--text); font-weight: 500; box-shadow: var(--shadow); }
.size-demo { display: flex; flex-direction: column; margin-top: 8px; padding: 10px 12px 12px; border-radius: 12px; background: var(--chat-bg); }
.pill { border: 0; background: var(--hover); color: var(--accent); border-radius: 16px; padding: 6px 12px; font-size: 14px; flex: none; }
.switch { appearance: none; position: relative; width: 42px; height: 24px; margin: 0; border-radius: 12px; background: var(--muted); cursor: pointer; flex: none; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .15s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(18px); }
.pass-form { display: flex; flex-direction: column; gap: 8px; padding: 2px 20px 12px 60px; }
.pass-form .primary { border: 0; background: var(--accent); color: #fff; border-radius: 10px; padding: 10px; }
.pass-form .primary:disabled { opacity: .6; }
.pass-form .err { color: var(--danger); font-size: 14px; }
.pass-form .err:empty { display: none; }
.pf-actions { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; padding: 0 16px 16px; }
.pf-actions button { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; border-radius: 12px; padding: 10px 4px 8px; background: var(--hover); color: var(--accent); font-size: 13px; }
.pf-actions .ic { font-size: 20px; }
.pf-toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 11; background: rgba(0,0,0,.78); color: #fff; padding: 7px 16px; border-radius: 18px; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.pf-toast.show { opacity: 1; }
.crop-card { width: min(360px, 94vw); }
.crop-stage { position: relative; margin: 0 auto; border-radius: 12px; overflow: hidden; background: #000; }
.crop-stage canvas { display: block; cursor: grab; touch-action: none; }
.crop-stage canvas:active { cursor: grabbing; }
.crop-mask { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(255,255,255,.85); box-shadow: 0 0 0 400px rgba(0,0,0,.55); pointer-events: none; }
.crop-zoom { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 20px; }
.crop-zoom input { flex: 1; accent-color: var(--accent); }
.crop-card .label { font-size: 13px; color: var(--muted); }
.crop-btns { display: flex; gap: 8px; }
.crop-btns button { flex: 1; }
@media (max-width: 700px) {
  #profileDlg { place-items: stretch; grid-template-columns: minmax(0, 1fr); }
  .sheet { width: 100%; max-height: none; height: 100%; border-radius: 0; }
}

/* меню вложений и опросы */
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; }
.setting input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); }
.attach-menu { position: absolute; left: 14px; bottom: 100%; z-index: 6; background: var(--bg); border-radius: 12px; box-shadow: 0 4px 18px rgba(0,0,0,.2); padding: 4px; }
.attach-menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 14px; border-radius: 8px; white-space: nowrap; }
.attach-menu button:hover { background: var(--hover); }
.poll { margin: 4px 0 2px; min-width: 240px; }
.poll-opt { position: relative; display: flex; justify-content: space-between; gap: 10px; width: 100%; border: 1px solid var(--line); background: none; border-radius: 10px; padding: 7px 10px; margin: 4px 0; text-align: left; overflow: hidden; }
.poll-opt .bar { position: absolute; inset: 0 auto 0 0; background: rgba(150,125,220,.18); z-index: 0; transition: width .2s; }
.poll-opt span { position: relative; z-index: 1; }
.poll-opt.mine { border-color: var(--accent); }
.poll-opt.mine .lbl::before { content: '✓ '; color: var(--accent); }
.poll-meta { font-size: 12px; color: var(--muted); }
.poll-form .opt-row { display: flex; gap: 6px; }
.poll-form .opt-row input { flex: 1; }
.poll-form .opt-row button { border: 0; background: none; color: var(--muted); font-size: 16px; }
.poll-form .add { border: 0; background: none; color: var(--accent); text-align: left; padding: 4px 0; }

/* исчезающие сообщения */

#timerBtn.on { opacity: 1; background: rgba(150,125,220,.15); }
.timer-menu { position: absolute; right: 60px; top: 52px; z-index: 6; background: var(--bg); border-radius: 12px; box-shadow: 0 4px 18px rgba(0,0,0,.2); padding: 4px; min-width: 200px; }
.timer-menu .label { padding: 6px 12px 2px; font-size: 13px; color: var(--muted); }
.timer-menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 12px; border-radius: 8px; }
.timer-menu button:hover { background: var(--hover); }
.timer-menu button.sel::after { content: ' ✓'; color: var(--accent); }
.bubble .t .exp { margin-right: 3px; }

/* стикеры и крупные эмодзи */
.sticker-panel { position: absolute; left: 14px; right: 14px; bottom: 100%; z-index: 6; background: var(--bg); border-radius: 12px; box-shadow: 0 4px 18px rgba(0,0,0,.2); padding: 8px; display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; max-height: 260px; overflow-y: auto; }
.sticker-panel .tile { aspect-ratio: 1; border: 0; border-radius: 10px; background: var(--hover) center / contain no-repeat; cursor: pointer; }
.sticker-panel .tile:hover { outline: 2px solid var(--accent); }
.sticker-panel .add { font-size: 28px; color: var(--muted); }
.sticker-panel .hint { grid-column: 1 / -1; font-size: 13px; color: var(--muted); padding: 2px 4px; }
.bubble.bare { background: none; box-shadow: none; padding: 0; }
.bubble.bare .t { background: rgba(0,0,0,.35); color: #fff; border-radius: 10px; padding: 1px 6px; margin-top: -18px; position: relative; }
img.sticker { display: block; max-width: 160px; max-height: 160px; cursor: default; }
.bubble.jumbo .txt { font-size: calc(44px * var(--msg-scale)); line-height: 1.15; }
.bubble.jumbo .t { background: none; color: var(--muted); margin: 0 0 0 8px; padding: 0; float: none; vertical-align: bottom; }

/* звонок */
.call { position: fixed; inset: 0; z-index: 40; background: #0e1621; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.call #remoteVideo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #0e1621; }
.call #localVideo { position: absolute; right: 16px; top: 16px; width: 28vw; max-width: 200px; border-radius: 12px; background: #000; box-shadow: 0 2px 12px rgba(0,0,0,.5); z-index: 2; transform: scaleX(-1); }
.call.audio #remoteVideo, .call.audio #localVideo, .call .hidden-video { display: none; }
.call-info { position: relative; z-index: 1; text-align: center; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.call.video.live .call-info { position: absolute; top: 20px; left: 20px; text-align: left; }
.call.video.live .call-ava { display: none; }
.call-ava { width: 120px; height: 120px; font-size: 48px; margin: 0 auto 16px; }
.call-name { font-size: 24px; font-weight: 600; }
.call-status { color: #b8c7d6; margin-top: 4px; }
.call-btns { position: absolute; bottom: 40px; display: flex; gap: 22px; z-index: 2; }
.call-btns button { width: 64px; height: 64px; border-radius: 50%; border: 0; font-size: 26px; background: rgba(255,255,255,.18); color: #fff; }
.call-btns button.off { background: #fff; color: #0e1621; }
.call-btns .accept { background: #4dd964; }
.call-btns .hang { background: #e53935; }
.call.ringing .call-ava { animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(77,217,100,.6); } 50% { box-shadow: 0 0 0 18px rgba(77,217,100,0); } }


/* СВОИ / Тёплый круг. Shared by web, PWA and Android WebView. */
:root {
  --bg:#fcfbf8; --chat-bg:#f2f0e9; --panel:#fffefa; --line:#e3e4dc;
  --text:#203c37; --muted:#697873; --hover:#eeefe8; --active:#e1ebe2;
  --in:#fffefa; --out:#deebe0; --accent:#286653; --on-accent:#fff;
  --badge:#286653; --check:#286653; --danger:#b64639; --shadow:0 5px 24px #233b3009;
  --electric:#f2ae90; --lavender:#e2ead8; --ink:#263d35; --coral:#bd583e;
  --overlay:#0b211b99; --switch-on:#568267; --poll-bar:#66976c26;
  color-scheme:light;
}
@media(prefers-color-scheme:dark) {
  :root:not([data-theme="light"]) {
    --bg:#161719; --chat-bg:#0e0f10; --panel:#1d1f21; --line:#2b2e31;
    --text:#ececee; --muted:#9b9fa5; --hover:#222427; --active:#22382f;
    --in:#1f2123; --out:#1d4639; --accent:#7ccfa4; --on-accent:#0e1a15;
    --badge:#7ccfa4; --check:#8fd9b2; --danger:#ff8f80; --lavender:#1d3a30; --coral:#f2ae90;
    --overlay:#000a; --switch-on:#4fa57c; --poll-bar:#7ccfa422;
    --shadow:0 5px 24px #0005; color-scheme:dark;
  }
}
:root[data-theme="dark"] {
  --bg:#161719; --chat-bg:#0e0f10; --panel:#1d1f21; --line:#2b2e31;
  --text:#ececee; --muted:#9b9fa5; --hover:#222427; --active:#22382f;
  --in:#1f2123; --out:#1d4639; --accent:#7ccfa4; --on-accent:#0e1a15;
  --badge:#7ccfa4; --check:#8fd9b2; --danger:#ff8f80; --lavender:#1d3a30; --coral:#f2ae90;
  --overlay:#000a; --switch-on:#4fa57c; --poll-bar:#7ccfa422;
  --shadow:0 5px 24px #0005; color-scheme:dark;
}
body { background:var(--chat-bg); font-family:Inter,"Segoe UI",system-ui,sans-serif; letter-spacing:-.25px; }
button,input,textarea,a { -webkit-tap-highlight-color:transparent; }
button { transition:background .16s,box-shadow .16s,transform .16s; }
button:active { transform:translateY(1px); }
button:focus-visible,a:focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
input:focus-visible,textarea:focus-visible { outline:2px solid var(--accent); outline-offset:-2px; }
::selection { background:var(--electric); color:var(--ink); }
* { scrollbar-width:thin; scrollbar-color:var(--line) transparent; }
.app { height:100vh; height:100dvh; max-width:1800px; margin:auto; }
.side { width:354px; background:var(--bg); padding-top:env(safe-area-inset-top); }
.brand { display:flex; align-items:center; gap:10px; padding:28px 26px 22px; font-size:29px; line-height:1; font-weight:750; letter-spacing:-1.7px; }
.brand-mark { display:grid; place-items:center; width:38px; height:38px; color:var(--accent); }
.creature { width:100%; height:100%; display:block; }
.brand-caption { display:block; margin-top:7px; font:9px/1.3 system-ui,sans-serif; letter-spacing:1.2px; color:var(--muted); }
.connection { margin-left:auto; color:var(--muted); font:10px system-ui,sans-serif; letter-spacing:0; white-space:nowrap; }
.connection::before { content:''; width:6px; height:6px; display:inline-block; background:var(--muted); border-radius:50%; margin-right:6px; }
.connection.live::before { background:#5e9264; box-shadow:0 0 0 3px #6d9a6920; }
.side-intro { display:flex; justify-content:space-between; align-items:center; padding:10px 26px 23px; }
.side-intro h1 { margin:0; font-size:32px; font-weight:650; line-height:1.15; letter-spacing:-1.5px; }
.side-intro h1 span { color:var(--muted); }
.side-intro sup { display:none; }
.create-chat { width:44px; height:44px; border:0; border-radius:50%; background:var(--accent); color:var(--on-accent); font-size:28px; line-height:1; }
.create-chat:hover { box-shadow:0 0 0 5px var(--hover); }
.side-head { padding:0 20px; gap:6px; }
.icon-btn { width:44px; height:44px; border-radius:13px; font-size:18px; color:var(--muted); }
.icon-btn:hover { color:var(--text); }
.search { background:var(--hover); border:1px solid transparent; border-radius:12px; padding:12px; font-size:13px; min-height:44px; }
.search::placeholder { color:var(--muted); opacity:1; }
#menuBtn { width:36px; }
.qr-btn { background:var(--hover); }
.chat-filters { display:flex; gap:6px; padding:20px 24px 13px; }
.chat-filters button { min-height:36px; padding:7px 12px; border:0; border-radius:9px; background:none; color:var(--muted); font-size:12px; }
.chat-filters button.selected { background:var(--active); color:var(--text); font-weight:650; }
.chat-filters button:hover { background:var(--hover); }
.list-heading { display:flex; justify-content:space-between; padding:11px 26px; color:var(--muted); font:9px/1.4 system-ui,sans-serif; letter-spacing:1.4px; }
.list { min-height:0; padding:2px 12px 12px; }
.item { display:flex; width:100%; text-align:left; border:1px solid transparent; background:none; padding:14px 12px; border-radius:14px; gap:12px; margin-bottom:3px; }
.item.active { background:var(--active); color:var(--text); border-color:var(--line); }
.item.active .sub,.item.active .time,.item.active .typing { color:var(--muted); }
.item .sub { font-size:13px; margin-top:6px; } .item .name { font-size:14px; font-weight:650; }
.item .time { font-size:10px; font-variant-numeric:tabular-nums; }
.ava { width:47px; height:47px; border-radius:50%; font-size:18px; font-weight:550; }
.ava.online::after { background:#6a9968; border-color:var(--bg); }
.item.active .ava.online::after { border-color:var(--active); }
.badge { background:var(--accent); color:var(--on-accent); font-size:10px; min-width:19px; height:19px; }
.item.active .badge { background:var(--accent); color:var(--on-accent); }
.side-foot { display:flex; justify-content:space-between; align-items:center; margin:0 24px; padding:14px 2px; font-size:10px; color:var(--muted); border-top:1px solid var(--line); }
.side-foot span:last-child { font-size:18px; color:var(--coral); }
.dock { display:flex; gap:4px; margin:0 16px max(16px,env(safe-area-inset-bottom)); padding:5px; border:1px solid var(--line); border-radius:16px; background:var(--panel); flex:none; }
.dock button { border:0; background:none; flex:1; display:flex; align-items:center; justify-content:center; gap:7px; border-radius:11px; min-height:44px; color:var(--muted); }
.dock button span { font-size:11px; } .dock button.selected { color:var(--accent); background:var(--hover); font-weight:600; }
.dock svg { width:18px; height:18px; }
.menu { top:201px; left:20px; min-width:265px; border:1px solid var(--line); border-radius:18px; padding:8px; box-shadow:0 16px 50px #142b2526; }
.menu button { padding:12px; min-height:44px; font-size:14px; border-radius:10px; }
.main { background-image:radial-gradient(var(--line) .7px,transparent .7px); background-size:20px 20px; }
.top { position:relative; min-height:84px; padding:16px 30px; gap:13px; background:var(--bg); z-index:4; }
.top .ava { width:44px; height:44px; font-size:18px; }
.top .name { font-size:16px; } .top .status { margin-top:4px; font-size:12px; }
.top .status.on { color:var(--accent); }
.top-actions { display:flex; align-items:center; gap:3px; }
.top-btn { font-size:12px; padding:9px 12px; background:var(--hover); color:var(--text); border:1px solid var(--line); border-radius:10px; }
.more-btn { display:none; }
#muteBtn.is-muted { color:var(--danger); }
#timerBtn { opacity:1; } #timerBtn.on { color:var(--accent); background:var(--hover); }
.msgs { padding:24px 0; overscroll-behavior:contain; }
.msgs-inner { max-width:900px; padding:0 40px; }
.day { background:var(--bg); color:var(--muted); padding:6px 14px; border:1px solid var(--line); font-size:11px; border-radius:20px; margin:3px 0 20px; }
.bubble { padding:11px 15px; border-radius:18px; line-height:1.55; box-shadow:0 2px 3px #24382b04; border:1px solid var(--line); max-width:min(540px,84%); }
.bubble.mine { border-color:transparent; } .bubble.first { margin-top:15px; }
.bubble.last:not(.mine) { border-bottom-left-radius:5px; } .bubble.mine.last { border-bottom-right-radius:5px; }
.bubble .who { margin-bottom:4px; color:var(--accent) !important; } .bubble .t { font-size:10px; margin-top:9px; }
.bubble.bare { border:0; } .bubble.jumbo .t { color:var(--muted); }
.quote { background:var(--hover); border-left-color:var(--accent); border-radius:8px; padding:7px 10px; }
.reacts { gap:6px; } .chip { border-radius:8px; padding:4px 8px; background:var(--hover); }
.chip.mine { background:var(--accent); color:var(--on-accent); }
.blank { max-width:330px; width:calc(100% - 40px); margin:17vh auto 0; background:none; color:var(--muted); text-align:center; padding:0; font-size:14px; line-height:1.7; }
.blank::before { content:'✳'; display:grid; place-items:center; width:76px; height:76px; margin:0 auto 24px; border-radius:50%; background:var(--lavender); color:var(--accent); font-size:48px; }
.empty { color:var(--muted); font-size:13px; line-height:1.7; padding:26px 16px; }
form.send { width:calc(100% - 64px); max-width:820px; padding:8px; gap:6px; margin:8px auto 24px; border:1px solid var(--line); border-radius:20px; background:var(--panel); align-items:flex-end; box-shadow:0 7px 28px #203c3709; }
form.send:focus-within { border-color:var(--accent); }
.send textarea:focus-visible { outline:none; }
.send textarea { background:none; border-radius:10px; box-shadow:none; padding:12px 9px; min-width:0; line-height:1.4; }
.send > button,.send #micBtn,.rec #recSend { display:grid; place-items:center; width:46px; height:46px; border-radius:14px; box-shadow:none; background:var(--accent); color:var(--on-accent); }
.send > .attach { background:none; color:var(--muted); width:42px; }
.send .attach-menu button { display:block; width:100%; height:auto; min-height:48px; border-radius:10px; background:none; color:var(--text); font-size:14px; padding:12px 16px; text-align:left; box-shadow:none; }
.send .attach-menu button:hover { background:var(--hover); }
.send .sticker-panel .tile { width:100%; height:auto; border-radius:12px; box-shadow:none; }
.send .sticker-panel .add { min-height:72px; }
.rec { inset:8px; border-radius:14px; box-shadow:none; } .rec .icon-btn { background:var(--hover); color:var(--text); }
.compose,.attach-bar { width:calc(100% - 64px); max-width:820px; background:var(--bg); border-radius:14px; padding:10px 14px; }
.down { bottom:106px; border:1px solid var(--line); box-shadow:var(--shadow); }
.pin-bar,.chat-search { padding:10px 24px; } .pin-title { font-size:11px; }
.timer-menu { top:78px; z-index:7; right:20px; } .chat-results { z-index:7; }
.ctx,.attach-menu,.timer-menu,.mention-box { border:1px solid var(--line); border-radius:16px; padding:8px; background:var(--panel); box-shadow:0 15px 45px #102c2526; }
.ctx > button { padding:12px; font-size:14px; min-height:44px; } .ctx-reacts button { min-height:40px; }
.overlay.dim { background:var(--overlay); backdrop-filter:blur(7px); }
.card,.sheet { border:1px solid var(--line); border-radius:24px; background:var(--bg); box-shadow:0 30px 100px #0003; }
.card { gap:14px; padding:28px; } .card h1 { font-size:23px; letter-spacing:-.8px; }
.card input,.field input:not([type=range]),.field textarea,.pass-form input { padding:13px 15px; background:var(--hover); border:1px solid var(--line); border-radius:12px; }
.card .primary,.pass-form .primary { min-height:48px; border-radius:12px; font-weight:600; color:var(--on-accent); background:var(--accent); }
.card .secondary,.card .danger-btn { min-height:44px; }
.sheet-bar { padding:18px 16px 12px 24px; border-bottom:1px solid var(--line); }
.sheet-bar h2 { font-size:16px; }
.hero { background:var(--hover); padding:28px 20px; border-radius:0 0 32px 32px; margin-bottom:16px; }
.hero-ava { width:100px; height:100px; border-radius:50%; font-size:38px; border:4px solid var(--bg); }
.hero-name { font-size:27px; letter-spacing:-1px; margin-top:8px; } .hero-sub { font-size:12px; margin-top:5px; }
.hero .cam { background:var(--accent); color:var(--on-accent); }
.pf-sec { border-top:1px solid var(--line); padding:8px 0; margin:0 12px; }
.pf-sec h3 { font-size:10px; letter-spacing:1px; text-transform:uppercase; margin:15px 12px 10px; }
.field { padding:9px 12px; } .field .lbl { font-size:12px; margin-bottom:9px; }
.pf-row { min-height:60px; padding:10px 12px; border-radius:12px; font-size:14px; }
.seg { border:1px solid var(--line); padding:4px; border-radius:13px; }
.seg button { border-radius:9px; font-size:12px; min-height:42px; }
.seg button.sel { background:var(--accent); color:var(--on-accent); box-shadow:none; }
.size-demo { border:1px solid var(--line); border-radius:16px; padding:12px; }
.pf-note { border-top:1px solid var(--line); font-size:11px; padding:18px 24px; line-height:1.6; }
.pf-actions button { background:var(--hover); border:1px solid var(--line); min-height:75px; border-radius:16px; color:var(--text); }
.switch:checked { background:var(--switch-on); } .pill { border-radius:10px; min-height:36px; }
.poll-opt { border-radius:11px; min-height:44px; padding:10px 12px; } .poll-opt .bar { background:var(--poll-bar); }
.poll { min-width:min(240px,60vw); } .photo { border-radius:12px; }
.call { background:#132b24; } .call.audio::before { content:''; position:absolute; width:70vmin; height:70vmin; border:1px solid #809d6e44; border-radius:50%; box-shadow:0 0 0 65px #a8c68b08,0 0 0 130px #a8c68b05; }
.call-ava { border-radius:50%; } .call-name { font-size:30px; letter-spacing:-1px; }
.call-status { font-size:13px; color:#b5cbbd; margin-top:13px; }
.call-btns { bottom:max(45px,env(safe-area-inset-bottom)); padding:13px; border:1px solid #ffffff22; border-radius:35px; background:#132b2499; gap:16px; }
.call-btns button { font-size:23px; } .call-btns .accept { background:#b8d3a5; color:var(--ink); } .call-btns .hang { background:#c9604b; }
/* A quiet home screen with real entry points. */
.app.no-chat .msgs { display:flex; padding:30px 0; }
.app.no-chat .msgs-inner { width:100%; margin:auto; }
.welcome { text-align:center; max-width:580px; margin:auto; padding:24px 16px; }
.eyebrow { font:10px/1.5 system-ui,sans-serif; text-transform:uppercase; letter-spacing:2px; }
.welcome .eyebrow { color:var(--muted); margin-top:34px; }
.welcome h2 { font:400 clamp(42px,4.4vw,66px)/1.07 Georgia,serif; letter-spacing:-2.5px; margin:17px 0; }
.welcome h2 em { color:var(--accent); font-weight:400; }
.welcome p { max-width:340px; margin:0 auto; font-size:14px; line-height:1.8; color:var(--muted); }
.welcome-art { position:relative; width:250px; height:176px; margin:0 auto; }
.circle-person { position:absolute; width:116px; height:116px; border-radius:50%; display:grid; place-items:center; font:42px Georgia,serif; border:6px solid var(--chat-bg); }
.circle-person.a { left:13px; top:15px; background:#b7cbaa; color:#2d5540; transform:rotate(-12deg); }
.circle-person.b { right:13px; bottom:0; background:#f2ae90; color:#723c2d; transform:rotate(12deg); }
.circle-person::after { content:''; width:25px; height:11px; border-bottom:2px solid currentColor; border-radius:50%; position:absolute; top:68px; }
.welcome-art::before { content:''; position:absolute; inset:-5px 12px; border:1px solid var(--line); border-radius:50%; transform:rotate(-25deg); }
.welcome-art::after { content:'✳'; position:absolute; right:30px; top:0; color:var(--coral); font-size:32px; }
.welcome-actions { display:flex; justify-content:center; gap:10px; margin:28px 0 40px; }
.welcome-actions button { display:flex; align-items:center; justify-content:center; gap:8px; min-height:46px; padding:11px 16px; border:1px solid var(--line); border-radius:12px; background:var(--bg); color:var(--text); font-size:12px; }
.welcome-actions button:first-child { background:var(--accent); color:var(--on-accent); border-color:var(--accent); }
.welcome-foot { color:var(--muted); font-size:10px; letter-spacing:.5px; }
.welcome-foot span { color:var(--coral); padding-inline:8px; }
/* Sign in: a small editorial poster, built without images or external fonts. */
#login { display:grid; grid-template-columns:minmax(0,1.1fr) minmax(390px,1fr); background:var(--bg); overflow:auto; }
.login-story { background:#203f35; color:#f4f2df; position:relative; width:100%; min-height:100%; align-self:stretch; display:flex; flex-direction:column; padding:18px 9%; overflow:hidden; }
.login-story .brand { padding:22px 0; } .login-story .brand-mark { color:#e9d9ae; } .login-story .brand-caption { color:#bbc9b3; }
.story-copy { margin-top:clamp(35px,7vh,80px); position:relative; z-index:1; }
.story-copy .eyebrow { color:#b4c8b4; font-size:9px; }
.story-copy h2 { font:400 clamp(58px,6.6vw,98px)/.98 Georgia,serif; letter-spacing:-4px; margin:25px 0; }
.story-copy h2 em { font-weight:400; color:#f1ae90; }
.story-copy p { font-size:14px; line-height:1.8; color:#c5d1c3; }
.orbit-art { position:relative; flex:1; min-height:220px; width:min(100%,400px); margin:24px auto; }
.orbit-ring { position:absolute; width:310px; height:160px; border:1px solid #78917a; border-radius:50%; top:30px; left:50%; transform:translateX(-50%) rotate(-25deg); }
.orbit-core { position:absolute; width:130px; height:130px; top:22px; left:calc(50% - 65px); color:#b9cdaa; }
.orbit-message { position:absolute; padding:14px 18px; font-size:13px; border-radius:16px 16px 16px 3px; background:#f1ecdb; color:#203f35; box-shadow:0 12px 25px #0001; }
.orbit-message.one { top:10px; left:0; transform:rotate(-8deg); } .orbit-message.two { bottom:12px; right:0; background:#f2ae90; transform:rotate(6deg); }
.orbit-message i { font-style:normal; margin-left:12px; }
.orbit-star { position:absolute; right:0; top:5px; font-size:42px; color:#f2ae90; }
.story-footer { display:flex; justify-content:space-between; padding:20px 0 10px; border-top:1px solid #66806b; font-size:9px; letter-spacing:1px; color:#c5d1c3; }
#loginForm { width:min(350px,calc(100% - 64px)); border:0; padding:40px 0; border-radius:0; box-shadow:none; background:none; text-align:left; gap:10px; }
.login-symbol { width:48px; height:48px; color:var(--accent); margin-bottom:24px; }
#loginForm .eyebrow { color:var(--muted); margin-bottom:10px; font-size:9px; }
#loginForm h1 { font:400 46px/1.1 Georgia,serif; letter-spacing:-1.8px; margin-bottom:6px; }
.login-intro { font-size:14px; color:var(--muted); margin:0 0 22px; line-height:1.6; }
.login-label { font-size:12px; font-weight:600; margin-top:8px; }
#loginForm input { background:var(--panel); padding:15px; border-radius:11px; min-width:0; font-size:16px; }
#loginForm .primary { margin-top:4px; font-size:14px; min-height:52px; }
#loginForm .err:empty { min-height:5px; }
.login-note { font-size:12px; color:var(--muted); line-height:1.8; border-top:1px solid var(--line); padding-top:22px; margin:22px 0 0; }
@media(min-width:1500px) { .app { border-inline:1px solid var(--line); } }
@media(max-width:1100px) and (min-width:701px) { .side { width:310px; } .brand { padding-inline:22px; } .brand-caption { font-size:8px; } .connection { font-size:9px; } .top { padding-inline:16px; gap:9px; } .top-actions .icon-btn { width:36px; } .top-btn { display:none; } .chat-filters { padding-inline:16px; } .msgs-inner { padding-inline:24px; } }
@media(max-width:700px) {
  .side { width:100%; } .brand { padding:22px 24px 18px; } .side-intro { padding:7px 24px 20px; } .side-intro h1 { font-size:32px; }
  .side-head { padding-inline:18px; } .chat-filters { padding:17px 22px 9px; } .chat-filters button { min-height:40px; }
  .list-heading { padding-block:10px; } .item { padding:15px 12px; } .side-foot { display:none; }
  .dock { margin:8px 14px max(12px,env(safe-area-inset-bottom)); } .dock button { min-height:48px; }
  .menu { top:194px; left:18px; right:18px; min-width:0; }
  .top { min-height:76px; padding:calc(12px + env(safe-area-inset-top)) 12px 12px; gap:10px; }
  .top .back { display:grid; width:40px; } .top .ava { width:42px; height:42px; }
  .top .meta { margin-left:0; } .top .name { font-size:15px; } .top .status { font-size:11px; }
  .more-btn { display:grid; width:44px; background:var(--hover); }
  .top-actions { display:none; position:absolute; right:12px; top:calc(70px + env(safe-area-inset-top)); padding:8px; border:1px solid var(--line); border-radius:16px; background:var(--panel); box-shadow:0 12px 35px #0002; flex-direction:column; align-items:stretch; min-width:235px; z-index:7; }
  .top-actions.expanded { display:flex; }
  .top-actions .icon-btn { width:100%; min-height:48px; display:flex; padding:12px; gap:14px; border-radius:10px; }
  .top-actions .icon-btn::after { content:attr(aria-label); font:13px system-ui,sans-serif; color:var(--text); }
  #contactBtn { display:block; min-height:44px; text-align:left; margin-bottom:5px; }
  .timer-menu { top:135px; right:20px; z-index:8; }
  .msgs-inner { padding:0 14px; } .msgs { padding-top:16px; }
  .bubble { padding:10px 13px; max-width:88%; border-radius:17px; } .day { margin-bottom:14px; }
  form.send { width:calc(100% - 20px); padding:6px; gap:4px; margin:6px auto max(10px,env(safe-area-inset-bottom)); border-radius:18px; }
  .send textarea { padding:13px 5px; font-size:calc(16px * var(--msg-scale)); }
  .send > button,.send #micBtn { width:46px; height:46px; border-radius:13px; } .send > .attach { width:38px; }
  .compose,.attach-bar { width:calc(100% - 20px); } .down { bottom:88px; }
  .chat-search,.pin-bar { padding:8px 13px; } .chat-search input { width:0; }
  .sheet { border:0; border-radius:0; height:100%; max-height:none; padding-top:env(safe-area-inset-top); }
  .group-card { max-height:calc(100dvh - 30px); width:calc(100% - 28px); padding:24px; }
  #login { grid-template-columns:1fr; align-content:start; }
  .login-story { padding:env(safe-area-inset-top) 28px 26px; min-height:0; }
  .login-story .brand { padding:24px 0; } .login-story .brand-caption { display:none; }
  .story-copy { margin-top:9px; } .story-copy .eyebrow { font-size:8px; letter-spacing:1.4px; }
  .story-copy h2 { font-size:52px; letter-spacing:-2px; margin:17px 0 5px; }
  .story-copy p,.story-footer { display:none; }
  .orbit-art { position:absolute; width:96px; height:96px; min-height:0; right:18px; bottom:22px; margin:0; }
  .orbit-core { width:90px; height:90px; top:0; left:0; } .orbit-ring,.orbit-message,.orbit-star { display:none; }
  #loginForm { width:min(400px,calc(100% - 56px)); padding:28px 0 max(28px,env(safe-area-inset-bottom)); }
  .login-symbol,#loginForm > .eyebrow { display:none; } #loginForm h1 { font-size:34px; }
  .login-intro { margin-bottom:12px; } .login-note { padding-top:16px; margin-top:16px; }
  .welcome-actions { flex-wrap:wrap; }
}
@media(max-width:360px) { .brand-caption { font-size:8px; } .connection { font-size:9px; } .story-copy h2 { font-size:45px; } .orbit-art { width:70px; right:18px; bottom:28px; } .orbit-core { width:70px; height:70px; } .chat-filters { gap:3px; padding-inline:18px; } .chat-filters button { padding-inline:10px; } }
@media(max-height:650px) and (max-width:700px) { .side-intro { padding-block:6px 12px; } .side-intro h1 { font-size:27px; } .brand { padding-top:12px; } .chat-filters { padding-top:10px; } .dock button { min-height:44px; } }
@media(prefers-reduced-motion:reduce) { *,*::before,*::after { animation:none !important; transition:none !important; scroll-behavior:auto !important; } }

/* ни один чат не открыт */
.app.no-chat .top, .app.no-chat .send, .app.no-chat .compose, .app.no-chat .attach-bar, .app.no-chat .pin-bar, .app.no-chat .down { display: none !important; }
.app.no-chat .blank { white-space: pre-line; text-align: center; }
.side .brand-mark { color:var(--accent); --eye:var(--bg); }
.with-icon { display:flex !important; align-items:center; gap:12px; }
.with-icon svg, .pf-row .ic svg, .pf-actions .ic svg { flex:none; vertical-align:middle; }
.with-icon.hidden { display:none !important; }
.ctx > button[data-act] { display:flex; align-items:center; gap:12px; }
.ctx > button svg { width:18px; height:18px; flex:none; color:var(--muted); }
.ctx > button.danger svg { color:currentColor; }
.item .muted-ic svg { width:14px; height:14px; vertical-align:-2px; }
.bubble .ck.wait svg { width:11px; height:11px; vertical-align:-1px; }
.voice svg { width:16px; height:16px; flex:none; }
.media-row .ic svg { width:20px; height:20px; }
.pick .x svg { width:16px; height:16px; vertical-align:middle; }
.sel-bar .icon-btn svg { width:20px; height:20px; }
.hero .cam svg { width:20px; height:20px; }
.call-btns button { display:grid; place-items:center; }
.call-btns button svg { width:26px; height:26px; }


.qr-btn { position: relative; }
.qr-badge { position: absolute; top: 2px; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; line-height: 16px; text-align: center; }

.add-by-name { display: flex; align-items: center; justify-content: center; gap: 8px; width: calc(100% - 24px); margin: 8px 12px; border: 0; background: var(--accent); color: #fff; border-radius: 12px; padding: 11px; font-size: 15px; }

/* окно группы: описание, фото, кнопки у участников */
.group-card textarea { border: 1px solid var(--line); border-radius: 13px; padding: 13px 15px; background: var(--hover); outline: 0; resize: vertical; font: inherit; color: inherit; }
.group-card textarea:focus { border-color: var(--accent); }
.group-card .hero { padding: 0 0 12px; }
.g-desc { color: var(--muted); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 6px; }
.g-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.g-photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; cursor: zoom-in; background: var(--hover); }
.g-photos .empty { grid-column: 1 / -1; }
.pick .acts { display: flex; flex: none; }

.app { height: var(--app-h, 100dvh); }

/* мало сообщений — они лежат у поля ввода, а не под шапкой; много — лента скроллится как обычно */
.msgs { display: flex; flex-direction: column; }
.msgs-inner { width: 100%; flex: none; margin: auto auto 0; }

.send textarea { min-height: 46px; }

/* телефон: меню навигации у нижнего края — на списке чатов и под профилем, в открытом чате его нет */
@media (max-width: 700px) {
  :root { --dock-h: calc(68px + max(12px, env(safe-area-inset-bottom))); }
  body > .dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 9; }
  .app.open ~ .dock { display: none; }
  body.pf-open > .dock.dock { display: flex; }
  .side .list { padding-bottom: var(--dock-h); }
  #profileDlg { bottom: var(--dock-h); }
}

/* панель эмодзи: на месте клавиатуры, под полем ввода */
.emoji-panel { display: flex; flex-direction: column; flex: none; height: min(300px, 42dvh); border-top: 1px solid var(--line); background: var(--panel, var(--bg)); padding-bottom: env(safe-area-inset-bottom); }
.emoji-panel.hidden { display: none; }
.main:has(.emoji-panel:not(.hidden)) form.send { margin-bottom: 6px; }
.em-tabs { display: flex; gap: 2px; padding: 6px 8px 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; flex: none; }
.emoji-panel .em-tab { flex: none; width: 44px; height: 38px; border: 0; border-bottom: 2px solid transparent; border-radius: 8px 8px 0 0; background: none; font-size: 21px; padding: 0; }
.emoji-panel .em-tab.on { border-bottom-color: var(--accent); background: var(--hover); }
.em-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); align-content: start; gap: 2px; padding: 8px; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.emoji-panel .em-grid button { width: 100%; height: 44px; border: 0; border-radius: 10px; background: none; font-size: 26px; padding: 0; display: grid; place-items: center; }
.emoji-panel .em-grid button:hover, .emoji-panel .em-grid button:active { background: var(--hover); }

/* низкий экран (телефон лёжа): компактная шапка списка, чтобы остались чаты и меню */
@media (max-height: 560px) {
  .brand { padding: 10px 20px 4px; font-size: 22px; } .brand-caption { display: none; }
  .side-intro { padding: 2px 20px 6px; } .side-intro h1 { font-size: 22px; } .create-chat { width: 38px; height: 38px; }
  .chat-filters { padding: 6px 16px 4px; } .list-heading { padding-block: 4px; }
  .side-foot { display: none; }
  .dock { margin-block: 4px 8px; } .dock button { min-height: 38px; }
  :root { --dock-h: calc(52px + max(8px, env(safe-area-inset-bottom))); }
}

/* жесты: ответ свайпом влево, назад — вправо */
.msgs { touch-action: pan-y; }
.bubble { will-change: transform; }
.swipe-reply { position: fixed; right: 14px; z-index: 8; width: 34px; height: 34px; margin-top: 0; border-radius: 50%; background: var(--panel, var(--bg)); color: var(--accent); display: grid; place-items: center; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translate(16px, -50%) scale(.6); }
.swipe-reply svg { width: 18px; height: 18px; }
.swipe-reply.hit { background: var(--accent); color: var(--on-accent, #fff); }
@media (max-width: 700px) {
  .app.peeking { position: relative; overflow: hidden; }
  .app.peeking .side { display: flex !important; position: absolute; inset: 0; z-index: 0; }
  .app.peeking .main { position: relative; z-index: 1; box-shadow: -10px 0 28px rgba(0,0,0,.2); will-change: transform; }
}

/* пересланное */
.bubble .fwd { display: block; font-size: 12.5px; color: var(--accent); font-weight: 600; margin-bottom: 3px; }
.bubble .fwd::before { content: '↪ '; }

/* форматирование текста */
.bubble b { font-weight: 700; }
.fmt-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; background: var(--hover); padding: 1px 5px; border-radius: 5px; }
.fmt-pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; background: var(--hover); padding: 8px 10px; border-radius: 8px; margin: 4px 0; white-space: pre-wrap; overflow-x: auto; }
.spoiler { background: var(--muted); color: transparent; border-radius: 4px; cursor: pointer; transition: background .2s, color .2s; }
.spoiler * { visibility: hidden; }
.spoiler.shown { background: var(--hover); color: inherit; cursor: auto; }
.spoiler.shown * { visibility: visible; }
.fmt-bar { position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%); z-index: 6; display: flex; gap: 2px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel, var(--bg)); box-shadow: 0 8px 24px #0002; }
.fmt-bar.hidden { display: none; }
.send .fmt-bar button { width: 40px; height: 34px; border: 0; border-radius: 8px; background: none; color: var(--text); box-shadow: none; font-size: 14px; font-weight: 700; padding: 0; display: grid; place-items: center; }
.send .fmt-bar button:hover { background: var(--hover); }

/* превью ссылки */
.link-card { display: block; margin-top: 6px; padding: 6px 10px; border-left: 3px solid var(--accent); border-radius: 6px; background: var(--hover); color: inherit; text-decoration: none; max-width: 340px; }
.lc-site { font-size: 12px; font-weight: 600; color: var(--accent); }
.lc-title { font-size: 14px; font-weight: 600; margin-top: 1px; }
.lc-desc { font-size: 13px; color: var(--muted); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.lc-img { display: block; width: 100%; max-height: 180px; object-fit: cover; border-radius: 6px; margin-top: 6px; }

/* альбом */
.album { display: grid; gap: 3px; border-radius: 10px; overflow: hidden; margin-bottom: 2px; width: min(320px, 70vw); }
.album.n2 { grid-template-columns: 1fr 1fr; }
.album.n3, .album.n4 { grid-template-columns: 1fr 1fr; }
.album.n3 > :first-child { grid-column: 1 / -1; }
.album > img, .album > video { width: 100% !important; height: 100% !important; aspect-ratio: 1; object-fit: cover; border-radius: 0; margin: 0; max-width: none; }
.album.n3 > :first-child { aspect-ratio: 2 / 1; }

/* «Переслать в…» */
.fwd-list { max-height: 50vh; overflow-y: auto; display: flex; flex-direction: column; }
.fwd-list .pick { border: 0; background: none; text-align: left; width: 100%; color: inherit; font: inherit; }

/* «Медиа и файлы» */
#mediaDlg { place-items: center; }
.media-sheet { width: min(560px, 100vw); max-height: 88vh; display: flex; flex-direction: column; }
.media-tabs { display: flex; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--line); overflow-x: auto; flex: none; }
.media-tabs button { border: 0; background: none; color: var(--muted); padding: 8px 12px; border-radius: 9px; font-size: 14px; white-space: nowrap; }
.media-tabs button.on { background: var(--active, var(--hover)); color: var(--text); font-weight: 600; }
.media-body { overflow-y: auto; padding: 8px 12px 16px; flex: 1; min-height: 200px; }
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.media-tile { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; cursor: zoom-in; background: var(--hover); }
.media-list { display: flex; flex-direction: column; }
.media-row { display: flex; gap: 12px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; min-width: 0; }
.media-row .ic { width: 40px; height: 40px; border-radius: 50%; background: var(--hover); display: grid; place-items: center; flex: none; }
.media-row .grow { flex: 1; min-width: 0; }
.media-row .name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; }
.media-row a.name { color: var(--accent); }
.media-row .sub { font-size: 12.5px; color: var(--muted); }
.media-body .empty { text-align: center; color: var(--muted); padding: 24px; }
.media-body .secondary { display: block; margin: 12px auto 0; border: 0; background: none; color: var(--accent); padding: 8px 14px; }
@media (max-width: 700px) {
  .media-sheet { width: 100%; height: 100%; max-height: none; border-radius: 0; }
  #mediaDlg { place-items: stretch; grid-template-columns: minmax(0, 1fr); }
}

/* низкий экран (окно ноутбука, телефон боком, открытая клавиатура): кнопка «Войти» должна быть на виду */
@media (max-height: 640px) {
  #loginForm { padding-block: 16px; gap: 6px; }
  .login-symbol, #loginForm > .eyebrow, .login-intro { display: none; }
  #loginForm h1 { font-size: 30px; margin-bottom: 0; }
  .login-note { padding-top: 10px; margin-top: 10px; }
  #login { align-items: start; }
}
@media (max-height: 640px) and (min-width: 701px) { .login-story { display: none; } #login { grid-template-columns: 1fr; justify-items: center; } }

/* вход на телефоне: компактная шапка, форма сразу видна; поле с фокусом не прячется под клавиатурой */
@media (max-width: 700px) {
  #login { display: flex; flex-direction: column; overflow-y: auto; }
  .login-story { flex: none; min-height: 0; height: auto; overflow: visible; padding: calc(env(safe-area-inset-top) + 14px) 24px 20px; }
  .login-story .brand { padding: 0; font-size: 24px; }
  .story-copy { margin-top: 14px; }
  .story-copy .eyebrow, .orbit-art { display: none; }
  .story-copy h2 { font-size: clamp(26px, 8vw, 34px); line-height: 1.08; letter-spacing: -1px; margin: 0; }
  .story-copy h2 br:first-of-type { display: none; } /* «Ближе. Даже если» — одной строкой */
  #loginForm { width: calc(100% - 48px); max-width: 420px; margin: 0 auto; padding: 22px 0 max(24px, env(safe-area-inset-bottom)); gap: 8px; }
  #loginForm h1 { font-size: 28px; margin-bottom: 2px; }
  .login-intro { margin-bottom: 10px; }
  .login-note { padding-top: 12px; margin-top: 12px; }
}
@media (max-width: 700px) and (max-height: 640px) {
  .story-copy { display: none; } /* совсем низкий экран — только логотип и форма */
}

/* сообщения Серафима (ИИ): мягкий оттенок акцента и подпись — видно, что это не человек */
.bubble.bot { background: color-mix(in srgb, var(--accent) 11%, var(--in)); border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent); }
.bubble .bot-who { color: var(--accent); font-size: 12.5px; font-weight: 700; letter-spacing: .2px; margin-bottom: 2px; }
/* картинка превью — фиксированной высоты: догрузка не сдвигает ленту и не сбивает «прилипание» к низу */
.lc-img { height: 160px; max-height: none; }

/* «✦ Серафим отвечает…» — над полем ввода, у всех участников переписки */
.bot-typing { align-self: center; width: calc(100% - 32px); max-width: 820px; margin: 0 auto -2px; padding: 4px 14px; font-size: 13px; color: var(--accent); font-weight: 600; flex: none; }
.bot-typing.hidden { display: none; }
.bt-mark { display: inline-block; animation: bt-glow 1.6s ease-in-out infinite; }
.bt-dots::after { content: ''; display: inline-block; width: 1.2em; text-align: left; animation: bt-dots 1.2s steps(4, end) infinite; }
@keyframes bt-dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75%, 100% { content: '...'; } }
@keyframes bt-glow { 0%, 100% { opacity: .45; transform: scale(.9); } 50% { opacity: 1; transform: scale(1.15); } }
@media (prefers-reduced-motion: reduce) { .bt-mark, .bt-dots::after { animation: none; } .bt-dots::after { content: '…'; } }

/* окно группы: вкладки «Участники» / «Настройки» */
.group-card .hero { padding: 0 0 6px; }
.g-tabs { display: flex; gap: 4px; padding: 4px; margin: 4px 0 6px; border-radius: 12px; background: var(--hover); }
.g-tabs button { flex: 1; border: 0; background: none; color: var(--muted); padding: 9px 10px; border-radius: 9px; font-size: 14px; }
.g-tabs button.on { background: var(--panel, var(--bg)); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px #0001; }
.g-row-btn { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; padding: 10px 4px; border-radius: 10px; text-align: left; }
.g-row-btn:hover { background: var(--hover); }
.g-photo-row { display: flex; align-items: center; gap: 12px; }
.g-photo-row .ava { width: 56px; height: 56px; font-size: 22px; flex: none; }
.danger-link { border: 0; background: none; color: var(--danger); padding: 6px; font-size: 14px; }
.g-switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.g-switch input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); }
.g-switch select { border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; background: var(--hover); color: inherit; font: inherit; }
.g-note { color: var(--muted); font-size: 14px; padding: 6px 2px; }
.group-card > * { flex-shrink: 0; } /* поля не сжимаются: окно прокручивается целиком */
.group-card textarea { min-height: 84px; }

/* выбор сообщений: долгое нажатие — отметка, сверху панель действий */
.top { position: relative; }
.sel-bar { position: absolute; inset: 0; z-index: 6; display: flex; align-items: center; gap: 6px; padding: 0 12px; padding-top: env(safe-area-inset-top); background: var(--panel, var(--bg)); border-bottom: 1px solid var(--line); }
.sel-bar.hidden { display: none; }
.sel-bar .sel-count { flex: 1; font-weight: 600; font-size: 16px; }
.sel-bar .icon-btn { width: 42px; height: 42px; font-size: 20px; display: grid; place-items: center; border-radius: 12px; }
.sel-bar .icon-btn:hover { background: var(--hover); }
.bubble.selected { outline: 2px solid var(--accent); outline-offset: 2px; }
.msgs-inner.selecting .bubble { cursor: pointer; }
.msgs-inner.selecting .bubble:not(.selected) { opacity: .75; }
@media (pointer: coarse) {
  /* на телефоне долгое нажатие — выбор, а не выделение текста (копировать — через меню) */
  .bubble { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
}

/* «Удалить?» — у всех или у меня */
.del-dlg { z-index: 20; }
.del-card { width: min(360px, calc(100% - 32px)); display: flex; flex-direction: column; gap: 8px; text-align: center; padding: 22px; }
.del-card h2 { margin: 0; font-size: 18px; }
.del-hint { margin: 0 0 6px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.del-card .danger-btn { border: 0; background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); font-weight: 600; min-height: 46px; border-radius: 12px; }
.del-card .secondary { min-height: 44px; }

/* «Медиа и файлы» в профиле чата и в окне группы */
.media-section { display: flex; flex-direction: column; }
.pf-sec .media-section { padding: 0 16px 14px; }
.media-section .media-tabs { padding: 6px 0; margin-bottom: 8px; }
.media-section .media-grid { max-height: none; }
.media-section .empty { text-align: center; color: var(--muted); padding: 16px 8px; font-size: 14px; }
.media-section .media-more { align-self: center; border: 0; background: none; color: var(--accent); padding: 8px 14px; }
.group-card .media-section { margin-bottom: 4px; }

/* как приложение, а не сайт: без синих подсветок нажатий и случайного выделения интерфейса */
* { -webkit-tap-highlight-color: transparent; }
html { touch-action: manipulation; }            /* без двойного нажатия для масштаба — отклик сразу */
body { overscroll-behavior: none; }             /* без «резинки» и обновления страницы рывком вниз */
button, a, label, .item, .top, .dock, .sheet-bar, .menu, .ctx, .chat-filters, .list-heading, .brand, .hero,
.media-tabs, .g-tabs, .sel-bar, .emoji-panel, .attach-menu, .pick, .ava, .day, .note, .t, .who, .fwd, .reacts {
  -webkit-user-select: none; user-select: none;
}
input, textarea { -webkit-user-select: text; user-select: text; }
img, video { -webkit-user-drag: none; -webkit-touch-callout: none; }
/* рамка фокуса — только с клавиатуры (Tab), не после нажатия пальцем или мышью */
:focus:not(:focus-visible) { outline: none; }
@media (pointer: coarse) {
  button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: none; }
}

/* скачивание APK: ссылка на входе и QR в настройках */
.login-apk { display:block; margin-top:14px; font-size:13px; color:var(--accent); text-decoration:none; }
.apk-qr { display:flex; flex-direction:column; align-items:center; gap:10px; padding:8px 0 14px; }
.apk-qr img { background:#fff; padding:8px; border-radius:12px; }
.apk-qr a { text-decoration:none; }

/* Серафим в личной переписке двух людей: состояние и согласие — всегда на виду у обоих */
.bot-bar { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin:0 14px 6px; padding:8px 12px; border:1px solid var(--line); border-radius:14px; background:var(--lavender); color:var(--text); font-size:13px; line-height:1.45; }
.bot-bar .txt { flex:1 1 220px; }
.bot-bar button { border:1px solid var(--line); background:var(--panel); color:var(--text); border-radius:10px; padding:7px 12px; min-height:36px; }
.bot-bar button.yes { background:var(--accent); color:var(--on-accent); border-color:transparent; }
#botDmBtn.on { color:var(--accent); }
.bot-bar { touch-action: pan-y; transition: transform .18s ease, opacity .18s ease; }
.bot-bar.dragging { transition: none; cursor: grabbing; }
