/* ======================================================================
   Drippy — собственный стиль: «плавающие» стеклянные панели на тёмном
   фоне с мягким сиянием, сообщения-пузыри, крупные скругления, фирменный
   градиент. На телефоне: экраны и панель вкладок внизу.
   ====================================================================== */

:root {
  --accent: #7c5cff;
  --accent-h: color-mix(in srgb, var(--accent) 84%, #000);
  --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
  --accent-text: color-mix(in srgb, var(--accent) 55%, var(--text));
  --brand-a: #ffb547;
  --brand-b: #8b6bff;
  --grad: linear-gradient(135deg, color-mix(in srgb, var(--accent) 85%, #ff5ea8) 0%, var(--accent) 55%, color-mix(in srgb, var(--accent) 80%, #2aa7ff) 100%);
  --grad-brand: linear-gradient(120deg, var(--brand-a), #ff6f91 45%, var(--brand-b));
  --green: #2bc77a; --green-h: #22a866;
  --red: #ff4d5e; --red-h: #e23a4b;
  --yellow: #ffbf3c;
  --st-online: #2bc77a; --st-idle: #ffbf3c; --st-dnd: #ff4d5e; --st-offline: #7d8090;
  --font-scale: 1;
  --fs: calc(15px * var(--font-scale));
  --r-sm: 12px; --r: 16px; --r-lg: 22px; --r-xl: 28px;
  --ease: cubic-bezier(.22, .9, .25, 1);
  --font: 'Onest', 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
  --display: 'Unbounded', 'Onest', system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'Cascadia Code', Consolas, Menlo, monospace;
  --rail-w: 68px; --side-w: 290px; --members-w: 264px; --gap: 8px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}

:root, [data-theme="dark"] {
  color-scheme: dark;
  --bg-app: #08080c;
  --glow-a: rgba(124, 92, 255, .22); --glow-b: rgba(255, 150, 70, .10); --glow-c: rgba(40, 170, 255, .10);
  --panel: rgba(20, 20, 28, .82); --panel-solid: #14141c; --panel-2: rgba(28, 28, 38, .92);
  --bg-1: #12121a; --bg-2: #181822; --bg-3: #22222e; --bg-4: #2c2c3a;
  --bg-float: #191923; --bg-input: rgba(255, 255, 255, .055); --bg-hover: rgba(255, 255, 255, .05); --bg-active: rgba(255, 255, 255, .09);
  --line: rgba(255, 255, 255, .07); --line-2: rgba(255, 255, 255, .12);
  --text: #f2f1f7; --text-2: #c2c1cf; --text-3: #8e8d9f; --text-4: #626175;
  --bubble: #23232f; --bubble-text: var(--text);
  --mention-bg: rgba(255, 191, 60, .10); --mention-bar: #ffbf3c;
  --code-bg: rgba(0, 0, 0, .32); --scroll: rgba(255, 255, 255, .14);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, .5), 0 2px 10px rgba(0, 0, 0, .3);
  --shadow-md: 0 8px 26px rgba(0, 0, 0, .38);
  --stage: #050508;
}
[data-theme="midnight"] {
  color-scheme: dark;
  --bg-app: #000;
  --glow-a: rgba(124, 92, 255, .12); --glow-b: rgba(255, 150, 70, .05); --glow-c: rgba(40, 170, 255, .05);
  --panel: rgba(10, 10, 14, .92); --panel-solid: #0a0a0e; --panel-2: #111117;
  --bg-1: #0a0a0e; --bg-2: #0e0e13; --bg-3: #18181f; --bg-4: #22222b;
  --bg-float: #111117; --bg-input: rgba(255, 255, 255, .06);
  --bubble: #17171f;
  --line: rgba(255, 255, 255, .08); --line-2: rgba(255, 255, 255, .13);
  --text: #f4f4f8; --text-2: #c0c0cc; --text-3: #8b8b9b; --text-4: #5d5d6d;
  --stage: #000;
}
[data-theme="light"] {
  color-scheme: light;
  --bg-app: #eceaf3;
  --glow-a: rgba(124, 92, 255, .20); --glow-b: rgba(255, 170, 80, .18); --glow-c: rgba(40, 170, 255, .14);
  --panel: rgba(255, 255, 255, .86); --panel-solid: #ffffff; --panel-2: #f6f5fa;
  --bg-1: #f4f3f9; --bg-2: #ffffff; --bg-3: #ecebf3; --bg-4: #e0dfea;
  --bg-float: #ffffff; --bg-input: rgba(20, 16, 50, .055); --bg-hover: rgba(20, 16, 50, .045); --bg-active: rgba(20, 16, 50, .08);
  --line: rgba(20, 16, 50, .08); --line-2: rgba(20, 16, 50, .14);
  --text: #16151f; --text-2: #3f3d4f; --text-3: #6c6a7e; --text-4: #a2a0b2;
  --bubble: #efeef6;
  --mention-bg: rgba(255, 180, 40, .16);
  --code-bg: rgba(20, 16, 50, .06); --scroll: rgba(20, 16, 50, .2);
  --shadow-lg: 0 18px 50px rgba(40, 30, 90, .18), 0 2px 10px rgba(40, 30, 90, .08);
  --shadow-md: 0 8px 26px rgba(40, 30, 90, .14);
  --st-offline: #a2a0b2;
  --stage: #15141c;
}
[data-motion="reduce"] *, [data-motion="reduce"] *::before, [data-motion="reduce"] *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { position: fixed; inset: 0; width: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg-app); }
body {
  font-family: var(--font); font-size: var(--fs); line-height: 1.4; color: var(--text); background: var(--bg-app);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; overflow: hidden; overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
body::before {
  content: ''; position: fixed; inset: -20%; pointer-events: none; z-index: 0;
  background:
    radial-gradient(40% 35% at 12% 8%, var(--glow-a), transparent 70%),
    radial-gradient(35% 30% at 92% 92%, var(--glow-b), transparent 70%),
    radial-gradient(30% 30% at 75% 15%, var(--glow-c), transparent 70%);
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; touch-action: manipulation; }
button:disabled { cursor: not-allowed; opacity: .5; }
a { color: #6cb6ff; text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
::selection { background: color-mix(in srgb, var(--accent) 45%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
img, video { max-width: 100%; }
h1, h2, h3, h4, h5, h6 { margin: 0; }
.ic { fill: currentColor; stroke: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic .s { fill: none; stroke: currentColor; }
.ic.red { color: var(--red); }
.ic.gold { color: var(--yellow); }

.scroll { overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.scroll::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
.scroll::-webkit-scrollbar-track { background: transparent; }

.spin { display: inline-block; width: 18px; height: 18px; border: 2.5px solid color-mix(in srgb, currentColor 22%, transparent); border-top-color: currentColor; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(6px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes sheet { from { transform: translateY(100%); } }

/* ---------------- кнопки и поля ---------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 18px;
  border-radius: 999px; font-weight: 600; font-size: .9em; white-space: nowrap; transition: background .15s, color .15s, transform .12s, box-shadow .15s, filter .15s;
  background: var(--bg-3); color: var(--text);
}
.btn:hover:not(:disabled) { background: var(--bg-4); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.primary { background: var(--grad); color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); background: var(--grad); }
.btn.green { background: var(--green); color: #fff; }
.btn.green:hover:not(:disabled) { background: var(--green-h); }
.btn.danger { background: var(--red); color: #fff; }
.btn.danger:hover:not(:disabled) { background: var(--red-h); }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line-2); }
.btn.ghost:hover:not(:disabled) { background: var(--bg-hover); }
.btn.danger-ghost { background: transparent; color: var(--red); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--red) 50%, transparent); }
.btn.danger-ghost:hover:not(:disabled) { background: var(--red); color: #fff; }
.btn.small { min-height: 34px; padding: 0 14px; font-size: .85em; }
.btn.tiny { min-height: 28px; padding: 0 11px; font-size: .78em; }
.btn.big { min-height: 48px; padding: 0 24px; font-size: .98em; }
.btn.loading { color: transparent !important; position: relative; }
.btn.loading::after { content: ''; position: absolute; width: 20px; height: 20px; border: 2.5px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.link-like { color: #6cb6ff; font-weight: 500; }
.link-like:hover { text-decoration: underline; }
.linkish { color: var(--text-3); font-size: .9em; }
.linkish:hover { color: var(--text); }

.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; color: var(--text-3); transition: color .12s, background .12s; flex: none; }
.icon-btn:hover:not(:disabled) { color: var(--text); background: var(--bg-hover); }
.icon-btn.on { color: var(--accent-text); background: var(--accent-soft); }
.icon-btn.tiny { width: 26px; height: 26px; border-radius: 8px; }
.icon-btn.small { width: 32px; height: 32px; }
.icon-btn.danger:hover { color: #fff; background: var(--red); }
.icon-btn.round { width: 40px; height: 40px; border-radius: 50%; background: var(--bg-3); color: var(--text-2); }
.icon-btn.round:hover { color: var(--text); background: var(--bg-4); }
.icon-btn.round.green:hover { color: #fff; background: var(--green); }
.icon-btn.round.red:hover { color: #fff; background: var(--red); }
.icon-btn.round.big { width: 60px; height: 60px; }
.icon-btn.round.big.green { background: var(--green); color: #fff; }
.icon-btn.round.big.red { background: var(--red); color: #fff; }
.icon-btn.off { color: var(--red); }

input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]), textarea, select, .select {
  width: 100%; background: var(--bg-input); border: 1.5px solid transparent; border-radius: var(--r-sm); padding: 11px 14px; color: var(--text); outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input:focus, textarea:focus, select:focus { border-color: color-mix(in srgb, var(--accent) 70%, transparent); box-shadow: 0 0 0 4px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: var(--text-4); }
textarea { resize: vertical; min-height: 46px; }
select, .select { appearance: none; padding-right: 36px; cursor: pointer; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
select option { background: var(--bg-float); color: var(--text); }

.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; min-width: 0; }
.field > span { font-size: .78em; font-weight: 600; color: var(--text-3); }
.field > span em { font-style: normal; font-weight: 500; color: var(--red); }
.field.bad > span { color: var(--red); }
.field.bad input { border-color: color-mix(in srgb, var(--red) 70%, transparent); }
.field-hint { color: var(--text-3); font-size: .8em; }
.field-error { color: var(--red); font-size: .875em; margin: 6px 0; }
.muted-text { color: var(--text-2); margin: 0 0 14px; line-height: 1.55; overflow-wrap: anywhere; }
.muted-text.small, small.muted-text { font-size: .84em; color: var(--text-3); }
.danger-text { color: var(--red) !important; }
.copyable { cursor: pointer; }
.copyable:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: .86em; background: var(--code-bg); padding: 1px 6px; border-radius: 6px; }

.switch { appearance: none; width: 46px; height: 28px; border-radius: 14px; background: var(--bg-4); position: relative; cursor: pointer; transition: background .2s; flex: none; margin: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: 0 2px 6px rgba(0, 0, 0, .25); }
.switch:checked { background: var(--grad); }
.switch:checked::after { transform: translateX(18px); }
.switch:disabled { opacity: .4; cursor: not-allowed; }
.range { width: 100%; accent-color: var(--accent); }
.range-row { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.range-val { min-width: 54px; text-align: right; color: var(--text-2); font-size: .875em; }

.set-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: 0; }
.set-text { min-width: 0; flex: 1; }
.set-title { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.set-desc { color: var(--text-3); font-size: .86em; margin-top: 4px; line-height: 1.45; }
.set-row > select { width: auto; min-width: 190px; }
.row-btns { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.sub-h { font-size: .8em; letter-spacing: .02em; color: var(--text-3); margin: 28px 0 10px; font-weight: 700; text-transform: uppercase; }
.note { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: var(--r-sm); background: var(--accent-soft); font-size: .88em; margin-bottom: 16px; }
.badge { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 6px; border-radius: 10px; background: var(--red); color: #fff; font-size: .7em; font-weight: 800; line-height: 1; flex: none; }
kbd { display: inline-block; min-width: 28px; padding: 4px 8px; border-radius: 8px; background: var(--bg-3); box-shadow: inset 0 -2px 0 var(--line-2); font-family: var(--font); font-size: .8em; font-weight: 700; text-align: center; color: var(--text-2); }
.kbd-row { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ---------------- аватары ---------------- */

.avatar { position: relative; width: var(--s); height: var(--s); flex: none; }
.av-img { width: 100%; height: 100%; border-radius: 34%; overflow: hidden; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: calc(var(--s) * .42); user-select: none; position: relative; }
.av-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar.speaking .av-img { box-shadow: 0 0 0 2px var(--ring-bg, var(--panel-solid)), 0 0 0 4px var(--green); }
.avatar.clickable { cursor: pointer; }
.avatar.clickable:hover .av-img { filter: brightness(1.08); }
.status-dot { position: absolute; right: -3px; bottom: -3px; width: max(10px, calc(var(--s) * .34)); height: max(10px, calc(var(--s) * .34)); border-radius: 50%; border: max(2.5px, calc(var(--s) * .075)) solid var(--ring-bg, var(--panel-solid)); background: var(--st-offline); }
.status-dot.online { background: var(--st-online); }
.status-dot.idle { background: var(--st-idle); }
.status-dot.dnd { background: var(--st-dnd); }
.status-dot.offline { background: var(--ring-bg, var(--panel-solid)); box-shadow: inset 0 0 0 max(2px, calc(var(--s) * .06)) var(--st-offline); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--st-offline); margin-right: 4px; vertical-align: middle; }
.dot.online { background: var(--st-online); }

/* ---------------- вход ---------------- */

#auth { position: fixed; top: 0; left: 0; right: 0; height: var(--vvh, 100dvh); display: grid; place-items: center; padding: calc(24px + var(--safe-t)) 16px calc(24px + var(--safe-b)); overflow-y: auto; z-index: 2; }
.auth-bg { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.auth-bg i { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .5; animation: drift 24s ease-in-out infinite alternate; }
.auth-bg i:nth-child(1) { width: 520px; height: 520px; left: -160px; top: -160px; background: var(--brand-b); }
.auth-bg i:nth-child(2) { width: 460px; height: 460px; right: -140px; bottom: -160px; background: var(--brand-a); animation-delay: -8s; opacity: .35; }
.auth-bg i:nth-child(3) { width: 360px; height: 360px; left: 45%; top: 55%; background: #ff6f91; animation-delay: -14s; opacity: .22; }
@keyframes drift { to { transform: translate(50px, 40px) scale(1.12); } }
.auth-card {
  position: relative; width: 100%; max-width: 400px; padding: 34px 28px 26px; border-radius: var(--r-xl);
  background: var(--panel); backdrop-filter: blur(24px) saturate(1.4); -webkit-backdrop-filter: blur(24px) saturate(1.4);
  box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--line); animation: rise .45s var(--ease);
}
.auth-logo { display: grid; place-items: center; margin-bottom: 12px; }
.auth-card h1 { font-family: var(--display); font-size: 1.6em; font-weight: 700; text-align: center; margin-bottom: 26px; letter-spacing: -.01em; }
.auth-card .field { margin-bottom: 14px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 46px !important; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; display: grid; place-items: center; color: var(--text-3); border-radius: 10px; }
.pw-eye:hover { color: var(--text); }
.pw-meter { height: 4px; border-radius: 2px; background: var(--bg-4); margin: -4px 0 14px; overflow: hidden; }
.pw-meter i { display: block; height: 100%; width: 0; transition: width .25s, background .25s; }
.pw-meter[data-s="0"] i, .pw-meter[data-s="1"] i { width: 25%; background: var(--red); }
.pw-meter[data-s="2"] i { width: 50%; background: var(--yellow); }
.pw-meter[data-s="3"] i { width: 75%; background: #8ad46f; }
.pw-meter[data-s="4"] i { width: 100%; background: var(--green); }
.auth-error { color: var(--red); font-size: .875em; min-height: 1.2em; margin: 0 0 10px; text-align: center; }
.auth-card .btn.big { width: 100%; }
.auth-switch { text-align: center; margin: 16px 0 0; }
.auth-dl { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--text-3); font-size: .85em; }
#splash { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; background: var(--bg-app); z-index: 5; color: var(--text-3); }
.splash-logo { animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.08); opacity: .8; } }

/* ---------------- каркас: плавающие панели ---------------- */

#app {
  position: fixed; top: 0; left: 0; right: 0; height: var(--vvh, 100dvh); z-index: 1; display: grid;
  grid-template-columns: var(--rail-w) var(--side-w) minmax(0, 1fr) auto; grid-template-rows: minmax(0, 1fr);
  gap: var(--gap); padding: var(--gap) var(--gap) var(--gap) 0;
}
#rail { grid-column: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 6px 0; overflow-y: auto; scrollbar-width: none; --ring-bg: var(--bg-app); }
#rail::-webkit-scrollbar { display: none; }
#side, #main, #members {
  background: var(--panel); border-radius: var(--r-lg); box-shadow: inset 0 0 0 1px var(--line);
  backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2);
}
#side { grid-column: 2; display: flex; flex-direction: column; min-height: 0; overflow: hidden; --ring-bg: var(--panel-solid); }
#main { grid-column: 3; display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; overflow: hidden; --ring-bg: var(--panel-solid); }
#members { grid-column: 4; width: var(--members-w); padding: 10px 10px 16px; --ring-bg: var(--panel-solid); }
#scrim, #tabbar { display: none; }

/* док серверов */
.rail-item { position: relative; width: var(--rail-w); display: flex; justify-content: center; flex: none; }
.rail-item .pill { position: absolute; left: 0; top: 50%; width: 4px; height: 0; border-radius: 0 4px 4px 0; background: var(--grad-brand); transition: height .2s var(--ease); transform: translateY(-50%); }
.rail-item.unread .pill { height: 8px; }
.rail-item:hover .pill { height: 18px; }
.rail-item.active .pill { height: 34px; }
.rail-btn { width: 50px; height: 50px; border-radius: 17px; overflow: hidden; display: grid; place-items: center; background: var(--panel); color: var(--text-2); transition: transform .18s var(--ease), background .18s, color .18s, box-shadow .18s; box-shadow: inset 0 0 0 1px var(--line); }
.rail-item:hover .rail-btn { transform: translateY(-1px); }
.rail-item.active .rail-btn { box-shadow: 0 0 0 2px var(--accent), 0 8px 20px color-mix(in srgb, var(--accent) 30%, transparent); }
.rail-item.home.active .rail-btn { background: var(--grad); }
.rail-item.home.active .logo circle { fill: #fff !important; }
.rail-item.add .rail-btn { color: var(--green); border: 1.5px dashed color-mix(in srgb, var(--green) 55%, transparent); box-shadow: none; background: transparent; }
.rail-item.add:hover .rail-btn { background: var(--green); color: #fff; border-color: var(--green); }
.rail-item .badge { position: absolute; right: 8px; bottom: -3px; box-shadow: 0 0 0 3px var(--bg-app); min-width: 20px; height: 20px; border-radius: 10px; font-size: .72em; }
.rail-item.in-voice::after { content: ''; position: absolute; right: 9px; top: -3px; width: 15px; height: 15px; border-radius: 50%; background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpolygon points='11 5 6 9 2 9 2 15 6 15 11 19'/%3E%3C/svg%3E") center/9px no-repeat; box-shadow: 0 0 0 3px var(--bg-app); }
.rail-item.dragging { opacity: .4; }
.rail-item.drop::before { content: ''; position: absolute; top: -5px; left: 14px; right: 14px; height: 3px; border-radius: 2px; background: var(--accent); }
.rail-sep { width: 28px; height: 2px; border-radius: 1px; background: var(--line-2); flex: none; margin: 2px 0; }
.rail-guilds { display: flex; flex-direction: column; gap: 8px; }
.gicon { width: var(--s); height: var(--s); display: grid; place-items: center; background: var(--bg-3); color: var(--text); font-weight: 700; font-size: calc(var(--s) * .33); overflow: hidden; flex: none; border-radius: 32%; }
.rail-btn .gicon { width: 100%; height: 100%; background: transparent; border-radius: 0; }
.rail-item:not(.home):not(.add):hover .rail-btn:not(:has(img)), .rail-item.active:not(.home) .rail-btn:not(:has(img)) { background: var(--grad); color: #fff; }
.gicon img { width: 100%; height: 100%; object-fit: cover; }
.gicon span.small { font-size: .82em; }
.rail-item.dm-unread .rail-btn { background: transparent; box-shadow: none; }
.rail-item.dm-unread .av-img { border-radius: 17px; }

/* боковая панель */
.side-head { height: 56px; flex: none; display: flex; align-items: center; padding: 0 12px; border-bottom: 1px solid var(--line); }
.side-title { font-family: var(--display); font-size: 1.15em; padding: 0 4px; }
.find-btn { width: 100%; height: 36px; border-radius: 12px; background: var(--bg-input); color: var(--text-3); font-size: .88em; text-align: left; padding: 0 12px; display: flex; align-items: center; gap: 8px; }
.find-btn:hover { color: var(--text-2); }
.guild-title { width: 100%; height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 10px; font-family: var(--display); font-size: .98em; font-weight: 600; border-radius: 12px; }
.guild-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guild-title:hover { background: var(--bg-hover); }
#sideBody { flex: 1; padding: 10px 10px 14px; }
.side-empty { color: var(--text-4); font-size: .88em; text-align: center; padding: 24px 10px; }
.side-locked, .side-cta { display: grid; justify-items: center; gap: 12px; padding: 40px 16px; color: var(--text-3); text-align: center; font-size: .9em; }
.nav-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 0 12px; height: 44px; border-radius: 14px; color: var(--text-2); font-weight: 600; margin-bottom: 4px; }
.nav-row:hover { background: var(--bg-hover); color: var(--text); }
.nav-row.active { background: var(--accent-soft); color: var(--text); }
.nav-row .badge { margin-left: auto; }
.side-label { display: flex; align-items: center; justify-content: space-between; padding: 14px 6px 6px 12px; font-size: .74em; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-4); }
.dm-row { position: relative; display: flex; align-items: center; gap: 12px; padding: 7px 10px; border-radius: 14px; color: var(--text-2); cursor: pointer; margin-bottom: 2px; }
.dm-row:hover { background: var(--bg-hover); }
.dm-row.active { background: var(--accent-soft); color: var(--text); }
.dm-row.unread { color: var(--text); }
.dm-row.offline .avatar { opacity: .6; }
.dm-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.dm-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-row.unread .dm-name { font-weight: 800; }
.dm-sub { color: var(--text-3); font-size: .78em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.dm-sub.live { color: var(--green); }
.dm-close { opacity: 0; }
.dm-row:hover .dm-close { opacity: 1; }
.dm-row:hover .badge { display: none; }

.cat-row { display: flex; align-items: center; padding: 14px 4px 4px 2px; color: var(--text-4); }
.cat-row:first-child { padding-top: 4px; }
.cat-name { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; font-size: .74em; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; text-align: left; padding: 2px 6px; }
.cat-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-name .ic { transition: transform .15s; }
.cat-row.closed .cat-name .ic { transform: rotate(-90deg); }
.cat-row:hover .cat-name { color: var(--text-2); }
.cat-row .icon-btn { opacity: 0; }
.cat-row:hover .icon-btn { opacity: 1; }
.cat-row.drop, .ch-row.drop { box-shadow: inset 0 2px 0 var(--accent); }
.ch-row { position: relative; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px; margin: 2px 0; border-radius: 12px; color: var(--text-3); cursor: pointer; }
.ch-row:hover { background: var(--bg-hover); color: var(--text-2); }
.ch-row.active { background: var(--accent-soft); color: var(--text); }
.ch-row.active .ch-ic { color: var(--accent-text); }
.ch-row.unread { color: var(--text); }
.ch-row.unread .ch-name { font-weight: 700; }
.ch-row.muted { opacity: .5; }
.ch-row.connected { color: var(--green); }
.ch-row.dragging { opacity: .4; }
.ch-ic { color: var(--text-4); }
.ch-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.unread-dot { position: absolute; left: -10px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--text); display: none; }
.ch-row.unread:not(.active) .unread-dot { display: block; }
.ch-actions { display: none; gap: 2px; }
.ch-row:hover .ch-actions { display: flex; }
.ch-row:hover .badge { display: none; }
.voice-users { padding: 2px 0 6px 28px; }
.voice-user { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; border-radius: 10px; color: var(--text-3); cursor: pointer; }
.voice-user:hover { background: var(--bg-hover); color: var(--text-2); }
.voice-user.speaking .av-img { box-shadow: 0 0 0 2px var(--panel-solid), 0 0 0 4px var(--green); }
.vu-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88em; }
.vu-icons { display: flex; align-items: center; gap: 4px; color: var(--text-4); }
.live-badge { background: var(--red); color: #fff; font-size: .6em; font-weight: 800; padding: 2px 6px; border-radius: 6px; letter-spacing: .03em; }

#sideFoot { flex: none; padding: 8px; display: grid; gap: 8px; }
#userPanel { display: flex; align-items: center; gap: 4px; padding: 6px; border-radius: var(--r); background: var(--bg-input); }
.me-btn { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 4px; border-radius: 12px; text-align: left; }
.me-btn:hover { background: var(--bg-hover); }
.me-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.me-text b { font-size: .9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-sub { font-size: .75em; color: var(--text-3); height: 1.25em; overflow: hidden; }
.me-sub span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: transform .2s var(--ease); }
.me-btn:hover .me-sub span { transform: translateY(-100%); }
.me-actions { display: flex; }
.me-actions .icon-btn { width: 34px; height: 34px; }
#voicePanel { padding: 10px; border-radius: var(--r); background: color-mix(in srgb, var(--green) 9%, var(--bg-input)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--green) 22%, transparent); animation: rise .25s var(--ease); }
.vp-top { display: flex; align-items: center; gap: 4px; }
.vp-info { flex: 1; min-width: 0; }
.vp-status { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: .88em; color: var(--green); }
.vp-status.connecting { color: var(--yellow); }
.vp-status.lost { color: var(--red); }
.vp-room { display: block; max-width: 100%; color: var(--text-3); font-size: .76em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.vp-room:hover { color: var(--text); text-decoration: underline; }
.vp-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.vp-btn { display: flex; align-items: center; justify-content: center; gap: 6px; height: 34px; border-radius: 12px; background: var(--bg-3); color: var(--text-2); font-size: .8em; font-weight: 600; }
.vp-btn:hover { background: var(--bg-4); color: var(--text); }
.vp-btn.on { background: var(--green); color: #fff; }
.vs-pop { width: 290px; padding: 16px; }
.vs-pop h4 { margin-bottom: 10px; font-family: var(--display); font-size: .95em; }
.vs-line { font-size: .8em; color: var(--text-3); margin: 0 0 8px; display: flex; gap: 6px; align-items: flex-start; }
.vs-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: .88em; }
.vs-row span { flex: 1; }
.vs-row .good { color: var(--green); }
.vs-row .warn { color: var(--yellow); }

/* ---------------- главная область ---------------- */

.main-head { min-height: 56px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 10px 0 18px; border-bottom: 1px solid var(--line); min-width: 0; z-index: 2; position: relative; }
.menu-btn { display: none; }
.head-ic { color: var(--text-4); }
.head-title { font-family: var(--display); font-weight: 600; font-size: 1.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; max-width: 40%; }
.head-title.link-like { color: var(--text); }
.head-div { width: 1px; height: 22px; background: var(--line-2); margin: 0 6px; flex: none; }
.head-topic { color: var(--text-3); font-size: .86em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; text-align: left; }
button.head-topic:hover { color: var(--text-2); }
.head-right { margin-left: auto; display: flex; align-items: center; gap: 2px; flex: none; }
.search-box { position: relative; margin-left: 6px; }
.head-search { width: 160px !important; height: 34px; padding: 0 30px 0 12px !important; font-size: .85em; border-radius: 999px !important; transition: width .2s var(--ease) !important; }
.head-search:focus { width: 240px !important; }
.search-box .ic { position: absolute; right: 11px; top: 9px; color: var(--text-3); pointer-events: none; }
.empty-main { flex: 1; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--text-3); text-align: center; padding: 20px; }

.chat-wrap { flex: 1; display: flex; min-height: 0; position: relative; }
.chat-col { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.messages { flex: 1; min-height: 0; padding-bottom: 10px; overflow-anchor: none; }
#msgList { display: flex; flex-direction: column; min-height: 100%; justify-content: flex-end; padding-top: 16px; }
.load-more { display: grid; place-items: center; padding: 24px; color: var(--text-3); }
.chat-error { color: var(--red); padding: 24px; text-align: center; }
.skeleton { padding: 20px 18px; display: grid; gap: 22px; }
.sk-row { display: flex; gap: 12px; }
.sk-av { width: 38px; height: 38px; border-radius: 34%; background: var(--bg-3); flex: none; }
.sk-row div { display: grid; gap: 8px; }
.sk-line { height: 14px; border-radius: 8px; background: var(--bg-3); animation: shimmer 1.4s ease-in-out infinite; }
@keyframes shimmer { 50% { opacity: .45; } }

.chat-welcome { padding: 18px 20px 10px; margin-bottom: 8px; }
.chat-welcome h2 { font-family: var(--display); font-size: 1.6em; font-weight: 700; margin: 14px 0 6px; letter-spacing: -.01em; overflow-wrap: anywhere; }
.chat-welcome p { color: var(--text-3); margin: 4px 0; }
.chat-welcome .wl-user { font-size: 1.1em; color: var(--text-2); margin-top: -2px; }
.wl-icon { width: 68px; height: 68px; border-radius: 22px; background: var(--grad); display: grid; place-items: center; color: #fff; box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 35%, transparent); }
.e2e-note { display: inline-flex !important; align-items: center; gap: 6px; font-size: .8em; color: var(--green) !important; background: color-mix(in srgb, var(--green) 12%, transparent); padding: 5px 12px; border-radius: 999px; margin-top: 12px !important; }

.day-div { display: flex; justify-content: center; margin: 18px 16px 8px; pointer-events: none; }
.day-div span { padding: 3px 12px; border-radius: 999px; background: var(--bg-input); color: var(--text-3); font-size: .74em; font-weight: 600; }
.new-div { display: flex; align-items: center; gap: 10px; margin: 10px 18px 6px; color: var(--red); font-size: .72em; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.new-div::before, .new-div::after { content: ''; flex: 1; height: 1.5px; background: color-mix(in srgb, var(--red) 60%, transparent); border-radius: 1px; }

/* ===== сообщения-пузыри ===== */
.msg { position: relative; display: grid; grid-template-columns: 38px minmax(0, 1fr); column-gap: 10px; padding: 1px 16px; }
.msg.start { margin-top: 12px; }
.msg-gutter { display: flex; justify-content: center; align-items: flex-start; grid-row: span 3; }
.msg-ref + .msg-gutter { grid-row: 2 / span 2; }
.hover-time { display: none; }
.msg-body { min-width: 0; grid-column: 2; display: flex; flex-direction: column; align-items: flex-start; }
.bubble {
  position: relative; max-width: min(680px, 88%); min-width: 0; padding: 8px 12px 6px; border-radius: 6px 18px 18px 6px;
  background: var(--bubble); color: var(--bubble-text); overflow-wrap: anywhere;
}
.msg.start .bubble { border-top-left-radius: 18px; }
.msg-head { display: flex; align-items: baseline; gap: 8px; line-height: 1.3; margin-bottom: 2px; }
.msg-head time { display: none; }
.author { font-weight: 700; color: var(--accent-text); cursor: pointer; font-size: .9em; }
.author:hover { text-decoration: underline; }
.msg-text { line-height: 1.45; overflow-wrap: anywhere; }
.msg-text.jumbo { font-size: 2.6em; line-height: 1.15; }
.b-meta { float: right; display: inline-flex; align-items: center; gap: 3px; margin: 8px 0 -2px 10px; font-size: .68em; color: var(--text-4); line-height: 1; user-select: none; position: relative; }
.bubble.jumbo, .bubble.media { background: transparent; padding: 0; }
.bubble.media .b-meta { position: absolute; right: 8px; bottom: 8px; margin: 0; padding: 3px 7px; border-radius: 999px; background: rgba(0, 0, 0, .55); color: #fff; float: none; }
.bubble.jumbo .b-meta { margin-top: 4px; }
.bubble.media .msg-head { margin: 2px 4px 4px; }
.bubble.media .attachments, .bubble.media .gif-msg { margin-top: 0; }
.edited { display: none; }
/* свои сообщения: справа, с градиентом */
.msg.own { grid-template-columns: minmax(0, 1fr); }
.msg.own .msg-gutter { display: none; }
.msg.own .msg-body { grid-column: 1; align-items: flex-end; }
.msg.own .bubble { background: var(--grad); color: #fff; border-radius: 18px 6px 6px 18px; box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 22%, transparent); }
.msg.own.start .bubble { border-top-right-radius: 18px; }
.msg.own .bubble.media, .msg.own .bubble.jumbo { background: transparent; box-shadow: none; }
.msg.own .msg-head { display: none; }
.msg.own .b-meta { color: rgba(255, 255, 255, .72); }
.msg.own .bubble.jumbo .b-meta { color: var(--text-4); }
.msg.own .bubble a.link { color: #fff; text-decoration: underline; text-decoration-color: rgba(255, 255, 255, .5); }
.msg.own .bubble code.inline, .msg.own .bubble .codeblock { background: rgba(0, 0, 0, .22); border-color: rgba(255, 255, 255, .12); }
.msg.own .bubble .mention { background: rgba(255, 255, 255, .22); color: #fff; }
.msg.own .bubble blockquote { border-left-color: rgba(255, 255, 255, .5); }
.msg.own .bubble .spoiler { background: rgba(255, 255, 255, .35); }
.msg.own .bubble .md-sub, .msg.own .undecrypted { color: rgba(255, 255, 255, .75); }
.msg.own .reactions { justify-content: flex-end; }
.msg.mentioned:not(.own) .bubble { background: color-mix(in srgb, var(--mention-bar) 13%, var(--bubble)); box-shadow: inset 3px 0 0 var(--mention-bar); }
.msg.replying .bubble { box-shadow: 0 0 0 2px var(--accent); }
.msg.flash .bubble { animation: flash 1.8s ease-out; }
@keyframes flash { 0%, 35% { box-shadow: 0 0 0 3px var(--yellow); } }
.msg.pending .bubble { opacity: .65; }
.msg.failed .bubble { box-shadow: 0 0 0 2px var(--red); }
.msg.editing .bubble { width: min(680px, 88%); }
.msg-failed { font-size: .8em; color: var(--red); margin-top: 4px; }
.undecrypted { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-style: italic; font-size: .9em; }
.blocked-msg { color: var(--text-3); font-size: .875em; font-style: italic; }
.msg.blocked > :not(.note-gutter):not(.note-body) { display: none; }
.msg.blocked.reveal > :not(.note-gutter):not(.note-body) { display: revert; }
.msg.blocked.reveal > .note-gutter { display: none; }
/* ответ */
.msg-ref { grid-column: 2; display: flex; align-items: center; gap: 6px; margin: 0 0 4px; font-size: .8em; color: var(--text-3); cursor: pointer; min-width: 0; max-width: min(560px, 88%); padding: 4px 10px 4px 8px; border-radius: 12px; background: var(--bg-input); border-left: 3px solid var(--accent); justify-self: start; }
.msg.own .msg-ref { grid-column: 1; justify-self: end; }
.msg-ref .ref-spine { display: none; }
.msg-ref .ref-name { font-weight: 700; color: var(--text-2); flex: none; }
.msg-ref .ref-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.msg-ref:hover .ref-text { color: var(--text); }
.msg-ref.deleted { cursor: default; font-style: italic; border-left-color: var(--text-4); }
/* системные сообщения */
.msg.system { display: flex; justify-content: center; padding: 6px 16px; margin: 6px 0; }
.msg.system .msg-gutter { display: contents; }
.msg.system .msg-body { display: block; max-width: min(520px, 92%); padding: 5px 12px; border-radius: 14px; background: var(--bg-input); text-align: center; line-height: 1.45; }
.msg.system .msg-body > * { vertical-align: middle; }
.msg.system .sys-ic { margin-right: 4px; display: inline-block; }
.msg.system time { margin-left: 6px; }
.sys-ic { color: var(--text-3); }
.sys-ic.green { color: var(--green); }
.sys-ic.red { color: var(--red); }
.sys-text { color: var(--text-3); font-size: .86em; text-align: center; }
.sys-text .author { font-size: inherit; color: var(--text); }
.msg.system time { font-size: .72em; color: var(--text-4); }

/* вид «Список» вместо пузырей */
[data-density="compact"] .msg { grid-template-columns: 40px minmax(0, 1fr); padding: 1px 48px 1px 16px; }
[data-density="compact"] .msg.system { justify-content: flex-start; padding-left: 16px; }
[data-density="compact"] .msg.system .msg-body { text-align: left; background: none; padding: 0; }
[data-density="compact"] .msg:not(.system):hover { background: var(--bg-hover); }
[data-density="compact"] .msg.start { margin-top: 10px; }
[data-density="compact"] .msg.own { grid-template-columns: 40px minmax(0, 1fr); }
[data-density="compact"] .msg.own .msg-gutter { display: flex; }
[data-density="compact"] .msg.own .msg-body, [data-density="compact"] .msg-body { grid-column: 2; align-items: stretch; }
[data-density="compact"] .msg .bubble { background: none !important; color: var(--text); padding: 0; border-radius: 0; max-width: none; box-shadow: none !important; }
[data-density="compact"] .msg.own .msg-head { display: flex; }
[data-density="compact"] .msg-head time { display: inline; font-size: .74em; color: var(--text-4); }
[data-density="compact"] .b-meta { display: none; }
[data-density="compact"] .edited { display: inline; font-size: .7em; color: var(--text-4); }
[data-density="compact"] .hover-time { display: block; visibility: hidden; font-size: .66em; color: var(--text-4); line-height: 1.45rem; }
[data-density="compact"] .msg:hover .hover-time { visibility: visible; }
[data-density="compact"] .msg .avatar { --s: 32px !important; }
[data-density="compact"] .msg-ref, [data-density="compact"] .msg.own .msg-ref { grid-column: 2; justify-self: start; }
[data-density="compact"] .msg.mentioned { background: var(--mention-bg); box-shadow: inset 2px 0 0 var(--mention-bar); }
[data-density="compact"] .msg.own .bubble a.link { color: #6cb6ff; }
[data-density="compact"] .msg.own .bubble .mention { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent-text); }
[data-density="compact"] .msg.own .reactions { justify-content: flex-start; }
[data-density="compact"] .msg.own .att-file, [data-density="compact"] .msg.own .att-play, [data-density="compact"] .msg.own .invite-embed { background: var(--bg-input); color: var(--text); }
[data-density="compact"] .msg.own .att-name { color: #6cb6ff; }

/* разметка */
.md-p { min-height: 1.4em; }
.md strong { font-weight: 700; }
.md blockquote { margin: 3px 0; padding: 0 0 0 12px; border-left: 3px solid var(--text-4); border-radius: 2px; }
.md-h { font-weight: 700; margin: 6px 0 4px; line-height: 1.3; font-family: var(--display); }
h3.md-h { font-size: 1.35em; } h4.md-h { font-size: 1.15em; } h5.md-h { font-size: 1.02em; }
.md-sub { font-size: .8em; color: var(--text-3); }
.md-list { margin: 2px 0; padding-left: 22px; }
.md-list li.nested { margin-left: 18px; }
code.inline { font-size: .86em; padding: 2px 5px; background: var(--code-bg); border-radius: 6px; white-space: pre-wrap; }
.codeblock { position: relative; margin: 6px 0; padding: 10px 12px; background: var(--code-bg); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; font-family: var(--mono); font-size: .82em; line-height: 1.5; max-width: 100%; }
.codeblock code { background: none; padding: 0; white-space: pre; font-size: 1em; }
.codeblock[data-lang]::before { content: attr(data-lang); position: absolute; right: 38px; top: 7px; font-size: .75em; color: var(--text-4); font-family: var(--font); }
.code-copy { position: absolute; right: 6px; top: 6px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; color: var(--text-3); opacity: 0; background: var(--bg-3); }
.codeblock:hover .code-copy { opacity: 1; }
.spoiler { background: var(--text-4); color: transparent; border-radius: 5px; cursor: pointer; transition: background .15s; padding: 0 2px; }
.spoiler * { visibility: hidden; }
.spoiler.shown { background: var(--bg-hover); color: inherit; cursor: text; }
.spoiler.shown * { visibility: visible; }
.mention { background: color-mix(in srgb, var(--mc, var(--accent)) 22%, transparent); color: color-mix(in srgb, var(--mc, var(--accent)) 65%, var(--text)); border-radius: 6px; padding: 0 4px; font-weight: 600; }
.mention[role=button] { cursor: pointer; }
.mention[role=button]:hover { background: var(--mc, var(--accent)); color: #fff; }
a.link { color: #6cb6ff; word-break: break-word; }

/* инструменты сообщения */
.msg-tools { position: absolute; right: 18px; top: -18px; display: none; align-items: center; gap: 2px; padding: 3px; border-radius: 14px; background: var(--bg-float); box-shadow: var(--shadow-md), 0 0 0 1px var(--line); z-index: 3; animation: fade .1s; }
.msg:not(.own) .msg-tools { right: auto; left: 64px; }
.msg:hover .msg-tools { display: flex; }
[data-density="compact"] .msg .msg-tools { left: auto; right: 18px; }
.tool { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; color: var(--text-3); }
.tool:hover { background: var(--bg-hover); color: var(--text); }
.emoji-tool { font-size: 1.1em; }
.tool-sep { width: 1px; height: 20px; background: var(--line-2); margin: 0 2px; }

/* реакции */
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; max-width: min(680px, 88%); }
.reaction { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 9px; border-radius: 999px; background: var(--bg-input); border: 1.5px solid transparent; font-size: .86em; }
.reaction:hover { border-color: var(--line-2); }
.reaction.mine { background: var(--accent-soft); border-color: var(--accent); }
.r-emoji { font-size: 1.05em; }
.r-count { font-weight: 700; color: var(--text-2); font-size: .9em; }
.reaction.mine .r-count { color: var(--accent-text); }
.reaction.add { opacity: 0; color: var(--text-3); padding: 0 7px; }
.msg:hover .reaction.add { opacity: 1; }

/* вложения */
.attachments { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; align-items: flex-start; max-width: 100%; }
.attachments.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(160px, 100%), 1fr)); width: min(440px, 100%); }
.att-img { position: relative; border-radius: 14px; overflow: hidden; background: var(--bg-3); display: grid; place-items: center; cursor: zoom-in; width: 100%; }
.att-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-img.spoiler-img img { filter: blur(40px) brightness(.7); }
.spoiler-label { position: absolute; padding: 6px 12px; border-radius: 16px; background: rgba(0, 0, 0, .6); color: #fff; font-weight: 800; font-size: .8em; letter-spacing: .04em; pointer-events: none; }
.att-img:not(.spoiler-img) .spoiler-label { display: none; }
.att-err { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text-3); font-size: .8em; padding: 16px; }
.att-file { display: flex; align-items: center; gap: 12px; padding: 12px; width: min(380px, 100%); border-radius: 14px; background: var(--bg-input); color: var(--text-3); }
.msg.own .att-file, .msg.own .att-play { background: rgba(0, 0, 0, .18); color: #fff; }
.att-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.att-name { text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg.own .att-name { color: #fff; }
.att-meta small { opacity: .7; }
.att-media { width: min(440px, 100%); }
.att-media video { width: 100%; border-radius: 14px; background: #000; max-height: 360px; }
.att-media audio { width: 100%; }
.att-play { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px; border-radius: 14px; background: var(--bg-input); color: var(--text-2); text-align: left; }
.att-play span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-play small { opacity: .7; }
.att-pending { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; font-size: .82em; }
.att-pending span { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 8px; background: rgba(0, 0, 0, .15); }
.upload-progress { height: 4px; border-radius: 2px; background: rgba(0, 0, 0, .2); margin-top: 6px; width: 220px; max-width: 100%; overflow: hidden; }
.upload-progress i { display: block; height: 100%; width: 0; background: currentColor; transition: width .2s; }
.gif-msg { position: relative; margin-top: 6px; border-radius: 14px; overflow: hidden; background: var(--bg-3); width: 100%; }
.gif-msg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gif-tag { position: absolute; left: 8px; top: 8px; padding: 1px 6px; border-radius: 6px; background: rgba(0, 0, 0, .55); color: #fff; font-size: .62em; font-weight: 800; }
.gif-load { width: 100%; height: 100%; min-height: 120px; color: var(--text-3); font-size: .85em; }
.invite-embed { margin-top: 8px; padding: 14px; border-radius: 16px; background: var(--bg-input); width: min(400px, 100%); color: var(--text); }
.msg.own .invite-embed { background: rgba(0, 0, 0, .2); color: #fff; }
.ie-label { font-size: .72em; font-weight: 700; text-transform: uppercase; opacity: .7; margin-bottom: 10px; letter-spacing: .03em; }
.ie-row { display: flex; align-items: center; gap: 12px; }
.ie-icon { width: 50px; height: 50px; border-radius: 16px; object-fit: cover; flex: none; }
.ie-icon.letter { display: grid; place-items: center; background: var(--grad); color: #fff; font-weight: 700; font-size: 1.3em; }
.ie-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ie-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ie-text small { opacity: .75; font-size: .78em; }
.ie-row.dead { opacity: .7; }
.join-preview { min-height: 8px; margin: -6px 0 14px; }
.join-preview .ie-row { padding: 12px; background: var(--bg-input); border-radius: 14px; }
.edit-box { margin: 2px 0; min-width: min(420px, 66vw); }
.edit-input { min-height: 44px !important; max-height: 300px; resize: none !important; background: rgba(0, 0, 0, .2) !important; color: inherit !important; }
.edit-hint { font-size: .74em; opacity: .75; margin-top: 4px; }
.msg.own .edit-hint .link-like { color: #fff; text-decoration: underline; }

.jump-present { display: flex; align-items: center; gap: 6px; justify-content: center; padding: 8px 16px; margin: 0 auto 6px; border-radius: 999px; background: var(--grad); color: #fff; font-size: .82em; font-weight: 600; z-index: 3; animation: rise .2s var(--ease); box-shadow: var(--shadow-md); }
.typing { height: 22px; padding: 0 20px; display: flex; align-items: center; gap: 8px; font-size: .78em; color: var(--text-3); flex: none; overflow: hidden; white-space: nowrap; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: bounce 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-3px); opacity: 1; } }

/* поиск и закрепы */
.side-panel { width: 380px; flex: none; border-left: 1px solid var(--line); padding: 0 12px 16px; }
.sp-head { position: sticky; top: 0; display: flex; align-items: center; gap: 8px; height: 52px; background: var(--panel-solid); z-index: 1; }
.sp-head b { flex: 1; }
.sp-note { font-size: .75em; color: var(--text-4); margin: 0 0 10px; display: flex; gap: 4px; align-items: center; }
.sp-card { display: block; width: 100%; text-align: left; padding: 10px; border-radius: 14px; background: var(--bg-input); margin-bottom: 8px; border: 1.5px solid transparent; }
.sp-card:hover { border-color: var(--line-2); }
.sp-empty { display: grid; justify-items: center; gap: 8px; color: var(--text-3); padding: 40px 0; }
.msg-preview { display: flex; gap: 10px; min-width: 0; }
.msg-preview > div { min-width: 0; flex: 1; }
.mp-head { display: flex; gap: 8px; align-items: baseline; }
.mp-head time { font-size: .72em; color: var(--text-4); }
.mp-text { font-size: .9em; color: var(--text-2); max-height: 140px; overflow: hidden; overflow-wrap: anywhere; }
.pins-pop { width: min(420px, 92vw); max-height: min(560px, 80vh); display: flex; flex-direction: column; }
.pins-pop header { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.pins-pop h3 { font-size: 1em; font-family: var(--display); }
.pins-list { overflow-y: auto; padding: 10px; display: grid; gap: 8px; }
.pins-list > .spin { margin: 20px auto; }
.pin-card { position: relative; padding: 12px; border-radius: 14px; background: var(--bg-input); }
.pin-actions { position: absolute; top: 6px; right: 6px; display: none; gap: 4px; align-items: center; background: var(--bg-float); border-radius: 10px; padding: 3px; box-shadow: var(--shadow-md); }
.pin-card:hover .pin-actions { display: flex; }
.pins-empty { display: grid; justify-items: center; gap: 12px; padding: 30px 20px; text-align: center; color: var(--text-3); }

/* ---------------- поле ввода ---------------- */

.composer-wrap { position: relative; padding: 0 14px 14px; flex: none; }
.composer { background: var(--bg-input); border-radius: 24px; box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .15s; }
.composer:focus-within { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 55%, transparent); }
.composer.disabled { display: flex; align-items: center; gap: 10px; padding: 14px 18px; color: var(--text-3); font-size: .9em; }
.comp-row { display: flex; align-items: flex-end; min-height: 50px; padding: 0 6px; }
.comp-btn { width: 40px; height: 40px; margin: 0 0 5px; color: var(--text-3); border-radius: 50%; }
.comp-btn.plus { color: var(--accent-text); }
#composerInput { flex: 1; resize: none; background: transparent !important; border: 0 !important; box-shadow: none !important; padding: 13px 6px !important; min-height: 50px; max-height: 45vh; line-height: 1.45; min-width: 0; }
#composerInput:focus-visible, .add-friend input:focus-visible, .copy-row input:focus-visible, .edit-input:focus-visible { outline: none; }
.comp-tools { display: flex; align-items: center; }
.send-btn { display: none; background: var(--grad); color: #fff !important; }
.send-btn:hover { filter: brightness(1.1); background: var(--grad) !important; }
.composer.has-text .send-btn { display: grid; }
.slow { display: flex; align-items: center; gap: 4px; font-size: .72em; color: var(--text-3); margin: 0 6px 16px 0; }
.reply-bar { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 18px; border-bottom: 1px solid var(--line); font-size: .85em; color: var(--text-3); }
.reply-bar span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-bar b { color: var(--text); }
.reply-ping { display: inline-flex; align-items: center; gap: 3px; font-weight: 800; font-size: .85em; color: var(--text-3); }
.reply-ping.on { color: var(--accent-text); }
.attach-bar { display: flex; gap: 12px; padding: 16px 16px 8px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.att-card { position: relative; flex: none; width: 150px; height: 150px; padding: 8px; border-radius: 16px; background: var(--bg-2); display: flex; flex-direction: column; gap: 6px; }
.att-card img { flex: 1; min-height: 0; width: 100%; object-fit: cover; border-radius: 10px; }
.att-card.spoiler img { filter: blur(20px); }
.att-card-ic { flex: 1; display: grid; place-items: center; color: var(--text-3); background: var(--bg-3); border-radius: 10px; }
.att-card-name { font-size: .78em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-card-tools { position: absolute; top: -8px; right: -8px; display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--bg-float); box-shadow: var(--shadow-md); }
.ac-box { position: absolute; left: 14px; right: 14px; bottom: calc(100% - 10px); max-height: 340px; overflow-y: auto; padding: 8px; border-radius: 18px; background: var(--bg-float); box-shadow: var(--shadow-lg), 0 0 0 1px var(--line); z-index: 10; animation: rise .15s var(--ease); }
.ac-title { font-size: .72em; font-weight: 700; text-transform: uppercase; color: var(--text-4); padding: 4px 8px 8px; }
.ac-row { width: 100%; display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 12px; text-align: left; }
.ac-row.sel { background: var(--accent-soft); }
.ac-label { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-row small { margin-left: auto; color: var(--text-3); font-size: .8em; }
.ac-emoji { font-size: 1.3em; width: 24px; text-align: center; }
.drop-overlay { position: absolute; inset: 0; z-index: 20; display: none; place-items: center; background: color-mix(in srgb, var(--bg-app) 65%, transparent); backdrop-filter: blur(4px); pointer-events: none; }
.drop-overlay.on { display: grid; }
.drop-overlay > div { display: grid; justify-items: center; gap: 8px; padding: 40px 56px; border-radius: var(--r-xl); background: var(--grad); color: #fff; box-shadow: var(--shadow-lg); text-align: center; }
.drop-overlay p { margin: 0; opacity: .85; font-size: .9em; }

/* эмодзи и GIF */
.popover.flat { padding: 0; }
.emoji-picker { width: min(380px, 94vw); height: min(430px, 62vh); display: grid; grid-template-rows: auto auto 1fr auto; }
.ep-search { margin: 12px 12px 8px; width: calc(100% - 24px) !important; }
.ep-tabs { display: flex; gap: 2px; padding: 0 8px 6px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.ep-tab { width: 34px; height: 32px; border-radius: 10px; font-size: 1.05em; filter: grayscale(.6); flex: none; }
.ep-tab:hover { background: var(--bg-hover); filter: none; }
.ep-grid { padding: 6px 8px; }
.ep-grid h5 { font-size: .7em; text-transform: uppercase; color: var(--text-4); padding: 8px 4px 4px; position: sticky; top: -6px; background: var(--bg-float); z-index: 1; }
.ep-cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); }
.ep-cell { height: 40px; font-size: 1.5em; border-radius: 10px; line-height: 1; }
.ep-cell:hover { background: var(--bg-hover); }
.ep-none { text-align: center; color: var(--text-3); padding: 30px; }
.ep-preview { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; border-top: 1px solid var(--line); font-size: .85em; color: var(--text-2); }
.ep-big { font-size: 1.7em; }
.gif-picker { width: min(400px, 94vw); height: min(460px, 62vh); display: flex; flex-direction: column; }
.gif-wrap { flex: 1; padding: 0 10px 10px; }
.gif-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.gif-col { display: flex; flex-direction: column; gap: 6px; }
.gif-item { width: 100%; border-radius: 12px; overflow: hidden; background: var(--bg-3); }
.gif-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gif-item:hover { outline: 2px solid var(--accent); }
.gif-status { text-align: center; color: var(--text-3); padding: 12px; font-size: .85em; }

/* ---------------- участники и профили ---------------- */

.mem-group { font-size: .74em; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-4); padding: 16px 10px 6px; }
.mem-group:first-child { padding-top: 6px; }
.mem-row { display: flex; align-items: center; gap: 11px; padding: 6px 8px; border-radius: 14px; cursor: pointer; margin-bottom: 2px; }
.mem-row:hover { background: var(--bg-hover); }
.mem-row.offline { opacity: .4; }
.mem-row.offline:hover { opacity: 1; }
.mem-text { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.mem-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 4px; color: var(--text-2); }
.mem-row:hover .mem-name { color: var(--text); }
.mem-text small { color: var(--text-3); font-size: .75em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mem-voice { display: flex; align-items: center; gap: 2px; color: var(--green) !important; }
.crown { color: var(--yellow); display: inline-flex; }
.crown.red { color: var(--red); }
.mem-back { display: none; }

.popover { position: fixed; z-index: 1000; background: var(--bg-float); border-radius: var(--r-lg); box-shadow: var(--shadow-lg), 0 0 0 1px var(--line); overflow: hidden; animation: pop .16s var(--ease); --ring-bg: var(--bg-float); max-width: calc(100vw - 16px); }
.profile-pop { width: 320px; }
.profile-card { position: relative; background: var(--bg-float); --ring-bg: var(--bg-float); }
.pc-banner { height: 96px; position: relative; }
.pc-banner::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, .25)); }
.pc-avatar { position: absolute !important; left: 16px; top: 52px; padding: 5px; background: var(--ring-bg); border-radius: 38%; width: calc(var(--s) + 10px) !important; height: calc(var(--s) + 10px) !important; }
.pc-avatar .av-img { width: var(--s); height: var(--s); }
.pc-avatar .status-dot { right: 2px; bottom: 2px; }
.pc-body { padding: 50px 16px 16px; }
.profile-card.panel .pc-body, .profile-card.full .pc-body { padding-top: 62px; }
.pc-names h3 { font-family: var(--display); font-size: 1.2em; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.pc-user { color: var(--text-3); font-size: .875em; }
.pc-status { margin-top: 8px; font-size: .875em; color: var(--text-2); }
.pc-extra { margin-top: 12px; display: grid; gap: 14px; padding: 12px; background: var(--bg-input); border-radius: 16px; }
.pc-extra:empty { display: none; }
.pc-extra > .spin { justify-self: center; }
.pc-extra h5 { font-size: .72em; text-transform: uppercase; color: var(--text-4); margin-bottom: 6px; font-weight: 700; letter-spacing: .03em; }
.pc-bio { font-size: .88em; white-space: pre-wrap; }
.pc-since-row { display: flex; gap: 14px; flex-wrap: wrap; }
.pc-since { display: flex; align-items: center; gap: 6px; font-size: .82em; color: var(--text-2); }
.pc-since img, .pc-gdot { width: 16px; height: 16px; border-radius: 5px; object-fit: cover; display: inline-grid; place-items: center; background: var(--accent); color: #fff; font-size: 9px; font-style: normal; }
.pc-actions { display: flex; gap: 8px; margin-top: 12px; }
.pc-actions .btn { flex: 1; }
.pc-list { display: grid; gap: 2px; }
.pc-li { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 12px; text-align: left; font-size: .875em; }
.pc-li:hover { background: var(--bg-hover); }
.pc-safety { display: inline-flex; align-items: center; gap: 6px; font-size: .8em; justify-self: start; }
.pc-safety .warn { color: var(--red); }
.role-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.role-chip { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px 0 7px; border-radius: 999px; background: var(--bg-3); font-size: .76em; font-weight: 600; }
.rc-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-grid; place-items: center; color: transparent; flex: none; }
button.rc-dot:hover { color: #fff; }
.role-chip.add { padding: 0 8px; color: var(--text-3); }
#members.dm-profile { padding: 0; }
#members.dm-profile .profile-card { background: transparent; min-height: 100%; --ring-bg: var(--panel-solid); }
#members.dm-profile .pc-avatar { background: var(--panel-solid); }
.safety-code { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 16px; border-radius: var(--r); background: var(--bg-input); font-family: var(--mono); font-size: 1.05em; text-align: center; letter-spacing: .05em; margin-bottom: 14px; }

/* ---------------- друзья ---------------- */

.tabs { display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.tabs::-webkit-scrollbar { display: none; }
.tab { height: 32px; padding: 0 14px; border-radius: 999px; color: var(--text-3); font-weight: 600; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; font-size: .88em; flex: none; }
.tab:hover { background: var(--bg-hover); color: var(--text-2); }
.tab.active { background: var(--bg-active); color: var(--text); }
.tab.add { background: var(--grad); color: #fff; }
.tab.add.active { background: var(--accent-soft); color: var(--accent-text); }
.home-wrap { flex: 1; display: flex; min-height: 0; }
.friends { flex: 1; padding: 16px 22px 22px; min-width: 0; }
.fs-wrap { position: relative; margin-bottom: 8px; }
.friend-search { padding-right: 38px !important; border-radius: 999px !important; }
.fs-wrap .ic { position: absolute; right: 13px; top: 13px; color: var(--text-3); }
.friends-title { font-size: .74em; text-transform: uppercase; letter-spacing: .04em; color: var(--text-4); margin: 16px 0 8px; font-weight: 700; }
.friend-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin: 0 0 8px; border-radius: 18px; cursor: pointer; background: var(--bg-input); transition: background .15s, transform .12s; }
.friend-row:hover { background: var(--bg-active); }
.friend-row:active { transform: scale(.99); }
.fr-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fr-text b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-user { font-weight: 400; color: var(--text-3); margin-left: 6px; font-size: .86em; }
.fr-text small { color: var(--text-3); font-size: .82em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-actions { display: flex; gap: 8px; }
.home-empty { display: grid; justify-items: center; gap: 16px; padding: 56px 20px; color: var(--text-3); text-align: center; }
.he-art { opacity: .6; }
.add-head h2 { font-family: var(--display); font-size: 1.15em; margin-bottom: 6px; }
.add-head p { color: var(--text-3); margin: 0 0 16px; font-size: .9em; }
.add-friend { display: flex; align-items: center; gap: 10px; padding: 5px 5px 5px 16px; border-radius: 999px; background: var(--bg-input); border: 1.5px solid var(--line-2); }
.add-friend:focus-within { border-color: var(--accent); }
.add-friend.ok { border-color: var(--green); }
.add-friend.err { border-color: var(--red); }
.add-friend input { background: transparent !important; border: 0 !important; box-shadow: none !important; padding: 10px 0 !important; min-width: 0; }
.add-msg { font-size: .85em; margin: 8px 0 0 16px; }
.add-msg.ok { color: var(--green); }
.add-msg.err { color: var(--red); }
.active-now { width: 320px; flex: none; border-left: 1px solid var(--line); padding: 18px; }
.active-now h3 { font-family: var(--display); font-size: 1.05em; margin-bottom: 16px; }
.an-empty { text-align: center; padding: 18px; border-radius: var(--r); background: var(--bg-input); }
.an-empty p { color: var(--text-3); font-size: .85em; margin-bottom: 0; }
.an-card { padding: 14px; border-radius: var(--r); background: var(--bg-input); cursor: pointer; margin-bottom: 10px; }
.an-card:hover { background: var(--bg-active); }
.an-head { display: flex; gap: 10px; align-items: center; }
.an-head small { display: block; color: var(--text-3); font-size: .78em; }
.an-room { display: flex; align-items: center; gap: 6px; margin-top: 10px; padding: 8px 10px; border-radius: 12px; background: var(--bg-input); font-size: .85em; color: var(--text-2); }
.an-room span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-avs { display: flex; }
.an-avs .avatar { margin-left: -6px; }

/* быстрый переход */
.switcher { width: min(560px, 100%); }
.switcher .modal-body { padding: 18px; }
.qs-input { font-size: 1.1em !important; padding: 14px 18px !important; border-radius: 999px !important; }
.qs-list { max-height: 50vh; margin-top: 12px; display: grid; gap: 2px; }
.qs-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 14px; text-align: left; }
.qs-row.sel, .qs-row:hover { background: var(--accent-soft); }
.qs-row span { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qs-row small { margin-left: auto; color: var(--text-3); font-size: .8em; }
.qs-none { color: var(--text-3); text-align: center; padding: 16px; }
.qs-tip { font-size: .76em; color: var(--text-3); margin: 14px 0 0; }
.qs-tip b { color: var(--accent-text); }

/* ---------------- голос ---------------- */

.voice-stage { flex: 1; display: flex; flex-direction: column; min-height: 0; background: var(--stage); --ring-bg: var(--stage); }
.stage { flex: 1; min-height: 0; padding: 16px; display: grid; gap: 10px; place-content: center; overflow: auto; }
.stage.grid { grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); align-content: center; }
.stage.grid.n1 { grid-template-columns: minmax(0, 860px); }
.stage.grid.n2 { grid-template-columns: repeat(2, minmax(0, 560px)); }
.stage.focus-mode { display: flex; flex-direction: column; gap: 10px; }
.stage-main { flex: 1; min-height: 0; display: flex; }
.stage-main .tile { flex: 1; aspect-ratio: auto; }
.stage-strip { display: flex; gap: 10px; overflow-x: auto; justify-content: center; flex: none; }
.stage-strip .tile { width: 170px; flex: none; }
.stage.empty { color: #aaa; text-align: center; }
.stage-empty { display: grid; justify-items: center; gap: 8px; }
.stage-empty h2 { font-family: var(--display); color: #fff; }
.tile { position: relative; aspect-ratio: 16 / 9; border-radius: var(--r-lg); overflow: hidden; background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--tile-bg, #7c5cff) 45%, #15141c), #0d0c12 75%); display: grid; place-items: center; cursor: pointer; outline: 3px solid transparent; outline-offset: -3px; transition: outline-color .15s; }
.tile.speaking { outline-color: var(--green); }
.tile video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.tile.screen video { object-fit: contain; }
video.mirror { transform: scaleX(-1); }
.tile-label { position: absolute; left: 10px; bottom: 10px; display: flex; align-items: center; gap: 5px; max-width: calc(100% - 20px); padding: 5px 10px; border-radius: 999px; background: rgba(0, 0, 0, .55); color: #fff; font-size: .8em; font-weight: 600; }
.tile-label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-warn { background: var(--red); border-radius: 50%; width: 16px; height: 16px; display: grid; place-items: center; font-size: .8em; }
.tile-tools { position: absolute; right: 10px; top: 10px; opacity: 0; transition: opacity .15s; }
.tile:hover .tile-tools { opacity: 1; }
.tile-tools .icon-btn { background: rgba(0, 0, 0, .55); color: #fff; width: 30px; height: 30px; }
.tile.ringing { cursor: default; animation: breathe 2s ease-in-out infinite; }
.stage-controls { flex: none; display: flex; justify-content: center; align-items: center; gap: 12px; padding: 12px 16px calc(18px + var(--safe-b)); flex-wrap: wrap; }
.stage-controls .ctl { width: 54px; height: 54px; border-radius: 50%; background: rgba(255, 255, 255, .1); color: #fff; }
.stage-controls .ctl:hover { background: rgba(255, 255, 255, .18); color: #fff; }
.stage-controls .ctl.on { background: #fff; color: #111; }
.stage-controls .ctl.off { color: var(--red); background: rgba(255, 77, 94, .15); }
.stage-controls .ctl.hang { background: var(--red); }
.stage-controls .ctl.hang:hover { background: var(--red-h); }
.call-stage { flex: none; height: 300px; display: flex; position: relative; border-bottom: 1px solid var(--line); }
.call-stage.tall { height: 62vh; }
.call-stage .stage { padding: 12px; }
.call-stage .stage.grid { grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 340px)); }
.call-resize { position: absolute; left: 50%; bottom: -13px; transform: translateX(-50%); width: 40px; height: 24px; border-radius: 12px; background: var(--bg-3); color: var(--text-2); display: grid; place-items: center; z-index: 2; box-shadow: var(--shadow-md); }
.call-stage.tall .call-resize .ic { transform: rotate(180deg); }
#callLayer { position: fixed; right: 20px; bottom: 20px; z-index: 900; }
.incoming { width: 270px; padding: 26px 20px 22px; border-radius: var(--r-xl); background: var(--bg-float); box-shadow: var(--shadow-lg), 0 0 0 1px var(--line); display: grid; justify-items: center; gap: 6px; text-align: center; animation: rise .3s var(--ease); --ring-bg: var(--bg-float); }
.incoming .avatar { animation: ringpulse 1.4s ease-out infinite; border-radius: 34%; }
@keyframes ringpulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 55%, transparent); } 100% { box-shadow: 0 0 0 22px transparent; } }
.incoming b { font-family: var(--display); font-size: 1.1em; margin-top: 10px; }
.incoming small { color: var(--text-3); }
.inc-actions { display: flex; gap: 14px; margin-top: 14px; }
.sources { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; max-height: 50vh; overflow-y: auto; }
.source { display: grid; gap: 6px; padding: 8px; border-radius: 14px; background: var(--bg-input); text-align: left; font-size: .8em; }
.source:hover { outline: 2px solid var(--accent); }
.source img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; background: #000; }
.source span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-opts { display: flex; gap: 20px; align-items: flex-end; margin-top: 16px; flex-wrap: wrap; }
.inline-check { display: inline-flex; gap: 10px; align-items: center; margin-bottom: 18px; }

/* ---------------- окна ---------------- */

#layer { position: relative; z-index: 800; }
.modal-back { position: fixed; top: 0; left: 0; right: 0; height: var(--vvh, 100dvh); z-index: 800; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 16px; background: rgba(4, 4, 10, .62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; transition: opacity .18s; overflow: hidden; }
.modal-back.in { opacity: 1; }
.modal-back.out { opacity: 0; }
.modal { position: relative; width: min(480px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; background: var(--bg-float); border-radius: var(--r-xl); box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--line); transform: scale(.96) translateY(8px); transition: transform .22s var(--ease); --ring-bg: var(--bg-float); min-width: 0; }
.modal-back.in .modal { transform: none; }
.modal.small { width: min(440px, 100%); }
.modal.wide { width: min(760px, 100%); }
.modal.profile { width: min(560px, 100%); overflow: hidden; }
.modal.profile .modal-body { padding: 0; }
.modal.profile .pc-banner { height: 130px; }
.modal.profile .pc-avatar { top: 80px; }
.modal.profile .pc-body { padding-top: 66px; }
.modal.full { width: 100%; height: 100%; max-height: none; border-radius: 0; background: transparent; box-shadow: none; }
.modal-back:has(.modal.full) { padding: 0; background: var(--bg-app); backdrop-filter: none; }
.modal.bare { background: transparent; box-shadow: none; width: auto; }
.modal-head { padding: 24px 58px 4px 24px; }
.modal-head h2 { font-family: var(--display); font-size: 1.25em; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.modal-sub { color: var(--text-3); font-size: .9em; margin: 6px 0 0; }
.modal-x { position: absolute; right: 14px; top: 16px; }
.modal-body { padding: 18px 24px; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; min-height: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px 20px; flex-wrap: wrap; }
.choice { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; margin-bottom: 10px; border-radius: var(--r); background: var(--bg-input); text-align: left; transition: background .15s, transform .12s; }
.choice:hover { background: var(--bg-active); }
.choice:active { transform: scale(.99); }
.choice > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; }
.choice small { color: var(--text-3); }
.choice-ic { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; background: var(--grad); color: #fff; }
.icon-pick-wrap { display: grid; place-items: center; margin: 4px 0 20px; }
.icon-pick { position: relative; width: 88px; height: 88px; border-radius: 30px; cursor: pointer; flex: none; }
.icon-pick img { width: 100%; height: 100%; object-fit: cover; border-radius: 30px; }
.icon-pick-empty { width: 100%; height: 100%; border-radius: 30px; border: 2px dashed var(--text-4); display: grid; place-content: center; justify-items: center; color: var(--text-3); gap: 2px; }
.icon-pick-empty small { font-size: .55em; font-weight: 800; }
.icon-pick:hover .icon-pick-empty { color: var(--text); border-color: var(--accent); }
.icon-pick-x { position: absolute; right: -4px; top: -4px; width: 26px; height: 26px; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; }
.type-pick { display: grid; gap: 8px; }
.type-opt { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r); background: var(--bg-input); text-align: left; color: var(--text-2); border: 1.5px solid transparent; }
.type-opt > span { flex: 1; display: flex; flex-direction: column; }
.type-opt small { color: var(--text-3); font-size: .8em; }
.type-opt.on { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--text-4); flex: none; }
.radio.on { border: 6px solid var(--accent); }
.copy-row { display: flex; gap: 8px; padding: 4px; border-radius: 999px; background: var(--bg-input); }
.copy-row input { background: transparent !important; border: 0 !important; box-shadow: none !important; min-width: 0; }
.invite-link { margin-top: 18px; }
.inv-friends { max-height: 240px; margin: 10px 0; display: grid; gap: 2px; }
.inv-friend { display: flex; align-items: center; gap: 12px; padding: 6px 8px; border-radius: 14px; }
.inv-friend:hover { background: var(--bg-hover); }
.inv-friend span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-opts summary { cursor: pointer; color: var(--text-3); font-size: .85em; margin: 10px 0; }
.lightbox .modal-body { padding: 0; display: grid; place-items: center; }
.lb-img { max-width: 94vw; max-height: 80dvh; border-radius: 14px; cursor: zoom-in; box-shadow: var(--shadow-lg); }
.lb-img.zoom { max-width: none; max-height: none; cursor: zoom-out; }
.lb-bar { display: flex; align-items: center; gap: 6px; margin-top: 10px; color: #ddd; }
.lb-name { font-size: .85em; margin-right: 10px; }
.lb-bar .icon-btn { color: #ddd; }
.modal.bare .modal-body { overflow: auto; max-height: 100dvh; }

/* меню */
.menu { position: fixed; z-index: 1001; min-width: 210px; max-width: min(300px, calc(100vw - 16px)); max-height: calc(100dvh - 16px); overflow-y: auto; padding: 6px; border-radius: 18px; background: var(--bg-float); box-shadow: var(--shadow-lg), 0 0 0 1px var(--line); animation: pop .12s var(--ease); scrollbar-width: thin; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 7px 10px; border-radius: 12px; color: var(--text-2); text-align: left; font-size: .88em; font-weight: 500; }
.menu-item:hover:not(:disabled) { background: var(--accent-soft); color: var(--text); }
.menu-item.danger { color: var(--red); }
.menu-item.danger:hover:not(:disabled) { background: var(--red); color: #fff; }
.menu-label { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.menu-label small { font-size: .82em; opacity: .7; font-weight: 400; }
.menu-sep { height: 1px; background: var(--line-2); margin: 4px 8px; }
.menu-header { font-size: .7em; font-weight: 700; text-transform: uppercase; color: var(--text-4); padding: 8px 10px 4px; letter-spacing: .03em; }
.menu-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.menu-dot.big { width: 14px; height: 14px; }
.menu-check { width: 20px; height: 20px; border-radius: 7px; border: 2px solid var(--text-4); display: grid; place-items: center; flex: none; }
.menu-check.radio { border-radius: 50%; }
.menu-check.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.menu-reacts { display: flex; gap: 4px; padding: 2px 2px 6px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
.menu-react { flex: 1; height: 42px; border-radius: 14px; background: var(--bg-input); font-size: 1.25em; }
.menu-react:hover { background: var(--bg-active); }
.menu-slider { display: grid; grid-template-columns: 1fr auto; gap: 6px; padding: 6px 10px; font-size: .8em; color: var(--text-3); }
.menu-slider input { grid-column: 1 / -1; accent-color: var(--accent); }

#tip { position: fixed; z-index: 2000; max-width: 280px; padding: 6px 11px; border-radius: 10px; background: #0b0b10; color: #fff; font-size: .8em; font-weight: 600; box-shadow: var(--shadow-md); pointer-events: none; animation: fade .1s; }
#toasts { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); z-index: 3000; display: grid; gap: 8px; justify-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 24px); }
.toast { padding: 11px 18px; border-radius: 999px; background: var(--bg-float); color: var(--text); box-shadow: var(--shadow-lg), 0 0 0 1px var(--line); font-size: .9em; font-weight: 600; opacity: 0; transform: translateY(10px); transition: opacity .2s, transform .25s var(--ease); text-align: center; }
.toast.in { opacity: 1; transform: none; }
.toast.error { background: var(--red); color: #fff; }
#conn { position: fixed; top: 0; left: 0; right: 0; z-index: 2500; display: flex; align-items: center; justify-content: center; gap: 10px; padding: calc(8px + var(--safe-t)) 12px 8px; background: var(--yellow); color: #1c1300; font-weight: 600; font-size: .875em; }
#conn .spin { width: 14px; height: 14px; }
.notif-offer { display: flex; align-items: center; gap: 12px; margin: 10px 12px 0; padding: 10px 10px 10px 16px; border-radius: var(--r); background: var(--grad); color: #fff; font-size: .875em; font-weight: 600; flex: none; flex-wrap: wrap; }
.notif-offer span { flex: 1; min-width: 160px; }
.notif-offer .btn.primary { background: #fff; color: var(--accent); box-shadow: none; }
.notif-offer .icon-btn { color: #fff; }

/* ---------------- страницы настроек ----------------
   Слева «шапка» и сгруппированные разделы с цветными иконками, справа содержимое
   из отдельных плиток. Без процентных высот: так прокрутка работает и в Safari на iPhone. */

.modal.full { height: 100vh; height: var(--vvh, 100dvh); max-height: var(--vvh, 100dvh) !important; }
.modal-back { grid-template-rows: minmax(0, 1fr); }
.settings-modal .modal-body { flex: 1; min-height: 0; display: flex; padding: 0; overflow: hidden; }
.settings-page { position: relative; flex: 1; min-height: 0; min-width: 0; display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: var(--gap); padding: var(--gap); }
.sp-side { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-radius: var(--r-lg); box-shadow: inset 0 0 0 1px var(--line); }
.sp-nav { flex: 1; min-height: 0; padding: 16px 14px 28px; }
.sp-hero { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; padding: 22px 16px 18px; margin-bottom: 18px; border-radius: var(--r-lg); background: radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--accent) 34%, transparent), transparent 70%), var(--bg-input); text-align: center; --ring-bg: var(--panel-solid); }
.sp-hero b { font-family: var(--display); font-size: 1.15em; margin-top: 6px; overflow-wrap: anywhere; }
.sp-hero small { color: var(--text-3); font-size: .82em; overflow-wrap: anywhere; }
.sp-hero .gicon { border-radius: 26px; }
button.sp-hero:hover { filter: brightness(1.06); }
.sp-nav h6 { font-size: .72em; font-weight: 700; text-transform: uppercase; color: var(--text-4); padding: 0 12px 7px; letter-spacing: .05em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-group { background: var(--bg-input); border-radius: 18px; padding: 4px; margin-bottom: 18px; }
.sp-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border-radius: 14px; color: var(--text); font-weight: 600; text-align: left; font-size: .94em; }
.sp-item + .sp-item { margin-top: 2px; }
.sp-item:hover { background: var(--bg-hover); }
.sp-item.active { background: var(--accent-soft); }
.sp-item.danger .sp-label { color: var(--red); }
.sp-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-ic { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--tint); color: #fff; flex: none; box-shadow: 0 4px 12px color-mix(in srgb, var(--tint) 35%, transparent); }
.sp-chev { color: var(--text-4); display: none; }
.sp-version { font-size: .72em; color: var(--text-4); padding: 0 12px; text-align: center; }
.sp-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--panel); border-radius: var(--r-lg); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.sp-content { flex: 1; min-height: 0; padding: 30px 40px 80px; }
.sp-inner { max-width: 720px; margin: 0 auto; position: relative; padding-bottom: 60px; min-width: 0; }
.sp-title { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; padding-right: 50px; }
.sp-title .sp-ic { width: 44px; height: 44px; border-radius: 14px; }
.sp-title h2 { font-family: var(--display); font-size: 1.35em; overflow-wrap: anywhere; min-width: 0; }
.sp-back { display: none; align-items: center; gap: 2px; color: var(--accent-text); margin: 0 0 14px -6px; font-weight: 600; font-size: 1.02em; }
.sp-close { position: absolute; top: calc(var(--gap) + 18px); right: calc(var(--gap) + 18px); display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: var(--bg-input); color: var(--text-2); z-index: 3; }
.sp-close:hover { color: var(--text); background: var(--bg-active); }
.sp-inner .set-row { background: var(--bg-input); border-radius: var(--r); padding: 14px 16px; margin-bottom: 8px; border-bottom: 0; }
.sp-inner .sub-h { margin: 26px 4px 10px; }
.sp-inner > .field, .sp-inner > .row2, .sp-inner .pe-form > .field { background: var(--bg-input); padding: 14px 16px; border-radius: var(--r); }
.sp-inner .row2 > .field { margin: 0; }
.save-bar { position: sticky; bottom: 18px; margin-top: 24px; display: flex; align-items: center; gap: 14px; padding: 10px 10px 10px 18px; border-radius: 999px; background: var(--bg-float); box-shadow: var(--shadow-lg), 0 0 0 1px var(--line); animation: rise .2s var(--ease); z-index: 5; flex-wrap: wrap; }
.save-bar span { flex: 1; font-weight: 600; font-size: .9em; min-width: 140px; }
.save-bar .link-like { color: var(--text-2); }
/* сгруппированные списки */
.list-title { font-size: .72em; font-weight: 700; text-transform: uppercase; color: var(--text-4); letter-spacing: .05em; margin: 24px 6px 8px; }
.list-group { background: var(--bg-input); border-radius: 18px; overflow: hidden; }
.list-group.pad { padding: 16px; }
.list-group.pad .muted-text { margin: 12px 0 0; }
.list-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 10px 16px; text-align: left; }
.list-row + .list-row { border-top: 1px solid var(--line); }
.list-row.tap:hover { background: var(--bg-hover); }
.lr-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lr-label { font-weight: 600; }
.lr-text small { color: var(--text-3); font-size: .8em; margin-top: 2px; }
.lr-value { color: var(--text-3); font-size: .92em; max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lr-chev { color: var(--text-4); }
.list-row.danger .lr-label { color: var(--red); }
.acc-hero { display: flex; align-items: center; gap: 16px; padding: 20px; border-radius: var(--r-lg); background: linear-gradient(135deg, color-mix(in srgb, var(--banner) 55%, transparent), color-mix(in srgb, var(--banner) 10%, transparent)), var(--bg-input); --ring-bg: var(--panel-solid); flex-wrap: wrap; }
.acc-hero .avatar .av-img { box-shadow: 0 0 0 4px var(--panel-solid); }
.acc-hero-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.acc-hero-text h3 { font-family: var(--display); font-size: 1.25em; overflow-wrap: anywhere; }
.acc-hero-text span { color: var(--text-2); font-size: .9em; }
.storage-top { display: flex; align-items: baseline; gap: 6px; margin-bottom: 10px; }
.storage-top b { font-family: var(--display); font-size: 1.2em; }
.storage-top span { color: var(--text-3); font-size: .88em; }

.acc-card { border-radius: var(--r-lg); overflow: hidden; background: var(--bg-input); --ring-bg: var(--panel-solid); }
.acc-banner { height: 96px; }
.acc-top { display: flex; align-items: flex-end; gap: 14px; padding: 0 16px; margin-top: -34px; flex-wrap: wrap; }
.acc-top .avatar { border: 5px solid var(--panel-solid); border-radius: 38%; width: calc(var(--s) + 10px); height: calc(var(--s) + 10px); background: var(--panel-solid); }
.acc-top h3 { flex: 1; font-family: var(--display); font-size: 1.15em; margin-bottom: 8px; min-width: 0; overflow-wrap: anywhere; }
.acc-top .btn { margin-bottom: 8px; }
.acc-rows { margin: 14px; padding: 16px; border-radius: var(--r); background: var(--bg-input); display: grid; gap: 18px; }
.acc-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.acc-row > div { min-width: 0; }
.acc-row h5 { font-size: .72em; text-transform: uppercase; color: var(--text-4); margin-bottom: 4px; letter-spacing: .03em; }
.acc-row span { overflow-wrap: anywhere; }
.profile-edit { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; }
.profile-preview h5 { font-size: .72em; text-transform: uppercase; color: var(--text-4); margin-bottom: 10px; }
.profile-preview .profile-card { border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-md), 0 0 0 1px var(--line); }
.color-btn { width: 64px; height: 40px; border-radius: 12px; cursor: pointer; display: block; box-shadow: inset 0 0 0 1px var(--line-2); }
.color-btn input { opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.counter { float: right; color: var(--text-4); font-weight: 500; }
.radio-list { display: grid; gap: 8px; margin-bottom: 8px; }
.radio-row { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: var(--r); background: var(--bg-input); cursor: pointer; border: 1.5px solid transparent; }
.radio-row:hover { background: var(--bg-active); }
.radio-row input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; margin: 0; }
.radio-row span { display: flex; flex-direction: column; min-width: 0; }
.radio-row small { color: var(--text-3); font-size: .82em; }
.radio-row:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.facts { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.facts li { display: flex; gap: 10px; align-items: flex-start; color: var(--text-2); font-size: .9em; line-height: 1.5; }
.facts li .ic { margin-top: 3px; color: var(--green); }
.e2e-card { display: flex; gap: 16px; align-items: flex-start; padding: 18px; border-radius: var(--r-lg); background: color-mix(in srgb, var(--green) 10%, var(--bg-input)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--green) 28%, transparent); margin-bottom: 20px; }
.e2e-card > .ic { color: var(--green); }
.e2e-card p { margin: 6px 0 0; color: var(--text-2); font-size: .9em; line-height: 1.5; }
.devices { display: grid; gap: 8px; }
.devices h5 { font-size: .72em; text-transform: uppercase; color: var(--text-4); margin: 12px 0 4px; }
.device { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: var(--r); background: var(--bg-input); }
.dev-ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--bg-3); color: var(--text-2); flex: none; }
.dev-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.dev-text small { color: var(--text-3); }
.look-sample { padding: 8px 0 16px; border-radius: var(--r-lg); background: var(--bg-input); margin-bottom: 8px; overflow: hidden; }
.theme-pick { display: flex; gap: 14px; flex-wrap: wrap; }
.theme-opt { display: grid; justify-items: center; gap: 6px; font-size: .8em; color: var(--text-2); }
.theme-opt i { width: 64px; height: 64px; border-radius: 22px; box-shadow: inset 0 0 0 1px var(--line-2); }
.t-dark i { background: linear-gradient(135deg, #1d1c28 50%, #08080c 50%); }
.t-midnight i { background: #000; }
.t-light i { background: linear-gradient(135deg, #fff 50%, #eceaf3 50%); }
.t-system i { background: linear-gradient(135deg, #fff 50%, #14141c 50%); }
.theme-opt.on i { box-shadow: 0 0 0 3px var(--accent); }
.swatches { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.swatch-grid { display: grid; grid-template-columns: repeat(9, 24px); gap: 8px; }
.swatch-grid.big { grid-template-columns: repeat(8, 40px); gap: 12px; }
.swatch { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; color: #fff; }
.swatch-grid.big .swatch { width: 40px; height: 40px; border-radius: 14px; }
.swatch.big { width: 66px; height: 52px; border-radius: 14px; }
.swatch.on { box-shadow: 0 0 0 2px var(--panel-solid), 0 0 0 4px var(--text); }
.swatch.custom { position: relative; cursor: pointer; }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.mic-test { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; flex-wrap: wrap; }
.mic-meter { position: relative; flex: 1; min-width: 140px; height: 10px; border-radius: 5px; background: var(--bg-4); overflow: hidden; }
.mic-meter .lvl { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--yellow); transition: width .05s linear; }
.mic-meter .lvl.over { background: var(--green); }
.mic-meter .thr { position: absolute; top: -2px; bottom: -2px; width: 3px; background: var(--text); border-radius: 2px; }
.key-cap { min-width: 140px; padding: 9px 14px; border-radius: 12px; background: var(--bg-input); box-shadow: inset 0 0 0 1.5px var(--line-2); font-weight: 700; }
.key-cap.rec { box-shadow: inset 0 0 0 2px var(--red); color: var(--red); }
.cam-preview { position: relative; aspect-ratio: 16/9; max-width: 420px; border-radius: var(--r-lg); background: var(--bg-input); display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--text-4); overflow: hidden; }
.cam-preview video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-stop { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); background: rgba(0, 0, 0, .55) !important; color: #fff !important; }
.about { display: grid; justify-items: center; gap: 8px; padding: 24px; text-align: center; }
.about h3 { font-family: var(--display); }
.overview-row { display: flex; gap: 24px; align-items: flex-start; }
.overview-row .icon-pick-wrap { margin: 0; }
.grow { flex: 1; min-width: 0; }
.storage { margin-bottom: 6px; }
.storage-bar { height: 10px; border-radius: 5px; background: var(--bg-4); overflow: hidden; }
.storage-bar i { display: block; height: 100%; background: var(--grad); border-radius: 5px; }
.storage-bar.warn i { background: var(--yellow); }
.storage-bar.full i { background: var(--red); }
.storage-text { margin-top: 8px; font-size: .85em; color: var(--text-3); overflow-wrap: anywhere; }
.storage-text b { color: var(--text); }

/* роли и права */
.roles-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.role-list { display: grid; gap: 4px; margin-top: 8px; }
.role-row { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: var(--r); background: var(--bg-input); cursor: pointer; width: 100%; text-align: left; }
.role-row:hover { background: var(--bg-active); }
.role-row b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-row .grip { color: var(--text-4); cursor: grab; }
.role-row.locked { opacity: .55; cursor: default; }
.role-row.drop { box-shadow: inset 0 2px 0 var(--accent); }
.role-row.everyone { padding: 14px; margin-bottom: 4px; }
.role-row.everyone > span { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.role-row.everyone small { color: var(--text-3); }
.role-count { display: flex; align-items: center; gap: 4px; color: var(--text-3); font-size: .85em; }
.tag { font-size: .7em; padding: 2px 7px; border-radius: 999px; background: var(--bg-4); color: var(--text-2); }
.role-edit-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.role-edit-head h3 { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--display); min-width: 0; }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--text-3); }
.sp-inner .tabs { border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 16px; }
.sp-inner h5 { font-size: .74em; text-transform: uppercase; color: var(--text-3); margin: 22px 0 4px; font-weight: 700; letter-spacing: .03em; }
.mem-line { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 14px; }
.mem-line:hover { background: var(--bg-hover); }
.mem-line span { font-weight: 600; }
.mem-line small { color: var(--text-3); flex: 1; }
.ow-wrap { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; }
.ow-list { display: grid; gap: 2px; align-content: start; }
.ow-head { display: flex; align-items: center; justify-content: space-between; font-size: .75em; text-transform: uppercase; color: var(--text-3); padding: 0 4px 6px; }
.ow-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; text-align: left; font-size: .9em; color: var(--text-2); }
.ow-item:hover { background: var(--bg-hover); }
.ow-item.on { background: var(--accent-soft); color: var(--text); }
.ow-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ow-perms h4 { margin-bottom: 4px; font-family: var(--display); }
.tri { display: flex; border-radius: 12px; overflow: hidden; box-shadow: inset 0 0 0 1.5px var(--line-2); flex: none; }
.tri-btn { width: 36px; height: 32px; display: grid; place-items: center; color: var(--text-3); font-weight: 700; }
.tri-btn + .tri-btn { border-left: 1px solid var(--line-2); }
.tri-btn.deny.on { background: var(--red); color: #fff; }
.tri-btn.inherit.on { background: var(--bg-4); color: var(--text); }
.tri-btn.allow.on { background: var(--green); color: #fff; }
.gm-list { display: grid; gap: 2px; margin-top: 12px; }
.gm-head, .gm-row { display: grid; grid-template-columns: minmax(0, 1.6fr) 1fr minmax(0, 1.4fr) auto; gap: 12px; align-items: center; padding: 8px 10px; }
.gm-row.two { grid-template-columns: minmax(0, 1fr) auto; }
.gm-head { font-size: .7em; text-transform: uppercase; color: var(--text-4); font-weight: 700; }
.gm-row { border-radius: 14px; }
.gm-row:hover { background: var(--bg-hover); }
.gm-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.gm-user > div { min-width: 0; display: flex; flex-direction: column; }
.gm-user b { display: flex; align-items: center; gap: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gm-user small { color: var(--text-3); font-size: .8em; }
.gm-date { color: var(--text-3); font-size: .85em; display: flex; align-items: center; gap: 8px; }

/* ---------------- планшет ---------------- */

@media (max-width: 1100px) {
  #members:not([hidden]) { position: fixed; top: 8px; right: 8px; bottom: 8px; z-index: 60; transform: translateX(calc(100% + 20px)); transition: transform .25s var(--ease); box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--line); background: var(--panel-solid); }
  #app.members-open #members { transform: none; }
  #app.members-open #scrim { display: block; position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .5); }
  .active-now { display: none; }
  .side-panel { position: absolute; right: 0; top: 0; bottom: 0; z-index: 10; width: min(380px, 100%); box-shadow: var(--shadow-lg); background: var(--panel-solid); }
}

/* ---------------- телефон: экраны и вкладки внизу ---------------- */

@media (max-width: 760px) {
  :root { --fs: calc(16px * var(--font-scale)); }
  /* iPhone увеличивает страницу, если шрифт в поле меньше 16px */
  input:not([type=checkbox]):not([type=radio]):not([type=range]), textarea, select { font-size: 16px !important; }
  #app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; gap: 0; padding: 0; }
  #side, #main, #members { border-radius: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--panel-solid); }
  #rail { display: none; }
  #side { grid-column: 1; grid-row: 1 / 3; padding-top: var(--safe-t); }
  #main { display: none; grid-column: 1; grid-row: 1 / 4; padding-top: var(--safe-t); }
  #app.m-main #main { display: flex; }
  #app.m-main #side, #app.m-main #rail { display: none !important; }
  #app.m-main.m-root #main { grid-row: 1 / 3; }
  #app.m-root #tabbar { display: grid; grid-column: 1; grid-row: 3; grid-template-columns: repeat(4, 1fr); padding: 6px 6px calc(6px + var(--safe-b)); background: var(--panel-solid); border-top: 1px solid var(--line); z-index: 5; --ring-bg: var(--panel-solid); }
  .tb-item { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0; border-radius: 14px; color: var(--text-3); font-size: .7em; font-weight: 600; min-width: 0; }
  .tb-item.on { color: var(--text); }
  .tb-item.on .tb-ic { background: var(--accent-soft); color: var(--accent-text); }
  .tb-ic { position: relative; display: grid; place-items: center; width: 56px; height: 32px; border-radius: 16px; transition: background .2s; }
  .tb-ic .badge { position: absolute; top: -3px; right: 6px; box-shadow: 0 0 0 2px var(--panel-solid); }
  #sideFoot { padding: 8px 10px; }
  #sideFoot:empty, #sideFoot:has(#voicePanel[hidden]) { display: none; }
  #userPanel { display: none; }
  .side-head { height: 60px; padding: 0 14px; }
  #sideBody { padding: 8px 12px 16px; }
  .ch-row { height: 46px; font-size: 1.02em; }
  .dm-row { padding: 9px 10px; }
  .ch-actions { display: none !important; }
  .cat-row .icon-btn { opacity: 1; }
  .dm-close { display: none; }
  .menu-btn { display: inline-grid; margin-left: -8px; }
  .m-root .menu-btn { display: none; }
  .main-head { min-height: 56px; padding: 0 6px 0 12px; gap: 6px; }
  .head-topic, .head-div, .search-box { display: none; }
  .head-title { max-width: none; flex: 1; min-width: 0; }
  .head-right { gap: 0; }
  .head-right .icon-btn { width: 40px; height: 40px; }
  .msg { padding: 1px 10px; column-gap: 8px; grid-template-columns: 32px minmax(0, 1fr); }
  .msg .msg-gutter .avatar { --s: 32px !important; }
  .bubble, .reactions, .msg-ref { max-width: 88%; }
  .msg:not(.own) .bubble, .msg:not(.own) .reactions, .msg:not(.own) .msg-ref { max-width: 94%; }
  .msg-tools, .msg:hover .msg-tools { display: none !important; }
  .reaction.add { display: none; }
  [data-density="compact"] .msg { padding: 1px 10px; grid-template-columns: 32px minmax(0, 1fr); }
  .composer-wrap { padding: 0 8px calc(8px + var(--safe-b)); }
  .chat-welcome { padding: 16px 14px 8px; }
  .chat-welcome h2 { font-size: 1.35em; }
  .attach-bar { padding: 14px 12px 8px; }
  .att-card { width: 120px; height: 120px; }
  #members:not([hidden]) { position: fixed; inset: 0; z-index: 70; width: auto; padding: calc(10px + var(--safe-t)) 12px calc(16px + var(--safe-b)); transform: translateX(100%); background: var(--panel-solid); top: 0; right: 0; bottom: 0; }
  #app.members-open #members { transform: none; }
  #app.members-open #scrim { display: none; }
  .mem-back { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-weight: 600; padding: 6px 4px 10px; }
  #members.dm-profile .mem-back { position: absolute; top: calc(10px + var(--safe-t)); left: 10px; z-index: 2; background: rgba(0, 0, 0, .4); color: #fff; border-radius: 999px; padding: 6px 12px; }
  .main-head .tabs { position: absolute; left: 0; right: 0; top: 100%; padding: 8px 12px; background: var(--panel-solid); border-bottom: 1px solid var(--line); }
  .home-wrap { margin-top: 48px; }
  .friends { padding: 12px 14px 16px; }
  .stage { padding: 8px; }
  .stage.grid, .stage.grid.n2 { grid-template-columns: minmax(0, 1fr); }
  .stage-strip .tile { width: 130px; }
  .call-stage { height: 46vh; }
  .stage-controls { gap: 10px; }
  .stage-controls .ctl { width: 52px; height: 52px; }
  #callLayer { left: 12px; right: 12px; bottom: calc(12px + var(--safe-b)); display: flex; justify-content: center; }
  .incoming { width: 100%; max-width: 360px; }
  .modal-back { padding: 0; place-items: end center; }
  .modal { width: 100% !important; max-height: 92dvh; border-radius: 26px 26px 0 0; transform: translateY(40px); }
  .modal::before { content: ''; position: absolute; top: 8px; left: 50%; width: 40px; height: 5px; margin-left: -20px; border-radius: 3px; background: var(--line-2); z-index: 1; }
  .modal.full::before, .modal.bare::before { display: none; }
  .modal-back.in .modal { transform: none; }
  .modal-head { padding-top: 26px; }
  .modal-body { padding: 16px 18px; }
  .modal-foot { padding: 12px 16px calc(14px + var(--safe-b)); }
  .modal-foot .btn { flex: 1; }
  .modal.full { border-radius: 0; transform: none; }
  .modal.bare { border-radius: 0; transform: none; }
  .modal-back:has(.modal.bare) { place-items: center; }
  .settings-page { display: flex; padding: 0; gap: 0; }
  .sp-side { flex: 1; border-radius: 0; box-shadow: none; background: var(--panel-solid); }
  .sp-nav { padding: calc(16px + var(--safe-t)) 14px calc(30px + var(--safe-b)); }
  .sp-hero { padding-top: 26px; }
  .sp-item { padding: 10px 10px; font-size: 1em; }
  .sp-chev { display: block; }
  .sp-item.active { background: none; }
  .sp-main { display: none; flex: 1; border-radius: 0; box-shadow: none; background: var(--panel-solid); }
  .settings-page.show-content .sp-side { display: none; }
  .settings-page.show-content .sp-main { display: flex; }
  .sp-content { padding: calc(12px + var(--safe-t)) 14px calc(40px + var(--safe-b)); }
  .sp-title { margin-bottom: 18px; }
  .sp-title h2 { font-size: 1.2em; }
  .sp-back { display: inline-flex; }
  .sp-close { top: calc(12px + var(--safe-t)); right: 12px; }
  .settings-page.show-content .sp-close { display: none; }
  .acc-hero { flex-direction: column; text-align: center; }
  .acc-hero .btn { width: 100%; }
  .profile-edit, .row2, .ow-wrap { grid-template-columns: minmax(0, 1fr); }
  .profile-preview { display: none; }
  .gm-head { display: none; }
  .gm-row { grid-template-columns: minmax(0, 1fr) auto; }
  .gm-row > :nth-child(2), .gm-row > :nth-child(3) { display: none; }
  .gm-row.two > :nth-child(2) { display: inline-flex; }
  /* приглашения на телефоне: код ссылки важнее числа использований — показываем его */
  .gm-row.inv { grid-template-columns: minmax(0, 1fr) auto auto; }
  .gm-row.inv > :nth-child(2) { display: inline-block; }
  .set-row { flex-wrap: wrap; }
  .set-row > select { min-width: 0; width: 100%; }
  .swatch-grid.big { grid-template-columns: repeat(4, 44px); }
  .swatch-grid { grid-template-columns: repeat(6, 28px); }
  .swatch { width: 28px; height: 28px; }
  .overview-row { flex-direction: column; align-items: center; }
  .save-bar { border-radius: 20px; bottom: calc(10px + var(--safe-b)); }
  .menu { border-radius: 20px; }
  .menu-item { min-height: 44px; font-size: .95em; }
  #toasts { bottom: calc(84px + var(--safe-b)); }
  .notif-offer { margin: 8px 10px 0; }
  .auth-card { padding: 28px 20px 22px; border-radius: 24px; }
  .profile-pop { width: min(340px, calc(100vw - 16px)); }
  .emoji-picker, .gif-picker { width: calc(100vw - 16px); }
}

@media (hover: none) {
  .msg-tools, .reaction.add { display: none !important; }
  .ch-actions { display: none !important; }
  .dm-close { display: none; }
}

/* ======================================================================
   Док разделов, дерево серверов, минималистичные страницы
   ====================================================================== */

#rail { justify-content: flex-start; gap: 6px; padding: 10px 0; }
.dock-logo { display: grid; place-items: center; width: 48px; height: 44px; margin-bottom: 10px; }
.dock-item { position: relative; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 16px; color: var(--text-3); transition: background .15s, color .15s; flex: none; }
.dock-item:hover { color: var(--text); background: var(--bg-hover); }
.dock-item.on { color: #fff; background: var(--grad); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
.dock-item .badge { position: absolute; top: 2px; right: 0; box-shadow: 0 0 0 3px var(--bg-app); }
.dock-dot { position: absolute; top: 9px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--text); box-shadow: 0 0 0 3px var(--bg-app); }
.dock-item.on .dock-dot { display: none; }
.dock-item.add { color: var(--text-3); border: 1.5px dashed var(--line-2); }
.dock-item.add:hover { color: var(--green); border-color: var(--green); background: transparent; }
.dock-space { flex: 1; }
.dock-me { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 16px; --ring-bg: var(--bg-app); margin-top: 4px; }
.dock-me:hover { background: var(--bg-hover); }

.side-head { gap: 8px; }
.side-title { flex: 1; min-width: 0; font-family: var(--display); font-size: 1.1em; padding-left: 6px; }
.side-tools { display: flex; gap: 2px; }
.side-cta { padding: 34px 16px; }
.side-cta p { margin: 0; }

.srv-row { position: relative; display: flex; align-items: center; gap: 12px; padding: 7px 8px; margin-bottom: 2px; border-radius: 14px; cursor: pointer; color: var(--text-2); }
.srv-row:hover { background: var(--bg-hover); color: var(--text); }
.srv-row.current { color: var(--text); }
.srv-row.open { background: var(--bg-input); border-radius: 14px 14px 0 0; margin-bottom: 0; }
.srv-row .gicon { border-radius: 11px; font-size: 12px; }
.srv-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srv-row.unread .srv-name { font-weight: 800; }
.srv-row.unread::before { content: ''; position: absolute; left: -6px; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%; background: var(--text); }
.srv-voice { color: var(--green); }
.srv-more { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; color: var(--text-3); opacity: 0; }
.srv-row:hover .srv-more, .srv-row.open .srv-more { opacity: 1; }
.srv-more:hover { background: var(--bg-active); color: var(--text); }
.srv-row.drop { box-shadow: inset 0 2px 0 var(--accent); }
.srv-row.dragging { opacity: .4; }
.srv-channels { background: var(--bg-input); border-radius: 0 0 14px 14px; padding: 2px 6px 8px; margin-bottom: 8px; }
.srv-channels .cat-row { padding-top: 10px; }
.srv-channels .ch-row { height: 34px; }

/* страницы (друзья и т. п.): спокойная шапка без вкладок */
.page-head { min-height: 56px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 10px 0 20px; }
.page-title { flex: 1; min-width: 0; font-family: var(--display); font-size: 1.25em; font-weight: 700; }
.icon-btn.accent { color: #fff; background: var(--grad); border-radius: 50%; width: 40px; height: 40px; }
.icon-btn.accent:hover { color: #fff; background: var(--grad); filter: brightness(1.1); }
.icon-btn.soft { background: var(--bg-input); border-radius: 50%; width: 38px; height: 38px; color: var(--text-2); }
.icon-btn.soft.green:hover { background: var(--green); color: #fff; }
.icon-btn.soft.red:hover { background: var(--red); color: #fff; }
.page-body { flex: 1; min-height: 0; padding: 4px 20px 24px; max-width: 760px; width: 100%; margin: 0 auto; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--bg-input); margin-bottom: 12px; }
.seg-btn { display: flex; align-items: center; justify-content: center; gap: 6px; height: 34px; border-radius: 10px; color: var(--text-3); font-weight: 600; font-size: .88em; white-space: nowrap; min-width: 0; }
.seg-btn:hover { color: var(--text); }
.seg-btn.on { background: var(--bg-3); color: var(--text); box-shadow: 0 2px 8px rgba(0, 0, 0, .18); }
[data-theme="light"] .seg-btn.on { background: #fff; }
.page-search { margin-bottom: 8px; border-radius: 12px !important; }
.people { display: flex; flex-direction: column; }
.person { display: flex; align-items: center; gap: 12px; padding: 8px 6px; border-radius: 14px; cursor: pointer; }
.person:hover { background: var(--bg-hover); }
.person-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.person-text b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-text small { color: var(--text-3); font-size: .82em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-actions { display: flex; gap: 6px; align-items: center; }
.quiet { display: grid; justify-items: center; gap: 8px; padding: 40px 16px; color: var(--text-3); text-align: center; font-size: .92em; }
.quiet.big { flex: 1; align-content: center; gap: 14px; }
.quiet.big b { font-family: var(--display); color: var(--text); font-size: 1.05em; }
.page-link { display: inline-flex; align-items: center; gap: 4px; align-self: center; margin-top: 18px; color: var(--text-3); font-size: .84em; }
.page-link:hover { color: var(--text); }
.at-input { display: flex; align-items: center; gap: 4px; padding: 0 6px 0 14px; border-radius: 14px; background: var(--bg-input); }
.at-input span { color: var(--text-3); font-weight: 700; }
.at-input input { background: transparent !important; border: 0 !important; box-shadow: none !important; padding-left: 2px !important; }
.add-msg { margin: 10px 2px 0; }

@media (max-width: 760px) {
  .page-head { padding: 0 8px 0 16px; }
  .page-body { padding: 4px 12px 20px; }
  .srv-row { padding: 9px 8px; }
  .srv-more { opacity: 1; }
  .srv-channels .ch-row { height: 44px; }
}

/* клавиатура открыта: убираем отступ под «домашнюю полоску» и даём больше места сообщениям */
@media (max-width: 760px) {
  .kb-open .composer-wrap { padding-bottom: 6px; }
  .kb-open #tabbar { display: none !important; }
  .kb-open .modal { max-height: calc(var(--vvh, 100dvh) - 10px); }
  .kb-open .modal-foot { padding-bottom: 12px; }
  .kb-open #toasts { bottom: 12px; }
}

/* меню на телефоне — «шторка» снизу */
.menu-back { position: fixed; top: 0; left: 0; right: 0; height: var(--vvh, 100dvh); z-index: 1000; background: rgba(4, 4, 10, .5); animation: fade .15s; }
.menu.sheet { left: 0 !important; right: 0; top: auto !important; bottom: 0; max-width: none; width: 100%; max-height: 75dvh; border-radius: 24px 24px 0 0; padding: 14px 10px calc(10px + var(--safe-b)); animation: sheet .25s var(--ease); }
.menu.sheet::before { content: ''; display: block; width: 40px; height: 5px; margin: -4px auto 10px; border-radius: 3px; background: var(--line-2); }
.menu.sheet .menu-item { min-height: 48px; font-size: 1em; }
.menu.sheet .has-sub .ic { transform: none; }

/* видеосообщения-«кружки» */
.composer.has-text .vn-btn { display: none; }
.vn { position: relative; width: 240px; height: 240px; border-radius: 50%; overflow: hidden; background: var(--bg-3); display: grid; place-items: center; cursor: pointer; margin-top: 2px; -webkit-mask-image: -webkit-radial-gradient(white, black); }
.vn video { width: 100%; height: 100%; object-fit: cover; display: block; }
.vn-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); pointer-events: none; }
.vn-ring circle { fill: none; stroke-width: 3.2; }
.vn-ring-bg { stroke: transparent; }
.vn.playing .vn-ring-bg, .vn-rec .vn-ring-bg { stroke: rgba(255, 255, 255, .18); }
.vn-ring-fg { stroke: #fff; stroke-linecap: round; transition: stroke-dasharray .1s linear; }
.vn-rec .vn-ring-fg { stroke: var(--red); }
.vn-dur { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); padding: 2px 8px; border-radius: 999px; background: rgba(0, 0, 0, .5); color: #fff; font-size: .72em; font-weight: 700; }
.vn-sound { position: absolute; right: 18%; top: 12%; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: rgba(0, 0, 0, .5); color: #fff; }
.vn.playing .vn-sound { display: none; }
.msg .bubble.media .vn + .b-meta, .bubble.media.has-vn .b-meta { right: 4px; bottom: 4px; }
.vn-modal .modal-body { padding-top: 28px; }
.vn-rec { display: grid; justify-items: center; gap: 14px; text-align: center; }
.vn-circle { position: relative; width: min(280px, 72vw); aspect-ratio: 1; border-radius: 50%; overflow: hidden; background: #000; -webkit-mask-image: -webkit-radial-gradient(white, black); }
.vn-circle video { width: 100%; height: 100%; object-fit: cover; }
.vn-time { display: flex; align-items: center; gap: 8px; font-size: 1.1em; font-variant-numeric: tabular-nums; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); animation: breathe 1s ease-in-out infinite; }
.vn-rec .muted-text { margin: 0; }
@media (max-width: 760px) { .vn { width: 200px; height: 200px; } }

/* ======================================================================
   Звонки: сетка, которая всегда помещается; личный звонок на весь экран
   ====================================================================== */
.voice-stage { position: relative; }
.stage { padding: 12px 12px 92px; }
.stage.grid { display: grid; grid-template-columns: repeat(var(--cols, 1), var(--tw, 1fr)); grid-auto-rows: calc(var(--tw, 320px) * 9 / 16); gap: 8px; place-content: center; overflow: hidden; }
.stage.grid .tile { width: 100%; height: 100%; aspect-ratio: auto; }
.stage.focus { display: flex; flex-direction: column; gap: 8px; }
.stage.focus .stage-main { flex: 1; min-height: 0; display: flex; }
.stage.focus .stage-main .tile { flex: 1; aspect-ratio: auto; }
.stage.focus .stage-strip { display: flex; gap: 8px; overflow-x: auto; flex: none; height: 96px; justify-content: center; }
.stage.focus .stage-strip .tile { width: 170px; height: 96px; flex: none; aspect-ratio: auto; }
.tile .avatar { --s: clamp(48px, 30%, 96px) !important; }
.stage-controls { display: none; }
.call-bar { position: absolute; left: 50%; bottom: calc(14px + var(--safe-b)); transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 999px; background: rgba(18, 18, 26, .72); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 10px 30px rgba(0, 0, 0, .4), inset 0 0 0 1px rgba(255, 255, 255, .08); z-index: 5; max-width: calc(100% - 24px); }
.call-bar .ctl { width: 52px; height: 52px; border-radius: 50%; background: rgba(255, 255, 255, .1); color: #fff; }
.call-bar .ctl:hover { background: rgba(255, 255, 255, .2); color: #fff; }
.call-bar .ctl.on { background: #fff; color: #111; }
.call-bar .ctl.off { background: rgba(255, 77, 94, .2); color: #ff8a95; }
.call-bar .ctl.hang { background: var(--red); }
.call-bar .ctl.hang:hover { background: var(--red-h); }
.call-bar .btn { min-height: 46px; padding: 0 22px; }

/* личный звонок */
#callStage.call-view { position: relative; flex: none; height: min(62%, 560px); display: flex; overflow: hidden; background: radial-gradient(120% 90% at 50% 30%, color-mix(in srgb, var(--peer) 40%, #0c0b12), #07070b 75%); border-bottom: 1px solid var(--line); --ring-bg: #0c0b12; }
.call-main { position: absolute; inset: 0; display: grid; place-items: center; }
.call-main video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.call-main video.contain { object-fit: contain; }
.call-person { display: grid; justify-items: center; gap: 12px; }
.call-person .avatar .av-img { box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.call-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: linear-gradient(180deg, rgba(0, 0, 0, .45), transparent); color: #fff; z-index: 3; }
.call-top .call-min { color: #fff; background: rgba(255, 255, 255, .12); border-radius: 50%; }
.call-who { display: flex; flex-direction: column; min-width: 0; }
.call-who b { font-family: var(--display); font-size: 1.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-who small { display: flex; align-items: center; gap: 4px; opacity: .8; font-variant-numeric: tabular-nums; }
.call-pip { position: absolute; right: 14px; bottom: calc(92px + var(--safe-b)); width: 110px; aspect-ratio: 3 / 4; border-radius: 18px; overflow: hidden; background: #000; box-shadow: 0 10px 30px rgba(0, 0, 0, .5), 0 0 0 2px rgba(255, 255, 255, .15); z-index: 4; }
.call-pip video { width: 100%; height: 100%; object-fit: cover; }
#callStage.call-strip { flex: none; display: flex; align-items: center; gap: 10px; margin: 8px 12px 0; padding: 6px 6px 6px 14px; border-radius: 16px; background: color-mix(in srgb, var(--green) 14%, var(--bg-input)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--green) 30%, transparent); }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); flex: none; animation: breathe 1.4s ease-in-out infinite; }
.cs-text { flex: 1; min-width: 0; text-align: left; font-size: .9em; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cs-text b { color: var(--text); }
#callStage .icon-btn.hang { color: #fff; background: var(--red); }
#callStage .icon-btn.off { color: var(--red); }

/* входящий звонок */
#callLayer { z-index: 950; }
.incoming { width: 300px; padding: 22px 20px 20px; border-radius: var(--r-xl); background: radial-gradient(120% 100% at 50% 0%, color-mix(in srgb, var(--peer) 40%, var(--bg-float)), var(--bg-float) 70%); box-shadow: var(--shadow-lg), 0 0 0 1px var(--line); display: grid; justify-items: center; gap: 18px; text-align: center; animation: rise .3s var(--ease); --ring-bg: var(--bg-float); }
.inc-who { display: grid; justify-items: center; gap: 6px; }
.inc-who .avatar { animation: ringpulse 1.4s ease-out infinite; border-radius: 34%; margin-bottom: 6px; }
.inc-who b { font-family: var(--display); font-size: 1.15em; }
.inc-who small { color: var(--text-3); }
.inc-actions { display: flex; gap: 18px; justify-content: center; margin: 0; }
.inc-btn { display: grid; justify-items: center; gap: 6px; color: var(--text-2); font-size: .74em; font-weight: 600; }
.inc-btn span { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; color: #fff; }
.inc-btn.red span { background: var(--red); }
.inc-btn.green span { background: var(--green); }
.inc-btn:hover span { filter: brightness(1.1); }

@media (max-width: 760px) {
  .stage { padding: 8px 8px 92px; }
  .stage.focus .stage-strip { height: 84px; }
  .stage.focus .stage-strip .tile { width: 120px; height: 84px; }
  .call-bar { gap: 8px; padding: 7px; }
  .call-bar .ctl { width: 50px; height: 50px; }
  /* развёрнутый звонок на телефоне — на весь экран поверх всего */
  #callStage.call-view { position: fixed; top: 0; left: 0; right: 0; height: var(--vvh, 100dvh); z-index: 700; border: 0; padding-top: var(--safe-t); }
  .call-top { padding-top: calc(12px + var(--safe-t)); }
  .call-pip { width: 96px; top: calc(70px + var(--safe-t)); bottom: auto; }
  #callStage.call-strip { margin: 6px 8px 0; }
  /* входящий звонок — отдельный экран */
  #callLayer { left: 0; right: 0; bottom: auto; top: 0; }
  #callLayer:empty { display: none; }
  .incoming { position: fixed; top: 0; left: 0; right: 0; width: auto; max-width: none; height: var(--vvh, 100dvh); border-radius: 0; padding: calc(80px + var(--safe-t)) 24px calc(50px + var(--safe-b)); align-content: space-between; background: radial-gradient(120% 70% at 50% 20%, color-mix(in srgb, var(--peer) 55%, #0c0b12), #07070b 80%); color: #fff; animation: fade .2s; }
  .inc-who b { font-size: 1.6em; }
  .inc-who small { color: rgba(255, 255, 255, .7); font-size: .95em; }
  .inc-actions { width: 100%; justify-content: space-around; }
  .inc-btn { color: rgba(255, 255, 255, .85); font-size: .8em; }
  .inc-btn span { width: 68px; height: 68px; }
}

/* ======================================================================
   Материал «Жидкое стекло»: яркая подложка, полупрозрачные панели
   с сильным размытием, светящаяся кромка и мягкие блики.
   Включается поверх любой темы: <html data-material="glass">.
   ====================================================================== */

[data-material="glass"] {
  --g-tint: rgba(18, 16, 30, .26);
  --g-tint-2: rgba(30, 28, 46, .4);
  --g-float: rgba(28, 26, 42, .58);
  --g-rim-a: rgba(255, 255, 255, .55);
  --g-rim-b: rgba(255, 255, 255, .06);
  --g-rim-c: rgba(255, 255, 255, .22);
  --g-hi: rgba(255, 255, 255, .16);
  --g-blur: blur(30px) saturate(1.9);
  --g-shadow: 0 10px 40px rgba(0, 0, 0, .35), 0 1px 2px rgba(0, 0, 0, .2);
  --bubble: rgba(255, 255, 255, .09);
  --bg-input: rgba(255, 255, 255, .07);
  --line: rgba(255, 255, 255, .09);
  --panel-solid: #1b1a28;
  --bg-float: #1d1c2b;
  --scene:
    radial-gradient(38% 42% at 18% 22%, color-mix(in srgb, var(--accent) 85%, transparent), transparent 70%),
    radial-gradient(34% 38% at 82% 18%, rgba(40, 170, 255, .7), transparent 70%),
    radial-gradient(40% 44% at 78% 82%, rgba(255, 84, 160, .62), transparent 70%),
    radial-gradient(36% 40% at 22% 84%, rgba(255, 160, 50, .5), transparent 70%),
    radial-gradient(30% 30% at 52% 50%, rgba(80, 230, 200, .28), transparent 75%),
    #0b0a14;
}
[data-material="glass"][data-theme="midnight"] {
  --g-tint: rgba(6, 6, 12, .5); --g-tint-2: rgba(10, 10, 18, .6); --g-float: rgba(14, 14, 22, .7);
  --panel-solid: #0e0e16; --bg-float: #12121c;
  --scene:
    radial-gradient(40% 36% at 8% 6%, color-mix(in srgb, var(--accent) 45%, transparent), transparent 70%),
    radial-gradient(36% 32% at 96% 12%, rgba(40, 170, 255, .3), transparent 70%),
    radial-gradient(42% 38% at 88% 96%, rgba(255, 94, 168, .28), transparent 70%),
    #000;
}
[data-material="glass"][data-theme="light"] {
  --g-tint: rgba(255, 255, 255, .26);
  --g-tint-2: rgba(255, 255, 255, .58);
  --g-float: rgba(255, 255, 255, .7);
  --g-rim-a: rgba(255, 255, 255, .95);
  --g-rim-b: rgba(255, 255, 255, .25);
  --g-rim-c: rgba(255, 255, 255, .7);
  --g-hi: rgba(255, 255, 255, .7);
  --g-shadow: 0 10px 36px rgba(60, 40, 140, .16), 0 1px 2px rgba(60, 40, 140, .08);
  --bubble: rgba(255, 255, 255, .62);
  --bg-input: rgba(255, 255, 255, .5);
  --line: rgba(30, 20, 80, .08);
  --panel-solid: #f3f1fa; --bg-float: #f7f6fc;
  --scene:
    radial-gradient(42% 38% at 8% 6%, color-mix(in srgb, var(--accent) 55%, transparent), transparent 70%),
    radial-gradient(38% 34% at 96% 12%, rgba(40, 190, 255, .45), transparent 70%),
    radial-gradient(44% 40% at 88% 96%, rgba(255, 110, 180, .42), transparent 70%),
    radial-gradient(40% 36% at 14% 92%, rgba(255, 190, 80, .45), transparent 70%),
    #eeeaf8;
}

/* сцена позади всего */
[data-material="glass"] body { background: #0b0a14; }
[data-material="glass"][data-theme="light"] body { background: #eeeaf8; }
[data-material="glass"] body::before { inset: -10%; background: var(--scene); animation: lg-drift 40s ease-in-out infinite alternate; }
@keyframes lg-drift { 50% { transform: translate(3%, -2%) scale(1.06) rotate(2deg); } to { transform: translate(-2%, 3%) scale(1.03) rotate(-2deg); } }
[data-material="glass"][data-motion="reduce"] body::before { animation: none; }

/* общий рецепт стекла */
[data-material="glass"] :is(#side, #main, #members, .sp-side, .sp-main, .auth-card) {
  background: var(--g-tint); backdrop-filter: var(--g-blur); -webkit-backdrop-filter: var(--g-blur);
  box-shadow: var(--g-shadow), inset 0 1px 0 var(--g-hi);
  border-radius: var(--r-xl);
}
[data-material="glass"] :is(.modal, .menu, .popover, .ac-box, .msg-tools, .toast, .save-bar, .pin-actions, .att-card-tools) {
  background: var(--g-float); backdrop-filter: var(--g-blur); -webkit-backdrop-filter: var(--g-blur);
  box-shadow: var(--shadow-lg), inset 0 1px 0 var(--g-hi);
}
[data-material="glass"] .ep-grid h5 { background: transparent; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }

/* светящаяся кромка: градиентная рамка в 1px */
[data-material="glass"] :is(#side, #main, #members, .sp-side, .sp-main, .auth-card, .modal, .menu, .popover, .composer, .call-bar, .save-bar, .toast, .ac-box)::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; z-index: 3;
  background: linear-gradient(155deg, var(--g-rim-a), var(--g-rim-b) 30%, transparent 55%, var(--g-rim-b) 75%, var(--g-rim-c));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
[data-material="glass"] :is(#side, #members, .sp-side, .sp-main, .composer, .toast) { position: relative; }

/* шапки и разделители мягче */
[data-material="glass"] :is(.side-head, .main-head) { border-bottom-color: transparent; box-shadow: 0 1px 0 var(--line); }

/* док */
[data-material="glass"] .rail-btn { background: var(--g-tint); backdrop-filter: var(--g-blur); -webkit-backdrop-filter: var(--g-blur); box-shadow: inset 0 1px 0 var(--g-hi), inset 0 0 0 1px var(--line); }
[data-material="glass"] .dock-item:not(.on):not(.add):hover { background: var(--g-tint); box-shadow: inset 0 1px 0 var(--g-hi), inset 0 0 0 1px var(--line); }
[data-material="glass"] .dock-item.on { box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 45%, transparent), inset 0 1px 0 rgba(255, 255, 255, .45); }

/* поле ввода — парящая стеклянная капсула */
[data-material="glass"] .composer {
  background: var(--g-tint-2); backdrop-filter: var(--g-blur); -webkit-backdrop-filter: var(--g-blur);
  box-shadow: var(--g-shadow), inset 0 1px 0 var(--g-hi); border-radius: 26px;
}
[data-material="glass"] .composer:focus-within { box-shadow: var(--g-shadow), inset 0 1px 0 var(--g-hi), 0 0 0 1.5px color-mix(in srgb, var(--accent) 60%, transparent); }

/* пузыри */
[data-material="glass"] .msg:not(.own) .bubble { box-shadow: inset 0 1px 0 var(--g-hi), inset 0 0 0 1px var(--line); }
[data-material="glass"] .msg.own .bubble { box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 30%, transparent), inset 0 1px 0 rgba(255, 255, 255, .4), inset 0 -1px 0 rgba(0, 0, 0, .12); }
[data-material="glass"][data-density="compact"] .msg .bubble { box-shadow: none !important; }

/* кнопки */
[data-material="glass"] .btn.primary { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 4px 14px color-mix(in srgb, var(--accent) 30%, transparent); }
[data-material="glass"] .call-bar { background: rgba(20, 20, 30, .42); backdrop-filter: blur(30px) saturate(1.9); -webkit-backdrop-filter: blur(30px) saturate(1.9); box-shadow: 0 12px 34px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .2); }

/* полноэкранные окна (настройки) — на той же сцене */
[data-material="glass"] .modal-back:has(.modal.full) { background: transparent; }
[data-material="glass"] .modal-back:has(.modal.full)::before { content: ''; position: absolute; inset: -10%; background: var(--scene); z-index: -1; }
[data-material="glass"] .modal.full { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none; }
[data-material="glass"] .modal.full::after { display: none; }
[data-material="glass"] .modal-back:not(:has(.modal.full)) { background: rgba(4, 4, 12, .35); }
[data-material="glass"] .sp-head { background: transparent; }

@media (max-width: 760px) {
  /* на телефоне экраны лежат прямо на сцене — без тяжёлого размытия */
  [data-material="glass"] :is(#side, #main) { background: var(--g-tint); backdrop-filter: none; -webkit-backdrop-filter: none; border-radius: 0; box-shadow: none; }
  [data-material="glass"] :is(#side, #main)::after { display: none; }
  [data-material="glass"] #side, [data-material="glass"] #app.m-root #main { background: transparent; }
  [data-material="glass"] :is(.sp-side, .sp-main) { border-radius: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--g-tint); }
  [data-material="glass"] :is(.sp-side, .sp-main)::after { display: none; }
  [data-material="glass"] #members:not([hidden]) { background: var(--g-float); border-radius: 0; position: fixed; }
  [data-material="glass"] #members::after { display: none; }
  [data-material="glass"] .main-head .tabs { background: var(--g-float); backdrop-filter: var(--g-blur); -webkit-backdrop-filter: var(--g-blur); }
  /* парящая панель вкладок */
  [data-material="glass"] #app.m-root #tabbar {
    margin: 0 12px calc(10px + var(--safe-b)); padding: 6px; border: 0; border-radius: 30px;
    background: var(--g-float); backdrop-filter: var(--g-blur); -webkit-backdrop-filter: var(--g-blur);
    box-shadow: var(--g-shadow), inset 0 1px 0 var(--g-hi), inset 0 0 0 1px var(--line); position: relative; z-index: 6;
  }
  [data-material="glass"] .tb-item.on .tb-ic { background: color-mix(in srgb, var(--accent) 26%, transparent); box-shadow: inset 0 1px 0 var(--g-hi); }
  [data-material="glass"] .modal:not(.full) { background: var(--g-float); }
}

@media (min-width: 761px) {
  [data-material="glass"] .incoming { position: relative; background: radial-gradient(120% 100% at 50% 0%, color-mix(in srgb, var(--peer) 40%, transparent), transparent 70%), var(--g-float); backdrop-filter: var(--g-blur); -webkit-backdrop-filter: var(--g-blur); box-shadow: var(--shadow-lg), inset 0 1px 0 var(--g-hi), inset 0 0 0 1px var(--line); }
}

/* выбор материала в настройках */
.material-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 420px; }
.mat-opt { position: relative; display: grid; gap: 8px; padding: 8px 8px 10px; border-radius: 20px; background: var(--bg-input); color: var(--text-2); font-size: .85em; font-weight: 600; text-align: center; box-shadow: inset 0 0 0 1px var(--line); }
.mat-opt.on { box-shadow: 0 0 0 2px var(--accent); color: var(--text); }
.mat-opt i { position: relative; display: block; height: 74px; border-radius: 14px; overflow: hidden; background: #15141e; }
.mat-opt i b { position: absolute; left: 14%; right: 14%; top: 22%; bottom: 22%; border-radius: 12px; background: #23222f; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06); }
.mat-opt.m-glass i { background:
  radial-gradient(60% 70% at 10% 10%, var(--accent), transparent 70%),
  radial-gradient(60% 70% at 95% 20%, #28aaff, transparent 70%),
  radial-gradient(60% 70% at 80% 100%, #ff5ea8, transparent 70%), #0b0a14; }
.mat-opt.m-glass i b { background: rgba(255, 255, 255, .14); backdrop-filter: blur(10px) saturate(1.8); -webkit-backdrop-filter: blur(10px) saturate(1.8); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 0 0 1px rgba(255, 255, 255, .18), 0 6px 16px rgba(0, 0, 0, .25); }

/* ---------- шапка лички: «в сети» / «был(а) …» ---------- */
.head-ttl { display: flex; flex-direction: column; justify-content: center; min-width: 0; line-height: 1.15; }
.head-ttl .head-title { text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.head-sub { font-size: .74em; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-sub.on { color: var(--accent-text); }

/* ---------- статусы сообщений ---------- */
.b-st { display: inline-grid; place-items: center; margin-left: 1px; vertical-align: -3px; }
.b-st .ic { stroke-width: 2.2; }
.msg.own .b-st.sent { opacity: .55; }
.msg.own .b-st.dlv { opacity: 1; }
.msg.own .b-st.read { color: #bff3ff; opacity: 1; }
.msg.own .b-st.failed { color: #ffd0d4; }
[data-density="compact"] .b-st.read { color: var(--accent-text); }

/* ---------- счётчик непрочитанных в списке чатов ---------- */
.dm-row .badge { margin-left: auto; background: var(--accent); min-width: 22px; height: 22px; border-radius: 11px; font-size: .72em; box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 35%, transparent); }
@media (hover: none) { .dm-row:hover .badge { display: inline-grid; } .dm-row .dm-close { display: none; } }

/* ---------- плашка уведомления внутри приложения ---------- */
.inapp { position: fixed; z-index: 1200; left: 50%; top: calc(10px + var(--safe-t)); width: min(420px, calc(100vw - 20px)); transform: translate(-50%, -140%); display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 20px; text-align: left; color: var(--text);
  background: color-mix(in srgb, var(--bg-float) 82%, transparent); backdrop-filter: blur(24px) saturate(1.8); -webkit-backdrop-filter: blur(24px) saturate(1.8); box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--line); transition: transform .32s var(--ease); --ring-bg: var(--bg-float); }
.inapp.in { transform: translate(-50%, 0); }
.inapp-text { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.inapp-text b { font-size: .9em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inapp-text span { font-size: .85em; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* предложение включить уведомления — плавающая карточка */
body > .notif-offer { position: fixed; z-index: 900; left: 0; right: 0; bottom: calc(96px + var(--safe-b)); width: min(460px, calc(100vw - 20px)); margin: 0 auto; flex-wrap: nowrap; gap: 10px; padding: 12px 12px 12px 16px; border-radius: 20px; font-size: .88em; box-shadow: var(--shadow-lg); }
body > .notif-offer > span { flex: 1; min-width: 0; }
@media (min-width: 761px) { body > .notif-offer { bottom: 104px; top: auto; } }

/* ---------- «Жидкое стекло», вариант 2: спокойный фон как в iOS 26 ----------
   Фон почти однотонный с мягким свечением акцента сверху; стеклянными остаются
   «плавающие» элементы: панель вкладок, поле ввода, меню, окна, звонок. */
[data-material="glass"] {
  --text-2: rgba(235, 235, 245, .84); --text-3: rgba(235, 235, 245, .62); --text-4: rgba(235, 235, 245, .46);
  --scene:
    radial-gradient(140% 55% at 50% -12%, color-mix(in srgb, var(--accent) 34%, transparent), transparent 64%),
    radial-gradient(70% 45% at 105% 105%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
    linear-gradient(180deg, #0e0d16 0%, #08080c 55%, #050507 100%);
}
[data-material="glass"][data-theme="midnight"] {
  --scene: radial-gradient(140% 50% at 50% -14%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 62%), #000;
}
[data-material="glass"][data-theme="light"] {
  --text-2: rgba(30, 30, 40, .86); --text-3: rgba(60, 60, 67, .64); --text-4: rgba(60, 60, 67, .5);
  --scene:
    radial-gradient(140% 55% at 50% -12%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 64%),
    radial-gradient(70% 45% at 105% 105%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%),
    linear-gradient(180deg, #f6f5fb, #efeff4);
}
[data-material="glass"] body::before { animation: none; inset: 0; }
[data-material="glass"] .cat-row, [data-material="glass"] .cat-name { color: var(--text-3); }
[data-material="glass"] .ch-row { color: var(--text-2); }

.audio-unlock { position: fixed; z-index: 1300; left: 0; right: 0; margin: 0 auto; top: calc(16px + var(--safe-t)); width: max-content; max-width: calc(100vw - 24px); display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 999px; background: var(--grad); color: #fff; font-weight: 700; box-shadow: var(--shadow-lg); animation: rise .25s var(--ease); }

/* ====================== список чатов ====================== */
.dm-search { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; margin: 2px 2px 10px; border-radius: 14px; background: var(--bg-input); color: var(--text-3); }
.dm-search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; color: var(--text); }
.dm-search input::-webkit-search-cancel-button { display: none; }
.online-strip { display: flex; gap: 6px; overflow-x: auto; overflow-y: hidden; margin: 0 -10px 8px; padding: 2px 10px 6px; scrollbar-width: none; }
.online-strip::-webkit-scrollbar { display: none; }
.os-item { flex: none; display: grid; justify-items: center; gap: 5px; width: 64px; color: var(--text-2); font-size: .72em; font-weight: 600; }
.os-item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.os-item .avatar { --ring-bg: var(--panel-solid); }
.dm-sec { padding: 12px 8px 6px; font-size: .74em; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--text-4); }
#side:not(.split) .dm-row { gap: 12px; padding: 8px 10px; border-radius: 16px; }
.dm-row .dm-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dm-top, .dm-bottom { display: flex; align-items: center; gap: 6px; min-width: 0; }
.dm-top .dm-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; color: var(--text); }
.dm-time { flex: none; font-size: .74em; color: var(--text-4); font-variant-numeric: tabular-nums; }
.dm-row.unread .dm-time { color: var(--accent-text); }
.dm-top .b-st { color: var(--text-4); opacity: 1; }
.dm-top .b-st.read { color: var(--accent-text); }
.dm-bottom .dm-sub { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .84em; color: var(--text-3); display: block; }
.dm-row.unread .dm-sub { color: var(--text-2); }
.dm-sub.live { color: var(--accent-text); display: flex; align-items: center; gap: 6px; }
.dm-sub.missed { color: var(--red); }
.dm-you { color: var(--text-2); }
.dm-sub .dots { display: inline-flex; gap: 2px; }
.dm-sub .dots i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; animation: blink 1.2s infinite; }
.dm-sub .dots i:nth-child(2) { animation-delay: .2s; }
.dm-sub .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
.dm-bottom .badge { margin-left: auto; }
.dm-row .dm-close { position: absolute; right: 6px; top: 6px; opacity: 0; }
.dm-row:hover .dm-close { opacity: 1; }
.dm-row:hover .badge { display: inline-grid; }
.side-cta .ic { color: var(--text-4); }

/* ====================== серверы: колонка значков + выбранный сервер ====================== */
#side.split #sideHead { display: none; }
#side.split #sideBody { display: flex; padding: 0; overflow: hidden; }
.srv-rail-wrap { flex: none; width: 72px; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; border-right: 1px solid var(--line); }
.srv-rail-wrap::-webkit-scrollbar { display: none; }
.srv-rail { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 0 16px; }
.srv-ic { position: relative; display: grid; place-items: center; width: 72px; flex: none; }
.srv-ic .gicon { border-radius: 50%; transition: border-radius .2s var(--ease), transform .15s; font-size: 14px; }
.srv-ic:hover .gicon, .srv-ic.on .gicon { border-radius: 16px; }
.srv-ic:active .gicon { transform: scale(.94); }
.srv-pill { position: absolute; left: 0; top: 50%; width: 4px; height: 0; margin-top: 0; border-radius: 0 4px 4px 0; background: var(--text); transition: height .2s var(--ease), margin-top .2s var(--ease); }
.srv-ic.unread .srv-pill { height: 8px; margin-top: -4px; }
.srv-ic:hover .srv-pill { height: 20px; margin-top: -10px; }
.srv-ic.on .srv-pill { height: 40px; margin-top: -20px; background: var(--accent); }
.srv-ic.on .gicon { box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
.srv-ic .badge { position: absolute; right: 8px; bottom: -2px; box-shadow: 0 0 0 3px var(--panel-solid); }
.srv-live { position: absolute; right: 9px; bottom: -1px; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--bg-3); color: var(--green); box-shadow: 0 0 0 3px var(--panel-solid); }
.srv-live.me { background: var(--green); color: #fff; }
.srv-ic.add { width: 48px; height: 48px; border-radius: 50%; background: var(--bg-input); color: var(--green); transition: border-radius .2s, background .2s, color .2s; }
.srv-ic.add:hover { border-radius: 16px; background: var(--green); color: #fff; }
.srv-sep { width: 32px; height: 2px; border-radius: 1px; background: var(--line-2); flex: none; }
.srv-ic.drop .gicon { box-shadow: 0 0 0 2px var(--accent); }
.srv-ic.dragging { opacity: .4; }
.srv-pane { flex: 1; min-width: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; }
.srv-hero { position: relative; margin: 8px 8px 4px; border-radius: 20px; overflow: hidden; isolation: isolate; background: color-mix(in srgb, var(--hue) 22%, var(--bg-2)); }
.srv-hero-bg { position: absolute; inset: -30px; z-index: -1; background: radial-gradient(90% 80% at 0% 0%, color-mix(in srgb, var(--hue) 70%, transparent), transparent 70%), radial-gradient(80% 70% at 100% 0%, color-mix(in srgb, var(--accent) 45%, transparent), transparent 70%); background-size: cover; background-position: center; filter: blur(26px) saturate(1.4); opacity: .75; }
.srv-hero-in { display: grid; justify-items: start; gap: 8px; padding: 16px 14px 14px; background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--panel-solid) 55%, transparent)); --ring-bg: var(--panel-solid); }
.srv-hero .gicon { border-radius: 18px; box-shadow: 0 6px 18px rgba(0, 0, 0, .25), 0 0 0 3px color-mix(in srgb, #fff 18%, transparent); }
.srv-title { display: flex; align-items: center; gap: 4px; max-width: 100%; font-family: var(--display); font-size: 1.12em; font-weight: 700; color: var(--text); text-align: left; }
.srv-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srv-stats { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .78em; color: var(--text-2); font-weight: 600; }
.srv-stats span { display: inline-flex; align-items: center; gap: 5px; }
.st-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-4); }
.st-dot.on { background: var(--green); }
.srv-desc { margin: 0; font-size: .82em; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.srv-acts { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; width: 100%; margin-top: 4px; }
.srv-act { display: grid; justify-items: center; gap: 3px; padding: 8px 4px; border-radius: 14px; background: color-mix(in srgb, var(--panel-solid) 55%, transparent); color: var(--text); font-size: .72em; font-weight: 700; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.srv-act:hover { background: color-mix(in srgb, var(--panel-solid) 75%, transparent); }
.srv-chs { padding: 4px 8px 16px; }
@media (max-width: 760px) {
  .srv-rail-wrap { width: 76px; }
  .srv-ic { width: 76px; }
  .srv-chs .ch-row { height: 44px; }
  .srv-pane { padding-bottom: 8px; }
}
[data-material="glass"] .srv-hero { background: color-mix(in srgb, var(--hue) 18%, transparent); }
[data-material="glass"] .srv-rail-wrap { border-right-color: var(--line); }

.dm-search input, .dm-search input:focus { background: none !important; box-shadow: none !important; padding: 0 !important; border-radius: 0; }
.dm-sub-ic { vertical-align: -1px; margin-right: 4px; }

/* ====================== серверы: капсулы, карточка, комнаты ====================== */
.srv-chips { position: sticky; top: -10px; z-index: 3; display: flex; gap: 8px; overflow-x: auto; overflow-y: hidden; margin: -10px -10px 0; padding: 10px 10px 10px; scrollbar-width: none; background: linear-gradient(var(--panel-solid) 75%, transparent); }
[data-material="glass"] .srv-chips { background: transparent; }
.srv-chips::-webkit-scrollbar { display: none; }
.srv-chip { position: relative; flex: none; display: flex; align-items: center; gap: 8px; height: 42px; max-width: 180px; padding: 0 12px 0 6px; border-radius: 999px; background: var(--bg-input); color: var(--text-2); font-weight: 700; font-size: .86em; box-shadow: inset 0 0 0 1px var(--line); transition: background .2s, color .2s, transform .15s; }
.srv-chip:active { transform: scale(.97); }
.srv-chip .gicon { border-radius: 50%; font-size: 11px; flex: none; }
.chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srv-chip.on { background: var(--grad); color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
.srv-chip.unread:not(.on) { color: var(--text); }
.chip-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.srv-chip.on .chip-dot { background: #fff; }
.chip-live { display: grid; place-items: center; color: var(--green); }
.srv-chip.on .chip-live { color: #fff; }
.srv-chip .badge { margin-left: 2px; }
.srv-chip.add { width: 42px; padding: 0; justify-content: center; color: var(--green); background: transparent; box-shadow: inset 0 0 0 1.5px dashed var(--line-2); border: 1.5px dashed var(--line-2); }
.srv-chip.add:hover { color: #fff; background: var(--green); border-color: var(--green); }
.srv-chip.drop { box-shadow: 0 0 0 2px var(--accent); }
.srv-chip.dragging { opacity: .4; }
#side:not(.split) .srv-hero { margin: 4px 0 6px; }
.srv-sec { margin-top: 12px; }
.sec-head { display: flex; align-items: center; gap: 4px; padding: 0 4px 6px 6px; }
.sec-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; font-size: .74em; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); text-align: left; }
.sec-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sec-title small { font-size: .95em; font-weight: 700; color: var(--text-4); }
.sec-chev { margin-left: auto; transition: transform .2s; color: var(--text-4); }
.srv-sec.closed .sec-chev { transform: rotate(-90deg); }
.sec-head .icon-btn { opacity: .7; }
.sec-head.drop { box-shadow: inset 0 -2px 0 var(--accent); }
.sec-card { padding: 4px; border-radius: 18px; background: var(--bg-input); box-shadow: inset 0 0 0 1px var(--line); }
.sec-card .ch-row { border-radius: 13px; }
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 8px; }
.room { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 18px; background: var(--bg-input); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; min-width: 0; transition: transform .15s, box-shadow .2s; }
.room:active { transform: scale(.98); }
.room.live { background: linear-gradient(160deg, color-mix(in srgb, var(--green) 16%, transparent), transparent 70%), var(--bg-input); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--green) 30%, transparent); }
.room.here { box-shadow: inset 0 0 0 2px var(--green); }
.room.active:not(.here) { box-shadow: inset 0 0 0 1.5px var(--accent); }
.room.drop { box-shadow: inset 0 0 0 2px var(--accent); }
.room-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.room-ic { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 10px; background: var(--bg-active); color: var(--text-2); flex: none; }
.room.live .room-ic { background: var(--green); color: #fff; }
.room-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92em; }
.room-gear { opacity: .6; }
.room-people { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; min-height: 30px; }
.room-face { position: relative; border-radius: 50%; --ring-bg: var(--bg-2); }
.room-face.speaking .avatar { box-shadow: 0 0 0 2px var(--green); border-radius: 50%; }
.room-muted { position: absolute; right: -3px; bottom: -3px; display: grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: var(--red); color: #fff; box-shadow: 0 0 0 2px var(--bg-2); }
.room-more { font-size: .75em; font-weight: 800; color: var(--text-3); padding-left: 2px; }
.room-empty { color: var(--text-4); font-size: .8em; min-height: 30px; display: flex; align-items: center; }
.room-join { align-self: flex-start; padding: 5px 12px; border-radius: 999px; background: var(--bg-active); font-size: .76em; font-weight: 800; color: var(--text-2); }
.room.live .room-join { background: var(--green); color: #fff; }
.room.here .room-join { background: transparent; color: var(--green); padding-left: 0; }
@media (max-width: 760px) {
  .srv-chips { top: -8px; margin: -8px -12px 0; padding: 8px 12px 10px; }
  .sec-card .ch-row { height: 46px; }
}
.row-btns.wrap { flex-wrap: wrap; gap: 8px; }
.row-btns .btn .ic { margin-right: 4px; }
@media (max-width: 760px) {
  .call-bar { gap: 6px; padding: 6px; }
  .call-bar .ctl { width: 48px; height: 48px; }
}

/* ====================== два вида: телефон и компьютер ====================== */
/* компьютер: колонка «Главная» + серверы */
#rail .srv-ic { width: var(--rail-w); }
#rail .srv-ic .badge { right: 6px; box-shadow: 0 0 0 3px var(--bg-app); }
#rail .srv-live { right: 7px; box-shadow: 0 0 0 3px var(--bg-app); }
#rail .srv-pill { background: var(--text); }
#rail .srv-ic.on .srv-pill { background: var(--text); }
.srv-ic.home .home-ic { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--bg-input); transition: border-radius .2s var(--ease), background .2s; }
.srv-ic.home:hover .home-ic, .srv-ic.home.on .home-ic { border-radius: 16px; background: var(--grad); }
#rail .srv-ic.add { width: 48px; }
#rail .srv-sep { margin: 2px 0; }
.guild-head { gap: 6px; }
.gh-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; font-family: var(--display); font-weight: 700; font-size: 1.02em; color: var(--text); text-align: left; }
.gh-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.desk-chs { padding: 2px 0 10px; }
#side .srv-hero { margin: 2px 0 8px; }
.dm-row.compact { gap: 10px; padding: 6px 8px; border-radius: 12px; }
.dm-row.compact .dm-sub { font-size: .8em; }
.dm-row.compact .dm-top .dm-name { font-weight: 600; }

/* телефон: папки чатов */
.folders { display: flex; gap: 6px; margin: 0 0 10px; overflow-x: auto; scrollbar-width: none; }
.folders::-webkit-scrollbar { display: none; }
.folder { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 999px; background: var(--bg-input); color: var(--text-2); font-weight: 700; font-size: .86em; }
.folder.on { background: var(--grad); color: #fff; }
.f-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: inline-grid; place-items: center; background: var(--accent); color: #fff; font-size: .74em; font-weight: 800; }
.folder.on .f-count { background: #fff; color: var(--accent); }

/* канал сервера в общем списке */
.ch-pic { position: relative; flex: none; display: grid; }
.ch-pic .gicon { border-radius: 50%; font-size: 15px; }
.ch-pic-hash { position: absolute; right: -2px; bottom: -2px; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--bg-3); color: var(--text-2); box-shadow: 0 0 0 2px var(--panel-solid); }
.dm-srv { font-weight: 500; color: var(--text-4); font-size: .86em; }
.dm-muted { color: var(--text-4); flex: none; }
.badge.muted { background: var(--bg-4) !important; color: var(--text-2); box-shadow: none !important; }
.badge.mention { background: var(--accent) !important; }
.dm-bottom .badge + .badge { margin-left: 4px; }

/* телефон: звонки */
.call-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 16px; cursor: pointer; }
.call-row:hover { background: var(--bg-hover); }
.call-row .dm-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.call-row .dm-name { font-weight: 700; color: var(--text); }
.call-row.missed .dm-name { color: var(--red); }
.call-row .dm-sub { display: flex; align-items: center; gap: 4px; font-size: .82em; }
.call-dir { color: var(--green); }
.call-row.missed .call-dir { color: var(--red); }
.call-cb { color: var(--accent-text); }
.call-row.live { background: color-mix(in srgb, var(--green) 10%, transparent); }

/* проверка собеседника */
.trust-ok { display: inline-grid; place-items: center; margin-left: 6px; color: var(--green); vertical-align: -2px; }
.trust-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin: 8px 12px 0; border-radius: 14px; background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--text); font-size: .85em; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--red) 35%, transparent); flex: none; }
.trust-bar > .ic { color: var(--red); }
.trust-bar span { flex: 1; min-width: 0; }
.safety-ok { display: flex; align-items: center; gap: 6px; color: var(--green); font-weight: 600; margin: 8px 0 0; }

/* ====================== вход и регистрация: компьютер и телефон ====================== */
#auth { display: block; padding: 0; overflow: hidden auto; background: #0b0a12; }
#auth .auth-bg { background:
  radial-gradient(60% 55% at 15% 20%, color-mix(in srgb, var(--accent) 45%, transparent), transparent 70%),
  radial-gradient(50% 50% at 85% 85%, rgba(255, 120, 170, .28), transparent 70%),
  radial-gradient(45% 45% at 80% 15%, rgba(60, 170, 255, .22), transparent 70%),
  linear-gradient(160deg, #13112a 0%, #0b0a12 60%); }
#auth .auth-bg i { opacity: .35; }
.auth-dots { position: absolute; inset: 0; background-image: radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1.2px); background-size: 26px 26px; -webkit-mask-image: radial-gradient(80% 70% at 50% 50%, #000 30%, transparent 85%); mask-image: radial-gradient(80% 70% at 50% 50%, #000 30%, transparent 85%); }
#auth[data-theme-light] .auth-bg { filter: none; }
.auth-welcome { display: none; }
.auth-shell { position: relative; z-index: 1; min-height: var(--vvh, 100dvh); display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
#auth .auth-card {
  display: flex; flex-direction: column; width: 100%; max-width: 480px; padding: 32px; border-radius: 20px;
  background: #17161f; color: #f2f1f7; box-shadow: 0 30px 80px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(255, 255, 255, .06); backdrop-filter: none; -webkit-backdrop-filter: none; animation: pop .35s var(--ease);
  --text: #f2f1f7; --text-2: #c2c1cf; --text-3: #9b9aad; --bg-input: #0d0c14; --line: rgba(255, 255, 255, .07);
}
#auth .auth-top { display: none; }
#auth .auth-logo { margin-bottom: 10px; }
#auth .auth-card h1 { font-size: 1.55em; margin-bottom: 6px; }
.auth-sub { text-align: center; color: var(--text-3); margin: 0 0 22px; }
#auth .field > span { font-size: .72em; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
#auth .field em { font-style: italic; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--red); }
.req { color: var(--red); font-style: normal; }
#auth .field input { height: 46px; background: var(--bg-input); border: 0; border-radius: 10px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05); color: var(--text); font-size: 1em; }
#auth .field input:focus { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 70%, transparent); outline: none; }
#auth .field.bad input { box-shadow: inset 0 0 0 1.5px var(--red); }
#auth .pw-meter { margin: -6px 0 14px; }
.auth-note { margin: -4px 0 12px; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--yellow) 12%, transparent); color: #f5d98a; font-size: .8em; line-height: 1.35; }
#auth .auth-error { text-align: left; }
#auth #authBtn { height: 46px; border-radius: 10px; font-size: 1em; }
#auth .auth-switch { text-align: left; margin-top: 12px; font-size: .88em; color: var(--text-3); }
#auth .auth-switch .linkish { color: #8fb4ff; font-weight: 600; }
#auth .auth-dl { border-top-color: var(--line); }

/* компьютер: вход — две колонки, как привычно; регистрация — одна */
.auth-side { display: none; }
@media (min-width: 761px) {
  #auth[data-mode="login"] .auth-pair > .auth-card { max-width: 500px; border-radius: 20px 0 0 20px; }
  #auth[data-mode="login"] .auth-side {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; width: 300px;
    padding: 32px 28px; border-radius: 0 20px 20px 0; text-align: center; color: #f2f1f7;
    background: radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--accent) 40%, #17161f), #17161f 75%);
    box-shadow: 0 30px 80px rgba(0, 0, 0, .5), inset 1px 0 0 rgba(255, 255, 255, .06); animation: pop .35s var(--ease);
  }
  .auth-pair { display: flex; align-items: stretch; width: 100%; justify-content: center; }
  #auth[data-mode="login"] .auth-card .auth-logo { display: none; }
  #auth[data-mode="login"] .auth-card h1, #auth[data-mode="login"] .auth-sub { text-align: center; }
  .as-art { position: relative; display: grid; place-items: center; width: 168px; height: 168px; margin-bottom: 10px; border-radius: 40px; background: rgba(255, 255, 255, .05); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
  .as-glow { position: absolute; inset: 20%; border-radius: 50%; background: var(--accent); filter: blur(40px); opacity: .55; animation: breathe 4s ease-in-out infinite; }
  .as-art svg { position: relative; }
  .as-lock { position: absolute; right: -8px; bottom: -8px; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 14px; background: var(--green); color: #fff; box-shadow: 0 8px 20px rgba(43, 199, 122, .4); }
  .auth-side h2 { font-family: var(--display); font-size: 1.15em; }
  .auth-side p { margin: 0; color: #b9b8c9; font-size: .88em; line-height: 1.45; }
}

/* телефон: приветствие и отдельные экраны входа/регистрации */
@media (max-width: 760px) {
  #auth .auth-bg i { display: none; }
  #auth[data-step="welcome"] .auth-shell { display: none; }
  #auth[data-step="welcome"] .auth-welcome {
    position: relative; z-index: 1; display: flex; flex-direction: column; min-height: var(--vvh, 100dvh);
    padding: calc(20px + var(--safe-t)) 24px calc(20px + var(--safe-b)); text-align: center; animation: fade .3s;
  }
  .aw-art { position: relative; flex: 1; display: grid; place-items: center; min-height: 280px; }
  .aw-ring { position: absolute; left: 50%; top: 50%; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .08); transform: translate(-50%, -50%); }
  .aw-ring.r1 { width: 170px; height: 170px; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 40%, transparent), transparent 70%); }
  .aw-ring.r2 { width: 250px; height: 250px; }
  .aw-ring.r3 { width: 330px; height: 330px; border-color: rgba(255, 255, 255, .05); }
  .aw-logo { position: relative; filter: drop-shadow(0 10px 30px color-mix(in srgb, var(--accent) 60%, transparent)); animation: breathe 3.5s ease-in-out infinite; }
  .aw-bubble { position: absolute; display: inline-flex; align-items: center; gap: 5px; padding: 8px 12px; border-radius: 16px; background: rgba(255, 255, 255, .09); color: #fff; font-size: .8em; font-weight: 700; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1); animation: floaty 5s ease-in-out infinite; }
  .aw-bubble.b1 { left: 4%; top: 22%; border-bottom-left-radius: 4px; }
  .aw-bubble.b2 { right: 2%; top: 40%; background: var(--grad); border-bottom-right-radius: 4px; animation-delay: -1.6s; }
  .aw-bubble.b3 { left: 12%; bottom: 16%; border-bottom-left-radius: 4px; animation-delay: -3.2s; }
  .aw-text h1 { font-family: var(--display); font-size: 1.6em; line-height: 1.15; color: #fff; margin-bottom: 10px; }
  .aw-text p { margin: 0 auto; max-width: 300px; color: #b9b8c9; }
  .aw-btns { display: grid; gap: 10px; margin-top: 28px; }
  .aw-btns .btn { height: 52px; border-radius: 14px; font-size: 1.02em; }
  .aw-login { background: rgba(255, 255, 255, .1); color: #fff; }
  .aw-login:hover { background: rgba(255, 255, 255, .16); }

  #auth .auth-shell { display: block; padding: 0; min-height: var(--vvh, 100dvh); }
  #auth .auth-card { max-width: none; min-height: var(--vvh, 100dvh); border-radius: 0; padding: calc(8px + var(--safe-t)) 20px calc(24px + var(--safe-b)); background: transparent; box-shadow: none; animation: rise .3s var(--ease); }
  #auth .auth-top { display: flex; height: 48px; align-items: center; margin: 0 -8px 8px; }
  .auth-back { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: #fff; }
  .auth-back:active { background: rgba(255, 255, 255, .1); }
  #auth .auth-logo { display: none; }
  #auth .auth-card h1 { font-size: 1.7em; }
  #auth #authBtn { height: 52px; border-radius: 14px; margin-top: 4px; }
  #auth .auth-switch { text-align: center; }
  #auth .auth-dl { display: none; }
}
@keyframes floaty { 50% { transform: translateY(-8px); } }

@media (max-width: 760px) { .auth-pair { display: block; } }

/* ====================== сообщения как в Telegram ====================== */
/* цитата ответа внутри пузыря */
.bubble .msg-ref { grid-column: auto; justify-self: stretch; display: flex; flex-direction: column; align-items: stretch; gap: 1px; max-width: none !important; margin: 2px 0 6px; padding: 5px 10px 6px; border: 0; border-radius: 8px;
  background: color-mix(in srgb, var(--ref, var(--accent)) 14%, transparent); box-shadow: inset 3px 0 0 var(--ref, var(--accent)); font-size: .86em; cursor: pointer; min-width: 0; }
.bubble .msg-ref .ref-name { font-weight: 700; color: var(--ref, var(--accent-text)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bubble .msg-ref .ref-text { color: var(--text-2); }
.msg.own .bubble .msg-ref { background: rgba(255, 255, 255, .16); box-shadow: inset 3px 0 0 rgba(255, 255, 255, .9); }
.msg.own .bubble .msg-ref .ref-name, .msg.own .bubble .msg-ref .ref-text { color: #fff; }
.msg.own .bubble .msg-ref .ref-text { opacity: .85; }
.bubble .msg-ref.deleted { flex-direction: row; align-items: center; gap: 6px; font-style: italic; color: var(--text-3); }
.bubble.media .msg-ref { margin: 6px 6px 6px; }
[data-density="compact"] .bubble .msg-ref { max-width: 520px !important; }
/* «Переслано от …» */
.fwd { display: flex; align-items: center; gap: 4px; margin: 0 0 4px; font-size: .8em; color: var(--accent-text); }
.msg.own .fwd { color: rgba(255, 255, 255, .85); }
.fwd b { font-weight: 700; }
/* хвостики у последнего пузыря в группе */
.msg:not(.own).end .bubble { border-bottom-left-radius: 4px; }
.msg.own.end .bubble { border-bottom-right-radius: 4px; }
/* свайп для ответа */
.msg { position: relative; }
.msg.swiping::after { content: ''; position: absolute; right: 14px; top: 50%; width: 30px; height: 30px; margin-top: -15px; border-radius: 50%; opacity: var(--sw, 0); transform: scale(calc(.6 + var(--sw, 0) * .4));
  background: var(--bg-active) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 17 4 12 9 7'/%3E%3Cpath d='M20 18v-2a4 4 0 0 0-4-4H4'/%3E%3C/svg%3E") center / 16px no-repeat; pointer-events: none; }
.msg.react-pop .bubble { animation: reactpop .35s var(--ease); }
@keyframes reactpop { 40% { transform: scale(1.04); } }
/* даты прилипают к верху при прокрутке */
/* дата дня: в ленте — на своём месте; при прокрутке сверху всплывает текущая (как в Telegram) и через секунду прячется */
.float-day { position: absolute; top: 8px; left: 50%; z-index: 4; transform: translate(-50%, -6px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.float-day.on { opacity: 1; transform: translate(-50%, 0); }
.float-day span { display: block; padding: 3px 12px; border-radius: 999px; font-size: .74em; font-weight: 600; color: var(--text-2); background: color-mix(in srgb, var(--bg-2) 82%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: var(--b-shadow, none); }
[data-palette="pastel"] .float-day span { background: color-mix(in srgb, var(--bg-float) 90%, transparent); color: var(--text-3); }
#main[data-wall]:not([data-wall="none"]) .float-day span { color: var(--text); }
.day-div span { background: color-mix(in srgb, var(--bg-2) 80%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: var(--text-2); }
/* кнопка «вниз» */
.chat-col { position: relative; }
.jump-present { position: absolute; right: 14px; bottom: 86px; width: 44px; height: 44px; padding: 0; margin: 0; border-radius: 50%; background: var(--bg-float); color: var(--text-2); box-shadow: var(--shadow-md), inset 0 0 0 1px var(--line); justify-content: center; }
.jump-present > .ic { transform: rotate(0deg); }
.jp-count:empty { display: none; }
.jp-count { position: absolute; top: -6px; left: 50%; transform: translateX(-50%); min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
/* пересылка */
.fw-search { width: 100%; height: 42px; margin-bottom: 8px; }
.fw-list { max-height: min(420px, 60dvh); display: grid; gap: 2px; }
.fw-row { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; text-align: left; color: var(--text); }
.fw-row:hover { background: var(--bg-hover); }
.fw-row .gicon { border-radius: 50%; }
.fw-name { flex: 1; min-width: 0; display: flex; flex-direction: column; font-weight: 600; overflow: hidden; }
.fw-name small { color: var(--text-3); font-weight: 500; }
.fw-row > .ic { color: var(--accent-text); }
.menu-reacts { justify-content: space-between; }

/* видео не может распереть вёрстку: всегда по размеру своего блока */
.call-main video, .call-pip video { position: absolute; inset: 0; width: 100%; height: 100%; }
.call-pip { contain: strict; }
.vn { flex: none; aspect-ratio: 1; height: auto; clip-path: circle(50% at 50% 50%); contain: layout paint; isolation: isolate; }
.vn video { position: absolute; inset: 0; width: 100%; height: 100%; }
.vn-ring-fg[stroke-dasharray^="0 "] { opacity: 0; }
.vn.playing { width: min(300px, 78vw); transition: width .25s var(--ease); }
.vn { transition: width .25s var(--ease); }
.vn-circle { clip-path: circle(50% at 50% 50%); }
.vn-circle video { position: absolute; inset: 0; width: 100%; height: 100%; }
.msg .bubble .msg-ref, .msg.own .bubble .msg-ref { justify-self: stretch; align-self: stretch; grid-column: auto; }

/* GIF и эмодзи на телефоне — панель снизу, как в Telegram; список всегда прокручивается */
.gif-wrap { min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y; }
.emoji-picker > * { min-height: 0; }
@media (max-width: 760px) {
  .popover:has(.gif-picker), .popover:has(.emoji-picker) { position: fixed !important; left: 0 !important; right: 0 !important; top: auto !important; bottom: 0 !important; width: auto !important; max-width: none !important; border-radius: 22px 22px 0 0; padding-bottom: var(--safe-b); animation: sheet .25s var(--ease); }
  .gif-picker, .emoji-picker { width: 100% !important; height: min(68dvh, 540px) !important; }
}

/* кружок: без чёрной рамки на iPhone — скругляем само видео, фон прозрачный */
.vn { background: transparent; transition: none; }
.vn video { border-radius: 50%; background: transparent; -webkit-mask-image: -webkit-radial-gradient(white, black); transform: translateZ(0); }
.vn.playing { transition: none; }
.vn .spin { margin: auto; }

/* своя камера на весь экран, пока собеседник без видео */
.call-top .avatar { flex: none; }

.composer.has-files .send-btn { display: grid; }
.composer.has-files .vn-btn { display: none; }

/* ====================== телефон: чат как в Telegram, но в цветах Drippy ====================== */
.comp-field { flex: 1; display: flex; align-items: flex-end; min-width: 0; }
.comp-main { display: flex; align-items: flex-end; }
:root { --tg-glass: color-mix(in srgb, var(--bg-float) 74%, transparent); --tg-line: rgba(255, 255, 255, .09); }
[data-theme="light"] { --tg-glass: rgba(255, 255, 255, .78); --tg-line: rgba(20, 16, 50, .07); }
.tg-glass, .tg-pill { background: var(--tg-glass); backdrop-filter: blur(22px) saturate(1.7); -webkit-backdrop-filter: blur(22px) saturate(1.7); box-shadow: inset 0 0 0 1px var(--tg-line), 0 6px 20px rgba(0, 0, 0, .16); }

@media (max-width: 760px) {
  /* обои: перелив цветов Drippy + узор из «капель» */
  .chat-col {
    background:
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72' fill='none' stroke='%23ffffff' stroke-opacity='.05' stroke-width='1.4'%3E%3Ccircle cx='14' cy='16' r='5'/%3E%3Ccircle cx='20' cy='16' r='5'/%3E%3Ccircle cx='50' cy='52' r='5'/%3E%3Ccircle cx='56' cy='52' r='5'/%3E%3Cpath d='M48 14c2 3 6 3 8 0M14 50c2 3 6 3 8 0'/%3E%3C/svg%3E"),
      radial-gradient(90% 60% at 0% 0%, color-mix(in srgb, var(--accent) 42%, transparent), transparent 60%),
      radial-gradient(80% 60% at 100% 100%, color-mix(in srgb, #ff6f91 30%, transparent), transparent 60%),
      radial-gradient(70% 50% at 100% 20%, color-mix(in srgb, #2aa7ff 20%, transparent), transparent 60%),
      var(--bg-app);
    background-size: 72px 72px, 160% 160%, 160% 160%, 160% 160%, auto;
    animation: tg-wall 26s ease-in-out infinite alternate;
  }
  [data-theme="light"] .chat-col { background-color: #efeaf7; }
  @keyframes tg-wall { to { background-position: 0 0, 30% 20%, 70% 80%, 20% 60%, 0 0; } }
  [data-motion="reduce"] .chat-col { animation: none; }

  /* плавающая шапка */
  #main { --head-h: 64px; }
  .main-head.tg-head { position: absolute; top: 0; left: 0; right: 0; z-index: 6; display: block; min-height: 0; padding: calc(6px + var(--safe-t)) 10px 6px; border: 0; background: linear-gradient(to bottom, color-mix(in srgb, var(--bg-app) 55%, transparent), transparent); box-shadow: none !important; pointer-events: none; }
  #main:has(.tg-head) { padding-top: 0 !important; }
  .tg-head > * { pointer-events: auto; }
  .tg-row { display: flex; align-items: center; gap: 8px; }
  .tg-pill { display: flex; align-items: center; height: 46px; border-radius: 23px; color: var(--text); }
  .tg-back { gap: 2px; padding: 0 12px 0 8px; flex: none; }
  .tg-count { min-width: 26px; height: 26px; padding: 0 7px; border-radius: 13px; display: grid; place-items: center; background: var(--text); color: var(--bg-app); font-size: .78em; font-weight: 800; }
  .tg-title { flex: 1; min-width: 0; flex-direction: column; justify-content: center; gap: 1px; padding: 0 14px; text-align: center; }
  .tg-title b { display: flex; align-items: center; justify-content: center; gap: 4px; max-width: 100%; font-size: .98em; }
  .tg-title b span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tg-title .head-sub { font-size: .74em; max-width: 100%; }
  .tg-muted { color: var(--text-4); }
  .tg-right { display: flex; align-items: center; gap: 6px; flex: none; }
  .tg-round { width: 46px; padding: 0; justify-content: center; color: var(--text); }
  .tg-ava { border-radius: 50%; display: grid; place-items: center; flex: none; --ring-bg: transparent; }
  .tg-ava .avatar, .tg-ava .gicon { border-radius: 50%; box-shadow: 0 0 0 1px var(--tg-line), 0 6px 20px rgba(0, 0, 0, .18); }
  .tg-ava .status-dot { display: none; }
  .tg-bars { display: grid; gap: 6px; margin-top: 6px; }
  .tg-bars:empty { display: none; }
  .tg-bars .trust-bar { margin: 0; }
  .tg-pinbar { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 4px 6px 4px 12px; border-radius: 24px; }
  .pb-marks { display: flex; flex-direction: column; gap: 2px; align-self: stretch; justify-content: center; }
  .pb-marks i { width: 3px; flex: 1; max-height: 12px; border-radius: 2px; background: color-mix(in srgb, var(--accent) 35%, transparent); }
  .pb-marks i.on { background: var(--accent); }
  .pb-text { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: left; color: var(--text); }
  .pb-text b { font-size: .86em; color: var(--accent-text); }
  .pb-text span { font-size: .84em; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pb-all { color: var(--text-2); }
  #msgScroll { padding-top: calc(var(--head-h) + 4px); scroll-padding-top: calc(var(--head-h) + 8px); }
  #callStage.call-strip { position: absolute; left: 10px; right: 10px; top: calc(var(--head-h) + 2px); z-index: 5; border-radius: 22px; }
  .float-day { top: calc(var(--head-h) + 6px); }

  /* сообщения: компактно, в личке без аватарок и имён */
  .msg { padding: 1px 8px; }
  .msg.start { margin-top: 8px; }
  .is-dm .msg:not(.own) { grid-template-columns: minmax(0, 1fr); }
  .is-dm .msg:not(.own) .msg-gutter { display: none; }
  .is-dm .msg:not(.own) .msg-body { grid-column: 1; }
  .is-dm .msg .msg-head { display: none; }
  .msg:not(.own) .bubble { background: color-mix(in srgb, var(--bubble) 90%, transparent); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
  [data-theme="light"] .msg:not(.own) .bubble { background: rgba(255, 255, 255, .94); }
  .bubble { padding: 6px 10px 5px; font-size: .97em; }
  .msg.system .msg-body { background: color-mix(in srgb, var(--bg-app) 55%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }

  /* поле ввода: ⊕ · капсула · ➤ */
  .composer-wrap { background: transparent; padding: 4px 8px calc(8px + var(--safe-b)); }
  .composer { background: transparent !important; box-shadow: none !important; border-radius: 0; }
  .composer::after { display: none !important; }
  .comp-row { gap: 8px; padding: 0; min-height: 0; align-items: flex-end; }
  .comp-btn.plus { width: 46px; height: 46px; margin: 0; flex: none; color: var(--text); background: var(--tg-glass); backdrop-filter: blur(22px) saturate(1.7); -webkit-backdrop-filter: blur(22px) saturate(1.7); box-shadow: inset 0 0 0 1px var(--tg-line), 0 6px 20px rgba(0, 0, 0, .16); }
  .comp-field { min-height: 46px; padding: 0 4px 0 14px; border-radius: 23px; background: var(--tg-glass); backdrop-filter: blur(22px) saturate(1.7); -webkit-backdrop-filter: blur(22px) saturate(1.7); box-shadow: inset 0 0 0 1px var(--tg-line), 0 6px 20px rgba(0, 0, 0, .16); }
  .composer:focus-within .comp-field { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 55%, transparent), 0 6px 20px rgba(0, 0, 0, .16); }
  #composerInput { min-height: 46px; padding: 12px 0 !important; }
  .comp-field .comp-btn { width: 36px; height: 36px; margin: 0 0 5px; }
  .comp-main .comp-btn { width: 46px; height: 46px; margin: 0; }
  .comp-main .vn-btn { color: var(--text); background: var(--tg-glass); backdrop-filter: blur(22px) saturate(1.7); -webkit-backdrop-filter: blur(22px) saturate(1.7); box-shadow: inset 0 0 0 1px var(--tg-line), 0 6px 20px rgba(0, 0, 0, .16); border-radius: 50%; }
  .comp-main .send-btn { border-radius: 50%; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 40%, transparent); }
  .reply-bar, .attach-bar:not([hidden]) { margin: 0 0 6px; border-radius: 18px; background: var(--tg-glass); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); box-shadow: inset 0 0 0 1px var(--tg-line); }
  .typing { background: transparent; }
  .jump-present { bottom: 76px; }
}
@media (max-width: 760px) {
  .tg-ava .av-img, .tg-ava .avatar { border-radius: 50% !important; }
  .msg.system .msg-body { background: color-mix(in srgb, var(--bg-float) 72%, transparent); }
  [data-theme="light"] .msg.system .msg-body { background: rgba(255, 255, 255, .7); }
  [data-theme="light"] .main-head.tg-head { background: linear-gradient(to bottom, rgba(239, 234, 247, .7), transparent); }
}
@media (max-width: 760px) {
  .msg.system { margin: 6px 0; }
  .msg.system .msg-body { font-size: .82em; padding: 5px 12px; max-width: 86%; border-radius: 14px; line-height: 1.35; }
  .msg.system .sys-ic { width: 14px; height: 14px; }
}

/* ====================== телефон: своя шапка Drippy (вместо копии Telegram) ====================== */
@media (max-width: 760px) {
  .tg-row { display: none; }
  .dh-bar { display: flex; align-items: center; gap: 2px; height: 54px; padding: 0 4px 0 2px; border-radius: 22px;
    background: var(--tg-glass); backdrop-filter: blur(24px) saturate(1.7); -webkit-backdrop-filter: blur(24px) saturate(1.7);
    box-shadow: inset 0 0 0 1px var(--tg-line), 0 10px 28px rgba(0, 0, 0, .18); position: relative; overflow: hidden; }
  /* фирменная «капля» акцента внизу капсулы */
  .dh-bar::after { content: ''; position: absolute; left: 18%; right: 18%; bottom: 0; height: 2px; border-radius: 2px; background: var(--grad); opacity: .55; pointer-events: none; }
  .dh-back { position: relative; display: grid; place-items: center; width: 40px; height: 44px; border-radius: 14px; color: var(--text); flex: none; }
  .dh-count { position: absolute; top: 3px; right: -2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: grid; place-items: center; background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 800; box-shadow: 0 0 0 2px var(--panel-solid); }
  .dh-who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; padding: 4px 6px; border-radius: 16px; text-align: left; color: var(--text); --ring-bg: var(--panel-solid); }
  .dh-who:active { background: var(--bg-hover); }
  .dh-hash { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); flex: none; }
  .dh-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
  .dh-text b { display: flex; align-items: center; gap: 4px; font-size: .95em; font-weight: 800; }
  .dh-text b span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dh-text .head-sub { font-size: .72em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dh-tools { display: flex; align-items: center; flex: none; }
  .dh-btn { width: 36px; height: 40px; border-radius: 12px; color: var(--text-2); }
  .dh-btn:active { background: var(--bg-hover); }
  .dh-btn.on { color: var(--accent-text); }
  /* плашка закреплённого — своя: полоска-градиент и значок */
  .tg-pinbar { min-height: 44px; border-radius: 16px; padding: 3px 4px 3px 10px; }
  .pb-marks i { background: color-mix(in srgb, var(--accent) 30%, transparent); }
  .pb-marks i.on { background: var(--grad); }

  /* пузыри — снова Drippy: плотные, без полупрозрачности, аватарки в личке на месте */
  .is-dm .msg:not(.own) { grid-template-columns: 32px minmax(0, 1fr); }
  .is-dm .msg:not(.own) .msg-gutter { display: flex; }
  .is-dm .msg:not(.own) .msg-body { grid-column: 2; }
  .is-dm .msg .msg-head { display: flex; }
  .msg:not(.own) .bubble { background: var(--bubble); box-shadow: none; }
  [data-theme="light"] .msg:not(.own) .bubble { background: #fff; }
  .bubble { padding: 7px 11px 5px; font-size: 1em; }
  .msg.start { margin-top: 10px; }

  /* системные строки — маленькие пилюли по ширине текста */
  .msg.system { margin: 4px 0; }
  .msg.system .msg-body { width: fit-content; max-width: 84%; margin: 0 auto; padding: 4px 11px; border-radius: 999px; font-size: .78em; box-shadow: none;
    background: color-mix(in srgb, var(--bg-float) 62%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: var(--text-2); }
  [data-theme="light"] .msg.system .msg-body { background: rgba(255, 255, 255, .62); }
  .msg.system .msg-body time { font-size: .9em; }

  /* обои — спокойнее: одно мягкое свечение акцента и редкий узор */
  .chat-col { background:
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96' fill='none' stroke='%23ffffff' stroke-opacity='.035' stroke-width='1.4'%3E%3Ccircle cx='20' cy='22' r='6'/%3E%3Ccircle cx='27' cy='22' r='6'/%3E%3Ccircle cx='68' cy='70' r='6'/%3E%3Ccircle cx='75' cy='70' r='6'/%3E%3C/svg%3E"),
      radial-gradient(120% 55% at 50% 0%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 65%),
      radial-gradient(90% 50% at 100% 100%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
      var(--bg-app);
    background-size: 96px 96px, 140% 140%, 140% 140%, auto; }
  [data-theme="light"] .chat-col { background-color: #f3f0f8; }
  @keyframes tg-wall { to { background-position: 0 0, 40% 30%, 60% 70%, 0 0; } }

  /* поле ввода — одна капсула Drippy, все кнопки внутри */
  .composer { background: var(--tg-glass) !important; backdrop-filter: blur(24px) saturate(1.7); -webkit-backdrop-filter: blur(24px) saturate(1.7);
    box-shadow: inset 0 0 0 1px var(--tg-line), 0 10px 28px rgba(0, 0, 0, .16) !important; border-radius: 24px; }
  .composer:focus-within { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 55%, transparent), 0 10px 28px rgba(0, 0, 0, .16) !important; }
  .comp-row { gap: 0; padding: 0 4px; align-items: flex-end; }
  .comp-btn.plus { width: 40px; height: 40px; margin: 0 0 4px; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none; color: var(--accent-text); }
  .comp-field { min-height: 48px; padding: 0; border-radius: 0; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none !important; }
  #composerInput { min-height: 48px; padding: 13px 4px !important; }
  .comp-main .comp-btn { width: 40px; height: 40px; margin: 0 0 4px; }
  .comp-main .vn-btn { background: none; backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none; color: var(--text-3); }
  .reply-bar, .attach-bar:not([hidden]) { margin: 0; background: none; backdrop-filter: none; box-shadow: none; border-radius: 0; }
}

/* профиль как вкладка: окно настроек над содержимым, нижнее меню видно и работает */
@media (max-width: 760px) {
  .modal-back.as-tab { top: 0; bottom: var(--tabbar-h, 72px); height: auto !important; }
  .modal-back.as-tab .modal.full { height: 100% !important; max-height: none; }
  .modal-back.as-tab .sp-close { display: none; }
  body.profile-tab #app.m-root #tabbar, body.profile-tab #tabbar { display: grid !important; position: fixed; left: 0; right: 0; bottom: 0; z-index: 900; }
  body.profile-tab #app #tabbar { grid-template-columns: repeat(5, 1fr); }
  .modal-back.as-tab .sp-side { padding-bottom: 12px; }
}
@media (max-width: 760px) {
  .modal-back.as-tab .sp-side { padding-top: var(--safe-t); }
}
/* профиль-вкладка: на весь экран, содержимое прокручивается под парящим нижним меню */
@media (max-width: 760px) {
  .modal-back.as-tab { bottom: 0 !important; height: var(--vvh, 100dvh) !important; }
  .modal-back.as-tab .modal, .modal-back.as-tab .settings-page, .modal-back.as-tab .sp-side, .modal-back.as-tab .sp-main {
    border-radius: 0 !important; box-shadow: none !important; }
  .modal-back.as-tab .modal::after, .modal-back.as-tab .sp-side::after, .modal-back.as-tab .sp-main::after { display: none !important; }
  .modal-back.as-tab .sp-nav, .modal-back.as-tab .sp-content { padding-bottom: calc(var(--tabbar-h, 76px) + 24px) !important; }
}
@media (max-width: 760px) { .modal-back.as-tab { background: var(--bg-app) !important; } }
@media (max-width: 760px) {
  body.profile-tab > #tabbar { display: grid !important; position: fixed; left: 0; right: 0; bottom: 0; z-index: 900; grid-template-columns: repeat(4, 1fr);
    padding: 6px 6px calc(6px + var(--safe-b)); background: var(--panel-solid); border-top: 1px solid var(--line); --ring-bg: var(--panel-solid); }
  [data-material="glass"] body.profile-tab > #tabbar { left: 12px; right: 12px; bottom: calc(10px + var(--safe-b)); margin: 0; padding: 6px; border: 0; border-radius: 30px;
    background: var(--g-float); backdrop-filter: var(--g-blur); -webkit-backdrop-filter: var(--g-blur); box-shadow: var(--g-shadow), inset 0 1px 0 var(--g-hi), inset 0 0 0 1px var(--line); }
}
@media (max-width: 760px) { .modal-back.as-tab .sp-side, .modal-back.as-tab .sp-main { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; background: transparent !important; } }

/* ====================== аккуратные пузыри: тонкая грань, ровные углы, время в строку ====================== */
:root:not([data-density="compact"]) .bubble { padding: 6px 11px 6px; border-radius: 6px 16px 16px 6px; }
:root:not([data-density="compact"]) .msg:not(.own).start .bubble { border-top-left-radius: 16px; }
:root:not([data-density="compact"]) .msg:not(.own).end .bubble { border-bottom-left-radius: 4px; }
:root:not([data-density="compact"]) .msg.own .bubble { border-radius: 16px 6px 6px 16px; }
:root:not([data-density="compact"]) .msg.own.start .bubble { border-top-right-radius: 16px; }
:root:not([data-density="compact"]) .msg.own.end .bubble { border-bottom-right-radius: 4px; }
/* без свечения: только тонкая светлая грань */
:root:not([data-density="compact"]) .msg.own .bubble:not(.media):not(.jumbo) { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12), 0 1px 2px rgba(0, 0, 0, .12) !important; }
:root:not([data-density="compact"]) .msg:not(.own) .bubble:not(.media):not(.jumbo) { box-shadow: inset 0 0 0 1px var(--line), 0 1px 2px rgba(0, 0, 0, .08) !important; }
[data-theme="light"]:not([data-density="compact"]) .msg:not(.own) .bubble:not(.media):not(.jumbo) { box-shadow: inset 0 0 0 1px rgba(20, 16, 50, .06), 0 1px 2px rgba(20, 16, 50, .06) !important; }
/* своё имя в своих пузырях не нужно; в личке и имя собеседника лишнее */
:root:not([data-density="compact"]) .msg.own .msg-head { display: none !important; }
:root:not([data-density="compact"]) .is-dm .msg .msg-head { display: none !important; }
/* время в конце строки */
.b-spacer { display: inline-block; height: 1px; }
.bubble.inline-meta .b-meta { position: absolute; right: 10px; bottom: 6px; float: none; margin: 0; }
/* плотнее внутри серии, воздух между сериями */
:root:not([data-density="compact"]) .msg { padding-top: 1px; padding-bottom: 1px; }
:root:not([data-density="compact"]) .msg.start { margin-top: 10px; }
.day-div { margin: 14px 0 10px; }

/* ====================== чистые края: сплошные пузыри, мягкое растворение при прокрутке ====================== */
:root { --bubble-solid: #23222f; --bubble-edge: rgba(255, 255, 255, .06); }
[data-theme="midnight"] { --bubble-solid: #17171f; }
[data-theme="light"] { --bubble-solid: #ffffff; --bubble-edge: rgba(20, 16, 50, .07); }
:root:not([data-density="compact"]) .msg:not(.own) .bubble:not(.media):not(.jumbo) { background: var(--bubble-solid) !important; box-shadow: inset 0 0 0 1px var(--bubble-edge) !important; }
:root:not([data-density="compact"]) .msg.own .bubble:not(.media):not(.jumbo) { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14) !important; }
/* фото, видео, GIF, кружки — без подложки и рамки */
.bubble.media { background: transparent !important; box-shadow: none !important; }
.msg.mentioned:not(.own) .bubble:not(.media) { box-shadow: inset 3px 0 0 var(--mention-bar), inset 0 0 0 1px var(--bubble-edge) !important; }
@media (max-width: 760px) {
  /* без тёмной полосы под шапкой: сообщения мягко растворяются у шапки и у поля ввода */
  .main-head.tg-head, [data-theme="light"] .main-head.tg-head { background: none !important; }
  #msgScroll {
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 calc(var(--head-h) * .75), #000 calc(100% - 16px), transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 calc(var(--head-h) * .75), #000 calc(100% - 16px), transparent 100%);
  }
  .composer-wrap { margin-top: -6px; position: relative; z-index: 2; }
}

/* ====================== голосовые сообщения ====================== */
.mic-btn { touch-action: none; user-select: none; -webkit-user-select: none; }
.composer { position: relative; }
.vrec { position: absolute; inset: 0; z-index: 4; display: flex; align-items: center; gap: 10px; padding: 0 10px 0 16px; border-radius: inherit; background: var(--bg-float); color: var(--text); font-variant-numeric: tabular-nums; transform: translateX(var(--dx, 0)); }
.vrec .rec-dot { flex: none; }
.vrec-time { flex: none; min-width: 38px; }
.vrec-wave { flex: 1; min-width: 0; height: 26px; display: flex; align-items: center; justify-content: flex-end; gap: 2px; overflow: hidden; }
.vrec-wave i { flex: none; width: 3px; border-radius: 2px; background: var(--accent); }
.vrec-hint { flex: none; display: flex; align-items: center; gap: 4px; font-size: .78em; color: var(--text-3); }
.vrec-hint .ic { transform: rotate(90deg); }
.vrec.cancelling { color: var(--red); }
.vrec.cancelling .vrec-wave i { background: var(--red); }
.vrec-del { color: var(--red); }
.vrec-send { width: 40px; height: 40px; border-radius: 50%; background: var(--grad); color: #fff !important; }
.composer.has-text .mic-btn, .composer.has-files .mic-btn { display: none; }

.vm { display: flex; align-items: center; gap: 10px; padding: 2px 2px 0; }
.vm-play { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #fff; }
.vm.own .vm-play { background: #fff; color: var(--accent); }
.vm-body { flex: none; min-width: 0; display: grid; gap: 3px; }
.vm-wave { display: flex; align-items: center; gap: 2px; height: 24px; cursor: pointer; }
.vm-wave i { flex: none; width: 3px; border-radius: 2px; background: color-mix(in srgb, var(--accent) 40%, transparent); }
.vm-wave i.on { background: var(--accent); }
.vm.own .vm-wave i { background: rgba(255, 255, 255, .45); }
.vm.own .vm-wave i.on { background: #fff; }
.vm-meta { display: flex; align-items: center; gap: 8px; font-size: .74em; color: var(--text-3); font-variant-numeric: tabular-nums; }
.vm.own .vm-meta { color: rgba(255, 255, 255, .8); }
.vm-speed { padding: 0 6px; border-radius: 6px; font-weight: 800; font-size: .95em; background: color-mix(in srgb, currentColor 14%, transparent); color: inherit; }
/* голосовое как в Telegram: пузырь по размеру волны, время — в правом нижнем углу рядом с длительностью */
.bubble.vm-only { position: relative; padding: 7px 10px 7px 8px; }
.bubble.vm-only .vm-meta { padding-right: 62px; }
.bubble.vm-only > .b-meta { position: absolute; right: 10px; bottom: 7px; margin: 0; }

/* ====================== группы и «Избранное» ====================== */
.saved-pic { display: grid; place-items: center; width: var(--s, 52px); height: var(--s, 52px); border-radius: 50%; background: var(--grad); color: #fff; flex: none; }
.group-row .ch-pic .gicon { border-radius: 50%; }
.gp { display: grid; gap: 8px; }
.gp-list { max-height: min(360px, 50dvh); display: grid; gap: 2px; }
.gp-row { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; text-align: left; color: var(--text); }
.gp-row:hover { background: var(--bg-hover); }
.gp-name { flex: 1; min-width: 0; display: flex; flex-direction: column; font-weight: 600; }
.gp-name small { color: var(--text-3); font-weight: 500; }
.gp-check { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--line-2); color: transparent; }
.gp-row.on .gp-check { background: var(--accent); box-shadow: none; color: #fff; }

/* медиа и файлы */
.media-modal .modal-body { display: flex; flex-direction: column; gap: 10px; min-height: min(60dvh, 520px); }
.mm-seg { align-self: stretch; }
.mm-body { flex: 1; min-height: 0; max-height: min(64dvh, 560px); }
.mm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.mm-cell { position: relative; aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: var(--bg-input); display: grid; place-items: center; }
.mm-cell img, .mm-cell video { width: 100%; height: 100%; object-fit: cover; display: block; }
.mm-cell.round img, .mm-cell.round video { border-radius: 50%; }
.mm-play { position: absolute; left: 6px; bottom: 6px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; }
.mm-list { display: grid; gap: 2px; }
.mm-row { display: flex; align-items: center; gap: 12px; padding: 8px 6px; border-radius: 12px; }
.mm-row:hover { background: var(--bg-hover); }
.mm-row.voice { align-items: flex-start; }
.mm-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.mm-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mm-text b, .mm-text a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.mm-text small { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ====================== опросы ====================== */
.poll { display: grid; gap: 6px; min-width: 240px; max-width: 340px; padding: 2px 0; }
.poll-q { font-size: 1em; }
.poll-kind { font-size: .74em; opacity: .7; margin-top: -4px; }
.poll-opt { position: relative; display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 6px 10px; border-radius: 12px; text-align: left; color: inherit; overflow: hidden; background: color-mix(in srgb, currentColor 8%, transparent); }
.poll-opt::before { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--pct, 0%); background: color-mix(in srgb, currentColor 16%, transparent); transition: width .3s var(--ease); }
.poll-opt > * { position: relative; }
.poll-mark { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px currentColor; opacity: .7; flex: none; }
.poll-opt.mine .poll-mark { background: currentColor; opacity: 1; }
.poll-opt.mine .poll-mark .ic { color: var(--bubble-solid); }
.msg.own .poll-opt.mine .poll-mark .ic { color: var(--accent); }
.poll-text { flex: 1; min-width: 0; }
.poll-pct { font-weight: 800; font-size: .85em; }
.poll-total { font-size: .74em; opacity: .7; }
.poll-opts { display: grid; gap: 6px; }
.poll-opt-row { display: flex; align-items: center; gap: 6px; }
.poll-opt-row input { flex: 1; }

/* ====================== выбор нескольких сообщений ====================== */
body.selecting #msgList .msg:not(.system) { cursor: pointer; padding-left: 44px !important; }
body.selecting #msgList .msg:not(.system)::before { content: ''; position: absolute; left: 12px; top: 50%; width: 20px; height: 20px; margin-top: -10px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--line-2); }
body.selecting #msgList .msg.sel::before { background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / 13px no-repeat; box-shadow: none; }
body.selecting #msgList .msg.sel { background: color-mix(in srgb, var(--accent) 10%, transparent); }
body.selecting .composer-wrap { visibility: hidden; }
.sel-bar { position: absolute; left: 10px; right: 10px; bottom: calc(10px + var(--safe-b)); z-index: 8; display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 20px; background: var(--bg-float); box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--line); animation: rise .2s var(--ease); }
.sel-bar b { font-size: .92em; }
.sel-sp { flex: 1; }
.sel-bar .icon-btn.danger { color: var(--red); }

/* ====================== закреплённые и архив в списке ====================== */
.dm-row.pinned { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.saved-pic.arch { background: var(--bg-3); color: var(--text-2); }
.inline-check { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: .9em; }

/* ====================== поиск в чате (как в Telegram) ====================== */
mark.cs-hl { background: color-mix(in srgb, var(--yellow) 60%, transparent); color: inherit; border-radius: 4px; padding: 0 1px; }
.cs-top { position: absolute; top: 0; left: 0; right: 0; z-index: 8; display: flex; align-items: center; gap: 8px; padding: calc(6px + var(--safe-t)) 10px 6px; animation: cs-drop .2s cubic-bezier(.2, .9, .3, 1.2); }
.cs-field { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 8px 0 14px; border-radius: 23px; color: var(--text-3);
  background: var(--tg-glass, var(--panel-solid)); backdrop-filter: blur(24px) saturate(1.7); -webkit-backdrop-filter: blur(24px) saturate(1.7);
  box-shadow: inset 0 0 0 1px var(--tg-line, var(--line)), 0 10px 28px rgba(0, 0, 0, .18); }
.cs-field:focus-within { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 55%, transparent), 0 10px 28px rgba(0, 0, 0, .18); color: var(--accent-text); }
.cs-input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: 0; color: var(--text); font: inherit; font-size: 16px; -webkit-appearance: none; appearance: none; }
.cs-input::-webkit-search-cancel-button { display: none; }
.cs-clear { width: 24px; height: 24px; border-radius: 50%; background: var(--bg-hover); color: var(--text-2); flex: none; }
.cs-cancel { flex: none; height: 46px; padding: 0 6px; color: var(--accent-text); font-weight: 700; }
.cs-bot { position: absolute; left: 8px; right: 8px; bottom: calc(8px + var(--safe-b)); z-index: 7; display: flex; align-items: center; gap: 2px; height: 52px; padding: 0 6px; border-radius: 26px;
  background: var(--tg-glass, var(--panel-solid)); backdrop-filter: blur(24px) saturate(1.7); -webkit-backdrop-filter: blur(24px) saturate(1.7);
  box-shadow: inset 0 0 0 1px var(--tg-line, var(--line)), 0 -6px 24px rgba(0, 0, 0, .14); animation: cs-rise .2s ease-out; }
.cs-count { flex: 1; min-width: 0; text-align: center; font-weight: 700; font-size: .9em; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-arrow, .cs-tool { width: 40px; height: 40px; border-radius: 14px; color: var(--accent-text); flex: none; }
.cs-tool { color: var(--text-2); }
.cs-tool.on { color: var(--accent-text); background: var(--accent-soft); }
.cs-arrow.up svg { transform: rotate(180deg); }
.cs-arrow:disabled, .cs-tool:disabled { opacity: .3; }
.cs-list { position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: 6; padding: calc(68px + var(--safe-t)) 8px calc(72px + var(--safe-b)); background: var(--bg-app); display: flex; flex-direction: column; gap: 2px; animation: cs-fade .15s ease-out; }
.cs-list[hidden] { display: none; }
.cs-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 16px; text-align: left; color: var(--text); flex: none; }
.cs-row:active, .cs-row:hover { background: var(--bg-hover); }
.cs-row.cur { background: var(--accent-soft); }
.cs-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cs-row-head { display: flex; justify-content: space-between; gap: 8px; }
.cs-row-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-row-head time { color: var(--text-3); font-size: .8em; flex: none; }
.cs-row-body { color: var(--text-2); font-size: .9em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
#main.cs-on .tg-head { visibility: hidden; }
#main.cs-on .composer-wrap, #main.cs-on .jump-present, #main.cs-on .typing { display: none; }
#main.cs-on #msgScroll { padding-bottom: calc(72px + var(--safe-b)); }
@keyframes cs-drop { from { opacity: 0; transform: translateY(-10px); } }
@keyframes cs-rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes cs-fade { from { opacity: 0; } }
[data-motion="reduce"] .cs-top, [data-motion="reduce"] .cs-bot, [data-motion="reduce"] .cs-list { animation: none; }
.cs-field input.cs-input { background: none !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; border-radius: 0 !important; min-height: 0; }

/* ====================== Telegram × Drippy: удобство на телефоне ====================== */

/* единая форма аватарок в списках — фирменный «сквиркл» Drippy */
.ch-pic .gicon, .group-row .ch-pic .gicon, .fw-row .gicon, .saved-pic { border-radius: 34%; }
.gicon.tinted { background: var(--gc); color: #fff; }

@media (max-width: 760px) {
  /* парящее нижнее меню с «каплей», которая перетекает между вкладками */
  :root:not([data-material="glass"]) #app { background: var(--panel-solid); }
  #app.m-root #tabbar, body.profile-tab > #tabbar {
    position: relative; margin: 0 12px calc(8px + var(--safe-b)); padding: 5px; border: 0; border-radius: 30px;
    background: var(--tg-glass); backdrop-filter: blur(24px) saturate(1.7); -webkit-backdrop-filter: blur(24px) saturate(1.7);
    box-shadow: inset 0 0 0 1px var(--tg-line), 0 10px 30px rgba(0, 0, 0, .28); }
  body.profile-tab > #tabbar { position: fixed; left: 12px; right: 12px; bottom: calc(8px + var(--safe-b)); margin: 0; }
  .tb-pill { position: absolute; left: 5px; top: 5px; bottom: 5px; width: calc((100% - 10px) / 4); border-radius: 25px; pointer-events: none;
    background: color-mix(in srgb, var(--accent) 16%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 24%, transparent);
    transform: translateX(calc(var(--i) * 100%)); }
  .tb-item { position: relative; z-index: 1; padding: 5px 0 4px; }
  .tb-item.on { color: var(--accent-text); }
  .tb-item.on .tb-ic, [data-material="glass"] .tb-item.on .tb-ic { background: none; box-shadow: none; }
  .tb-item:active .tb-ic { transform: scale(.9); }
  .tb-ic { transition: transform .15s; }

  /* свайп по чату */
  .dm-row.swipeable { position: relative; overflow: hidden; touch-action: pan-y; }
  .dm-row.swipeable > :not(.sw-acts) { transform: translateX(var(--sw, 0px)); }
  .dm-row.sw-anim > :not(.sw-acts), .dm-row.sw-anim .sw-acts { transition: transform .28s var(--ease), width .28s var(--ease); }
  .sw-acts { position: absolute; top: 0; bottom: 0; right: 0; display: flex; width: max(216px, calc(-1 * var(--sw, 0px))); transform: translateX(calc(100% + var(--sw, 0px))); }
  .sw-act { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: #fff; font-size: .68em; font-weight: 700; transition: flex .2s var(--ease); overflow: hidden; white-space: nowrap; }
  .sw-act.mute { background: #f0a020; }
  .sw-act.pin { background: #2fb36b; }
  .sw-act.arch { background: #8b8a9b; }
  .dm-row.sw-full .sw-act:not(.arch) { flex: 0; }
  .dm-row:not(.swipeable) .sw-acts { display: none; }
}

/* меню сообщения «в фокусе» */
.mf-layer { position: absolute; inset: 0; z-index: 60; transition: opacity .16s; }
.mf-layer.out { opacity: 0; }
.mf-back { position: absolute; inset: 0; background: rgba(6, 6, 14, .4); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); animation: fade .18s; }
[data-theme="light"] .mf-back { background: rgba(240, 236, 248, .45); }
.mf-msg { position: absolute !important; margin: 0 !important; pointer-events: none; z-index: 1; animation: mf-pop .26s cubic-bezier(.2, .9, .3, 1.25); }
.mf-msg.clipped { overflow: hidden; -webkit-mask-image: linear-gradient(to bottom, #000 82%, transparent); mask-image: linear-gradient(to bottom, #000 82%, transparent); }
.mf-msg .msg-tools, .mf-msg .msg-head time + * { display: none !important; }
.msg.mf-src { opacity: 0; }
.mf-reacts, .mf-menu { position: absolute; z-index: 2; background: var(--tg-glass, var(--panel-solid)); backdrop-filter: blur(24px) saturate(1.7); -webkit-backdrop-filter: blur(24px) saturate(1.7);
  box-shadow: inset 0 0 0 1px var(--tg-line, var(--line)), 0 14px 36px rgba(0, 0, 0, .32); }
.mf-reacts { border-radius: 28px; padding: 5px; animation: mf-in .24s cubic-bezier(.2, .9, .3, 1.3); transform-origin: bottom left; }
.mf-reacts.own { transform-origin: bottom right; }
.mf-reacts .menu-reacts { display: flex; gap: 2px; margin: 0; padding: 0; border: 0; }
.mf-reacts .menu-react { flex: none; width: 42px; height: 42px; border-radius: 50%; background: none; font-size: 26px; display: grid; place-items: center; transition: transform .15s; }
.mf-reacts .menu-react:active { transform: scale(1.25); }
.mf-reacts .mf-plus { background: var(--bg-hover); color: var(--text-2); font-size: 0; }
.mf-menu { width: min(250px, calc(100% - 16px)); padding: 5px; border-radius: 18px; overflow-y: auto; animation: mf-in .22s cubic-bezier(.2, .9, .3, 1.15); transform-origin: top left; }
.mf-menu.own { transform-origin: top right; }
.mf-item { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 12px; border-radius: 12px; color: var(--text); font-size: .95em; font-weight: 500; text-align: left; }
.mf-item .ic { color: var(--text-2); flex: none; }
.mf-item:active { background: var(--bg-hover); }
.mf-item.danger, .mf-item.danger .ic { color: var(--red); }
.mf-sep { display: block; height: 1px; margin: 4px 8px; background: var(--line); }
@keyframes mf-pop { from { transform: scale(.97); } 50% { transform: scale(1.015); } }
@keyframes mf-in { from { opacity: 0; transform: scale(.85); } }
[data-motion="reduce"] :is(.mf-msg, .mf-reacts, .mf-menu, .mf-back) { animation: none; }

/* профиль собеседника: быстрые действия плитками и медиа прямо в профиле */
.pc-quick { display: grid !important; grid-template-columns: repeat(auto-fit, minmax(58px, 1fr)); gap: 8px; width: 100%; }
.pc-tile { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 10px 4px 8px; border-radius: 16px; background: var(--bg-input); color: var(--accent-text); font-size: .74em; font-weight: 700; transition: transform .12s, background .15s; }
.pc-tile span { color: var(--text-2); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.pc-tile:active { transform: scale(.95); background: var(--bg-hover); }
.pc-tile.on { color: var(--text-3); }
.pc-media .mm-box { display: flex; flex-direction: column; gap: 10px; }
.mm-box { display: flex; flex-direction: column; gap: 10px; min-height: 0; flex: 1; }
.mm-body.inline { max-height: none; min-height: 120px; }
.pc-seen { margin-top: 2px; font-size: .82em; color: var(--text-3); }
.pc-seen.on { color: var(--accent-text); }
.pc-quick { margin: 4px 0 2px; }
.mf-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mf-menu { width: min(264px, calc(100% - 16px)); }

/* ====================== одна кнопка: голосовое ↔ кружок ====================== */
.mic-btn .ic { transition: transform .2s; }
.mic-btn.swap .ic { animation: rec-swap .32s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes rec-swap { 0% { transform: scale(.4) rotate(-90deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
.mic-btn.recording { color: #fff !important; background: var(--grad) !important; transform: scale(1.18); box-shadow: 0 6px 22px color-mix(in srgb, var(--accent) 45%, transparent) !important; transition: transform .2s; }
.rec-lock { position: fixed; z-index: 1200; transform: translate(-50%, calc(-100% + var(--dy, 0px))); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 6px; border-radius: 18px; pointer-events: none;
  background: var(--tg-glass, var(--panel-solid)); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: inset 0 0 0 1px var(--tg-line, var(--line)), 0 8px 24px rgba(0, 0, 0, .25); color: var(--text-2); animation: mf-in .2s ease-out; }
.rec-lock .ic:last-child { transform: rotate(180deg); animation: rec-up 1.2s ease-in-out infinite; }
@keyframes rec-up { 50% { translate: 0 -3px; } }
.vrec .vrec-label { flex: 1; min-width: 0; color: var(--text-3); font-size: .85em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vnr-layer { position: fixed; inset: 0; z-index: 1100; display: grid; place-items: center; padding: 20px; pointer-events: none;
  background: rgba(6, 6, 14, .35); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); animation: fade .2s; transition: opacity .2s; }
.vnr-layer.out { opacity: 0; }
.vnr-circle { position: relative; width: min(72vw, 300px); aspect-ratio: 1; border-radius: 50%; overflow: hidden; background: #000; box-shadow: 0 20px 60px rgba(0, 0, 0, .45); animation: mf-pop .3s cubic-bezier(.2, .9, .3, 1.25); transition: transform .2s, filter .2s; }
.vnr-circle video { width: 100%; height: 100%; object-fit: cover; }
.vnr-circle .vn-ring { position: absolute; inset: 0; width: 100%; height: 100%; }
.vnr-circle .vn-ring-bg { stroke: rgba(255, 255, 255, .18); }
.vnr-circle .vn-ring-fg { stroke: var(--red); }
.vnr-layer.cancelling .vnr-circle { transform: scale(.9); filter: grayscale(1) brightness(.7); }

/* медиа и ссылки не распирают окно: длинные адреса обрезаются */
.mm-box, .mm-body, .mm-list, .mm-row, .pc-media, .pc-extra, .pc-extra section { min-width: 0; max-width: 100%; }
.mm-text b, .mm-text a, .mm-text small { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mm-seg { min-width: 0; max-width: 100%; }
.mm-seg .seg-btn { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-card.full, .profile-card.full .pc-body { min-width: 0; max-width: 100%; overflow-x: hidden; }
.pc-li { min-width: 0; max-width: 100%; }

/* ====================== серверы: свой стиль Drippy ====================== */
@media (min-width: 761px) {
  /* сообщения — в удобной для чтения колонке по центру, а не по краям широкого экрана */
  #msgList, #main .typing { width: 100%; max-width: 940px; margin-left: auto; margin-right: auto; }
  #main .composer-wrap { width: 100%; max-width: 968px; margin-left: auto; margin-right: auto; }
  /* каналы на компьютере — карточками и «комнатами» */
  .desk-chs.spaces { padding: 0 2px 12px; }
  .desk-chs.spaces .srv-sec:first-child { margin-top: 10px; }
  .desk-chs.spaces .room-grid { grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); }
  .desk-chs.spaces .room { padding: 10px; gap: 8px; }
  .desk-chs.spaces .ch-row { cursor: pointer; }
}
.head-faces { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px 0 6px; border-radius: 16px; color: var(--text-2); font-weight: 700; font-size: .82em; transition: background .15s; }
.head-faces:hover, .head-faces.on { background: var(--bg-hover); color: var(--text); }
.hf-stack { display: inline-flex; }
.hf-stack .avatar { margin-left: -6px; --ring-bg: var(--panel-solid); }
.hf-stack .avatar:first-child { margin-left: 0; }
.hf-stack .av-img { box-shadow: 0 0 0 2px var(--panel-solid); }
.hf-n { display: inline-flex; align-items: center; gap: 4px; }
.head-live { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 6px; border-radius: 17px; margin-right: 4px;
  background: color-mix(in srgb, var(--green) 14%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--green) 35%, transparent); color: var(--text); }
.head-live:hover { background: color-mix(in srgb, var(--green) 22%, transparent); }
.head-live.here { box-shadow: inset 0 0 0 2px var(--green); }
.hl-faces { display: inline-flex; }
.hl-faces .avatar { margin-left: -5px; }
.hl-faces .avatar:first-child { margin-left: 0; }
.hl-text { display: flex; flex-direction: column; line-height: 1.1; font-size: .8em; font-weight: 700; text-align: left; }
.hl-text small { color: var(--green); font-weight: 600; font-size: .9em; }
.dh-chev { color: var(--text-3); flex: none; }

/* шторка каналов на телефоне */
.ch-switch .modal-body { display: flex; flex-direction: column; gap: 12px; }
.cs-srv { display: flex; align-items: center; gap: 12px; }
.cs-srv .gicon { border-radius: 34%; }
.cs-srv-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cs-srv-text b { font-size: 1.05em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-srv-text small { color: var(--text-3); }
.cs-srv-acts { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.cs-srv-list .srv-sec:first-child { margin-top: 0; }
.cs-srv-list .room-grid { grid-template-columns: 1fr 1fr; }

/* ====================== фильтр 18+ ====================== */
.nsfw-block { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 90px; min-width: 160px; padding: 14px; border-radius: 14px;
  background: repeating-linear-gradient(135deg, var(--bg-input) 0 10px, color-mix(in srgb, var(--bg-input) 70%, var(--bg-hover)) 10px 20px); color: var(--text-3); font-size: .85em; font-weight: 600; }
.vn .nsfw-block { width: 100%; height: 100%; border-radius: 50%; min-width: 0; text-align: center; flex-direction: column; }
.nsfw-unsure { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 90px; padding: 14px; border-radius: 14px; background: var(--bg-input); color: var(--text-2); font-size: .85em; font-weight: 600; }
img.nsfw-pending { filter: blur(14px) saturate(.6); transition: filter .25s; } /* пока проверяется — видно размытым, а не пустое место */

/* ====================== жалобы ====================== */
.rep-modal .modal-body { display: flex; flex-direction: column; gap: 12px; }
.rep-preview { padding: 10px; border-radius: 14px; background: var(--bg-input); max-height: 160px; overflow: hidden; }
.rep-reasons { display: grid; gap: 4px; }
.rep-reason { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; border-radius: 12px; background: var(--bg-input); color: var(--text); text-align: left; font-weight: 600; }
.rep-reason .ic { opacity: 0; color: var(--accent-text); }
.rep-reason.on { box-shadow: inset 0 0 0 1.5px var(--accent); }
.rep-reason.on .ic { opacity: 1; }
.rep-note { display: flex; gap: 6px; align-items: flex-start; margin: 0; color: var(--text-3); font-size: .82em; }
.rep-list { display: grid; gap: 12px; margin-top: 14px; }
.rep-card { padding: 14px; border-radius: 18px; background: var(--bg-input); box-shadow: inset 0 0 0 1px var(--line); display: grid; gap: 8px; }
.rep-card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rep-card-head time { margin-left: auto; color: var(--text-3); font-size: .78em; }
.rep-tag { padding: 3px 10px; border-radius: 999px; font-size: .78em; font-weight: 700; background: var(--accent-soft); color: var(--accent-text); }
.rep-tag.r-18, .rep-tag.r-threat { background: color-mix(in srgb, var(--red) 18%, transparent); color: var(--red); }
.rep-ok { display: inline-flex; align-items: center; gap: 3px; color: var(--green); font-size: .75em; font-weight: 700; }
.rep-unk { color: var(--text-3); font-size: .75em; font-weight: 700; }
.rep-who, .rep-note-text { margin: 0; font-size: .9em; }
.rep-note-text { color: var(--text-2); font-style: italic; }
.rep-items { display: grid; gap: 6px; }
.rep-item { padding: 8px 10px; border-radius: 12px; background: var(--bg-2, var(--panel-solid)); }
.rep-item.main { box-shadow: inset 3px 0 0 var(--red); }
.rep-item-head { display: flex; align-items: center; gap: 8px; font-size: .85em; }
.rep-item-head time { color: var(--text-3); font-size: .9em; }
.rep-text { margin-top: 4px; font-size: .92em; overflow-wrap: anywhere; }
.rep-atts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.rep-att { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 10px; background: var(--bg-hover); color: var(--text-2); font-size: .82em; }
.rep-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.av-img img:not([src]) { display: none; }

/* ====================== поддержка и админка ====================== */
.sup-modal .modal-body, .sup-ticket .modal-body { display: flex; flex-direction: column; gap: 12px; }
.sup-hero { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 18px; background: linear-gradient(135deg, var(--accent-soft), transparent), var(--bg-input); flex-wrap: wrap; }
.sup-hero > div { flex: 1; min-width: 180px; }
.sup-hero p { margin: 2px 0 0; color: var(--text-2); font-size: .9em; }
.sup-hero > .ic { color: var(--accent-text); }
.sup-list { display: grid; gap: 6px; }
.sup-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--bg-input); text-align: left; color: var(--text); }
.sup-row:hover { background: var(--bg-hover); }
.sup-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sup-row-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sup-row-text small { color: var(--text-3); }
.sup-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--text-4); }
.sup-dot.s-open { background: var(--yellow); }
.sup-dot.s-answered { background: var(--green); }
.sup-status { font-size: .78em; font-weight: 700; color: var(--text-3); white-space: nowrap; }
.sup-status.s-answered { color: var(--green); }
.sup-status.s-open { color: var(--yellow); }
.sup-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sup-thread { display: flex; flex-direction: column; gap: 8px; max-height: min(52dvh, 460px); min-height: 160px; padding: 4px; }
.sup-msg { max-width: 88%; padding: 10px 12px; border-radius: 16px; background: var(--bg-input); }
.sup-msg.user { align-self: flex-end; background: var(--accent-soft); }
.sup-msg.staff { align-self: flex-start; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--green) 35%, transparent); }
.sup-who { display: flex; gap: 8px; align-items: center; font-size: .8em; margin-bottom: 4px; }
.sup-who time { color: var(--text-3); }
.sup-msg.staff .sup-who b { color: var(--green); display: inline-flex; align-items: center; }
.sup-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.sup-attach { margin-top: 8px; }
.sup-attach summary { cursor: pointer; color: var(--text-2); font-size: .85em; }
.restrict-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 16px; margin-bottom: 14px; background: color-mix(in srgb, var(--red) 10%, var(--bg-input)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--red) 30%, transparent); }
.restrict-card > .ic { color: var(--red); flex: none; }
.restrict-card p { margin: 4px 0 8px; color: var(--text-2); font-size: .9em; }
body > .restrict-offer { background: linear-gradient(135deg, #e5484d, #b4232f); }
.adm-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 12px; }
.adm-stat { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px; border-radius: 16px; background: var(--bg-input); text-align: left; color: var(--text-2); font-size: .85em; }
.adm-stat b { font-size: 1.9em; color: var(--text); line-height: 1.1; }
.adm-stat[onclick], button.adm-stat:hover { background: var(--bg-hover); }
.adm-seg { margin: 10px 0; overflow-x: auto; }
.adm-users { display: grid; gap: 4px; }
.adm-user { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; text-align: left; color: var(--text); }
.adm-user:hover { background: var(--bg-hover); }
.adm-user-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.adm-user-text b { display: flex; align-items: center; gap: 6px; }
.adm-user-text small { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-av { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 34%; background: var(--bg-hover); color: var(--text-2); font-weight: 800; flex: none; }
.adm-av.big { width: 56px; height: 56px; font-size: 1.3em; }
.adm-av.on::after { content: ''; position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 2px var(--panel-solid); }
.adm-modal .modal-body { display: block; }
.adm-card { display: grid; gap: 10px; }
.adm-card h5 { margin: 8px 0 0; color: var(--text-3); text-transform: uppercase; font-size: .72em; letter-spacing: .04em; }
.adm-top { display: flex; align-items: center; gap: 12px; }
.adm-top h3 { margin: 0; }
.adm-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.adm-facts span { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 12px; background: var(--bg-input); color: var(--text-3); font-size: .78em; }
.adm-facts b { color: var(--text); font-size: 1.4em; }
.adm-list { display: grid; gap: 4px; font-size: .88em; }
.adm-list small { color: var(--text-3); }
.audit-row { display: grid; gap: 2px; padding: 8px 10px; border-radius: 12px; background: var(--bg-input); }
.audit-row time { color: var(--text-3); font-size: .78em; }

/* ====================== звонки: кнопки и своя камера ====================== */
/* нажатия без задержки и без двойного касания-«масштаба» на телефоне */
button, [role="button"], .ctl, .inc-btn { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.call-bar .ctl:active { transform: scale(.92); }
.call-bar .ctl.busy { opacity: .65; pointer-events: none; animation: ctl-busy 1s ease-in-out infinite; }
@keyframes ctl-busy { 50% { opacity: .4; } }
/* своя камера на холсте — без отражения */
canvas.self-view { display: block; width: 100%; height: 100%; object-fit: cover; background: #000; }
.call-main canvas.self-view, .call-pip canvas.self-view { position: absolute; inset: 0; }
.cam-preview canvas.self-view { position: absolute; inset: 0; }
video.self-src { position: fixed; left: 0; top: 0; width: 2px; height: 2px; opacity: 0; pointer-events: none; z-index: -1; }
video.mirror { transform: none !important; }
.vnr-circle canvas.vnr-canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.vnr-circle video.vnr-hidden { opacity: 0; }

/* окна поверх нижнего меню, когда «Профиль» открыт вкладкой */
body.profile-tab .modal-back:not(.as-tab) { z-index: 950; }

/* ====================== правки интерфейса ====================== */
/* одна голосовая комната — на всю ширину */
.room-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
/* скрытое сообщение (автомодерация, заблокированный) — аккуратная плашка, а не курсив по ширине */
.note-body .blocked-msg { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 14px; background: var(--bg-input); box-shadow: inset 0 0 0 1px var(--line); font-style: normal; font-size: .82em; color: var(--text-3); text-align: left; }
.msg.own .note-body { align-items: flex-end; }
/* звонки во вкладке «Звонки» */
.call-row .dm-top { display: flex; align-items: baseline; gap: 8px; }
.call-row .dm-top .dm-name { flex: 1; min-width: 0; }
.call-row .dm-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ====================== загрузка: «скелет» интерфейса ====================== */
#splash { display: block; place-content: initial; padding: 0; overflow: hidden; }
.sk-app { position: absolute; inset: 0; display: grid; grid-template-columns: var(--rail-w, 72px) var(--side-w, 280px) minmax(0, 1fr); gap: var(--gap, 8px); padding: var(--gap, 8px) var(--gap, 8px) var(--gap, 8px) 0; }
.sk-app b, .sk-app i, .sk-search, .sk-composer { display: block; border-radius: 10px; background: var(--sk, rgba(255, 255, 255, .06)); position: relative; overflow: hidden; }
[data-theme="light"] .sk-app { --sk: rgba(20, 16, 50, .07); }
.sk-app b::after, .sk-app i::after, .sk-search::after, .sk-composer::after {
  content: ''; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .06), transparent); animation: sk-shine 1.4s ease-in-out infinite; }
@keyframes sk-shine { to { transform: translateX(100%); } }
[data-motion="reduce"] .sk-app ::after { animation: none; }
.sk-rail { display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 6px; }
.sk-rail i { width: 48px; height: 48px; border-radius: 16px; }
.sk-rail .sk-logo { border-radius: 50%; background: color-mix(in srgb, var(--accent) 30%, transparent); }
.sk-side, .sk-main { border-radius: var(--r-lg, 20px); background: var(--panel-solid); display: flex; flex-direction: column; gap: 10px; padding: 14px 12px; min-height: 0; overflow: hidden; }
.sk-head { height: 28px; display: flex; align-items: center; }
.sk-head b { height: 16px; }
.sk-search { height: 36px; border-radius: 12px; }
.sk-row { display: flex; align-items: center; gap: 10px; padding: 4px 2px; }
.sk-row .sk-av { width: 40px; height: 40px; border-radius: 34%; flex: none; }
.sk-row span { flex: 1; display: grid; gap: 7px; }
.sk-row b { height: 10px; }
.sk-msgs { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 10px; max-width: 940px; width: 100%; margin: 0 auto; }
.sk-msg { display: flex; }
.sk-msg.own { justify-content: flex-end; }
.sk-msg b { height: 36px; border-radius: 18px; max-width: 70%; }
.sk-composer { height: 48px; border-radius: 24px; max-width: 968px; width: 100%; margin: 0 auto; flex: none; }
.sk-tabbar { display: none; }
.sk-status { position: absolute; left: 50%; top: calc(14px + var(--safe-t, 0px)); transform: translate(-50%, -8px); margin: 0; padding: 7px 14px; border-radius: 999px; background: var(--bg-float); color: var(--text-2); font-size: .82em; font-weight: 600; box-shadow: var(--shadow-lg); opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; z-index: 2; }
.sk-status.on { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 760px) {
  .sk-app { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; padding: var(--safe-t, 0px) 0 0; gap: 0; }
  .sk-rail, .sk-main { display: none; }
  .sk-side { border-radius: 0; padding: 14px 14px; }
  .sk-head { height: 40px; }
  .sk-row .sk-av { width: 52px; height: 52px; }
  .sk-tabbar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; height: 56px; margin: 0 12px calc(8px + var(--safe-b, 0px)); padding: 6px; border-radius: 30px; background: var(--tg-glass, var(--panel-solid)); }
  .sk-tabbar i { border-radius: 24px; }
}

/* ====================== звонок на компьютере (в духе Discord) ====================== */
#callStage.call-view.desk { height: clamp(260px, 46%, 520px); flex-direction: column; background: #0b0b10; border-bottom: 1px solid var(--line); }
#callStage.call-view.desk.full { height: 100%; flex: 1; border: 0; }
.chat-col.call-full > :not(#callStage) { display: none !important; }
.dc-top { display: flex; align-items: center; gap: 10px; padding: 10px 14px 0; color: rgba(255, 255, 255, .75); font-size: .85em; font-weight: 600; z-index: 2; }
.dc-title { display: inline-flex; align-items: center; gap: 2px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dc-top-tools { display: flex; gap: 2px; }
.dc-tool { color: rgba(255, 255, 255, .7); border-radius: 10px; }
.dc-tool:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.dc-tiles { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; gap: 14px; padding: 12px 18px; flex-wrap: wrap; align-content: center; }
.dc-tile { position: relative; flex: 0 1 auto; width: min(340px, 42%); aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; display: grid; place-items: center;
  background: radial-gradient(120% 120% at 50% 0%, color-mix(in srgb, var(--tile-bg, #333) 55%, #15151c), #101016); cursor: default; transition: box-shadow .15s; --ring-bg: #15151c; }
.dc-tiles.n3 .dc-tile, .dc-tiles.n4 .dc-tile { width: min(300px, 40%); }
.dc-tile.screen { width: min(720px, 70%); }
.call-view.desk.full .dc-tile { width: min(560px, 46%); }
.call-view.desk.full .dc-tile.screen { width: min(1200px, 90%); }
.dc-tile:not([data-uid="0"]) { cursor: pointer; }
.dc-tile.speaking { box-shadow: 0 0 0 3px var(--green), 0 0 24px color-mix(in srgb, var(--green) 35%, transparent); }
.dc-tile .avatar .av-img { border-radius: 50%; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); }
.dc-tile .avatar.speaking .av-img { box-shadow: 0 0 0 3px #15151c, 0 0 0 6px var(--green); }
.dc-tile video, .dc-tile canvas.self-view { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.dc-tile video.contain { object-fit: contain; }
.dc-name { position: absolute; left: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 5px; max-width: calc(100% - 16px); padding: 4px 9px; border-radius: 8px; background: rgba(0, 0, 0, .55); color: #fff; font-size: .8em; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dc-name .ic.red { color: #ff6b78; }
.dc-vol { position: absolute; right: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 8px; background: rgba(0, 0, 0, .55); color: #fff; font-size: .75em; font-weight: 700; opacity: 0; transition: opacity .15s; }
.dc-tile:hover .dc-vol { opacity: 1; }
.dc-bar { display: flex; justify-content: center; align-items: center; gap: 10px; padding: 6px 12px 14px; z-index: 2; }
.dc-bar .ctl { width: 48px; height: 48px; border-radius: 50%; background: rgba(255, 255, 255, .1); color: #fff; }
.dc-bar .ctl:hover { background: rgba(255, 255, 255, .18); }
.dc-bar .ctl.on { background: #fff; color: #111; }
.dc-bar .ctl.off { background: rgba(255, 77, 94, .22); color: #ff8a95; }
.dc-bar .ctl.hang { background: var(--red); width: 64px; border-radius: 24px; }
.dc-bar .ctl.hang:hover { background: var(--red-h); }
.dc-bar .ctl.busy { opacity: .6; }
.ctl-split { display: inline-flex; align-items: center; border-radius: 26px; background: rgba(255, 255, 255, .1); padding-right: 4px; }
.ctl-split:hover { background: rgba(255, 255, 255, .14); }
.ctl-split.off { background: rgba(255, 77, 94, .22); }
.ctl-split .ctl { background: transparent !important; }
.ctl-split .ctl.on { background: #fff !important; }
.ctl-split .ctl-more { width: 22px; height: 30px; border-radius: 10px; color: rgba(255, 255, 255, .7); }
.ctl-split .ctl-more:hover { color: #fff; background: rgba(255, 255, 255, .1); }
/* громкость собеседника */
.vol-pop { display: grid; gap: 12px; width: 270px; padding: 4px; }
.vol-head { display: flex; align-items: center; gap: 10px; }
.vol-head b { display: block; }
.vol-head small { color: var(--text-3); }
.vol-line { display: flex; align-items: center; gap: 10px; color: var(--text-2); }
.vol-range { flex: 1; accent-color: var(--accent); }
.vol-val { min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.vol-val.boost { color: var(--yellow); }
.vol-presets { display: flex; gap: 6px; }
.vol-presets .chip { flex: 1; padding: 6px 0; border-radius: 10px; background: var(--bg-input); color: var(--text-2); font-size: .82em; font-weight: 700; }
.vol-presets .chip:hover { background: var(--bg-hover); color: var(--text); }
.set-row.compact { padding: 4px 0; }
.call-person { cursor: pointer; }
.hk-list { display: grid; gap: 8px; }
.hk-list > div { display: flex; justify-content: space-between; align-items: center; }
.hk-list kbd { padding: 3px 8px; border-radius: 6px; background: var(--bg-input); box-shadow: inset 0 -1px 0 var(--line-2); font: inherit; font-size: .85em; }

/* звонок на компьютере: демонстрация или видео крупно */
#callStage.call-view.desk.focus:not(.full) { height: clamp(380px, 72%, 900px); }
.dc-focus { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 10px 16px 0; }
.dc-focus-main { flex: 1; min-height: 0; display: grid; place-items: center; }
.dc-focus-main .dc-tile { width: 100%; height: 100%; max-width: 100%; aspect-ratio: auto; }
.dc-focus-main .dc-tile.main video { object-fit: contain; }
.dc-strip { flex: none; display: flex; justify-content: center; gap: 10px; height: 96px; }
.dc-strip .dc-tile { width: auto; height: 100%; aspect-ratio: 16 / 9; }
.dc-strip .dc-tile .avatar { --s: 48px !important; width: 48px; height: 48px; }
.dc-strip .dc-name { font-size: .7em; padding: 2px 6px; left: 4px; bottom: 4px; }
.dc-strip .dc-vol, .dc-strip .dc-full { display: none; }
.dc-tile.has-video { cursor: zoom-in; }
.dc-tile.main.has-video { cursor: zoom-out; }
.dc-vol { cursor: pointer; border: 0; }
.dc-full { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 8px; background: rgba(0, 0, 0, .55); color: #fff; opacity: 0; transition: opacity .15s; }
.dc-tile:hover .dc-full { opacity: 1; }
.dc-tile:fullscreen { width: 100vw; height: 100vh; border-radius: 0; background: #000; }
.dc-tile:fullscreen video { object-fit: contain; }

/* голосовой канал на компьютере */
.voice-stage.desk-stage { display: flex; flex-direction: column; flex: 1; min-height: 0; background: #0b0b10; color: #fff; }
.desk-stage .dc-tiles.many .dc-tile { width: min(260px, 30%); }
.desk-stage .dc-empty { flex: 1; display: grid; place-content: center; justify-items: center; gap: 8px; text-align: center; color: rgba(255, 255, 255, .6); padding: 20px; }
.desk-stage .dc-empty h2 { margin: 6px 0 0; color: #fff; }
.desk-stage .dc-empty p { margin: 0; max-width: 360px; }
.dc-join { display: flex; justify-content: center; padding: 8px 12px 18px; }

/* предпросмотр аватара и баннера */
.ip-modal .modal-body { display: grid; gap: 14px; }
.ip-card { width: 100%; }
.ip-banner { height: 120px; }
.ip-sizes { display: flex; align-items: flex-end; gap: 14px; justify-content: center; }

/* звонки: трансляция, подсказки, картинка в картинке */
.vol-stream { display: grid; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.vol-sub { display: flex; align-items: center; gap: 4px; color: var(--text-3); font-weight: 700; }
.ctl-split.live { background: #fff; }
.ctl-split.live .ctl, .ctl-split.live .ctl-more { color: #111; }
.dc-pip { position: absolute; top: 8px; right: 44px; width: 30px; height: 30px; border-radius: 8px; background: rgba(0, 0, 0, .55); color: #fff; opacity: 0; transition: opacity .15s; }
.dc-tile:hover .dc-pip { opacity: 1; }
.dc-strip .dc-pip { display: none; }
.dc-ring { margin-right: 6px; }
.ctl.nudge { animation: ctl-nudge .6s ease-in-out 2; }
@keyframes ctl-nudge { 25% { transform: translateX(-4px); box-shadow: 0 0 0 3px var(--red); } 75% { transform: translateX(4px); } }

@media (max-width: 760px) { body > .update-offer { top: calc(12px + var(--safe-t)); bottom: auto; } }

/* ====================== правки после проверки интерфейса ====================== */
@media (min-width: 761px) { #rail .dock-me { display: none; } }
@media (max-width: 760px) {
  /* шапка списка без полосы — как остальные «капсулы» */
  .side-head { border-bottom: 0; }
  /* удобные для пальца размеры */
  .sec-title { min-height: 34px; }
  .srv-sec .sec-head .icon-btn.tiny, .room .icon-btn.tiny { width: 34px; height: 34px; }
  .srv-title { min-height: 34px; }
  .sp-back { min-height: 40px; padding-right: 12px; }
  .side-cta .link-like, .people-empty .link-like, .page-body .link-like { display: inline-flex; align-items: center; min-height: 36px; }
  /* эмодзи: шторка над полем ввода, не закрывает набранный текст */
  .emoji-picker { height: min(46dvh, 380px) !important; }
  .emoji-picker .ep-preview { display: none; }
  .emoji-picker { grid-template-rows: auto auto 1fr !important; }
}

@media (max-width: 760px) { .popover.above-composer { border-radius: 22px !important; margin: 0 6px; padding-bottom: 0 !important; } }

.popover { max-height: calc(100dvh - 16px); overflow-y: auto; overscroll-behavior: contain; }

/* iOS 26: окно сайта с экрана «Домой» не доходит до низа экрана — нижний отступ не нужен */
:root.ios-short { --safe-b: 0px; }
/* Ошибка WebKit 301108: полосу ниже укороченного окна iOS заливает фоном <html>.
   Красим его в цвет интерфейса — тогда полоса сливается с фоном под нижним меню, а не чернеет. */
@media (max-width: 760px) { :root.ios-pwa:not([data-material="glass"]) { background: var(--panel-solid); } }

.inc-sound { display: flex; align-items: center; gap: 6px; justify-content: center; font-size: 13px; color: var(--text-2); padding: 6px 12px; border-radius: 99px; background: rgba(255,255,255,.08); }

/* ПК: входящий звонок — по центру экрана, фон затемнён */
@media (min-width: 761px) {
  #callLayer:not(:empty) { inset: 0; right: 0; bottom: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .45); animation: fade .2s; }
  #callLayer:empty { display: none; }
  #callLayer .incoming { width: 320px; padding: 30px 22px 24px; }
}

/* звонок в личке: собеседник ещё не ответил */
.call-person.waiting .avatar, .dc-tile.waiting .avatar { position: relative; z-index: 1; animation: dc-breathe 2.4s ease-in-out infinite; }
.dc-tile.waiting .avatar .av-img { filter: saturate(.75) brightness(.9); }
.dc-waves { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.dc-waves i { grid-area: 1 / 1; width: var(--wave, 96px); height: var(--wave, 96px); border-radius: 50%; border: 2px solid color-mix(in srgb, var(--green) 70%, #fff); opacity: 0; animation: dc-wave 2.4s cubic-bezier(.2, .6, .3, 1) infinite; }
.dc-waves i:nth-child(2) { animation-delay: .8s; }
.dc-waves i:nth-child(3) { animation-delay: 1.6s; }
@keyframes dc-wave { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(2.3); opacity: 0; } }
@keyframes dc-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
.dc-wait-label { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; z-index: 2; }
.dc-wait-label .ic { color: var(--green); animation: dc-shake 1.2s ease-in-out infinite; }
.dc-dots i { font-style: normal; animation: dc-dot 1.2s infinite; opacity: .2; }
.dc-dots i:nth-child(2) { animation-delay: .2s; }
.dc-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes dc-dot { 0%, 100% { opacity: .2; } 40% { opacity: 1; } }
@keyframes dc-shake { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(-14deg); } 20%, 40% { transform: rotate(14deg); } }
.dc-tile.waiting .dc-name { opacity: .75; }
@media (prefers-reduced-motion: reduce) { .dc-waves i, .call-person.waiting .avatar, .dc-tile.waiting .avatar, .dc-wait-label .ic, .dc-dots i { animation: none; } .dc-waves i:first-child { opacity: .35; transform: scale(1.4); } }
.call-person.waiting { position: relative; }
/* окно растянули с телефонной ширины до ПК: кнопки свайпа в списке чатов не показываем */
@media (min-width: 761px) { .sw-acts { display: none !important; } .dm-row.swipeable > * { transform: none !important; } }

/* карточка ссылки */
.lp-bar { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 12px; margin: 0 0 6px; border-left: 3px solid var(--accent); border-radius: 10px; background: var(--bg-2); color: var(--text-2); }
.lp-bar > .ic { color: var(--accent); flex: none; }
.lp-bar-text { display: grid; min-width: 0; flex: 1; font-size: 13px; line-height: 1.3; }
.lp-bar-text b { color: var(--accent); font-weight: 600; }
.lp-bar-text span, .lp-bar-text b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lp-bar-img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; flex: none; }
.lp-card { display: grid; gap: 8px; margin-top: 6px; max-width: 420px; padding: 8px 10px 10px 12px; border-left: 3px solid var(--accent); border-radius: 8px; background: color-mix(in srgb, var(--accent) 9%, transparent); color: inherit; text-decoration: none; overflow: hidden; }
.lp-card:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.lp-text { display: grid; gap: 2px; min-width: 0; font-size: .92em; line-height: 1.35; }
.lp-site { color: var(--accent); font-weight: 600; font-size: .92em; }
.lp-title { font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lp-desc { color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.lp-img { position: relative; border-radius: 8px; overflow: hidden; background: var(--bg-3); }
.lp-img img { display: block; width: 100%; max-height: 240px; object-fit: cover; }
.lp-play { position: absolute; inset: 0; display: grid; place-items: center; }
.lp-play .ic { width: 52px; height: 52px; padding: 13px; border-radius: 50%; background: rgba(0, 0, 0, .6); color: #fff; }
.msg.own .lp-card { background: rgba(255, 255, 255, .1); border-left-color: rgba(255, 255, 255, .7); }
.msg.own .lp-site { color: inherit; opacity: .85; }

/* несколько аккаунтов */
.acc-list { display: grid; gap: 6px; }
.acc-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; background: var(--bg-2); }
.acc-row.cur { box-shadow: inset 0 0 0 1.5px var(--accent); }
.acc-text { display: grid; flex: 1; min-width: 0; }
.acc-text b, .acc-text small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-text small { color: var(--text-3); }
.acc-cur { color: var(--accent); display: grid; place-items: center; width: 34px; }
.acc-add { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; color: var(--accent); font-weight: 600; text-align: left; }
.acc-add:hover { background: var(--bg-2); }
.acc-plus { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 16%, transparent); }
.acc-back { display: inline-flex; align-items: center; gap: 4px; margin: 4px 0 8px; }

/* ====================== оформление: стиль имени ====================== */
.nst { --n1: currentColor; --n2: currentColor; }
/* имя с оформлением часто в контейнере с overflow: hidden (многоточие): свечение и края букв
   выходят на пару пикселей — расширяем область обрезки, а текст остаётся на месте */
.nst { padding: 2px 3px; margin: -2px -3px; }
.nfx-grad, .nfx-shimmer { background: linear-gradient(90deg, var(--n1), var(--n2)); -webkit-background-clip: text; background-clip: text; color: transparent !important; -webkit-text-fill-color: transparent; }
.nfx-shimmer { background: linear-gradient(90deg, var(--n1), var(--n2), var(--n1)); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; animation: nst-shimmer 3.2s linear infinite; }
.nfx-glow { text-shadow: 0 0 6px color-mix(in srgb, var(--n1, currentColor) 55%, transparent); }
/* неон: чёткие буквы и узкий ореол (широкий белый слой на мелком тексте превращался в мазню) */
.nfx-neon { text-shadow: 0 0 1px color-mix(in srgb, var(--n1, currentColor) 90%, #fff), 0 0 6px color-mix(in srgb, var(--n1, currentColor) 60%, transparent); animation: nst-neon 2.4s ease-in-out infinite; }
.nfx-shadow { text-shadow: 1px 1px 0 color-mix(in srgb, var(--n2, currentColor) 60%, #000), 2px 2px 0 rgba(0, 0, 0, .35); }
@keyframes nst-shimmer { to { background-position: -200% 0; } }
@keyframes nst-neon { 0%, 100% { opacity: 1; } 50% { opacity: .82; } }

/* ====================== оформление: рамка аватарки ====================== */

/* ====================== оформление: эффект профиля ====================== */
.profile-card.has-pfx { overflow: hidden; isolation: isolate; }
.pfx { position: absolute; inset: 0; pointer-events: none; z-index: 3; overflow: hidden; border-radius: inherit; }
.pfx i { position: absolute; top: -10%; left: var(--x); font-style: normal; font-size: calc(14px * var(--s)); line-height: 1; opacity: 0; animation: pfx-fall var(--t) linear var(--d) infinite; }
.pfx-snow i { color: #fff; text-shadow: 0 0 4px #fff8; }
.pfx-petals i { color: #ffb3c7; }
.pfx-hearts i { color: #ff5ea8; animation-name: pfx-rise; top: auto; bottom: -10%; }
.pfx-stars i { top: calc(var(--x) * .8); color: #ffe07a; animation: pfx-twinkle calc(var(--t) / 2) ease-in-out var(--d) infinite; }
.pfx-bubbles i { top: auto; bottom: -10%; width: calc(14px * var(--s)); height: calc(14px * var(--s)); border-radius: 50%; border: 1.5px solid #fff9; background: radial-gradient(circle at 30% 30%, #fff8, transparent 60%); animation-name: pfx-rise; }
.pfx-confetti i { width: 6px; height: 10px; background: hsl(var(--h) 90% 60%); border-radius: 2px; animation-name: pfx-confetti; }
.pfx-fireflies i { top: calc(30% + var(--x) * .6); width: 6px; height: 6px; border-radius: 50%; background: #fff37a; box-shadow: 0 0 10px 3px #ffe07a88; animation: pfx-firefly var(--t) ease-in-out var(--d) infinite; }
@keyframes pfx-fall { 0% { transform: translateY(0) rotate(0); opacity: 0; } 10% { opacity: .9; } 90% { opacity: .8; } 100% { transform: translateY(560px) rotate(240deg); opacity: 0; } }
@keyframes pfx-rise { 0% { transform: translateY(0) scale(.7); opacity: 0; } 15% { opacity: .9; } 100% { transform: translateY(-560px) scale(1.1); opacity: 0; } }
@keyframes pfx-twinkle { 0%, 100% { opacity: 0; transform: scale(.5); } 50% { opacity: 1; transform: scale(1); } }
@keyframes pfx-confetti { 0% { transform: translateY(0) rotate(0); opacity: 0; } 10% { opacity: 1; } 100% { transform: translateY(560px) rotate(720deg); opacity: .6; } }
@keyframes pfx-firefly { 0%, 100% { transform: translate(0, 0); opacity: .2; } 25% { transform: translate(14px, -10px); opacity: 1; } 50% { transform: translate(-6px, -22px); opacity: .5; } 75% { transform: translate(-16px, -6px); opacity: 1; } }
[data-motion="reduce"] .pfx i, [data-motion="reduce"] .nst { animation: none !important; }
[data-motion="reduce"] .pfx i { opacity: .7; top: calc(var(--x) * .9); }

/* ====================== цветовые темы (градиенты) ====================== */
:root[data-grad]:not([data-theme="light"]) {
  --bg-app: color-mix(in srgb, var(--g1) 60%, #050507);
  --glow-a: color-mix(in srgb, var(--g2) 50%, transparent);
  --glow-b: color-mix(in srgb, var(--g3) 45%, transparent);
  --glow-c: color-mix(in srgb, var(--g2) 25%, transparent);
  --panel: color-mix(in srgb, color-mix(in srgb, var(--g1) 30%, #101016) 84%, transparent);
  --panel-solid: color-mix(in srgb, var(--g1) 30%, #101016);
  --panel-2: color-mix(in srgb, color-mix(in srgb, var(--g1) 30%, #17171f) 92%, transparent);
  --bg-1: color-mix(in srgb, var(--g1) 26%, #0f0f15);
  --bg-2: color-mix(in srgb, var(--g1) 26%, #15151d);
  --bg-3: color-mix(in srgb, var(--g1) 26%, #1f1f29);
  --bg-4: color-mix(in srgb, var(--g1) 26%, #292935);
  --bg-float: color-mix(in srgb, var(--g1) 28%, #16161e);
  --bubble: color-mix(in srgb, var(--g2) 16%, #1f1f2a);
}
:root[data-grad][data-theme="light"] {
  --bg-app: color-mix(in srgb, var(--g2) 22%, #fff);
  --glow-a: color-mix(in srgb, var(--g2) 40%, transparent);
  --glow-b: color-mix(in srgb, var(--g1) 30%, transparent);
  --panel-solid: color-mix(in srgb, var(--g2) 8%, #fff);
  --bg-1: color-mix(in srgb, var(--g2) 8%, #fff);
  --bg-2: color-mix(in srgb, var(--g2) 12%, #f6f6f9);
  --bg-3: color-mix(in srgb, var(--g2) 16%, #ececf2);
  --bg-float: color-mix(in srgb, var(--g2) 8%, #fff);
}
:root[data-grad] body::before { background: radial-gradient(60% 50% at 10% 0%, var(--glow-a), transparent 70%), radial-gradient(60% 55% at 100% 100%, var(--glow-b), transparent 70%), radial-gradient(40% 40% at 80% 10%, var(--glow-c), transparent 70%); }

/* выбор оформления в настройках */
.grad-grid, .icon-grid, .pfx-grid, .nfont-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.grad-opt, .icon-opt, .pfx-opt, .nfont-opt { display: grid; justify-items: center; align-content: start; gap: 6px; padding: 8px 6px; border-radius: 14px; background: var(--bg-2); font-size: 12px; color: var(--text-2); text-align: center; outline: 2px solid transparent; outline-offset: -2px; transition: outline-color .15s; min-width: 0; }
.grad-opt.on, .icon-opt.on, .pfx-opt.on, .nfont-opt.on { outline-color: var(--accent); color: var(--text); }
.grad-opt i { width: 56px; height: 40px; border-radius: 10px; background: linear-gradient(135deg, var(--a), var(--b) 55%, var(--c)); box-shadow: inset 0 0 0 1px var(--line-2); }
.grad-opt.none i { background: repeating-linear-gradient(45deg, var(--bg-3) 0 6px, var(--bg-4) 6px 12px); }
.icon-opt img { width: 44px; height: 44px; border-radius: 12px; }

.pfx-thumb { position: relative; width: 64px; height: 44px; border-radius: 10px; overflow: hidden; background: linear-gradient(160deg, var(--bg-3), var(--bg-4)); }
.pfx-thumb .pfx i { font-size: 9px; }
.nfont-opt b { font-size: 16px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.nst-colors { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.nst-colors input[type="color"] { width: 44px; height: 32px; padding: 0; border: 0; background: none; border-radius: 8px; cursor: pointer; }
.cos-preview { display: flex; align-items: center; gap: 16px; padding: 16px; border-radius: 16px; background: var(--bg-2); margin-bottom: 6px; }
.cos-preview .cp-name { font-size: 18px; font-weight: 700; }
.sp-list { display: grid; gap: 8px; }
.sp-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; background: var(--bg-2); text-align: left; }
.sp-row:hover { background: var(--bg-3); }
.sp-row .sp-text { display: grid; flex: 1; min-width: 0; }
.sp-row .sp-text small { color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chip-row .chip { padding: 7px 14px; border-radius: 99px; background: var(--bg-2); color: var(--text-2); font-size: 13px; font-weight: 600; }
.chip-row .chip.on { background: var(--accent); color: #fff; }
.sub-h.small { margin: 18px 0 8px; font-size: .74em; }
.cos-section { margin-top: 8px; }

.err-row { display: grid; gap: 4px; padding: 10px 12px; border-radius: 12px; background: var(--bg-2); margin-bottom: 8px; }
.err-head { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; }
.err-head b { overflow-wrap: anywhere; }
.err-count { flex: none; font-weight: 700; color: var(--red); }
.err-stack { white-space: pre-wrap; font-size: 11px; max-height: 240px; overflow: auto; background: var(--code-bg); padding: 8px; border-radius: 8px; margin: 4px 0 0; }

/* ======================================================================
   ПАСТЕЛЬ — тема по умолчанию. Светлая и тёмная версии одной палитры:
   кремовый (или сливовый) фон с нежными пятнами розового, голубого и мятного,
   лавандовые свои сообщения, мягкие тени, крупные скругления.
   Работает поверх обоих материалов: «обычный» и «жидкое стекло».
   ====================================================================== */
:root[data-palette="pastel"][data-theme="light"] {
  --bg-app: #fbf5ef;
  --glow-a: rgba(255, 170, 205, .55); --glow-b: rgba(160, 195, 255, .5); --glow-c: rgba(170, 240, 200, .45);
  --panel: rgba(255, 253, 251, .86); --panel-solid: #fffdfb; --panel-2: #faf6fb;
  --bg-1: #faf6f3; --bg-2: #ffffff; --bg-3: #f2edf7; --bg-4: #e7dff1;
  --bg-float: #ffffff; --bg-input: rgba(110, 80, 170, .07); --bg-hover: rgba(110, 80, 170, .06); --bg-active: rgba(110, 80, 170, .11);
  --line: rgba(110, 80, 170, .1); --line-2: rgba(110, 80, 170, .17);
  --text: #2b2540; --text-2: #4d4566; --text-3: #8a7fb0; --text-4: #b4abcc;
  --bubble: #ffffff; --bubble-text: #2b2540; --bubble-edge: rgba(110, 80, 170, .06);
  --mention-bg: rgba(255, 180, 90, .16);
  --code-bg: rgba(110, 80, 170, .07); --scroll: rgba(110, 80, 170, .22);
  --shadow-lg: 0 18px 50px rgba(120, 90, 170, .2), 0 2px 10px rgba(120, 90, 170, .08);
  --shadow-md: 0 8px 26px rgba(120, 90, 170, .15);
  --b-shadow: 0 2px 8px rgba(120, 90, 170, .13);
  --st-offline: #b4abcc;
  --wb-bg: #fdf6ee; --wb1: #ffd9e6; --wb2: #d9e8ff; --wb3: #e3ffe9;
  --wall-o: .24;
  --tg-glass: rgba(255, 253, 251, .8); --tg-line: rgba(110, 80, 170, .08);
}
:root[data-palette="pastel"][data-theme="dark"] {
  --bg-app: #15111d;
  --glow-a: rgba(255, 110, 180, .16); --glow-b: rgba(90, 130, 255, .16); --glow-c: rgba(70, 200, 150, .11);
  --panel: rgba(30, 25, 42, .86); --panel-solid: #1e1929; --panel-2: #241e31;
  --bg-1: #1a1523; --bg-2: #221c2e; --bg-3: #2a2438; --bg-4: #352d46;
  --bg-float: #221c2e; --bg-input: rgba(255, 255, 255, .06); --bg-hover: rgba(255, 255, 255, .05); --bg-active: rgba(255, 255, 255, .09);
  --line: rgba(220, 200, 255, .08); --line-2: rgba(220, 200, 255, .14);
  --text: #f1ecfb; --text-2: #d2c9e8; --text-3: #a99cc9; --text-4: #716790;
  --bubble: #2a2438; --bubble-text: #f1ecfb; --bubble-edge: rgba(255, 255, 255, .04);
  --code-bg: rgba(0, 0, 0, .28); --scroll: rgba(220, 200, 255, .16);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, .5), 0 2px 10px rgba(0, 0, 0, .3);
  --shadow-md: 0 8px 26px rgba(0, 0, 0, .4);
  --b-shadow: 0 2px 10px rgba(0, 0, 0, .28);
  --st-offline: #716790;
  --wb-bg: #17131f; --wb1: #4a2a45; --wb2: #22305a; --wb3: #1f3d34;
  --wall-o: .12;
  --tg-glass: rgba(34, 28, 46, .8); --tg-line: rgba(255, 255, 255, .07);
}
/* фон приложения — те же нежные пятна, что и в фоне чата */
:root[data-palette="pastel"] body::before {
  background: radial-gradient(45% 40% at 8% 6%, var(--glow-a), transparent 70%), radial-gradient(45% 42% at 96% 30%, var(--glow-b), transparent 70%), radial-gradient(50% 42% at 30% 100%, var(--glow-c), transparent 70%);
}
/* свои сообщения: акцент с лёгким переливом, без резкого градиента */
:root[data-palette="pastel"] {
  --grad: linear-gradient(135deg, color-mix(in srgb, var(--accent) 82%, #fff) 0%, var(--accent) 100%);
  --accent-text: color-mix(in srgb, var(--accent) 70%, var(--text));
}
:root[data-palette="pastel"][data-theme="dark"] { --grad: linear-gradient(135deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 80%, #000) 100%); }
[data-palette="pastel"] .bubble { border-radius: 8px 20px 20px 8px; box-shadow: var(--b-shadow); }
[data-palette="pastel"] .msg.start .bubble { border-top-left-radius: 20px; }
[data-palette="pastel"] .msg.own .bubble { border-radius: 20px 8px 8px 20px; box-shadow: 0 3px 12px color-mix(in srgb, var(--accent) 30%, transparent); }
[data-palette="pastel"] .msg.own .bubble:is(.media, .jumbo, .sticker-msg) { box-shadow: none; }
[data-palette="pastel"] .msg.own.start .bubble { border-top-right-radius: 20px; }
[data-palette="pastel"] .bubble.media, [data-palette="pastel"] .bubble.jumbo { box-shadow: none; }
[data-palette="pastel"] .day-div span { background: color-mix(in srgb, var(--bg-float) 88%, transparent); color: var(--text-3); box-shadow: var(--b-shadow); }
[data-palette="pastel"][data-density="compact"] .bubble { box-shadow: none; }

/* жидкое стекло поверх пастели: яркие пастельные пятна под стеклом */
[data-material="glass"][data-palette="pastel"][data-theme="light"] {
  --g-tint: rgba(255, 255, 255, .16); --g-tint-2: rgba(255, 255, 255, .42); --g-float: rgba(255, 255, 255, .58);
  --bubble: rgba(255, 255, 255, .72); --bg-input: rgba(255, 255, 255, .55);
  --panel-solid: #fbf7fb; --bg-float: #fdfaff;
  --scene:
    radial-gradient(42% 38% at 8% 8%, rgba(255, 140, 190, .9), transparent 70%),
    radial-gradient(40% 36% at 96% 18%, rgba(130, 175, 255, .85), transparent 70%),
    radial-gradient(44% 40% at 85% 92%, color-mix(in srgb, var(--accent) 60%, transparent), transparent 70%),
    radial-gradient(42% 38% at 12% 90%, rgba(140, 230, 185, .85), transparent 70%),
    #fbf3ee;
}
[data-material="glass"][data-palette="pastel"][data-theme="dark"] {
  --g-tint: rgba(28, 22, 40, .2); --g-tint-2: rgba(36, 30, 50, .4); --g-float: rgba(34, 28, 48, .56);
  --g-rim-a: rgba(255, 235, 255, .42); --g-rim-c: rgba(255, 235, 255, .18);
  --bubble: rgba(255, 255, 255, .1); --bg-input: rgba(255, 255, 255, .08);
  --panel-solid: #1e1929; --bg-float: #231d30;
  --text-2: rgba(240, 232, 255, .86); --text-3: rgba(240, 232, 255, .64); --text-4: rgba(240, 232, 255, .44);
  --scene:
    radial-gradient(42% 38% at 8% 8%, rgba(255, 110, 180, .62), transparent 70%),
    radial-gradient(40% 36% at 96% 18%, rgba(90, 130, 255, .62), transparent 70%),
    radial-gradient(44% 40% at 85% 92%, color-mix(in srgb, var(--accent) 50%, transparent), transparent 70%),
    radial-gradient(42% 38% at 12% 90%, rgba(70, 200, 150, .4), transparent 70%),
    #120e19;
}

/* ====================== фон чата ====================== */
#main[data-wall] { isolation: isolate; }
.chat-wall { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; border-radius: inherit; --wb-bg: var(--bg-app); --wb1: color-mix(in srgb, var(--accent) 22%, var(--bg-app)); --wb2: color-mix(in srgb, #2aa7ff 16%, var(--bg-app)); --wb3: color-mix(in srgb, #ff7ab0 14%, var(--bg-app)); --wall-o: .14; }
[data-palette="pastel"] .chat-wall { --wb-bg: inherit; --wb1: inherit; --wb2: inherit; --wb3: inherit; --wall-o: inherit; }
.cw-grad { position: absolute; inset: 0; background: radial-gradient(60% 40% at 0% 0%, var(--wb1), transparent 70%), radial-gradient(60% 45% at 100% 30%, var(--wb2), transparent 70%), radial-gradient(70% 45% at 30% 100%, var(--wb3), transparent 70%), var(--wb-bg); }
.chat-wall.solid .cw-grad { background: radial-gradient(80% 60% at 20% 0%, color-mix(in srgb, var(--wc) 70%, #fff), transparent 70%), var(--wc); }
.cw-pat { position: absolute; inset: 0; background: color-mix(in srgb, var(--accent) 70%, var(--text-3)); -webkit-mask-repeat: repeat; mask-repeat: repeat; }
.cw-img { position: absolute; inset: -20px; background: center / cover no-repeat var(--bg-app); }
.cw-dim { position: absolute; inset: 0; background: #000; }
.cw-live { position: absolute; inset: 0; background: var(--wb-bg, var(--bg-app)); }
.cw-live b { position: absolute; width: 70%; height: 45%; border-radius: 50%; filter: blur(40px); opacity: .8; animation: cw-lava 16s ease-in-out infinite alternate; }
[data-theme="dark"] .cw-live b { opacity: .32; }
@keyframes cw-lava { 0% { transform: translate(0, 0) scale(1); } 50% { transform: translate(10%, -8%) scale(1.18); } 100% { transform: translate(-8%, 10%) scale(.92); } }
[data-motion="reduce"] .cw-live b { animation: none; }
/* со стеклом: под чатом видна «сцена», поэтому без сплошного градиента — только узор */
[data-material="glass"] .chat-wall .cw-grad { display: none; }
[data-material="glass"] .chat-wall.solid .cw-grad { display: block; opacity: .55; }
[data-material="glass"] .chat-wall .cw-live { background: transparent; }
/* старые темы: фон чата есть, но сам чат — на панели как раньше */
#main[data-wall]:not([data-wall="none"]) .messages, #main[data-wall]:not([data-wall="none"]) .chat-col { background: transparent; }

/* выбор фона в настройках */
.wall-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.wall-opt { position: relative; height: 150px; border-radius: 16px; overflow: hidden; isolation: isolate; outline: 2.5px solid transparent; outline-offset: 2px; text-align: left; background: var(--bg-app); box-shadow: inset 0 0 0 1px var(--line); }
label.wall-opt { display: block; cursor: pointer; }
.wall-opt.on { outline-color: var(--accent); }
.wall-opt .chat-wall { z-index: -1; }
.wall-opt .mini { position: absolute; left: 8px; right: 8px; bottom: 30px; display: grid; gap: 5px; }
.wall-opt .mini i { height: 13px; border-radius: 8px; box-shadow: var(--b-shadow, none); }
.wall-opt .mini i:first-child { width: 70%; background: var(--bubble); }
.wall-opt .mini i:last-child { width: 56%; justify-self: end; background: var(--grad); }
.wall-opt .wn { position: absolute; left: 0; right: 0; bottom: 0; padding: 5px 8px; font-size: 11.5px; font-weight: 600; color: var(--text); background: color-mix(in srgb, var(--bg-float) 86%, transparent); display: flex; justify-content: space-between; align-items: baseline; gap: 4px; white-space: nowrap; overflow: hidden; }
.wall-opt .wn small { font-size: 10px; }
.wall-opt .wn small { color: var(--text-3); font-weight: 500; }
.wall-opt .wplus { position: absolute; inset: 0 0 26px; display: grid; place-items: center; color: var(--text-3); }
.wall-opt input[type="color"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.theme-opt.t-pastel i { background: linear-gradient(135deg, #ffd9e6, #d9e8ff 55%, #e3ffe9) !important; }
.theme-opt.t-pastel-light i { background: linear-gradient(135deg, #fdf6ee, #ffd9e6) !important; }
.theme-opt.t-pastel-dark i { background: linear-gradient(135deg, #17131f, #4a2a45 60%, #22305a) !important; }
.accent-group { font-size: 12px; color: var(--text-3); margin: 10px 0 6px; }
.theme-hint { display: block; font-size: .85em; color: var(--text-3); }
/* на фоне чата шапка и поле ввода — на подложке, узор не просвечивает сквозь текст */
@media (min-width: 761px) {
  #main[data-wall]:not([data-wall="none"]) > .main-head { background: color-mix(in srgb, var(--bg-float) 86%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
}
#main[data-wall]:not([data-wall="none"]) .composer { background: color-mix(in srgb, var(--bg-float) 92%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
[data-material="glass"] #main[data-wall]:not([data-wall="none"]) .composer { background: var(--g-float, var(--bg-float)); }

/* служебные сообщения (звонки, закрепы, даты) на фоне чата — на заметной подложке */
#main[data-wall]:not([data-wall="none"]) .msg.system .msg-body,
#main[data-wall]:not([data-wall="none"]) .day-div span {
  background: color-mix(in srgb, var(--bg-float) 92%, transparent); color: var(--text-2);
  box-shadow: 0 2px 10px rgba(40, 20, 80, .14), inset 0 0 0 1px var(--line);
  -webkit-backdrop-filter: blur(12px) saturate(1.4); backdrop-filter: blur(12px) saturate(1.4);
}
#main[data-wall]:not([data-wall="none"]) .msg.system time { color: var(--text-3); }
/* на картинке, своём цвете и живых фонах — как в Telegram: тёмная полупрозрачная плашка, белый текст */
#main:is([data-wall="image"], [data-wall="color"], [data-wall="lava"], [data-wall="aurora"]) .msg.system .msg-body,
#main:is([data-wall="image"], [data-wall="color"], [data-wall="lava"], [data-wall="aurora"]) .day-div span {
  background: rgba(20, 14, 32, .5); color: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
}
#main:is([data-wall="image"], [data-wall="color"], [data-wall="lava"], [data-wall="aurora"]) .msg.system time { color: rgba(255, 255, 255, .72); }
#main:is([data-wall="image"], [data-wall="color"], [data-wall="lava"], [data-wall="aurora"]) .msg.system .sys-text b,
#main:is([data-wall="image"], [data-wall="color"], [data-wall="lava"], [data-wall="aurora"]) .msg.system .author { color: #fff; }
#main[data-wall]:not([data-wall="none"]) .msg.system .sys-text,
#main[data-wall]:not([data-wall="none"]) .msg.system .sys-text :not(.ic) { color: inherit !important; }
#main[data-wall]:not([data-wall="none"]) .msg.system .msg-body { font-weight: 500; }

/* ====================== оформление профиля: новый раздел ====================== */
.nst[data-nf="pixel"] { font-size: .74em; letter-spacing: .02em; }
/* пиксельный шрифт чёткий только на размерах, кратных 8 px: 8 в списках, 16 в заголовках */
@supports (font-size: round(down, 1em, 8px)) { .nst[data-nf="pixel"] { font-size: max(8px, round(down, .74em, 8px)); letter-spacing: 0; line-height: 1.5; } }
.nst[data-nf="pixel"].nfx-glow, .nst[data-nf="pixel"].nfx-neon { text-shadow: 0 0 3px color-mix(in srgb, var(--n1, currentColor) 50%, transparent); }
.nst[data-nf="hand"], .nst[data-nf="calli"] { font-size: 1.16em; }
.nst[data-nf="lobster"] { font-weight: 400; }
.cos-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 22px; align-items: start; }
.cos-preview-col { position: sticky; top: 0; display: grid; gap: 12px; }
.cos-card { position: relative; border-radius: 22px; overflow: hidden; background: var(--bg-float); box-shadow: var(--shadow-md), inset 0 0 0 1px var(--line); isolation: isolate; --ring-bg: var(--bg-float); }
.cos-card-banner { height: 92px; }
.cos-card-av { position: absolute; left: 18px; top: 46px; padding: 5px; border-radius: 34%; background: var(--bg-float); }
.cos-card-av .avatar { display: block; }
.cos-card-body { padding: 52px 18px 18px; display: grid; gap: 2px; min-height: 110px; }
.cos-card-name { font-family: var(--display); font-size: 21px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.cos-card-user { color: var(--text-3); font-size: 13.5px; }
.cos-card-status { margin-top: 8px; font-size: 13px; color: var(--text-2); background: var(--bg-2); border-radius: 12px; padding: 7px 10px; }
.cos-actions { display: flex; gap: 8px; }
.cos-actions .btn { flex: 1; }
.cos-controls { display: grid; gap: 14px; min-width: 0; }
.cos-block { background: var(--bg-2); border-radius: 18px; padding: 14px; box-shadow: inset 0 0 0 1px var(--line); }
.cos-bh { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.cos-bh b { font-size: 14px; }
.cos-bh small { color: var(--text-3); font-size: 12px; }
.cos-grid { display: grid; gap: 8px; }
.cos-grid.fonts { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
.cos-grid.fx { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }

.cos-grid.pfxs { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.cos-tile { display: grid; justify-items: center; align-content: center; gap: 6px; min-width: 0; padding: 12px 8px 10px; border-radius: 14px; background: var(--bg-1); color: var(--text-3); font-size: 11.5px; text-align: center; box-shadow: inset 0 0 0 1px var(--line); transition: transform .12s, box-shadow .15s, background .15s; }
.cos-tile:hover { background: var(--bg-3); }
.cos-tile:active { transform: scale(.97); }
.cos-tile.on { box-shadow: inset 0 0 0 2px var(--accent), 0 4px 14px color-mix(in srgb, var(--accent) 25%, transparent); color: var(--text); background: color-mix(in srgb, var(--accent) 8%, var(--bg-1)); }
.ct-sample { font-size: 15px; font-weight: 700; color: var(--text); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.5; padding: 0 2px; }
.cos-tile .avatar { margin: 6px 0 4px; }
.cos-tile .pfx-thumb { width: 100%; height: 56px; border-radius: 10px; }
.cos-colors { display: grid; gap: 10px; }
.cdots { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cdot { position: relative; width: 30px; height: 30px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); display: grid; place-items: center; color: var(--text-3); cursor: pointer; transition: transform .12s; }
.cdot:hover { transform: scale(1.08); }
.cdot.on { box-shadow: 0 0 0 2px var(--bg-2), 0 0 0 4px var(--accent); }
.cdot.pair { background: linear-gradient(135deg, var(--c), var(--c2)); width: 44px; border-radius: 99px; }
.cdot.none { background: var(--bg-1); box-shadow: inset 0 0 0 1.5px var(--line-2); }
.cdot.custom { background: conic-gradient(#ff5e7e, #ffd36b, #7cf08c, #39d0ff, #9a83ff, #ff5ea8, #ff5e7e); color: #fff; }
.cdot.custom.on { background: var(--c); }
.cdot.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.cd-label { font-size: 12px; color: var(--text-3); margin-right: 2px; }
.cd-arrow { color: var(--text-3); }
@media (max-width: 900px) {
  .cos-layout { grid-template-columns: 1fr; }
  .cos-preview-col { position: static; }
}

/* низ колонки: панели звонка и пользователя не шире колонки (раньше вылезали за правый край) */
#sideFoot { grid-template-columns: minmax(0, 1fr); }
#sideFoot > * { min-width: 0; }
#userPanel .me-btn { min-width: 0; flex: 1; }
.vp-buttons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.vp-btn { min-width: 0; padding: 0 8px; }
.vp-btn span, .vp-btn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vp-btn .ic { flex: none; }

/* ====================== приложение для Windows: своя полоса заголовка ====================== */
#appbar { display: none; }
html.desktop-app #appbar { position: fixed; top: 0; left: 0; right: 0; height: 32px; z-index: 4000; display: flex; align-items: center; gap: 8px; padding: 0 150px 0 14px;
  -webkit-app-region: drag; user-select: none; color: var(--text-2); font-size: 12.5px; background: var(--bg-app); }
html.desktop-app #appbar b { font-family: var(--display); font-size: 12px; letter-spacing: .03em; color: var(--text); }
html.desktop-app .ab-title { color: var(--text-3); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
html.desktop-app .ab-title:not(:empty)::before { content: '·'; margin-right: 8px; }
.ab-logo { display: grid; place-items: center; width: 16px; height: 16px; flex: none; color: var(--text); }
.ab-logo svg { width: 16px; height: 16px; }
html.desktop-app #app, html.desktop-app #auth, html.desktop-app #splash { top: 32px; height: calc(var(--vvh, 100dvh) - 32px); }
html.desktop-app #splash { bottom: auto; }
html.desktop-app .modal-back, html.desktop-app #callLayer:not(:empty) { top: 32px; }
html.desktop-app body > .update-offer { top: auto; }

/* панель быстрых действий у пузыря: сбоку на свободном месте, не поверх аватарки и соседних сообщений */
.msg:not(.own) .bubble > .msg-tools { top: 50%; bottom: auto; left: calc(100% + 8px); right: auto; transform: translateY(-50%); white-space: nowrap; }
.msg.own .bubble > .msg-tools { top: 50%; bottom: auto; left: auto; right: calc(100% + 8px); transform: translateY(-50%); white-space: nowrap; }
.msg:not(.own) .bubble > .msg-tools.inside { top: -20px; transform: none; left: auto; right: 6px; }
.msg.own .bubble > .msg-tools.inside { top: -20px; transform: none; right: auto; left: 6px; }
.msg .bubble > .msg-tools { color: var(--text-2); font-size: var(--fs); }

/* ====================== трансляции как в Discord ====================== */
.stream-ph { display: grid; place-items: center; background: radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--tile-bg) 45%, #0b0a12), #0b0a12 75%) !important; cursor: default; }
.stream-ph .sp-in { display: grid; justify-items: center; gap: 8px; padding: 14px; text-align: center; color: #fff; max-width: 92%; }
.stream-ph .sp-in b { font-size: 15px; }
.stream-ph .sp-in small { color: rgba(255, 255, 255, .7); font-size: 12px; line-height: 1.35; }
.stream-ph .sp-btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.stream-ph .btn { gap: 6px; }
.stream-live { position: absolute; top: 8px; left: 8px; display: flex; align-items: center; gap: 6px; z-index: 3; pointer-events: auto; }
.stream-live .live-badge { background: #ed4245; color: #fff; font-size: 10.5px; font-weight: 800; letter-spacing: .04em; padding: 2px 7px; border-radius: 6px; }
.stream-viewers { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 6px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 11.5px; font-weight: 700; }
.stream-stop { position: absolute !important; top: 6px; right: 6px; z-index: 4; width: 30px; height: 30px; border-radius: 10px; background: rgba(0, 0, 0, .55) !important; color: #fff !important; opacity: 0; transition: opacity .15s; }
:is(.dc-tile, .tile):hover .stream-stop, .tile .stream-stop { opacity: 1; }
.call-main > .stream-ph { position: absolute; inset: 0; border-radius: 0; }

/* кружок: кнопка смены камеры под кругом */
.vnr-flip { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); width: 52px; height: 52px; border-radius: 50%; background: rgba(0, 0, 0, .55) !important; color: #fff !important; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); z-index: 5; pointer-events: auto; }
.vnr-flip.busy { opacity: .6; }
.vnr-flip .ic { transition: transform .3s; }
.vnr-layer.back-cam .vnr-flip .ic { transform: rotate(180deg); }

/* панель трансляции (как в Discord): громкость звука трансляции и выход из неё */
.stream-bar { position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 4; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; border-radius: 14px;
  background: rgba(10, 8, 18, .62); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); color: #fff; opacity: 0; transform: translateY(4px); transition: opacity .15s, transform .15s; }
:is(.dc-tile, .tile):hover .stream-bar, .stream-bar:focus-within, .tile .stream-bar { opacity: 1; transform: none; }
.sb-vol { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; max-width: 260px; }
.sb-vol .sb-mute { color: #fff !important; flex: none; }
.stream-bar.muted .sb-range { opacity: .4; }
.sb-range { flex: 1; min-width: 60px; }
.sb-val { font-size: 12px; min-width: 38px; text-align: right; }
.sb-val.boost { color: #ffbf3c; }
.sb-leave { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 10px; background: #ed4245; color: #fff; font-size: 12.5px; font-weight: 700; white-space: nowrap; flex: none; }
.sb-leave:hover { background: #c8383b; }
@media (max-width: 760px) { .sb-leave span { display: none; } .sb-leave { padding: 7px; } }

/* скачать приложение */
.dl-list { display: grid; gap: 10px; margin-top: 12px; }
.dl-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); }
.dl-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); flex: none; }
.dl-text { display: grid; gap: 2px; flex: 1; min-width: 0; }
.dl-text small { color: var(--text-3); }
.dl-card .btn { gap: 6px; flex: none; text-decoration: none; }
.dl-soon { color: var(--text-3); font-size: 12.5px; font-weight: 600; flex: none; }

/* ====================== экономия видеокарты ======================
   Как в Discord: украшения (рамки, эффекты имени) двигаются только при наведении и в карточке профиля;
   когда окно Drippy не в фокусе (игра, другая программа) — все анимации на паузе. */
.nst { animation-play-state: paused; }
.msg:hover .nst, .mem-row:hover .nst, .nst:hover, .profile-card .nst, .cos-section .nst, .sp-hero .nst { animation-play-state: running; }
html.app-bg *, html.app-bg *::before, html.app-bg *::after { animation-play-state: paused !important; transition: none !important; }

/* ====================== рамки аватарок: тонкая обводка + свечение ======================
   Контур повторяет форму аватарки (скруглённый квадрат или круг), под ним — мягкое свечение
   цвета рамки. Без вращения и размытия краёв: ровно на любом размере и не грузит видеокарту. */
.avatar { --av-r: 34%; }
.dc-tile .avatar, .tg-ava .avatar, .tg-ava { --av-r: 50%; }

/* у «звёзд», «сердечек» и «ушек» украшения остаются поверх контура */

/* нимб — над головой, без контура; только мягкое свечение */

/* звонок: говорящего показывает только контур плитки — аватарка без кольца и свечения */
.dc-tile.speaking { box-shadow: 0 0 0 3px var(--green) !important; }
.dc-tile .avatar.speaking .av-img, .tile .avatar.speaking .av-img, .call-person .avatar.speaking .av-img { box-shadow: 0 10px 30px rgba(0, 0, 0, .45) !important; }
.dc-tile .avatar.speaking, .tile .avatar.speaking { animation: none !important; }

/* уведомления на ПК: справа сверху, выезжают справа (под полосой заголовка в приложении) */
@media (min-width: 761px) {
  .inapp { left: auto; right: 16px; top: 16px; width: 360px; transform: translateX(calc(100% + 40px)); opacity: 0;
    transition: transform .38s cubic-bezier(.2, .9, .25, 1.05), opacity .25s ease; padding: 12px 14px 12px 12px; border-radius: 18px;
    background: color-mix(in srgb, var(--bg-float) 94%, transparent); backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3);
    box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--line), inset 3px 0 0 var(--accent); }
  .inapp.in { transform: translateX(0); opacity: 1; }
  .inapp:hover { transform: translateX(-4px); }
  html.desktop-app .inapp { top: 44px; }
}

/* рамка ровная на любом размере: отступ и толщина в целых пикселях, скругление строго концентрично аватарке */
.avatar { --av-k: .34; }
.dc-tile .avatar, .tg-ava .avatar, .tg-ava { --av-k: .5; }

/* стопка уведомлений на ПК: справа сверху, новые сверху, до трёх */
#inappStack { position: fixed; z-index: 1200; top: 16px; right: 16px; width: 360px; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
html.desktop-app #inappStack { top: 44px; }
#inappStack .inapp { position: relative; left: auto; right: auto; top: auto; width: 100%; pointer-events: auto;
  transition: transform .38s cubic-bezier(.2, .9, .25, 1.05), opacity .25s ease, translate .32s cubic-bezier(.2, .9, .25, 1); }
@media (max-width: 760px) { #inappStack { display: none; } }

/* уведомления: чистый тёмный фон, без цветной полоски и полупрозрачности */
@media (min-width: 761px) {
  .inapp, #inappStack .inapp { background: #1a1722 !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(255, 255, 255, .06) !important; color: #f1ecfb; --ring-bg: #1a1722; }
  .inapp .inapp-text span { color: #b9b1cf; }
}

/* карточка профиля: у аватарки 5px подложки — рамка обводит саму картинку, а не подложку, и не налезает на ник */

/* шапка сервера: длинное название не растягивает карточку — обрезается многоточием, кнопки всегда влезают */
.srv-hero-in { grid-template-columns: minmax(0, 1fr); }
.srv-acts { grid-auto-columns: minmax(0, 1fr); }
.srv-act span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* плашка «Включите уведомления» не перекрывает меню, шторки и окна — прячется, пока они открыты */
body:has(.modal-back, .menu-back, .menu, .popover, .mf-layer, .incoming) > .notif-offer { visibility: hidden; }

/* фон чата: ползунки не прилипают к сетке плиток */
.wall-grid + .field, .wall-grid ~ .field { margin-top: 14px; }
.mic-test { margin-bottom: 12px; }

/* громкость собеседника: нормальные поля, значение не прилипает к краю */
.vol-pop { width: 296px; padding: 14px; gap: 12px; box-sizing: border-box; }
.vol-line { display: flex; align-items: center; gap: 10px; }
.vol-line .vol-range { flex: 1; min-width: 0; }
.vol-pop .set-row.compact { padding: 2px 0; border: 0; }
.vol-pop > .btn { justify-self: stretch; justify-content: center; }

/* «ушки»: стоят на верхнем крае рамки, а не на лице */

/* iOS 26 (WebKit 301108): с высотой 100vh у <html> окно приложения с экрана «Домой» получает полную высоту экрана */
:root.ios-pwa { height: 100vh; }
/* полоса под укороченным окном — в цвет фона и при «жидком стекле» */
@media (max-width: 760px) { :root.ios-pwa[data-material="glass"] { background: var(--bg-app); } }

/* GIF и эмодзи на телефоне: ручка сверху — шторку можно смахнуть вниз */
@media (max-width: 760px) {

  .popover.pick-sheet::before { content: ''; display: block; width: 40px; height: 5px; margin: 8px auto 2px; border-radius: 3px; background: var(--line-2); }
}

/* каналы: значок в списке и кнопка звука вместо поля ввода у подписчиков */
.dm-kind { flex: none; color: var(--text-3); margin-right: -2px; }
.composer.chan-bar { justify-content: center; padding: 6px; min-height: 0; }
.chan-mute { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 10px 14px; border-radius: 14px; color: var(--accent-text); font-weight: 700; }
.chan-mute:hover { background: var(--bg-hover); }

/* папки чатов на телефоне компактнее: пять вкладок помещаются в ширину экрана */
@media (max-width: 760px) { .folders { gap: 5px; } .folder { padding: 0 11px; font-size: .8em; gap: 5px; } }

/* плитки звонка: аватарка всегда квадратная (проценты давали овал — ширина и высота считались от разных сторон) */
.tile .avatar { --s: clamp(48px, 22vmin, 96px) !important; width: var(--s); height: var(--s); }

/* «Нет связи» на телефоне — плашка над нижним меню, а не у статус-бара (iOS перекрашивал статус-бар в жёлтый) */
@media (max-width: 760px) {
  #conn { top: auto; bottom: calc(92px + var(--safe-b)); left: 12px; right: 12px; padding: 9px 14px; border-radius: 16px; box-shadow: var(--shadow-lg); font-size: .82em; }
}

/* лента «в сети»: место сверху и по бокам, чтобы рамки и украшения не обрезались */
.online-strip { padding: 10px 12px 6px; margin: -6px -12px 4px; gap: 8px; }

/* «ушки» одного цвета с рамкой и сливаются с ней: без светлой каймы на стыке */

/* ====================== минимализм: ушки и значок «в сети» ======================
   Ушки — мягкая форма (SVG-маска) того же сплошного цвета, что и рамка, и уходят под её линию,
   поэтому рамка и ушки читаются как одна фигура. Значок статуса меньше, с тонкой каймой. */

.status-dot { width: max(9px, calc(var(--s) * .24)); height: max(9px, calc(var(--s) * .24)); border-width: max(2px, calc(var(--s) * .045)); right: calc(var(--s) * -.02); bottom: calc(var(--s) * -.02); }
.status-dot.offline { box-shadow: inset 0 0 0 max(1.5px, calc(var(--s) * .04)) var(--st-offline); }
.pc-avatar .status-dot { right: 3px; bottom: 3px; }

/* звёзды и сердечки: два аккуратных элемента вместо россыпи */

/* ====================== украшения аватарки: SVG-иллюстрации поверх ====================== */

/* у карточки профиля 5px подложки вокруг картинки */

/* ====================== вход и регистрация (v2): разворот на ПК, афиша + шторка на телефоне ====================== */
#auth.v2 { display: block; padding: 0; overflow: hidden auto; background: #0b0a11; color: #ecebf5; --af-line: rgba(255, 255, 255, .16); }
#auth.v2[hidden] { display: none; }
#auth.v2 .auth-split { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
#auth.v2 .auth-hero { display: flex; flex-direction: column; justify-content: space-between; gap: 24px; padding: 48px 56px; border-right: 1px solid rgba(255, 255, 255, .07); }
#auth.v2 .ah-brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 1.05em; }
#auth.v2 .ah-big { margin: 0; font-family: var(--display); font-weight: 800; font-size: clamp(40px, 5.4vw, 76px); line-height: 1.02; letter-spacing: -.01em; }
#auth.v2 .ah-big em { font-style: normal; color: var(--accent); }
#auth.v2 .ah-phone { display: none; }
#auth.v2 .ah-note { margin: 0; max-width: 340px; color: #77748c; font-size: .9em; line-height: 1.5; }
#auth.v2 .aw-btns { display: none; }
#auth.v2 .auth-panel { display: grid; place-items: center; padding: 48px 40px; }
#auth.v2 .af { width: min(360px, 100%); display: grid; gap: 4px; background: none; box-shadow: none; padding: 0; animation: fade .3s; }
#auth.v2 .af-top { display: none; }
#auth.v2 .af h2 { margin: 0; font-family: var(--display); font-size: 1.6em; font-weight: 800; }
#auth.v2 .af-sub { margin: 2px 0 22px; color: #77748c; font-size: .9em; }
#auth.v2 .af-sub:empty { display: none; }
#auth.v2 .field { display: grid; gap: 2px; margin: 0 0 18px; }
#auth.v2 .field > span { font-size: .78em; font-weight: 600; color: #8d8aa3; text-transform: none; letter-spacing: 0; }
#auth.v2 .af-in { position: relative; display: flex; align-items: center; gap: 6px; border-bottom: 1.5px solid var(--af-line); transition: border-color .15s; }
#auth.v2 .af-in:focus-within { border-color: var(--accent); }
#auth.v2 .field.bad .af-in { border-color: var(--red); }
#auth.v2 .af-in > b { color: #55526a; font-weight: 500; font-size: 1.05em; }
#auth.v2 .field input { height: 42px; flex: 1; min-width: 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none !important; font-size: 1.02em; color: inherit; outline: none; }
#auth.v2 #server { border-bottom: 1.5px solid var(--af-line); }
#auth.v2 .pw-eye { position: static; color: #77748c; }
#auth.v2 .field em { min-height: 0; font-style: normal; font-size: .8em; color: var(--red); }
#auth.v2 .field em:empty { display: none; }
#auth.v2 .pw-meter { margin: -12px 0 16px; }
#auth.v2 .auth-note { margin: 0 0 14px; padding: 0; background: none; color: #a99a6a; font-size: .82em; }
#auth.v2 .auth-error { min-height: 0; margin: 0 0 10px; text-align: left; }
#auth.v2 .auth-error:empty { display: none; }
#auth.v2 #authBtn { height: 46px; border-radius: 12px; margin-top: 6px; font-size: 1em; }
#auth.v2 .auth-switch { margin: 14px 0 0; text-align: left; color: #77748c; font-size: .88em; }
#auth.v2 .auth-switch .linkish { color: #b9a8ff; font-weight: 600; }
#auth.v2 .auth-dl { margin-top: 18px; }

@media (max-width: 760px) {
  #auth.v2 .auth-split { grid-template-columns: minmax(0, 1fr); min-height: var(--vvh, 100dvh); grid-template-rows: 1fr auto; }
  #auth.v2 .auth-hero { border: 0; padding: calc(28px + var(--safe-t)) 24px 0; justify-content: center; transition: opacity .25s, transform .25s; }
  #auth.v2 .ah-desk, #auth.v2 .ah-note { display: none; }
  #auth.v2 .ah-phone { display: inline; }
  #auth.v2 .ah-big { font-size: 46px; }
  #auth.v2 .ah-brand span { display: none; }
  #auth.v2[data-step="welcome"] .ah-note { display: block; margin-top: -8px; }
  #auth.v2[data-step="welcome"] .aw-btns { display: grid; gap: 10px; margin-top: auto; padding-bottom: calc(22px + var(--safe-b)); }
  #auth.v2[data-step="welcome"] .auth-hero { justify-content: flex-start; }
  #auth.v2[data-step="welcome"] .ah-brand { margin-top: auto; }
  #auth.v2 .aw-btns .btn { height: 52px; border-radius: 14px; font-size: 1em; }
  #auth.v2 .aw-login { background: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16); color: inherit; }
  #auth.v2[data-step="welcome"] .auth-panel { display: none; }
  /* форма — шторка снизу, фраза приглушена сверху */
  #auth.v2[data-step="form"] .auth-hero { opacity: .5; justify-content: flex-start; padding-bottom: 20px; }
  #auth.v2[data-step="form"] .ah-big { font-size: 30px; }
  #auth.v2[data-step="form"] .ah-big br:nth-of-type(1) { display: none; }
  #auth.v2 .auth-panel { place-items: stretch; padding: 0; }
  #auth.v2 .af { width: auto; background: #17161f; border-radius: 24px 24px 0 0; padding: 12px 20px calc(20px + var(--safe-b)); animation: sheet .28s var(--ease); }
  #auth.v2 .af::before { content: ''; display: block; width: 36px; height: 4px; border-radius: 2px; background: #2f2d3d; margin: 0 auto 10px; }
  #auth.v2 .af-top { display: flex; align-items: center; justify-content: space-between; margin: 0 0 12px; }
  #auth.v2 .af-back { display: inline-flex; align-items: center; gap: 4px; margin-left: -6px; padding: 4px 6px; border-radius: 8px; color: #8d8aa3; font-size: .85em; }
  #auth.v2 .af-dots { display: flex; gap: 5px; }
  #auth.v2 .af-dots i { width: 16px; height: 3px; border-radius: 2px; background: #2a2838; }
  #auth.v2 .af-dots i.on { background: var(--accent); }
  #auth.v2 .af h2 { font-size: 1.35em; }
  #auth.v2 .af-sub { margin: 2px 0 14px; }
  #auth.v2 .field > span { display: none; }
  #auth.v2 .field input { height: 46px; font-size: 1.15em; }
  #auth.v2 .af-in { border-bottom-color: var(--accent); }
  /* показываем только поле текущего шага */
  #auth.v2 [data-fs] { display: none !important; }
  #auth.v2[data-fs="0"] [data-fs="0"]:not([hidden]), #auth.v2[data-fs="1"] [data-fs="1"]:not([hidden]), #auth.v2[data-fs="2"] [data-fs="2"]:not([hidden]) { display: grid !important; }
  #auth.v2[data-fs="1"] .pw-meter[data-fs="1"]:not([hidden]) { display: block !important; margin: -12px 0 14px; }
  #auth.v2 .auth-note { display: none; }
  #auth.v2[data-mode="register"][data-fs="2"] .auth-note:not([hidden]) { display: block; }
  #auth.v2 .auth-switch { text-align: center; margin-top: 12px; }
  #auth.v2[data-fs="1"] .auth-switch, #auth.v2[data-fs="2"] .auth-switch { display: none; }
  #auth.v2 #authBtn { height: 52px; border-radius: 14px; }
  #auth.v2 .auth-dl { display: none; }
}

/* вкладка «Профиль» на телефоне: нижнее меню не перекрывает окна поверх (подтверждение выхода и др.) */
body.profile-tab:has(.modal-back:not(.as-tab)) > #tabbar, body.profile-tab:has(.menu-back) > #tabbar { visibility: hidden; }
/* шторка входа на телефоне — на всю ширину */
#auth.v2 .auth-split { width: 100%; }

/* QR-коды приглашений */
.qr-box { position: relative; width: var(--qs); height: var(--qs); padding: 12px; border-radius: 18px; background: #fff; box-sizing: content-box; }
.qr-box > svg { display: block; width: 100%; height: 100%; }
.qr-box > svg rect, .qr-box > svg path { shape-rendering: crispEdges; }
.qr-logo { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: #fff; box-shadow: 0 0 0 3px #fff; }
.inv-qr { display: grid; justify-items: center; gap: 8px; margin-top: 14px; }
.inv-qr:empty { display: none; }
.inv-qr small { text-align: center; }

/* QR-коды приглашений */
.qr-box { position: relative; width: var(--qs); height: var(--qs); padding: 12px; border-radius: 18px; background: #fff; box-sizing: content-box; }
.qr-box > svg { display: block; width: 100%; height: 100%; }
.qr-logo { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: #fff; }
.inv-qr { display: grid; justify-items: center; gap: 8px; margin-top: 14px; }
.inv-qr:empty { display: none; }
.inv-qr small { text-align: center; }
.qr-me { display: grid; justify-items: center; gap: 4px; padding: 6px 0 4px; }
.qr-me .qr-box { margin-top: 14px; }

/* поиск по сообщениям */
.gs-results { display: grid; gap: 2px; margin-top: 6px; }
.gs-head { display: flex; justify-content: space-between; align-items: baseline; }
.gs-head small { color: var(--text-3); font-weight: 500; text-transform: none; letter-spacing: 0; }
.gs-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; text-align: left; width: 100%; }
.gs-row:hover { background: var(--bg-hover); }
.gs-text { display: grid; gap: 1px; min-width: 0; }
.gs-top { display: flex; justify-content: space-between; gap: 8px; }
.gs-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92em; }
.gs-top time { flex: none; color: var(--text-3); font-size: .78em; }
.gs-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); font-size: .86em; }
.gs-sub i { font-style: normal; color: var(--text-3); }
.gs-sub mark { background: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--text); border-radius: 3px; padding: 0 1px; }
.gs-modal-list { max-height: min(60vh, 520px); margin-top: 10px; }

/* онбординг: пустой список и подсказки на месте */
.side-cta.first-steps { gap: 8px; padding: 48px 24px; }
.side-cta.first-steps b { color: var(--text); font-size: 1.05em; margin-top: 6px; }
.side-cta.first-steps p { margin: 0 0 10px; }
.side-cta.first-steps .btn { width: min(260px, 100%); }
.coach { position: fixed; inset: 0; z-index: 1600; pointer-events: none; }
.coach-ring { position: fixed; border-radius: 14px; box-shadow: 0 0 0 2.5px var(--accent), 0 0 0 9999px rgba(4, 4, 10, .5); transition: all .25s var(--ease); }
.coach-tip { position: fixed; pointer-events: auto; padding: 12px 14px 10px; border-radius: 16px; background: var(--accent); color: #fff; box-shadow: 0 12px 34px color-mix(in srgb, var(--accent) 40%, transparent); animation: rise .25s var(--ease); }
.coach-tip p { margin: 0 0 8px; font-size: .9em; line-height: 1.4; font-weight: 600; }
.coach-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.coach-skip { color: rgba(255, 255, 255, .7); font-size: .8em; }
.coach-next { padding: 6px 12px; border-radius: 10px; background: rgba(255, 255, 255, .2); color: #fff; font-size: .82em; font-weight: 700; }

/* ====================== ветки ====================== */
.th-chip { display: flex; align-items: center; gap: 8px; max-width: min(460px, 100%); margin-top: 6px; padding: 7px 12px; border-radius: 12px; background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); text-align: left; font-size: .86em; }
.th-chip:hover { background: var(--bg-3); }
.th-chip .ic { flex: none; color: var(--accent-text); }
.th-chip b { flex: none; color: var(--text); }
.th-chip span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); }
.th-chip .th-n { flex: none; margin-left: auto; padding: 0 7px; border-radius: 99px; background: var(--accent); color: #fff; font-style: normal; font-size: .82em; font-weight: 700; }
.th-pop { width: 320px; max-width: calc(100vw - 24px); padding: 10px; display: grid; gap: 2px; }
.th-head { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 8px; }
.th-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; text-align: left; width: 100%; }
.th-row:hover { background: var(--bg-hover); }
.th-row.arch { opacity: .6; }
.th-text { display: grid; min-width: 0; flex: 1; }
.th-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th-text small { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th-sec { padding: 10px 6px 4px; color: var(--text-3); font-size: .72em; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.th-empty { padding: 4px 6px 8px; margin: 0; }
.ch-row.thread-row { padding-left: 30px; min-height: 30px; font-size: .92em; }
.ch-row.thread-row .th-branch { position: absolute; left: 16px; top: -2px; width: 10px; height: 18px; border-left: 1.5px solid var(--line-2); border-bottom: 1.5px solid var(--line-2); border-bottom-left-radius: 8px; }
.ch-row.thread-row { position: relative; }
.head-crumb { display: inline-flex; align-items: center; gap: 4px; color: var(--text-3); font-weight: 600; }
.head-crumb:hover { color: var(--text); }
.head-sep { color: var(--text-4); margin: 0 2px; }
.head-tag { margin-left: 6px; padding: 1px 8px; border-radius: 99px; background: var(--bg-3); color: var(--text-3); font-size: .75em; font-weight: 700; }
.icon-btn.dot { position: relative; }
.icon-btn.dot::after { content: ''; position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

/* журнал аудита и мероприятия */
.au-list { display: grid; gap: 2px; margin-top: 10px; }
.au-row { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 10px; align-items: center; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.au-ic { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--bg-3); color: var(--text-3); }
.au-text { display: grid; min-width: 0; font-size: .9em; }
.au-text small { color: var(--text-3); }
.ev-list { display: grid; gap: 10px; }
.ev-card { padding: 14px; border-radius: 16px; background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); display: grid; gap: 6px; }
.ev-card.live { box-shadow: inset 0 0 0 1.5px var(--green); }
.ev-time { display: flex; align-items: center; gap: 6px; color: var(--accent-text); font-size: .82em; font-weight: 700; text-transform: capitalize; }
.ev-name { font-size: 1.05em; }
.ev-desc { margin: 0; color: var(--text-2); font-size: .9em; white-space: pre-wrap; }
.ev-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.ev-foot .grow { flex: 1; }
.ev-room { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); font-size: .85em; }
.nav-row.ev-side { margin: 2px 0 6px; }
.nav-row.ev-side.live { color: var(--green); }
#side .nav-row.ev-side { margin: 0 0 8px; padding: 9px 12px; border-radius: 12px; background: var(--bg-2); font-size: .9em; font-weight: 600; }

/* упоминания, заметки, ссылки с текстом */
.ib-pop { width: 380px; max-width: calc(100vw - 24px); max-height: min(70vh, 560px); overflow-y: auto; padding: 10px; display: grid; gap: 2px; align-content: start; }
.ib-pop .gs-row.new .gs-top b::after { content: ''; display: inline-block; width: 7px; height: 7px; margin-left: 6px; border-radius: 50%; background: var(--accent); vertical-align: middle; }
.pc-note { width: 100%; min-height: 36px; resize: none; border: 0; border-radius: 8px; padding: 6px 8px; background: transparent; color: var(--text-2); font: inherit; font-size: .88em; }
.pc-note:hover, .pc-note:focus { background: var(--bg-input); outline: none; }
.pc-sec h4 { margin: 0 0 4px; font-size: .72em; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); }
a.link.masked { text-decoration: none; border-bottom: 1px solid currentColor; }

/* свои эмодзи */
img.cemoji { width: 1.375em; height: 1.375em; object-fit: contain; vertical-align: -.3em; margin: 0 .05em; }
.msg-text.jumbo img.cemoji { width: 3em; height: 3em; }
.ep-cell img.cemoji { width: 28px; height: 28px; margin: 0; }
.ep-big.cemoji { width: 40px; height: 40px; }
.r-emoji img.cemoji { width: 18px; height: 18px; vertical-align: -4px; }
.emo-grid { display: grid; gap: 6px; margin-top: 14px; }
.emo-row { display: flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 12px; background: var(--bg-2); }
.emo-row img { width: 32px; height: 32px; object-fit: contain; margin-right: 8px; }
.emo-row input { flex: 1; min-width: 0; height: 32px; padding: 0 6px; border: 0; background: transparent; color: inherit; font: inherit; }
.emo-row input:focus { background: var(--bg-input); border-radius: 8px; outline: none; }
.emo-colon { color: var(--text-3); }
.vc-chat-btn { gap: 6px; }
.vc-chat-btn .badge { margin-left: 2px; }
/* «Играет в …» */
.mem-act { color: var(--green) !important; font-weight: 600; }
.act-card { display: flex; gap: 10px; align-items: center; margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--bg-2); }
.act-card .act-ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--green) 18%, var(--bg-3)); color: var(--green); flex: none; }
.act-card > div { display: grid; min-width: 0; }
.act-card small { color: var(--text-3); font-size: .72em; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.act-card b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-card span { color: var(--text-3); font-size: .8em; }

/* папки серверов */
.srv-fwrap { display: grid; justify-items: center; gap: 8px; border-radius: 18px; }
.srv-fwrap.open { background: color-mix(in srgb, var(--fc) 16%, transparent); padding-bottom: 8px; }
.srv-ic.srv-folder { background: color-mix(in srgb, var(--fc) 28%, var(--bg-2)); border-radius: 16px; }
.sf-mini { display: grid; grid-template-columns: repeat(2, 20px); gap: 2px; padding: 2px; }
.sf-mini .gicon { border-radius: 6px !important; font-size: 8px; }
.sf-open { color: var(--fc); display: grid; place-items: center; }
.srv-ic.srv-folder { width: 48px; height: 48px; display: grid; place-items: center; padding: 0; overflow: visible; }
.srv-fwrap { width: 56px; }
.sf-mini { grid-template-columns: repeat(2, 18px); grid-auto-rows: 18px; gap: 3px; padding: 0; }
.sf-mini .gicon { width: 18px !important; height: 18px !important; font-size: 7px !important; border-radius: 6px !important; }
.srv-fwrap.open .srv-ic:not(.srv-folder) .gicon { border-radius: 16px; }
#rail .srv-ic.srv-folder { width: var(--rail-w); height: auto; background: none; border-radius: 0; }
.sf-mini, .sf-open { width: 48px; height: 48px; border-radius: 16px; background: color-mix(in srgb, var(--fc) 30%, var(--bg-2)); display: grid; place-content: center; }
.srv-fwrap, .srv-fwrap.open { position: relative; width: var(--rail-w); background: none; padding: 0; }
.srv-fwrap.open::before { content: ''; position: absolute; left: 50%; top: 0; bottom: -4px; width: 56px; transform: translateX(-50%); border-radius: 18px; background: color-mix(in srgb, var(--fc) 16%, transparent); z-index: -1; }
.srv-fwrap.open { padding-bottom: 4px; isolation: isolate; }

/* звуковая панель */
.sb-pop { width: 320px; max-width: calc(100vw - 24px); padding: 10px; }
.sb-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.sb-btn { display: flex; align-items: center; gap: 8px; padding: 10px; border-radius: 12px; background: var(--bg-2); text-align: left; font-size: .88em; font-weight: 600; }
.sb-btn:hover { background: var(--bg-3); }
.sb-btn:active { transform: scale(.97); }
.sb-e { font-size: 1.3em; }
@keyframes sb-hit { 0% { box-shadow: 0 0 0 0 var(--accent); } 100% { box-shadow: 0 0 0 10px transparent; } }
.sb-hit { animation: sb-hit .6s ease-out; }

/* форум */
.fm-wrap { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 22px 30px; display: grid; gap: 12px; align-content: start; }
.fm-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fm-search { flex: 1; min-width: 160px; height: 38px; padding: 0 12px; border: 0; border-radius: 10px; background: var(--bg-input); color: inherit; font: inherit; }
.fm-bar .select { width: auto; }
.fm-guide { padding: 12px 14px; border-radius: 12px; background: var(--bg-2); color: var(--text-2); font-size: .9em; }
.fm-list { display: grid; gap: 8px; }
.fm-card { display: grid; gap: 6px; padding: 14px 16px; border-radius: 14px; background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); text-align: left; width: 100%; }
.fm-card:hover { background: var(--bg-3); }
.fm-card.unread .fm-top b { color: var(--text); }
.fm-card.arch { opacity: .65; }
.fm-top { display: flex; align-items: center; gap: 8px; }
.fm-top b { font-size: 1.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-top .badge { margin-left: auto; }
.fm-last { color: var(--text-2); font-size: .88em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-last i { font-style: normal; color: var(--text-3); }
.fm-meta { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: .8em; }
@media (max-width: 760px) { .fm-wrap { padding: 12px 12px 24px; } .fm-bar .btn { width: 100%; justify-content: center; } }
.rules-box { max-height: 50vh; overflow-y: auto; padding: 12px 14px; border-radius: 12px; background: var(--bg-2); }

/* кружок: загрузка и ошибка — всегда круг, как в Telegram */
.vn { width: 240px !important; min-width: 240px; height: 240px !important; background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--accent) 22%, var(--bg-3)), var(--bg-3) 70%); }
@media (max-width: 760px) { .vn { width: 200px !important; min-width: 200px; height: 200px !important; } }
.vn.playing { width: min(300px, 78vw) !important; min-width: 0; height: auto !important; }
.vn-mid { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: rgba(0, 0, 0, .45); color: #fff; border: 0; padding: 0; }
.vn-mid .spin { margin: 0; }
.vn-retry { cursor: pointer; }
.vn-retry:active { transform: translate(-50%, -50%) scale(.92); }
.vn-load .vn-ring-bg { stroke: rgba(255, 255, 255, .14); }
.vn-load .vn-ring-fg { stroke: var(--accent); opacity: 1 !important; }

/* отправляемое фото/видео: превью и круг загрузки */
.up-frame { cursor: default; }
.up-frame img, .up-frame video { width: 100%; height: 100%; object-fit: cover; display: block; filter: brightness(.75); }
.up-frame.up-vn { width: 200px; height: 200px; border-radius: 50%; }
.up-ov { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: rgba(0, 0, 0, .5); color: #fff; display: grid; place-items: center; }
.up-ov i { position: absolute; inset: 3px; border-radius: 50%; background: conic-gradient(#fff calc(var(--up) * 1%), transparent 0); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px)); mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px)); transition: --up .2s; animation: up-spin 1.4s linear infinite; }
@keyframes up-spin { to { transform: rotate(360deg); } }
.up-ov { box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .22); }
.msg.pending .up-frame { opacity: 1; }
.msg.pending .bubble:has(.up-frame) { opacity: 1; }

/* ====================== канал как в Telegram: посты без аватарок, слева, с просмотрами ====================== */
.msg.post { grid-template-columns: minmax(0, 1fr); }
.msg.post .msg-gutter { display: none; }
.msg.post .msg-body { grid-column: 1; align-items: flex-start; }
.msg.post .bubble { max-width: min(560px, 100%); border-radius: 16px; padding: 9px 13px 7px; box-shadow: 0 2px 10px rgba(0, 0, 0, .12); }
.msg.post + .msg.post { margin-top: 8px; }
.msg.post .bubble.media { border-radius: 16px; overflow: hidden; }
.post-meta { gap: 6px; }
.post-views { display: inline-flex; align-items: center; gap: 3px; }
.post-sig { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-edited { opacity: .85; }
@media (max-width: 760px) { .msg.post .bubble { max-width: 100%; } .msg.post .msg-body { padding-right: 12px; } }

/* права администратора */
.adm-who { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.adm-who b { display: block; font-size: 1.05em; }
.adm-who small { color: var(--text-3); }
.adm-h { margin: 6px 0 8px; font-size: .78em; text-transform: uppercase; letter-spacing: .04em; color: var(--accent-text); }
.adm-rights { display: grid; border-radius: 14px; background: var(--bg-2); overflow: hidden; margin-bottom: 14px; }
.adm-right { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; cursor: pointer; }
.adm-right + .adm-right { border-top: 1px solid var(--line); }
.adm-right.off { opacity: .5; cursor: default; }
.adm-add { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 6px; margin-bottom: 6px; border: 0; background: none; color: var(--accent-text); font: inherit; font-weight: 600; cursor: pointer; border-radius: 10px; }
.adm-add:hover { background: var(--hover); }
.gm-row.clickable { cursor: pointer; border-radius: 10px; }
.gm-row.clickable:hover { background: var(--hover); }
.gm-list.pick { max-height: 50vh; overflow-y: auto; margin-top: 8px; }
.gm-list.pick .gm-row { width: 100%; border: 0; background: none; color: inherit; font: inherit; text-align: left; padding: 8px; border-radius: 10px; cursor: pointer; }
.gm-list.pick .gm-row:hover { background: var(--hover); }

/* комментарии под постом канала (как в Telegram) */
.cm-bar { display: flex; align-items: center; gap: 10px; width: calc(100% + 26px); margin: 8px -13px -7px; padding: 9px 13px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--accent-text); font: inherit; font-size: .9em; font-weight: 600; cursor: pointer; text-align: left; border-radius: 0 0 16px 16px; clear: both; }
.cm-bar:hover { background: var(--hover); }
.cm-bar .cm-text { flex: 1; }
.cm-bar .cm-avs { display: inline-flex; }
.cm-bar .cm-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.bubble.media .cm-bar { margin: 0; width: 100%; background: var(--bubble); }
.cm-head { padding: 16px 0 4px; }
.cm-head .cm-post .cm-bar { display: none; }
.cm-start { text-align: center; margin: 14px auto 6px; width: fit-content; padding: 4px 12px; border-radius: 999px; background: var(--bg-float); color: var(--text-3); font-size: .78em; font-weight: 600; }
.bubble.has-cm.inline-meta .b-meta { position: static; float: right; margin: 6px 0 0 10px; }
.bubble.has-cm .b-meta { float: right; }
.bubble.has-cm .cm-bar { clear: both; display: flex; }
.bubble.has-cm .b-spacer { display: none; }
.cm-head .cm-post .cm-bar { display: none !important; }

/* «Уменьшить движение»: короткая анимация ещё и один раз — иначе бесконечная анимация крутится каждый кадр */
[data-motion="reduce"] *, [data-motion="reduce"] *::before, [data-motion="reduce"] *::after { animation-iteration-count: 1 !important; }
/* демонстрация экрана: интерфейс замирает — ни анимаций, ни размытия под стеклом */
:root.perf-lite *, :root.perf-lite *::before, :root.perf-lite *::after { animation-play-state: paused !important; transition: none !important; }
:root.perf-lite .spin, :root.perf-lite .vn-load, :root.perf-lite .rec-dot { animation-play-state: running !important; }
:root.perf-lite * { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
:root.perf-lite .tg-glass, :root.perf-lite .tg-pill { background: var(--bg-float); }
/* спиннер — на отдельном слое: вращение не перерисовывает соседей (рамки, тени, размытие) */
.spin { will-change: transform; contain: strict; }
/* длинные заголовки настроек («Конфиденциальность») не рвутся посреди слова — переносятся по слогам или сжимаются */
.sp-title h2 { overflow-wrap: normal; word-break: normal; hyphens: auto; -webkit-hyphens: auto; }
@media (max-width: 760px) { .sp-title { padding-right: 0; } .sp-title h2 { font-size: clamp(1em, 5.4vw, 1.2em); } }

/* ====================== стикеры ====================== */
.sticker { display: grid; place-items: center; max-width: 100%; }
.sticker img { width: 100%; height: 100%; object-fit: contain; display: block; user-select: none; -webkit-user-drag: none; }
.sticker-err { display: grid; justify-items: center; gap: 4px; font-size: .75em; color: var(--text-3); text-align: center; }
.bubble.sticker-msg { background: transparent !important; box-shadow: none !important; padding: 0; }
.bubble.sticker-msg .b-meta { position: static; float: right; margin: 4px 2px 0 0; padding: 2px 7px; border-radius: 999px; background: rgba(0, 0, 0, .45); color: #fff; }
.sticker-picker { width: 360px; max-width: calc(100vw - 24px); height: 380px; display: flex; flex-direction: column; }
.st-head { display: flex; align-items: baseline; justify-content: space-between; padding: 12px 14px 6px; }
.st-head small { color: var(--text-3); }
.st-grid { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 6px 10px 12px; align-content: start; }
.st-cell { aspect-ratio: 1; display: grid; place-items: center; border: 0; border-radius: 12px; background: none; cursor: pointer; padding: 4px; color: var(--text-2); }
.st-cell:hover { background: var(--hover); }
.st-cell .sticker { width: 100% !important; height: 100% !important; }
.st-add { border: 2px dashed var(--line); gap: 2px; align-content: center; font: inherit; }
.st-add small { font-size: .72em; }
.st-empty { grid-column: 1 / -1; margin: 8px 4px; color: var(--text-3); font-size: .85em; }
@media (max-width: 760px) {
  .popover:has(.sticker-picker) { position: fixed !important; left: 0 !important; right: 0 !important; top: auto !important; bottom: 0 !important; width: auto !important; max-width: none !important; border-radius: 22px 22px 0 0; padding-bottom: var(--safe-b); }
  .sticker-picker { width: 100%; max-width: none; height: min(60dvh, 460px); }
}
.bubble.sticker-msg { position: relative; }
.bubble.sticker-msg .b-meta { position: absolute; right: 2px; bottom: 2px; margin: 0; float: none; }
/* кружок, пока идёт проверка на 18+: виден, но размыт, нажать нельзя */
.vn.vn-checking video { filter: blur(22px) saturate(.6); }
.vn.vn-checking { pointer-events: none; }
.vn.vn-checking::after { content: ''; position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px; border: 2.5px solid rgba(255, 255, 255, .3); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.cm-post-slot { min-height: 40px; display: grid; }
.cm-post-slot > .spin { margin: 10px auto; }
@media (max-width: 760px) { .overview-row { align-items: stretch; } .overview-row .icon-pick-wrap { align-self: center; } .overview-row .grow { width: 100%; } }
.ttl-badge { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 2px 8px; border-radius: 999px; background: var(--bg-3); color: var(--text-3); font-size: .75em; font-weight: 600; white-space: nowrap; }
.ttl-mini { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; color: var(--text-3); }

/* ====================== интеграции ====================== */
.int-list { display: grid; gap: 10px; margin-top: 12px; }
.int-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; background: var(--bg-2); }
.int-logo { display: grid; flex: none; }
.int-text { flex: 1; min-width: 0; display: grid; }
.int-text small { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.int-acts { display: flex; align-items: center; gap: 12px; }
.int-show { display: flex; align-items: center; gap: 8px; font-size: .85em; color: var(--text-2); }
.btn.spotify { background: #1DB954; color: #000; font-weight: 700; }
.btn.spotify:hover { background: #1ed760; }
@media (max-width: 560px) { .int-card { flex-wrap: wrap; } .int-acts { width: 100%; justify-content: space-between; } }
/* «Слушает Spotify» */
.act-card.listen { align-items: stretch; }
.lc-art { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; flex: none; display: block; background: var(--bg-3); }
.lc-noart { display: grid; place-items: center; color: #1DB954; }
.lc-art-link { flex: none; display: block; }
.lc-body { display: grid; min-width: 0; flex: 1; align-content: center; gap: 1px; }
.lc-body small { color: #1DB954 !important; }
.lc-body b, .lc-ar { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-ar { color: var(--text-2); font-size: .85em; }
.lc-prog { margin-top: 6px; }
.lc-bar { height: 4px; border-radius: 2px; background: var(--bg-3); overflow: hidden; }
.lc-bar i { display: block; height: 100%; background: var(--text); border-radius: 2px; transition: width 1s linear; }
.lc-time { display: flex; justify-content: space-between; font-size: .68em; color: var(--text-3); margin-top: 2px; font-variant-numeric: tabular-nums; }
.mem-act { color: var(--text-3); }
.vnr-layer:not(.back-cam) .vnr-circle video { transform: scaleX(-1); }

/* одна панель: эмодзи и стикеры */
.emoji-picker.with-st { display: flex; flex-direction: column; }
.ep-combo { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.ep-combo [hidden] { display: none !important; }
.ep-emoji { flex: 1; min-height: 0; display: grid; grid-template-rows: auto auto 1fr auto; }
.ep-stickers, .st-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ep-seg { display: flex; gap: 4px; margin: 8px 10px 4px; padding: 3px; border-radius: 12px; background: var(--bg-3); }
.ep-seg button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; border: 0; border-radius: 9px; background: none; color: var(--text-3); font: inherit; font-size: .85em; font-weight: 700; cursor: pointer; }
.ep-seg button.on { background: var(--bg-float); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .2); }

/* почта в учётной записи */
.em-val { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.em-ok { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--green); color: #fff; flex: none; }
.em-warn { font-style: normal; font-size: .78em; color: var(--yellow, #f0b232); white-space: nowrap; }
.em-code { font: 700 1.6em ui-monospace, Consolas, monospace; letter-spacing: .4em; text-align: center; }
.em-addr { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .lr-value:has(.em-val) { min-width: 0; display: flex; }
#auth .af-in.is-email > b { display: none; }
#auth .af-in.no-at > b { display: none; }

/* картинка с подписью: картинка на всю ширину пузыря сверху, подпись снизу (как в Telegram) */
.bubble.media-top { width: min(440px, 100%); overflow: hidden; --bx: 12px; --by: 8px; }
.msg.post .bubble.media-top { width: min(500px, 100%); --bx: 13px; --by: 9px; }
.bubble.media-top > .attachments, .bubble.media-top > .gif-msg { margin: 4px calc(-1 * var(--bx)) 10px; width: calc(100% + 2 * var(--bx)); max-width: none; align-items: stretch; }
.bubble.media-top > .attachments:first-child, .bubble.media-top > .gif-msg:first-child { margin-top: calc(-1 * var(--by)); }
.bubble.media-top .att-img, .bubble.media-top .gif-msg { max-width: none !important; width: 100%; border-radius: 0; max-height: 520px !important; }
.bubble.media-top .att-img img { object-fit: cover; }
.bubble.media-top .attachments.grid { gap: 2px; }
/* в сетке фото и в картинке над подписью размер задаёт сетка/пузырь, а не исходная ширина */
.attachments.grid .att-img, .bubble.media-top .att-img, .bubble.media-top .gif-msg { width: 100% !important; max-width: none !important; }

/* деликатный контент: размыто, по нажатию — показать */
.nsfw-blur { position: relative; overflow: hidden; }
.nsfw-blur > img, .nsfw-blur > video, .nsfw-blur img, .nsfw-blur video { filter: blur(34px) saturate(.7); transform: scale(1.08); }
.nsfw-soft { position: absolute; inset: 0; z-index: 2; display: grid; place-content: center; justify-items: center; gap: 4px; border: 0; background: rgba(10, 8, 16, .35); color: #fff; font: inherit; cursor: pointer; text-align: center; padding: 10px; }
.nsfw-soft b { font-size: .92em; }
.nsfw-soft span { font-size: .78em; opacity: .8; }
.vn .nsfw-soft { border-radius: 50%; }

/* ====================== черновики, цитаты, ссылки на сообщения ====================== */
.dm-draft { color: var(--red); font-weight: 600; }
.msg-ref.quote { white-space: normal; align-items: flex-start; flex-direction: column; gap: 1px; padding: 5px 10px 6px 9px; }
.msg-ref.quote .ref-text { white-space: normal; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; font-style: italic; color: var(--text-2); }
.msg-ref .ref-name { display: inline-flex; align-items: center; gap: 4px; }
.msg-ref .ref-q { opacity: .7; }
.reply-bar .rb-text { display: flex; align-items: center; gap: 5px; }
.reply-bar .rb-quote { font-style: italic; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.reply-bar .rb-quote::before { content: '«'; }
.reply-bar .rb-quote::after { content: '»'; }
.reply-bar .rb-q { flex: none; color: var(--accent-text); }
a.link.msg-link { display: inline-flex; align-items: center; gap: 4px; padding: 0 7px; border-radius: 7px; background: var(--accent-soft); color: var(--accent-text); text-decoration: none; font-weight: 600; }
a.link.msg-link::before { content: '↪'; font-weight: 700; }
.msg.own .bubble a.link.msg-link { background: rgba(255, 255, 255, .2); color: #fff; text-decoration: none; }

/* ====================== перевод и расшифровка речи ====================== */
.msg-tr { margin-top: 6px; padding: 6px 10px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 10%, transparent); border-left: 3px solid var(--accent); font-size: .94em; max-width: 560px; }
.msg-tr .tr-head { display: flex; align-items: center; gap: 5px; font-size: .78em; font-weight: 700; color: var(--accent-text); margin-bottom: 2px; }
.msg-tr .tr-head .link-like { margin-left: auto; font-weight: 600; }
.msg-tr .tr-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-tr.err { color: var(--text-3); font-size: .84em; }
.tr-wait, .stt-wait { display: inline-flex; align-items: center; gap: 8px; color: var(--text-3); font-size: .86em; }
.tr-wait .spin, .stt-wait .spin { width: 14px; height: 14px; }
.msg.own .msg-tr { background: rgba(255, 255, 255, .16); border-left-color: rgba(255, 255, 255, .7); }
.msg.own .msg-tr .tr-head, .msg.own .tr-wait, .msg.own .stt-wait { color: rgba(255, 255, 255, .9); }
.stt-btn { display: inline-grid; place-items: center; width: 24px; height: 20px; border-radius: 6px; color: inherit; background: color-mix(in srgb, currentColor 14%, transparent); }
.stt-btn:hover, .stt-btn.on { background: color-mix(in srgb, currentColor 26%, transparent); }
.stt-text { margin-top: 6px; padding: 6px 10px; border-radius: 10px; background: color-mix(in srgb, currentColor 8%, transparent); font-size: .92em; line-height: 1.4; max-width: 360px; white-space: pre-wrap; overflow-wrap: anywhere; }
.stt-err { color: var(--red); }
.msg.own .stt-text { background: rgba(255, 255, 255, .16); }
.vn-wrap { position: relative; display: inline-block; }
.vn-wrap > .stt-btn { position: absolute; right: 6px; bottom: 6px; width: 30px; height: 30px; border-radius: 50%; background: rgba(0, 0, 0, .45); color: #fff; backdrop-filter: blur(6px); }
.vn-wrap + .stt-text { max-width: 240px; }

/* ====================== один просмотр ====================== */
.att-card.once { outline: 2px solid var(--accent); outline-offset: 2px; }
.att-card-tools .icon-btn.on { color: #fff; background: var(--accent); }
.once-box { display: flex; align-items: center; gap: 12px; min-width: 220px; padding: 12px 16px 12px 12px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 14%, var(--bg-input)); color: var(--text); text-align: left; cursor: pointer; }
.once-box:disabled { cursor: default; }
.once-box .once-ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--grad); color: #fff; flex: none; }
.once-box.done .once-ic { background: var(--bg-3); color: var(--text-3); }
.once-box .once-t { display: grid; gap: 2px; }
.once-box small { color: var(--text-3); }
.once-box.loading .once-ic { opacity: .6; }
.msg.own .once-box { background: rgba(255, 255, 255, .16); color: #fff; }
.msg.own .once-box small { color: rgba(255, 255, 255, .8); }
.msg.own .once-box .once-ic { background: rgba(255, 255, 255, .25); }
.once-view { position: fixed; inset: 0; z-index: 9000; background: rgba(4, 3, 8, .94); display: grid; place-items: center; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.once-view .once-media { max-width: 96vw; max-height: 86vh; display: grid; place-items: center; }
.once-view img, .once-view video { max-width: 96vw; max-height: 86vh; border-radius: 12px; pointer-events: none; }
.once-view .once-hint { position: absolute; bottom: calc(18px + var(--safe-b, 0px)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: rgba(255, 255, 255, .12); color: #fff; font-size: .86em; white-space: nowrap; }
.once-view .once-x { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: 12px; color: #fff; }

/* ====================== геопозиция ====================== */
.bubble.geo-msg { padding: 4px; }
.geo { display: grid; gap: 6px; max-width: 100%; }
.geo-map { position: relative; overflow: hidden; border-radius: 12px; background: var(--bg-3); cursor: pointer; max-width: 100%; contain: paint; }
.geo-map img { position: absolute; width: 256px; height: 256px; max-width: none; -webkit-user-drag: none; }
.geo-attr { position: absolute; right: 4px; bottom: 3px; font-size: 9px; padding: 0 4px; border-radius: 4px; background: rgba(255, 255, 255, .75); color: #333; }
.geo-pin { position: absolute; left: 50%; top: 50%; width: 26px; height: 34px; transform: translate(-50%, -100%); pointer-events: none; }
.geo-pin i, .geo-pin-ic i { position: absolute; inset: 0; background: var(--accent); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 32'%3E%3Cpath d='M12 0C5.4 0 0 5.3 0 11.9 0 20.8 12 32 12 32s12-11.2 12-20.1C24 5.3 18.6 0 12 0zm0 16.5a4.6 4.6 0 1 1 0-9.2 4.6 4.6 0 0 1 0 9.2z'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 32'%3E%3Cpath d='M12 0C5.4 0 0 5.3 0 11.9 0 20.8 12 32 12 32s12-11.2 12-20.1C24 5.3 18.6 0 12 0zm0 16.5a4.6 4.6 0 1 1 0-9.2 4.6 4.6 0 0 1 0 9.2z'/%3E%3C/svg%3E") center/contain no-repeat; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35)); }
.geo-pin.live::after { content: ''; position: absolute; left: 50%; bottom: -6px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 45%, transparent); animation: geoPulse 1.6s ease-out infinite; z-index: -1; }
@keyframes geoPulse { from { transform: scale(.6); opacity: 1; } to { transform: scale(3); opacity: 0; } }
.geo-pin-ic { position: relative; }
.geo-pin-ic.live i { background: var(--red); }
.geo-cap { display: flex; align-items: center; gap: 8px; padding: 2px 6px 4px; }
.geo-cap-ic { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.geo.is-live:not(.ended) .geo-cap-ic { background: var(--grad); color: #fff; }
.geo-cap-t { display: grid; min-width: 0; flex: 1; }
.geo-cap-t b { font-size: .9em; }
.geo-cap-t small { color: var(--text-3); font-size: .78em; }
.geo.ended .geo-map { filter: grayscale(.7); opacity: .85; }
.msg.own .geo-cap-t small { color: rgba(255, 255, 255, .8); }
.msg.own .geo-cap-ic { background: rgba(255, 255, 255, .22); color: #fff; }
.msg.own .geo-stop { color: #fff; border-color: rgba(255, 255, 255, .5); }
.geo-modal { width: min(720px, 100%); }
.geo-big { position: relative; height: min(56vh, 460px); border-radius: 14px; overflow: hidden; background: var(--bg-3); }
.geo-big .leaflet-container { font: inherit; }
.geo-center { position: absolute; inset: 0; z-index: 500; pointer-events: none; }
.geo-pin.big { width: 34px; height: 44px; }
.geo-info { margin: 8px 2px 0; }
.geo-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.geo-actions .btn { display: inline-flex; align-items: center; gap: 6px; }
.geo-live-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.geo-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.leaflet-container .leaflet-control-attribution { font-size: 10px; }

/* ====================== папки с чатами ====================== */
.folder.f-edit { padding: 0 11px; color: var(--text-3); }
.desk-folders { margin: 0 4px 8px; }
.desk-folders .folder { height: 28px; padding: 0 11px; font-size: .8em; }
.dm-sec { display: flex; align-items: center; justify-content: space-between; }
.dm-sec-btn { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; color: var(--text-4); }
.dm-sec-btn:hover { color: var(--text); background: var(--bg-input); }
.fold-types { display: grid; gap: 2px; margin-bottom: 4px; }
.fold-chats { max-height: 300px; margin-top: 6px; }
.fw-row.on { background: var(--accent-soft); }
.fold-check { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); color: #fff; flex: none; }
.fw-row.on .fold-check { background: var(--accent); border-color: var(--accent); }
.fold-list { display: grid; gap: 6px; }
.fold-row { display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: var(--bg-input); }
.fold-row > svg { grid-row: 1 / span 2; color: var(--accent-text); }
.fold-row small { grid-column: 2; }
.fold-row .fold-tools { grid-column: 3; grid-row: 1 / span 2; display: flex; gap: 2px; }
.fold-row .up svg { transform: rotate(180deg); }
.fold-add { justify-self: start; display: inline-flex; align-items: center; gap: 6px; }

/* ====================== фон и цвет отдельного чата ====================== */
.chat-look-modal .wall-grid { margin-bottom: 4px; }
.chat-look-modal .swatch-grid { grid-template-columns: repeat(auto-fill, 32px); }
.chat-look-modal .swatch { width: 32px; height: 32px; border-radius: 10px; background: var(--bg-input); color: var(--text-3); }
.chat-look-modal .swatch.on { outline: 3px solid var(--text); outline-offset: 2px; }

/* ====================== статистика канала ====================== */
.stats-modal .modal-body { display: grid; gap: 10px; }
.stats-seg { justify-self: start; }
.stats-load { display: grid; place-items: center; min-height: 200px; }
.st-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.st-card { display: grid; gap: 2px; padding: 12px; border-radius: 14px; background: var(--bg-input); }
.st-card small { color: var(--text-3); font-size: .76em; font-weight: 700; }
.st-card b { font-size: 1.5em; font-family: var(--display); font-variant-numeric: tabular-nums; }
.st-note { font-size: .74em; color: var(--text-3); }
.st-card.up .st-note { color: var(--green); font-weight: 700; }
.st-card.down .st-note { color: var(--red); font-weight: 700; }
.st-h { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; font-size: .86em; }
.st-legend { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; font-weight: 600; color: var(--text-3); font-size: .9em; }
.st-legend i { width: 10px; height: 10px; border-radius: 3px; }
.st-legend i.j { background: var(--green); }
.st-legend i.l { background: var(--red); margin-left: 6px; }
.st-j { fill: var(--green); }
.st-l { fill: var(--red); }
.st-chart { position: relative; }
.st-svg { width: 100%; height: auto; display: block; overflow: visible; touch-action: pan-y; }
.st-grid { stroke: var(--line); stroke-width: 1; }
.st-ax { fill: var(--text-4); font-size: 11px; font-family: var(--font); }
.st-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.st-area { fill: color-mix(in srgb, var(--accent) 14%, transparent); stroke: none; }
.st-dot { fill: var(--accent); stroke: var(--bg-float); stroke-width: 2; }
.st-tip { position: absolute; top: -4px; padding: 3px 8px; border-radius: 8px; background: var(--bg-float); box-shadow: var(--shadow-md); font-size: .78em; font-weight: 700; pointer-events: none; white-space: nowrap; }
.st-posts { display: grid; gap: 4px; }
.st-post { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 8px 10px; border-radius: 12px; text-align: left; background: transparent; color: var(--text); }
.st-post:hover { background: var(--bg-input); }
.st-post-t { display: grid; min-width: 0; }
.st-post-t span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-post-t small { color: var(--text-4); font-size: .76em; }
.st-post-n { display: flex; gap: 10px; align-items: center; font-size: .84em; color: var(--text-2); font-variant-numeric: tabular-nums; }
.st-post-n span { display: inline-flex; align-items: center; gap: 4px; }
.st-bar { grid-column: 1 / -1; height: 4px; border-radius: 4px; background: var(--bg-input); overflow: hidden; }
.st-bar i { display: block; height: 100%; background: var(--grad); border-radius: 4px; }
@media (max-width: 700px) { .st-cards { grid-template-columns: repeat(2, 1fr); } }

.vm.sending .vm-play { opacity: .85; }
.vm.sending .vm-play .spin { width: 18px; height: 18px; border-color: rgba(255, 255, 255, .35); border-top-color: #fff; }

/* ====================== компьютер: «плавающие окна» ====================== */
#tabsBar { display: none; }
:root[data-layout="float"][data-mode="desk"] #app { gap: 12px; padding: 14px 14px 14px 10px; }

#tabsBar::-webkit-scrollbar { display: none; }
.dk-tab { flex: none; display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 8px 0 6px; border-radius: 13px; color: var(--text-2); font-weight: 600; font-size: .88em; max-width: 240px; }
.dk-tab:hover { background: var(--bg-hover); }
.dk-tab.on { background: var(--grad); color: #fff; box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 40%, transparent); }
.dk-tab .dk-tl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dk-tab small { color: var(--text-3); font-weight: 500; white-space: nowrap; }
.dk-tab.on small { color: rgba(255, 255, 255, .75); }
.dk-tab .badge { position: static; margin: 0; }
.dk-tab .dk-x { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; opacity: .45; flex: none; }
.dk-tab .dk-x:hover { opacity: 1; background: rgba(127, 127, 127, .2); }
.dk-tab .gicon, .dk-tab .avatar { flex: none; }
.dk-tab.call { color: var(--green); background: color-mix(in srgb, var(--green) 14%, transparent); padding-right: 12px; }
.dk-tab.call.on { background: var(--green); color: #fff; }
.dk-tab.call b { font-variant-numeric: tabular-nums; font-weight: 700; }
.dk-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 25%, transparent); flex: none; }
:root[data-layout="float"][data-mode="desk"] #rail { align-self: center; justify-content: center; gap: 6px; padding: 8px; border-radius: 22px; background: var(--panel); box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--line); backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2); justify-self: center; max-height: 100%; --ring-bg: var(--panel-solid); }
.dk-ri { position: relative; width: 46px; height: 46px; flex: none; border-radius: 15px; display: grid; place-items: center; color: var(--text-2); }
.dk-ri:hover { background: var(--bg-hover); color: var(--text); }
.dk-ri.on { background: var(--text); color: var(--panel-solid); }
.dk-ri .badge { position: absolute; top: 2px; right: 2px; box-shadow: 0 0 0 3px var(--panel-solid); }
.dk-sep { width: 26px; height: 1px; background: var(--line); margin: 4px 0; flex: none; }
.dk-me { margin-top: 4px; }
:root[data-layout="float"][data-mode="desk"] #side, :root[data-layout="float"][data-mode="desk"] #main, :root[data-layout="float"][data-mode="desk"] #members { border-radius: 24px; box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--line); }
:root[data-layout="float"][data-mode="desk"] #userPanel { display: none; }
:root[data-layout="float"][data-mode="desk"] #sideFoot:not(:has(#voicePanel:not([hidden]))) { display: none; }
.dk-back { margin-right: 2px; }
.dk-add .dk-plus { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--bg-input); color: var(--text-2); flex: none; }
.dk-onl { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; font-size: .75em; font-weight: 700; color: var(--green); font-variant-numeric: tabular-nums; }
.dk-onl i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.dk-srv .dk-tag { color: var(--text-2); }

.menu-check svg { display: block; width: 12px; height: 12px; stroke-width: 3; }
.menu-check.radio.on::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; }

/* интерфейс не уезжает вбок: каркас обрезается по краям окна */
html, body { overflow-x: clip; }
#app { overflow: clip; }
#app > * { min-width: 0; }

/* ====================== компьютер: друзья и сервер (плавающие окна) ====================== */
:root[data-layout="float"][data-mode="desk"] #side.dk-guild #userPanel { display: flex; }
:root[data-layout="float"][data-mode="desk"] #side.dk-guild #sideFoot { display: grid; }
.dk-fseg { margin: 4px 10px 6px; }
.dk-act { color: var(--green); }
.dk-racts { display: flex; gap: 4px; margin-left: auto; }
.dk-fpage { padding: 18px 22px 24px; display: flex; flex-direction: column; gap: 14px; }
.dk-add-bar { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border-radius: 16px; background: var(--bg-input); box-shadow: inset 0 0 0 1px var(--line); color: var(--accent-text); }
.dk-addin { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font: inherit; }
.dk-addin::placeholder { color: var(--text-3); }
.dk-fh { font-family: var(--display); font-size: 1.05em; margin-top: 6px; }
.dk-fcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.dk-fcard { display: grid; gap: 10px; padding: 14px; border-radius: 18px; background: var(--bg-input); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; }
.dk-fcard:hover { background: var(--bg-hover); }
.dk-fc-top { display: flex; align-items: center; gap: 10px; }
.dk-fc-top small, .dk-fmini small { display: block; color: var(--text-3); font-size: .8em; }
.dk-fc-what { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: color-mix(in srgb, var(--bg-app) 45%, transparent); font-size: .88em; min-width: 0; }
.dk-fc-what small { display: block; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dk-fc-what > div { min-width: 0; }
.dk-fc-what.big { font-size: 1em; padding: 12px; max-width: 520px; }
.dk-fc-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #fff; flex: none; }
.dk-fc-acts { display: flex; gap: 6px; }
.dk-fminis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.dk-fmini { display: grid; justify-items: center; gap: 6px; padding: 16px 10px; border-radius: 18px; background: var(--bg-input); box-shadow: inset 0 0 0 1px var(--line); text-align: center; cursor: pointer; min-width: 0; }
.dk-fmini:hover { background: var(--bg-hover); }
.dk-fmini b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dk-fempty { padding: 4px 2px; }
.dk-fprof { padding: 16px 22px 24px; display: flex; flex-direction: column; gap: 14px; }
.dk-fprof .profile-card { max-width: 640px; border-radius: 22px; overflow: hidden; }
.dk-pacts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.dk-pacts .btn { display: inline-flex; align-items: center; gap: 7px; }
.dk-active .dk-fempty { padding: 8px 12px; }
.srv-tag { margin: 2px 0 0; padding: 6px 10px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--text-2); font-size: .84em; }

/* ====================== вкладки в самой верхней строке ====================== */
#webbar { display: none; }
html.has-webbar #webbar { position: fixed; top: 0; left: 0; right: 0; height: 36px; z-index: 4000; display: flex; align-items: center; gap: 8px; padding: 0 12px 0 14px; color: var(--text-2); font-size: 12.5px; background: color-mix(in srgb, var(--bg-app) 88%, transparent); border-bottom: 1px solid var(--line); }
html.has-webbar #webbar b { font-family: var(--display); font-size: 12px; letter-spacing: .03em; color: var(--text); margin-right: 6px; }
html.has-webbar #app { top: 36px; height: calc(var(--vvh, 100dvh) - 36px); }
html.dk-tabs #appbar .ab-title { display: none; }
html.dk-tabs #tabsBar { display: flex; align-items: flex-end; align-self: stretch; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; -webkit-app-region: no-drag; margin-left: 4px; }
html.dk-tabs #tabsBar.empty { visibility: hidden; }
html.dk-tabs #appbar #tabsBar { max-width: calc(100% - 20px); }
html.dk-tabs #tabsBar .dk-tab { height: 28px; border-radius: 9px 9px 0 0; padding: 0 6px 0 7px; font-size: 12px; max-width: 200px; background: transparent; box-shadow: none; color: var(--text-2); }
html.dk-tabs #tabsBar .dk-tab:hover { background: var(--bg-hover); }
html.dk-tabs #tabsBar .dk-tab.on { background: var(--panel-solid); color: var(--text); box-shadow: inset 0 2px 0 var(--accent); }
html.dk-tabs #tabsBar .dk-tab.call { color: var(--green); }
html.dk-tabs #tabsBar .dk-tab.call.on { background: color-mix(in srgb, var(--green) 18%, var(--panel-solid)); color: var(--text); box-shadow: inset 0 2px 0 var(--green); }
html.dk-tabs #tabsBar .avatar, html.dk-tabs #tabsBar .gicon { --s: 18px !important; width: 18px; height: 18px; }

/* ====================== телефон: пять разделов внизу (Чаты · Каналы · Серверы · Звонки · Профиль) ====================== */
@media (max-width: 760px) {
  #app.m-root #tabbar, body.profile-tab > #tabbar, body.profile-tab #app #tabbar, .sk-tabbar { grid-template-columns: repeat(5, 1fr); }
  .tb-pill { width: calc((100% - 10px) / 5); background: radial-gradient(120% 120% at 50% 0%, color-mix(in srgb, var(--accent) 34%, transparent), color-mix(in srgb, var(--accent) 12%, transparent));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), inset 0 0 0 1px color-mix(in srgb, var(--accent) 32%, transparent); }
  #tabbar.on-friends .tb-pill { opacity: .55; }
  .tb-ic { width: 46px; }
  .tb-item { font-size: .66em; letter-spacing: .1px; }
  .tb-label { white-space: nowrap; }
  .side-title .logo, .side-title .logo-svg { vertical-align: -3px; margin-right: 7px; color: var(--text); }
}

/* ====================== фото профиля: счётчик и просмотр всех фото ====================== */
.pc-avatar.clickable { cursor: pointer; }
.pc-avn { position: absolute; z-index: 3; left: 0; bottom: 2px; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; background: rgba(0, 0, 0, .62); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--ring-bg); }
.avg { position: fixed; inset: 0; z-index: 2000; background: #050308; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 70px 16px calc(30px + var(--safe-b, 0px)); animation: fadeIn .18s; }
.avg-bars { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); left: 14px; right: 14px; display: flex; gap: 4px; }
.avg-bars i { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .25); }
.avg-bars i.on { background: #fff; }
.avg-x { position: absolute; top: calc(24px + env(safe-area-inset-top, 0px)); right: 12px; z-index: 2; width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: rgba(255, 255, 255, .1); color: #fff; }
.avg-img { width: min(86vw, 70vh, 520px); aspect-ratio: 1; object-fit: cover; border-radius: 26px; background: rgba(255, 255, 255, .05); box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
.avg-info { display: grid; justify-items: center; gap: 3px; color: #fff; text-align: center; position: relative; z-index: 2; }
.avg-info small { color: rgba(255, 255, 255, .6); }
.avg-acts { display: flex; gap: 8px; margin-top: 10px; }
.avg-prev, .avg-next { position: absolute; top: 80px; bottom: 170px; width: 32%; z-index: 1; background: transparent; }
.avg-prev { left: 0; } .avg-next { right: 0; }
@keyframes fadeIn { from { opacity: 0; } }

/* ====================== телефон: профиль на весь экран, аватар по центру ====================== */
.pc-close { display: none; }
@media (max-width: 760px) {
  .modal-back:has(> .modal.profile) { padding: 0; place-items: stretch; }
  .modal.profile { height: var(--vvh, 100dvh); max-height: none !important; border-radius: 0; transform: translateY(24px); }
  .modal.profile .modal-body { padding: 0; overflow-y: auto; }
  .modal.profile .profile-card.full { border-radius: 0; min-height: 100%; }
  .modal.profile .pc-banner { height: calc(190px + env(safe-area-inset-top, 0px)); }
  .modal.profile .pc-avatar { left: 50% !important; transform: translateX(-50%); top: calc(132px + env(safe-area-inset-top, 0px)); }
  .modal.profile .profile-card.full .pc-body { padding-top: 74px; }
  .modal.profile .pc-names { text-align: center; display: grid; justify-items: center; }
  .modal.profile .pc-names h3 { font-size: 1.5em; }
  .modal.profile .pc-close { display: grid; place-items: center; position: absolute; z-index: 5; top: calc(12px + env(safe-area-inset-top, 0px)); left: 12px; width: 40px; height: 40px; border-radius: 13px; background: rgba(0, 0, 0, .4); color: #fff; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
}

@media (max-width: 760px) { .modal.profile::before { display: none; } }

/* ====================== телефон: шапка своего профиля (вкладка «Профиль») ====================== */
.me-hero { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; margin: -16px -14px 16px; padding: 0 16px 6px; --ring-bg: var(--panel-solid); }
.mh-banner { align-self: stretch; height: calc(170px + var(--safe-t, 0px)); margin: 0 -16px; border-radius: 0 0 26px 26px; }
.mh-av { margin-top: -56px; position: relative; z-index: 2; }
.mh-av > .av-img { box-shadow: 0 0 0 6px var(--panel-solid); }
.mh-bn-edit { position: absolute; z-index: 2; right: 14px; bottom: 14px; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: rgba(0, 0, 0, .4); color: #fff; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.mh-av.clickable { cursor: pointer; }
.mh-name { margin-top: 12px; font-family: var(--display); font-size: 1.55em; font-weight: 800; letter-spacing: -.3px; overflow-wrap: anywhere; }
.mh-user { color: var(--text-3); font-size: .9em; margin-top: 2px; }
.mh-status { margin-top: 8px; max-width: 100%; padding: 5px 12px; border-radius: 12px; background: var(--bg-input); color: var(--text-2); font-size: .88em; overflow-wrap: anywhere; }
.mh-quick { margin-top: 16px; grid-template-columns: 1.35fr 1fr 1fr !important; }
.mh-quick .pc-tile.main { background: var(--accent); color: var(--on-accent, #fff); }
.mh-quick .pc-tile.main span { color: inherit; }
@media (max-width: 760px) {
  .modal-back.as-tab .sp-side:has(.me-hero) { padding-top: 0; }
  .modal-back.as-tab .sp-side:has(.me-hero) .sp-nav { padding-top: 16px; }
}

/* «Моя учётная запись»: баннер (картинка/GIF) фоном шапки, текст читается поверх */
.acc-hero { position: relative; overflow: hidden; isolation: isolate; }
.acc-bn { position: absolute; inset: 0; z-index: -1; }
.acc-bn::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, .15), rgba(0, 0, 0, .55)); }
.acc-hero .acc-hero-text h3, .acc-hero .acc-hero-text span { color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .5); }

/* ====================== редактор картинки ====================== */
.ie-modal { width: min(440px, 100%); }
.ie-stage { position: relative; width: 100%; max-height: 52vh; margin: 0 auto; overflow: hidden; border-radius: var(--r-lg); background: #0a0910 repeating-conic-gradient(#15131c 0 25%, #0e0d14 0 50%) 0 0 / 20px 20px; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.ie-stage:active { cursor: grabbing; }
.ie-img { position: absolute; left: 50%; top: 50%; max-width: none !important; pointer-events: none; transform-origin: center; }
.ie-frame { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .85); border-radius: inherit; }
.ie-stage.round .ie-frame { border-radius: 50%; box-shadow: 0 0 0 2000px rgba(0, 0, 0, .5), inset 0 0 0 2px rgba(255, 255, 255, .85); }
.ie-grid { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .2s; background: linear-gradient(90deg, transparent calc(33.33% - .5px), rgba(255, 255, 255, .35) 0 calc(33.33% + .5px), transparent 0 calc(66.66% - .5px), rgba(255, 255, 255, .35) 0 calc(66.66% + .5px), transparent 0), linear-gradient(180deg, transparent calc(33.33% - .5px), rgba(255, 255, 255, .35) 0 calc(33.33% + .5px), transparent 0 calc(66.66% - .5px), rgba(255, 255, 255, .35) 0 calc(66.66% + .5px), transparent 0); }
.ie-stage:active .ie-grid { opacity: 1; }
.ie-row { display: grid; grid-template-columns: 20px 104px 1fr 34px; align-items: center; gap: 8px; margin-top: 10px; color: var(--text-2); font-size: .9em; }
.ie-row svg { color: var(--accent-text); }
.ie-zoom { grid-template-columns: 20px 104px 1fr; margin-top: 14px; }
.ie-v { text-align: right; font-size: .85em; color: var(--text-3); font-variant-numeric: tabular-nums; }
.ie-tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.ie-tool { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 4px 7px; border-radius: 14px; background: var(--bg-input); color: var(--accent-text); font-size: .76em; font-weight: 700; }
.ie-tool span { color: var(--text-2); }
.ie-tool:active { transform: scale(.95); }
.ie-adjust { margin-top: 4px; }
.sp-react { display: contents; }
/* обёртка содержимого окна (openModal): дети — прямо в .modal-body, как раньше (flex, grid, gap) */
.rm-host { display: contents; }
.rm-foot:empty { display: none; }
.rp-host { display: contents; }

/* ====================== визитки серверов ====================== */
.card-art { position: absolute; inset: 0; z-index: -2; overflow: hidden; pointer-events: none; }
.card-art svg { width: 100%; height: 100%; display: block; transition: transform .6s var(--ease, ease); }
/* движение — только под курсором (и не во время демонстрации экрана) */
.card-art .drift, .card-art .tw { animation: none; }
:is(.dk-srv, .srv-hero):hover .card-art .drift { animation: card-drift 8s ease-in-out infinite alternate; }
:is(.dk-srv, .srv-hero):hover .card-art .tw { animation: card-tw 2.4s ease-in-out infinite alternate; }
:is(.dk-srv, .srv-hero):hover .card-art svg { transform: scale(1.05); }
@keyframes card-drift { to { transform: translateX(-30px); } }
@keyframes card-tw { to { opacity: .2; } }
html.perf-lite .card-art *, html[data-motion="reduce"] .card-art * { animation: none !important; transition: none !important; }

/* карточка сервера в списке */
.dk-srv.has-card { position: relative; isolation: isolate; overflow: hidden; min-height: 62px; border-radius: 14px; margin-bottom: 4px; }
.dk-srv.has-card::before { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(10, 8, 16, .86) 0%, rgba(10, 8, 16, .45) 60%, rgba(10, 8, 16, .05) 100%); }
.dk-srv.has-card .dm-name { color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
.dk-srv.has-card .dm-sub, .dk-srv.has-card .dk-tag { color: rgba(255, 255, 255, .85) !important; text-shadow: 0 1px 3px rgba(0, 0, 0, .7); }
.dk-srv.has-card .dk-onl { padding: 1px 7px; border-radius: 999px; background: rgba(0, 0, 0, .45); color: #fff; }
.dk-srv.has-card .gicon { box-shadow: 0 0 0 2px rgba(255, 255, 255, .9), 0 6px 16px rgba(0, 0, 0, .4); }
.dk-srv.has-card.active { outline: 2px solid var(--accent); outline-offset: -2px; }

/* шапка сервера над каналами */
.srv-hero.has-card { background: #0b0910; }
.srv-hero.has-card .srv-hero-in { background: linear-gradient(180deg, rgba(10, 8, 16, .1) 0%, rgba(10, 8, 16, .55) 45%, color-mix(in srgb, var(--panel-solid) 96%, transparent) 100%); padding-top: 34px; }
.srv-hero.has-card .srv-title, .srv-hero.has-card .srv-stats, .srv-hero.has-card .srv-tag { color: #fff; text-shadow: 0 1px 6px rgba(0, 0, 0, .5); }
.srv-hero.has-card .card-art { height: 120px; bottom: auto; }

/* выбор визитки в настройках */
.card-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.card-opt { position: relative; isolation: isolate; height: 48px; border-radius: 12px; overflow: hidden; outline: 2px solid transparent; outline-offset: 2px; text-align: left; }
.card-opt.on { outline-color: var(--accent); }
.card-opt span { position: absolute; left: 8px; bottom: 5px; font-size: 11.5px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); }
.card-opt.none { background: var(--bg-3); }
.card-opt.none span { color: var(--text-2); text-shadow: none; }
.card-opt:hover .card-art .drift { animation: card-drift 8s ease-in-out infinite alternate; }

/* ====================== ключ восстановления, сброс пароля ====================== */
.recovery-code { margin: 12px 0; padding: 14px; border-radius: 14px; background: var(--bg-3); font: 700 17px ui-monospace, Consolas, monospace; letter-spacing: .06em; text-align: center; word-break: break-all; user-select: all; }
.auth-forgot { margin: -6px 0 6px; text-align: right; font-size: .9em; }
.reset-flow { display: grid; gap: 12px; }
.reset-warn { display: flex; gap: 8px; align-items: flex-start; margin: 0; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--text-2); font-size: .92em; line-height: 1.45; }
.reset-warn .ic { flex: none; margin-top: 2px; color: var(--red); }

/* секретный чат (сквозное шифрование): замок и зелёное имя, как в Telegram */
.dm-name.secret { color: var(--green); }
.dm-lock { flex: none; margin-right: 4px; vertical-align: -1px; color: var(--green); }

/* заголовок колонки (на телефоне — шапка сервера): длинное название в одну строку с многоточием, а не в две огромные */
.side-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* карточка сервера: «Уведомления» целиком помещается в узкую кнопку */
.srv-act { padding-inline: 2px; letter-spacing: -.01em; }
/* вход: «Забыли пароль?» не прилипает к кнопке */
.auth-forgot { margin: 2px 0 0; text-align: center; }
/* поле ввода: длинная подсказка («Написать в «Группа с длинным названием»») в одну строку, поле не раздувается */
.composer textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* группа: идёт звонок без меня */
.call-join-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: color-mix(in srgb, var(--green) 12%, var(--panel-solid)); border-bottom: 1px solid var(--line); }
.call-join-bar .cj-faces { display: flex; }
.call-join-bar .cj-faces > * + * { margin-left: -6px; }
.call-join-bar .cj-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.call-join-bar .cj-text b { color: var(--green); font-size: .92em; }
.call-join-bar .cj-text small { color: var(--text-3); font-size: .8em; }
.call-join-bar.here { cursor: pointer; }
.call-join-bar.here:hover { background: color-mix(in srgb, var(--green) 18%, var(--panel-solid)); }
