/* O2 · веб — та же дизайн-система, что в приложениях (ui/design/Theme.kt) */
@font-face { font-family: Inter; src: url(fonts/Inter_400Regular.ttf); font-weight: 400; font-display: swap; }
@font-face { font-family: Inter; src: url(fonts/Inter_500Medium.ttf); font-weight: 500; font-display: swap; }
@font-face { font-family: Inter; src: url(fonts/Inter_600SemiBold.ttf); font-weight: 600; font-display: swap; }
@font-face { font-family: Inter; src: url(fonts/Inter_700Bold.ttf); font-weight: 700; font-display: swap; }
@font-face { font-family: Inter; src: url(fonts/Inter_800ExtraBold.ttf); font-weight: 800; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url(fonts/JetBrainsMono_400Regular.ttf); font-weight: 400; font-display: swap; }

:root {
  --bg: #f6f6f3; --surface: #ffffff; --alt: #ededE9; --ink: #0b0b0c; --ink2: #3a3a3c;
  --muted: #8a8a8e; --faint: #c7c7c4; --line: #e3e3de; --on-ink: #ffffff;
  --sans: Inter, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --r-m: 16px; --r-l: 22px; --r-xl: 28px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #0a0a0b; --surface: #151517; --alt: #1f1f22; --ink: #f4f4f2; --ink2: #c9c9cc; --faint: #48484b; --line: #262628; --on-ink: #0a0a0b; }
}
:root[data-theme="dark"] { --bg: #0a0a0b; --surface: #151517; --alt: #1f1f22; --ink: #f4f4f2; --ink2: #c9c9cc; --faint: #48484b; --line: #262628; --on-ink: #0a0a0b; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 400 16px/22px var(--sans); letter-spacing: -0.1px; -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
#app { height: 100%; }
.mono { font-family: var(--mono); letter-spacing: 0.2px; }
.muted { color: var(--muted); }
.caption { font-size: 13px; line-height: 17px; font-weight: 500; color: var(--muted); }
.hidden { display: none !important; }
svg.i { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: block; }

/* типографика */
.display { font-size: 34px; line-height: 40px; font-weight: 800; letter-spacing: -0.9px; margin: 0; }
.title { font-size: 22px; line-height: 28px; font-weight: 700; letter-spacing: -0.4px; margin: 0; }
.headline { font-size: 17px; line-height: 22px; font-weight: 600; letter-spacing: -0.2px; }
.label { font-size: 11px; font-weight: 600; letter-spacing: 0.9px; text-transform: uppercase; color: var(--muted); margin: 24px 24px 8px; }

/* кнопки */
.btn { height: 54px; padding: 0 22px; border: 0; border-radius: 999px; background: var(--ink); color: var(--on-ink); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .15s, opacity .2s; }
.btn:active { transform: scale(.97); }
.btn:disabled { background: var(--alt); color: var(--muted); cursor: default; transform: none; }
.btn.sec { height: 48px; background: var(--alt); color: var(--ink); font-size: 15px; }
.btn.small { height: 40px; padding: 0 16px; font-size: 14px; }
.btn.wide { width: 100%; }
.ic { width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; display: grid; place-items: center; color: var(--ink); transition: transform .15s, background .2s; flex: none; }
.ic:hover { background: var(--alt); }
.ic:active { transform: scale(.9); }
.ic.fill { background: var(--ink); color: var(--on-ink); }
.ic.fill:disabled { background: var(--alt); color: var(--faint); }
.ic.big { width: 56px; height: 56px; }

/* поля */
.field { width: 100%; min-height: 54px; padding: 15px 16px; border: 0; border-radius: var(--r-m); background: var(--alt); outline: none; resize: none; }
.field::placeholder { color: var(--muted); }
.field.mono { font-family: var(--mono); font-size: 14px; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* сегменты */
.seg { position: relative; display: flex; height: 42px; padding: 3px; border-radius: 999px; background: var(--alt); }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 999px; color: var(--muted); font-size: 13px; font-weight: 500; position: relative; z-index: 1; transition: color .2s; }
.seg button.on { color: var(--ink); font-weight: 600; }
.seg .knob { position: absolute; top: 3px; bottom: 3px; border-radius: 999px; background: var(--surface); transition: left .28s cubic-bezier(.2,0,0,1); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 10px; border-radius: 999px; background: var(--surface); border: .7px solid var(--line); font-size: 13px; font-weight: 500; color: var(--ink2); white-space: nowrap; }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); position: relative; }
.pill.on .dot { background: var(--ink); }
.pill.on .dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; background: var(--ink); opacity: .25; animation: pulse 1.6s infinite; }
@keyframes pulse { from { transform: scale(.5); opacity: .35; } to { transform: scale(1.6); opacity: 0; } }
.tag { display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--alt); font-size: 12px; font-weight: 500; color: var(--ink2); }
.tag.on { background: var(--ink); color: var(--on-ink); }

/* аватары */
.avatar { position: relative; flex: none; display: grid; place-items: center; }
.avatar .disc { border-radius: 50%; display: grid; place-items: center; font-weight: 600; }
.avatar svg { position: absolute; inset: 0; }

/* карточки и группы */
.card { margin: 0 16px; background: var(--surface); border-radius: var(--r-l); padding: 16px; }
.group { margin: 0 16px; background: var(--surface); border-radius: var(--r-l); overflow: hidden; }
.grow { display: flex; align-items: center; gap: 14px; min-height: 54px; padding: 11px 16px; position: relative; }
.grow + .grow::before { content: ""; position: absolute; top: 0; right: 0; left: 62px; height: .7px; background: var(--line); }
.grow.click { cursor: pointer; }
.grow.click:hover { background: color-mix(in srgb, var(--alt) 50%, transparent); }
.grow .gi { width: 32px; height: 32px; border-radius: 9px; background: var(--alt); display: grid; place-items: center; flex: none; }
.grow .gi svg { width: 18px; height: 18px; }
.grow.danger .gi { background: var(--ink); color: var(--on-ink); }
.grow.danger .t { font-weight: 600; }
.grow .body { flex: 1; min-width: 0; }
.grow .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* вход */
.auth { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth .box { width: 100%; max-width: 400px; }
.auth .lead { color: var(--ink2); margin: 8px 0 32px; }
.auth .note { display: flex; gap: 8px; margin-top: 20px; color: var(--muted); }
.auth .note svg { flex: none; width: 16px; height: 16px; margin-top: 1px; }
.sys svg { flex: none; width: 15px; height: 15px; }
.err { margin-top: 14px; padding: 10px 14px; border-radius: 12px; background: var(--alt); font-weight: 600; font-size: 15px; }
.err:empty { display: none; }

/* основной экран */
.side { display: flex; flex-direction: column; min-height: 0; border-right: .7px solid var(--line); position: relative; }
.side .head { display: flex; align-items: center; gap: 10px; padding: 18px 16px 8px 20px; }
.side .head .display { flex: 1; }
.side .tabs { padding: 4px 16px 10px; }
.list { flex: 1; overflow-y: auto; padding-bottom: 96px; }
.chat-row { display: flex; align-items: center; gap: 14px; padding: 12px 20px; cursor: pointer; position: relative; }
.chat-row::after { content: ""; position: absolute; left: 88px; right: 0; bottom: 0; height: .7px; background: var(--line); }
.chat-row:hover { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.chat-row.on { background: var(--surface); }
.chat-row .meta { flex: 1; min-width: 0; }
.chat-row .prev { font-size: 15px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.chat-row .prev.unread { color: var(--ink2); }
.chat-row .right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; font-size: 13px; color: var(--muted); }
.badge { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--ink); color: var(--on-ink); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.req { margin: 4px 16px; padding: 16px; border-radius: var(--r-l); background: var(--surface); }
.req .top { display: flex; align-items: center; gap: 14px; }
.req .actions { display: flex; gap: 8px; margin-top: 14px; }
.req .actions .btn { flex: 1; height: 48px; }
.fab { position: absolute; right: 20px; bottom: 20px; }

.empty { text-align: center; padding: 72px 40px; }
.empty .mark-disc { width: 96px; height: 96px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; margin: 0 auto 20px; }

/* чат */
.pane { display: flex; flex-direction: column; min-height: 0; }
.pane .bar { display: flex; align-items: center; gap: 4px; height: 64px; padding: 0 8px; }
.pane .who { flex: 1; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 8px; border-radius: 14px; }
.pane .who:hover { background: var(--surface); }
.notice { margin: 4px 16px; padding: 10px 14px; border-radius: 12px; background: var(--alt); color: var(--ink2); font-size: 13px; }
.msgs { flex: 1; overflow-y: auto; padding: 8px 12px; display: flex; flex-direction: column; }
.sys { align-self: center; display: flex; gap: 8px; align-items: center; max-width: 340px; margin: 12px 0 20px; padding: 10px 14px; border-radius: 14px; background: var(--surface); font-size: 13px; color: var(--muted); }
.day { align-self: center; margin: 14px 0 10px; padding: 5px 12px; border-radius: 999px; background: var(--surface); font-size: 13px; font-weight: 500; color: var(--muted); }
.msg { max-width: min(300px, 78%); padding: 9px 12px 7px 14px; background: var(--surface); border-radius: 20px; align-self: flex-start; white-space: pre-wrap; word-break: break-word; margin-top: 8px; animation: rise .25s cubic-bezier(.2,0,0,1); }
.msg.join { margin-top: 2px; }
.msg.mine { background: var(--ink); color: var(--on-ink); align-self: flex-end; }
.msg:not(.mine).jt { border-top-left-radius: 6px; } .msg:not(.mine).jb { border-bottom-left-radius: 6px; }
.msg.mine.jt { border-top-right-radius: 6px; } .msg.mine.jb { border-bottom-right-radius: 6px; }
.msg .t { font-size: 11px; opacity: .55; text-align: right; margin-top: 2px; display: flex; gap: 3px; justify-content: flex-end; align-items: center; }
.msg .t svg { width: 14px; height: 14px; }
.msg.cipher .body { font-family: var(--mono); font-size: 14px; }
.msg.media { padding: 4px; }
.msg.media .t { padding: 2px 8px 4px; }
.msg img { display: block; width: 260px; max-width: 100%; border-radius: 16px; }
.file { display: flex; gap: 12px; align-items: center; min-width: 200px; }
.file .fi { width: 44px; height: 44px; border-radius: 12px; background: var(--alt); display: grid; place-items: center; flex: none; }
.msg.mine .file .fi { background: color-mix(in srgb, var(--on-ink) 14%, transparent); }
@keyframes rise { from { transform: translateY(6px); opacity: 0; } }

.compose { display: flex; gap: 6px; align-items: flex-end; padding: 8px 10px 12px; }
.compose textarea { flex: 1; min-height: 48px; max-height: 160px; padding: 13px 18px; border: 0; border-radius: 24px; background: var(--surface); outline: none; resize: none; }
.compose .ic { width: 48px; height: 48px; }

/* профиль */
.qr-card { margin: 0 16px; padding: 24px; border-radius: var(--r-xl); background: var(--surface); text-align: center; }
.qr-card .qr { width: 216px; margin: 0 auto 16px; }
.qr { background: #ffffff; border-radius: 16px; padding: 10px; }
.qr svg { width: 100%; height: auto; display: block; }
.wallet { margin: 0 16px; padding: 24px; border-radius: var(--r-xl); background: var(--ink); color: var(--on-ink); }
.wallet .num { font-size: 44px; line-height: 48px; font-weight: 700; letter-spacing: -1.6px; }
.wallet .dim { opacity: .6; }
.row2 { display: flex; gap: 8px; }
.row2 > * { flex: 1; }

/* модалки */
.modal { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,.35); backdrop-filter: blur(8px); animation: fade .2s; }
.sheet { width: 100%; max-width: 440px; max-height: 90vh; overflow-y: auto; background: var(--bg); border-radius: var(--r-xl); padding: 8px 0 20px; animation: rise .3s cubic-bezier(.2,0,0,1); }
.sheet .sh { display: flex; align-items: center; padding: 8px 8px 8px 24px; }
.sheet .sh .title { flex: 1; }
.sheet .pad { padding: 0 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 4px; padding: 0 16px; }
.grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: var(--surface); cursor: pointer; transition: transform .15s; }
.grid img:active { transform: scale(.96); }
.code-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px 0; font-family: var(--mono); font-size: 18px; letter-spacing: 1px; }
@keyframes fade { from { opacity: 0; } }

/* оверлеи */
.overlay { position: fixed; inset: 0; z-index: 20; background: var(--bg); animation: fade .25s; }
.overlay canvas { width: 100%; height: 100%; display: block; }
.overlay .center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.overlay .caption-box { position: absolute; left: 0; right: 0; bottom: 8%; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 0 24px; text-align: center; transition: opacity .5s, transform .5s; }
.overlay .caption-box.off { opacity: 0; transform: translateY(24px); }
.overlay .code-card { background: var(--surface); border-radius: 20px; padding: 18px 22px; font-family: var(--mono); font-size: 17px; line-height: 28px; letter-spacing: 1px; white-space: pre; }

.banner { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 15; width: min(460px, calc(100vw - 24px)); display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 22px; background: var(--surface); border: .7px solid var(--line); cursor: pointer; animation: drop .3s cubic-bezier(.2,0,0,1); }
@keyframes drop { from { transform: translate(-50%, -20px); opacity: 0; } }

@media (max-width: 760px) {
  .side { border-right: 0; }
}

/* палитры (как Palettes в ui/design/Theme.kt) */
:root[data-palette="ocean"] { --bg: #f3f6fa; --surface: #ffffff; --alt: #e6ecf4; --ink: #1e4fd8; --ink2: #2b3a55; --muted: #7d8799; --faint: #c3cbd8; --line: #dde3ec; --on-ink: #ffffff; }
:root[data-palette="ocean"][data-theme="dark"] { --bg: #0b1020; --surface: #141b2e; --alt: #1c2540; --ink: #7ea6ff; --ink2: #c3cee6; --muted: #8590a8; --faint: #3a4560; --line: #222b44; --on-ink: #0b1020; }
@media (prefers-color-scheme: dark) { :root[data-palette="ocean"]:not([data-theme="light"]) { --bg: #0b1020; --surface: #141b2e; --alt: #1c2540; --ink: #7ea6ff; --ink2: #c3cee6; --muted: #8590a8; --faint: #3a4560; --line: #222b44; --on-ink: #0b1020; } }
:root[data-palette="forest"] { --bg: #f3f7f3; --surface: #ffffff; --alt: #e5eee7; --ink: #1f7a4d; --ink2: #2c4337; --muted: #7c8a82; --faint: #c2d0c6; --line: #dce6df; --on-ink: #ffffff; }
:root[data-palette="forest"][data-theme="dark"] { --bg: #0a140f; --surface: #121e17; --alt: #1a2a21; --ink: #6fd3a0; --ink2: #c4dccd; --muted: #84978b; --faint: #35483d; --line: #1e2c24; --on-ink: #0a140f; }
@media (prefers-color-scheme: dark) { :root[data-palette="forest"]:not([data-theme="light"]) { --bg: #0a140f; --surface: #121e17; --alt: #1a2a21; --ink: #6fd3a0; --ink2: #c4dccd; --muted: #84978b; --faint: #35483d; --line: #1e2c24; --on-ink: #0a140f; } }
:root[data-palette="lilac"] { --bg: #f6f4fb; --surface: #ffffff; --alt: #ece7f7; --ink: #6b3fd8; --ink2: #3d3258; --muted: #877f99; --faint: #cdc5de; --line: #e4deef; --on-ink: #ffffff; }
:root[data-palette="lilac"][data-theme="dark"] { --bg: #100c1a; --surface: #19132a; --alt: #231b3b; --ink: #b49bff; --ink2: #d4ccea; --muted: #8f88a6; --faint: #41385c; --line: #261f3b; --on-ink: #100c1a; }
@media (prefers-color-scheme: dark) { :root[data-palette="lilac"]:not([data-theme="light"]) { --bg: #100c1a; --surface: #19132a; --alt: #231b3b; --ink: #b49bff; --ink2: #d4ccea; --muted: #8f88a6; --faint: #41385c; --line: #261f3b; --on-ink: #100c1a; } }
:root[data-palette="sunset"] { --bg: #faf5f2; --surface: #ffffff; --alt: #f3e8e2; --ink: #c2512b; --ink2: #573a2f; --muted: #9a8378; --faint: #ddcbc2; --line: #eee1da; --on-ink: #ffffff; }
:root[data-palette="sunset"][data-theme="dark"] { --bg: #160f0c; --surface: #211714; --alt: #2d201b; --ink: #ff9a6b; --ink2: #e6d2c9; --muted: #a38c82; --faint: #4e3b33; --line: #2e221d; --on-ink: #160f0c; }
@media (prefers-color-scheme: dark) { :root[data-palette="sunset"]:not([data-theme="light"]) { --bg: #160f0c; --surface: #211714; --alt: #2d201b; --ink: #ff9a6b; --ink2: #e6d2c9; --muted: #a38c82; --faint: #4e3b33; --line: #2e221d; --on-ink: #160f0c; } }
:root[data-palette="night"] { --bg: #000000; --surface: #0e0e0f; --alt: #18181a; --ink: #f4f4f2; --ink2: #c9c9cc; --faint: #48484b; --line: #1c1c1e; --on-ink: #0a0a0b; color-scheme: dark; }
.swatches { display: flex; gap: 14px; overflow-x: auto; padding: 14px 16px; }
.swatch { display: flex; flex-direction: column; align-items: center; gap: 6px; background: none; border: 0; padding: 0; }
.swatch .dot { width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); display: block; }
.swatch.on .dot { outline: 2.5px solid var(--ink); outline-offset: 2px; }
.swatch[data-p="mono"] .dot { background: radial-gradient(circle, #0b0b0c 0 11px, #f6f6f3 12px); }
.swatch[data-p="ocean"] .dot { background: radial-gradient(circle, #1e4fd8 0 11px, #f3f6fa 12px); }
.swatch[data-p="forest"] .dot { background: radial-gradient(circle, #1f7a4d 0 11px, #f3f7f3 12px); }
.swatch[data-p="lilac"] .dot { background: radial-gradient(circle, #6b3fd8 0 11px, #f6f4fb 12px); }
.swatch[data-p="sunset"] .dot { background: radial-gradient(circle, #c2512b 0 11px, #faf5f2 12px); }
.swatch[data-p="night"] .dot { background: radial-gradient(circle, #f4f4f2 0 11px, #000 12px); }
.msg .fwd { font-size: 12px; opacity: .65; margin-bottom: 2px; }
.editbar { display: flex; align-items: center; gap: 10px; padding: 6px 12px 0 18px; }

/* запись голосового */
.ic.rec { background: var(--ink); color: var(--bg); font-size: 12px; min-width: 56px; border-radius: 999px; }

/* ── 1.4: всплывающее меню, вкладки-иконки, фон чата, голосовые, видео-квадраты, записи ── */
.pop-scrim { position: fixed; inset: 0; z-index: 30; }
.pop { position: fixed; z-index: 31; min-width: 210px; background: var(--surface); border-radius: 18px; padding: 6px; box-shadow: 0 14px 44px rgba(0,0,0,.2), 0 2px 8px rgba(0,0,0,.08); animation: popin .16s cubic-bezier(.2,0,0,1); }
.pop-item { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; color: var(--ink); font: inherit; padding: 10px 12px; border-radius: 12px; cursor: pointer; text-align: left; }
.pop-item:hover { background: var(--alt); }
.pop-item.danger { color: #d93025; }
@keyframes popin { from { opacity: 0; transform: scale(.94) translateY(4px); } }
.tabbar { display: flex; gap: 4px; background: var(--alt); border-radius: 999px; padding: 4px; }
.tabbar button { flex: 1; height: 40px; border: 0; background: none; border-radius: 999px; color: var(--muted); display: grid; place-items: center; cursor: pointer; transition: background .2s, color .2s; }
.tabbar button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.msgs {
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--ink) 10%, transparent) 1px, transparent 0),
    radial-gradient(120% 60% at 100% 0%, color-mix(in srgb, var(--ink) 7%, transparent), transparent 60%),
    radial-gradient(90% 50% at 0% 100%, color-mix(in srgb, var(--ink) 5%, transparent), transparent 60%);
  background-size: 22px 22px, 100% 100%, 100% 100%;
  background-attachment: local, scroll, scroll;
}
.vp { display: flex; align-items: center; gap: 10px; min-width: 230px; max-width: 280px; padding: 2px 0; }
.vp-btn { width: 42px; height: 42px; flex: none; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; background: var(--ink); color: var(--on-ink); }
.vp.mine .vp-btn { background: color-mix(in srgb, currentColor 16%, transparent); color: inherit; }
.vp-mid { flex: 1; min-width: 0; }
.vp-bar { position: relative; height: 22px; cursor: pointer; touch-action: none; }
.vp-track, .vp-fill { position: absolute; left: 0; top: 9.5px; height: 3px; border-radius: 3px; }
.vp-track { right: 0; background: currentColor; opacity: .25; }
.vp-fill { width: 0; background: currentColor; }
.vp-knob { position: absolute; top: 5px; left: -6px; width: 12px; height: 12px; border-radius: 50%; background: currentColor; }
.vp-row { display: flex; align-items: center; gap: 8px; font-size: 12px; opacity: .8; }
.vp-time { flex: 1; }
.vp-speed { border: 0; font: 700 12px var(--sans); color: inherit; background: color-mix(in srgb, currentColor 12%, transparent); border-radius: 8px; padding: 2px 7px; cursor: pointer; }
.vp-spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.vsq { width: 240px; height: 240px; border-radius: 28px; overflow: hidden; background: color-mix(in srgb, currentColor 8%, transparent); display: grid; place-items: center; cursor: pointer; }
.vsq-ph { display: grid; place-items: center; gap: 6px; }
.vsq video { width: 100%; height: 100%; object-fit: cover; display: block; }
.post { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.post-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.post-head .ic { margin-left: auto; width: 32px; height: 32px; }
.post-media { margin-top: 8px; border-radius: 16px; overflow: hidden; }
.post-media img { width: 100%; max-height: 520px; object-fit: cover; display: block; border-radius: 16px; }
.car { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.car::-webkit-scrollbar { display: none; }
.car-item { flex: 0 0 100%; scroll-snap-align: center; display: grid; place-items: center; }
.car-dots { display: flex; justify-content: center; gap: 5px; padding: 8px 0 0; }
.car-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); transition: background .2s, width .2s; }
.car-dots span.on { background: var(--ink); width: 14px; border-radius: 3px; }
.post-actions { display: flex; justify-content: space-between; max-width: 360px; margin-top: 8px; }
.pa { display: flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--muted); font: 500 13px var(--sans); padding: 6px 8px; margin-left: -8px; border-radius: 999px; cursor: pointer; }
.pa:hover { background: var(--alt); color: var(--ink); }
.pa.on { color: #e0245e; }
.pa.on svg path { fill: currentColor; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 0 16px 8px; }
.chip { display: flex; align-items: center; gap: 8px; flex: none; border: 0; background: var(--surface); color: var(--ink); font: 500 14px var(--sans); padding: 6px 12px 6px 6px; border-radius: 999px; cursor: pointer; }

/* стикеры: крупно и без пузыря */
.msg.sticker { background: none !important; box-shadow: none; padding: 0; }
.msg.sticker .stk { font-size: 96px; line-height: 1.05; animation: stkpop .35s cubic-bezier(.3,1.6,.5,1); }
.msg.sticker .t { background: color-mix(in srgb, var(--surface) 85%, transparent); color: var(--ink2); border-radius: 999px; padding: 1px 8px; display: inline-flex; }
@keyframes stkpop { from { transform: scale(.4); } }
.stk-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; }
.stk-cell { aspect-ratio: 1; border: 0; background: none; font-size: 32px; border-radius: 14px; cursor: pointer; }
.stk-cell:hover { background: var(--alt); }
.chip.on { background: var(--ink); color: var(--on-ink); }

/* панель эмодзи и стикеров под полем ввода */
.stk-panel { height: 300px; display: flex; flex-direction: column; background: var(--surface); border-top: 1px solid var(--line); }
.stk-body { flex: 1; overflow-y: auto; padding: 0 10px 10px; }
.emo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); }
.emo-cell { aspect-ratio: 1; border: 0; background: none; font-size: 26px; border-radius: 12px; cursor: pointer; }
.emo-cell:hover { background: var(--alt); }
.stk-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)) !important; }
.stk-cell img { width: 100%; height: 100%; object-fit: contain; }
.msg.sticker .stk-img { width: 150px; height: 150px; display: block; animation: stkpop .35s cubic-bezier(.3,1.6,.5,1); }

/* видеосообщение-кружок: без пузыря, обводка = прогресс, раскрывается со звуком */
.msg.note .t { margin-top: 4px; }
.vnote { position: relative; width: 210px; height: 210px; transition: width .3s cubic-bezier(.2,.8,.2,1), height .3s cubic-bezier(.2,.8,.2,1); cursor: pointer; touch-action: pan-y; }
.vnote.open { width: min(300px, 70vw); height: min(300px, 70vw); touch-action: none; }
.vnote-in { position: absolute; inset: 6px; border-radius: 32%; overflow: hidden; background: var(--alt, rgba(127,127,127,.12)); display: grid; place-items: center; }
.vnote-in video { width: 100%; height: 100%; object-fit: cover; display: block; }
.vnote-mute { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); font-size: 12px; background: rgba(0,0,0,.45); border-radius: 999px; padding: 3px 6px; pointer-events: none; transition: opacity .2s; }
.vnote.open .vnote-mute { opacity: 0; }
.vnote-ring { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.vnote-ring path { fill: none; vector-effect: non-scaling-stroke; }
.vnote-ring .trk { stroke: color-mix(in srgb, var(--ink) 14%, transparent); stroke-width: 2px; }
.vnote-ring .done { stroke: var(--ink); stroke-width: 4px; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; opacity: 0; transition: opacity .25s, stroke-width .15s; }
.vnote.open .vnote-ring .done { opacity: 1; }
.vnote.seeking .vnote-ring .done { stroke-width: 7px; }

/* наборы стикеров вкладками */
.stk-packs { display: flex; gap: 4px; overflow-x: auto; padding: 0 2px 6px; scrollbar-width: none; }
.stk-pack { flex: none; width: 46px; height: 46px; border: 0; border-radius: 14px; background: none; display: grid; place-items: center; cursor: pointer; padding: 0; }
.stk-pack.on { background: color-mix(in srgb, var(--ink) 10%, transparent); }
.stk-pack-img { width: 38px; height: 38px; }
.stk-pack .stk-emo { font-size: 24px; }
.stk-cell .stk-emo { font-size: 44px; line-height: 1; }
.msg.sticker .stk { cursor: pointer; }
.msg.sticker .stk.wiggle { animation: stkwig .6s ease-in-out; }
@keyframes stkwig { 0%,100% { transform: rotate(0) scale(1); } 20% { transform: rotate(-12deg) scale(.9); } 45% { transform: rotate(10deg) scale(1.08); } 70% { transform: rotate(-6deg); } }

/* звонок */
.call-log { align-self: center; margin: 8px auto; background: var(--surface); color: var(--ink2); border-radius: 999px; padding: 6px 14px; font-size: 13px; cursor: pointer; }
.call { position: fixed; inset: 0; z-index: 100; background: linear-gradient(#15161a, #060607); color: #fff; display: flex; flex-direction: column; align-items: center; animation: rise .25s; }
.call-remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.call-local { position: absolute; top: 16px; right: 16px; width: 140px; height: 190px; object-fit: cover; border-radius: 18px; transform: scaleX(-1); background: #000; }
.call-top { position: relative; margin-top: 12vh; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.call-top.over { margin-top: 24px; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.call-av { width: 120px; height: 120px; border-radius: 50%; background: #2a2b31; display: grid; place-items: center; font: 700 48px var(--sans); margin-bottom: 14px; }
.call-av.pulse { box-shadow: 0 0 0 0 rgba(255,255,255,.18); animation: callpulse 1.8s infinite; }
@keyframes callpulse { 70% { box-shadow: 0 0 0 26px rgba(255,255,255,0); } 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); } }
.call-name { font: 700 30px var(--sans); }
.call-status { opacity: .75; }
.call-route { color: rgba(255,255,255,.55) !important; }
.call-bottom { position: absolute; bottom: 40px; left: 0; right: 0; display: flex; justify-content: center; }
.call-row { display: flex; gap: 22px; justify-content: center; margin-bottom: 22px; }
.call-row.wide { gap: 90px; }
.call-btn-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.call-btn-wrap .caption { color: rgba(255,255,255,.7) !important; }
.call-btn { width: 60px; height: 60px; border-radius: 50%; border: 0; background: rgba(255,255,255,.16); color: #fff; font-size: 22px; cursor: pointer; }
.call-btn.on { background: #fff; color: #000; }
.call-btn.red { background: #e5484d; }
.call-btn.green { background: #2bb673; }
.call-btn.big, .call-row.wide .call-btn { width: 72px; height: 72px; }

/* кто есть кто: подтверждённый ник рядом с ФИО, двойники — с пометкой */
.id-tag { font: 500 12px var(--sans); color: var(--muted); margin-left: 6px; }
.id-tag.warn { color: var(--ink); background: color-mix(in srgb, var(--ink) 8%, transparent); border-radius: 999px; padding: 1px 6px; }
.twin { margin: 6px 12px 10px; background: var(--ink); color: var(--bg); border-radius: 20px; padding: 16px; }
.twin p { opacity: .8; margin: 4px 0 10px; font-size: 14px; }
.twin .btn { background: var(--bg); color: var(--ink); }

/* звонок: кнопки компактнее, в один ряд */
.call-row { gap: 10px; flex-wrap: nowrap; margin-bottom: 0; }
.call-btn { width: 54px; height: 54px; font-size: 20px; }
.call-btn-wrap .caption { font-size: 10px; max-width: 64px; text-align: center; }
.call-bottom { bottom: 28px; padding: 0 8px; }

/* мелочи вёрстки */
.empty { max-width: 460px; margin: auto; padding: 72px 24px; }
.empty p { overflow-wrap: anywhere; }
.auth a, .caption a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.compose textarea { min-width: 0; }
@media (max-width: 420px) {
  .bar .ic { width: 38px; height: 38px; }
  .bar .who .caption { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
}

.call-log.missed { color: var(--ink); font-weight: 700; }

/* вопрос «объединить похожие чаты?» */
.dups { margin: 6px 12px; padding: 14px 16px; border-radius: 18px; background: var(--surface); }
.dups b { display: block; color: var(--ink); }
.dups p { margin: 4px 0 6px; color: var(--muted); font-size: 14px; line-height: 1.35; }
.dups .caption { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dups .row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* ── 1.7.4: раскладка ПК как во «ВКонтакте» ── */
/* полосы прокрутки — тонкие и только по делу; горизонтальные ленты листаются без полосы */
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--ink) 18%, transparent) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--ink) 18%, transparent); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
.swatches, .chips, .stk-packs { scrollbar-width: none; }
.swatches::-webkit-scrollbar, .chips::-webkit-scrollbar, .stk-packs::-webkit-scrollbar { display: none; }
html, body { overflow: hidden; }

.main { display: flex; flex-direction: column; height: 100%; }
.shell { flex: 1; min-height: 0; display: flex; }
.content { flex: 1; min-width: 0; display: grid; grid-template-columns: 380px minmax(0, 1fr); min-height: 0; }
.top, .nav { display: none; }

@media (min-width: 1000px) {
  .top { display: block; flex: none; height: 56px; background: var(--surface); border-bottom: .7px solid var(--line); }
  .top-in { max-width: 1320px; height: 100%; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 14px; }
  .brand { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 6px 8px 6px 0; width: 236px; font: 700 22px var(--sans); letter-spacing: -.4px; color: var(--ink); }
  .me { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 4px 12px 4px 4px; border-radius: 999px; font-weight: 600; font-size: 15px; max-width: 260px; }
  .me span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .me:hover, .brand:hover { background: var(--alt); }
  .brand:hover { border-radius: 12px; }

  .shell { width: 100%; max-width: 1320px; margin: 0 auto; padding: 16px 20px; gap: 16px; }
  .nav { display: flex; flex-direction: column; width: 220px; flex: none; }
  .nav-item { display: flex; align-items: center; gap: 14px; height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: none; color: var(--ink); font-size: 16px; text-align: left; }
  .nav-item svg.i { color: var(--ink2); }
  .nav-item span { flex: 1; white-space: nowrap; }
  .nav-item:hover { background: color-mix(in srgb, var(--surface) 60%, transparent); }
  .nav-item.on { background: var(--surface); font-weight: 600; }
  .nav-item.on svg.i { color: var(--ink); }
  .nav-sep { height: .7px; background: var(--line); margin: 10px 12px; }
  .nav-foot { margin-top: auto; padding: 4px 12px; }

  /* содержимое — белая карточка; свои плашки внутри — прежним фоном */
  .content { background: var(--surface); border-radius: 14px; overflow: hidden; grid-template-columns: 360px minmax(0, 1fr); }
  .content .side { border-right: .7px solid var(--line); }
  .content .card, .content .group, .content .req, .content .qr-card, .content .dups, .content .chip,
  .content .sys, .content .day, .content .call-log, .content .compose textarea, .content .seg .knob,
  .content .tabbar button.on, .content .chat-row.on, .content .empty .mark-disc { background: var(--bg); }
  .content .chat-row:hover { background: color-mix(in srgb, var(--bg) 70%, transparent); }
  .content .msg:not(.mine):not(.sticker) { background: var(--bg); }
  .content .msgs { background-color: var(--surface); }
  .content .pane .who:hover { background: var(--bg); }

  .side .tabs { display: none; }
  .side .head .pill { display: none; }
  .side .head .display { font-size: 22px; line-height: 28px; letter-spacing: -.4px; }
  .main.tab-chats .fab { display: none; }

  /* остальные вкладки: карточка по центру, чат не показываем */
  .main:not(.tab-chats) .content { grid-template-columns: minmax(0, 1fr); max-width: 860px; }
  .main:not(.tab-chats) .content .pane { display: none; }
  .main:not(.tab-chats) .content .side { border-right: 0; }
  .main:not(.tab-chats) .shell { justify-content: flex-start; }
}

@media (max-width: 999px) {
  .content { grid-template-columns: 380px minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .content { grid-template-columns: minmax(0, 1fr); }
  .main.chat-open .side { display: none; }
  .main:not(.chat-open) .pane { display: none; }
}

/* редактор записи на странице */
.editor { margin: 6px 12px 10px; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: .7px solid var(--line); transition: box-shadow .2s, border-color .2s; }
.content .editor { background: var(--bg); }
.editor.drag { border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 12%, transparent); }
.ed-row { display: flex; gap: 12px; align-items: flex-start; }
.ed-row textarea { flex: 1; min-width: 0; border: 0; outline: none; background: none; resize: none; padding: 9px 0; font-size: 16px; line-height: 22px; max-height: 420px; overflow-y: auto; }
.editor.open .ed-row textarea { min-height: 88px; }
.editor.reply.open .ed-row textarea { min-height: 44px; }
.editor .ed-quick { width: 40px; height: 40px; color: var(--muted); }
.editor.open .ed-quick { display: none; }
.editor:not(.open) .ed-who, .editor:not(.open) .ed-bar, .editor:not(.open) .ed-thumbs { display: none; }
.ed-who { padding: 4px 0 6px; align-items: center; }
.ed-who .caption { flex: none; align-self: center; }
.ed-thumbs { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 0; }
.ed-thumbs:empty { display: none; }
.ed-thumb { position: relative; width: 104px; height: 104px; border-radius: 12px; overflow: hidden; background: var(--alt); }
.ed-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ed-file { height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px; padding: 8px; font-size: 12px; color: var(--ink2); text-align: center; overflow: hidden; }
.ed-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.ed-x { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 16px; line-height: 22px; padding: 0; }
.ed-bar { display: flex; align-items: center; gap: 4px; border-top: .7px solid var(--line); margin-top: 8px; padding-top: 8px; }
.ed-bar .ic { width: 38px; height: 38px; color: var(--ink2); }
.ed-bar .btn.small { height: 36px; }
.ed-bar .caption { margin-right: 6px; }

/* отступы: «.pad» вне модалок, группы внутри «.pad» не прилипают к краям */
.list > .pad, .list > p.caption { padding: 8px 20px; margin: 0; }
.pad > .group { margin-left: 0 !important; margin-right: 0 !important; }
.side .head .ic { width: 40px; height: 40px; }
.post-actions { max-width: 300px; }
@media (min-width: 1000px) {
  .side .head { padding: 18px 20px 8px 24px; }
  .post { padding: 14px 24px; }
  .list > .label { margin-left: 24px; }
}

/* редактор: крупнее и с подписями у инструментов */
.editor.open { padding: 14px 16px 10px; box-shadow: 0 6px 24px rgba(0,0,0,.06); }
.editor.open .ed-row textarea { min-height: 140px; font-size: 17px; line-height: 24px; }
.editor.reply.open .ed-row textarea { min-height: 56px; font-size: 16px; }
.ed-tool { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border: 0; border-radius: 10px; background: none; color: var(--ink2); font-size: 14px; }
.ed-tool:hover { background: var(--alt); color: var(--ink); }
.ed-tool svg.i { width: 20px; height: 20px; }
.ed-emo { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); max-height: 180px; overflow-y: auto; padding: 6px 0; border-top: .7px solid var(--line); margin-top: 6px; }
.ed-emo .emo-cell { font-size: 22px; }
@media (max-width: 520px) { .ed-tool span { display: none; } }

/* 1.7.7: полос прокрутки не видно нигде — листается колесом, тачпадом и пальцем как обычно */
*, *::before, *::after { scrollbar-width: none !important; }
*::-webkit-scrollbar { display: none !important; width: 0 !important; height: 0 !important; }
/* логотип: без серой подложки при наведении — только лёгкое затухание */
.brand:hover, .brand { background: none !important; border-radius: 0; }
.brand { transition: opacity .15s; padding: 6px 0; }
.brand:hover { opacity: .7; }
.me { transition: background .15s; }
/* выбор «от имени» и страниц: видимые таблетки с обводкой, выбранная — тёмная */
.chip, .content .chip { background: var(--surface); border: .7px solid var(--line); }
.content .chip { background: var(--surface); }
.editor .chip { background: var(--surface); }
.chip.on, .content .chip.on, .editor .chip.on { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.chip:hover:not(.on) { border-color: var(--faint); }
.ed-who { gap: 6px; flex-wrap: wrap; overflow: visible; }

/* переключатель (комментарии к записям) */
.switch { appearance: none; -webkit-appearance: none; width: 46px; height: 28px; border-radius: 999px; background: var(--alt); border: .7px solid var(--line); position: relative; cursor: pointer; flex: none; transition: background .2s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: transform .2s, background .2s; }
.switch:checked { background: var(--ink); border-color: var(--ink); }
.switch:checked::after { transform: translateX(18px); background: var(--on-ink); }

/* счётчики в шапке профиля / страницы */
.stats { display: flex; justify-content: center; gap: 28px; margin: 14px 0 4px; }
.stats .stat { display: flex; flex-direction: column; align-items: center; }
.stats .stat b { font-size: 18px; font-weight: 700; color: var(--ink); }
.stats .stat span { font-size: 12px; color: var(--muted); }

/* «Кого вы читаете?» — источники чипами с аватарками */
.src-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.src-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 4px 14px 4px 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; cursor: pointer; }
.src-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.src-chip.on { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.src-chip .avatar, .src-chip .disc { flex: none; }
