/* ===== Дизайн-система ===== */
:root {
  --brand: #18181b; --on-brand: #ffffff; --brand-2: #52525b; --link: #2563eb;
  --grad: var(--brand);
  --bg: #f4f4f5; --card: #ffffff; --card-2: #fafafa; --border: #e4e4e7; --border-2: #d4d4d8;
  --text: #18181b; --text-2: #71717a; --text-3: #a1a1aa;
  --input: #f4f4f5; --hover: rgba(24, 24, 27, .05); --shadow: 0 8px 30px rgba(0, 0, 0, .08);
  --like: #e11d48; --whale: #0ea5e9; --bookmark: #f59e0b; --online: #22c55e; --danger: #ef4444; --success: #16a34a; --warn: #f59e0b;
  --plus: #a855f7; --radius: 18px; --radius-sm: 12px; --font: 15px;
  color-scheme: light;
}
[data-theme="dark"] {
  --brand: #f4f4f5; --on-brand: #18181b; --brand-2: #a1a1aa; --link: #60a5fa;
  --bg: #09090b; --card: #141416; --card-2: #18181b; --border: #27272a; --border-2: #3f3f46;
  --text: #f4f4f5; --text-2: #a1a1aa; --text-3: #52525b;
  --input: #1c1c1f; --hover: rgba(255, 255, 255, .05); --shadow: 0 8px 30px rgba(0, 0, 0, .4);
  color-scheme: dark;
}
[data-font="small"] { --font: 13.5px; }
[data-font="large"] { --font: 17px; }

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text);
  font-size: var(--font); line-height: 1.5; transition: background .25s, color .25s; }
a { color: inherit; text-decoration: none; }
img, video { max-width: 100%; }
button { font-family: inherit; }
::selection { background: color-mix(in srgb, var(--link) 25%, transparent); }

/* ===== Каркас ===== */
.layout { display: flex; min-height: 100vh; max-width: 1240px; margin: 0 auto; gap: 24px; padding: 0 16px; }
.layout.wide .main { max-width: 900px; }
.sidebar { width: 248px; padding: 18px 0; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; overflow-y: auto; scrollbar-width: none; }
.sidebar::-webkit-scrollbar { display: none; }
.logo { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 14px; border-radius: 16px; }
.logo img { width: 38px; height: 38px; border-radius: 11px; }
.logo-text { font-size: 23px; font-weight: 800; letter-spacing: -1px; color: var(--text); }
.nav-item { display: flex; align-items: center; gap: 14px; padding: 11px 14px; border-radius: 14px; color: var(--text-2); font-weight: 500; transition: background .15s, color .15s; position: relative; }
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active { color: var(--text); background: var(--hover); font-weight: 700; }
.nav-item.active .ico { color: var(--text); }
.ico { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ico svg, svg.i { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.badge-count { background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 7px; margin-left: auto; min-width: 20px; text-align: center; }
.nav-sep { height: 1px; background: var(--border); margin: 8px 14px; }
.nav-cta { margin: 12px 4px 0; }
.main { flex: 1; max-width: 620px; padding: 20px 0 40px; min-width: 0; }
.right { width: 320px; padding: 20px 0; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: none; }
.right::-webkit-scrollbar { display: none; }
.page-title { font-size: 22px; font-weight: 800; letter-spacing: -.5px; margin-bottom: 4px; display: flex; align-items: center; gap: 10px; }
.page-sub { color: var(--text-2); margin-bottom: 16px; font-size: 14px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; color: var(--text-2); }
.back-link:hover { background: var(--hover); color: var(--text); }

/* ===== Карточки и элементы ===== */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 12px; }
.card.flat { padding: 0; overflow: hidden; }
.card-title { font-weight: 700; font-size: 15px; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-title a { font-size: 13px; color: var(--link); font-weight: 600; }
.muted { color: var(--text-2); } .faint { color: var(--text-3); } .small { font-size: 13px; } .tiny { font-size: 11.5px; }
.row { display: flex; align-items: center; gap: 10px; } .row.wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.center { text-align: center; } .mt { margin-top: 12px; } .mb { margin-bottom: 12px; } .hidden { display: none !important; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.empty { text-align: center; color: var(--text-2); padding: 48px 16px; }
.empty .big { font-size: 42px; margin-bottom: 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: var(--brand); color: var(--on-brand); border: none; padding: 10px 20px;
  border-radius: 12px; cursor: pointer; font-size: 14px; font-weight: 700; transition: transform .12s, opacity .15s, box-shadow .15s;
  white-space: nowrap; }
.btn:hover { opacity: .88; }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 14px; font-size: 13px; border-radius: 10px; }
.btn.ghost { background: transparent; color: var(--text); border: 1.5px solid var(--border-2); box-shadow: none; font-weight: 600; }
.btn.ghost:hover { background: var(--hover); border-color: var(--text-3); }
.btn.soft { background: var(--input); color: var(--text); box-shadow: none; font-weight: 600; }
.btn.danger { background: var(--danger); box-shadow: none; }
.btn.danger.ghost { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn.pill { border-radius: 999px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; border: none; background: none; cursor: pointer; color: var(--text-2); transition: background .15s, color .15s; flex-shrink: 0; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

input, textarea, select { width: 100%; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: 12px; font-size: 14px; outline: none;
  font-family: inherit; background: var(--input); color: var(--text); transition: border .15s, background .15s; }
input:focus, textarea:focus, select:focus { border-color: var(--text-3); background: var(--card); }
textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--brand); }
input[type=color] { padding: 2px; height: 40px; width: 60px; }
input[type=file] { padding: 8px; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.check { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; cursor: pointer; }
.check input { margin-top: 3px; }
.check b { display: block; font-size: 14px; } .check small { color: var(--text-2); font-size: 12.5px; }
.form-row { display: flex; gap: 10px; } .form-row > * { flex: 1; }

.alert { border-radius: 12px; padding: 11px 14px; margin-bottom: 14px; font-size: 14px; border: 1px solid; }
.alert.error { background: color-mix(in srgb, var(--danger) 8%, transparent); border-color: color-mix(in srgb, var(--danger) 25%, transparent); color: var(--danger); }
.alert.success { background: color-mix(in srgb, var(--success) 8%, transparent); border-color: color-mix(in srgb, var(--success) 25%, transparent); color: var(--success); }
.alert.info { background: var(--input); border-color: var(--border); color: var(--text); }
.alert.warning { background: color-mix(in srgb, var(--warn) 10%, transparent); border-color: color-mix(in srgb, var(--warn) 30%, transparent); color: #b45309; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--input); font-size: 13px; font-weight: 600; color: var(--text-2); border: 1px solid transparent; cursor: pointer; white-space: nowrap; }
.chip:hover { color: var(--text); }
.chip.active { background: var(--text); color: var(--card); }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; margin-bottom: 12px; }
.chips::-webkit-scrollbar { display: none; }
.tag-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--input); color: var(--text-2); }

.tabs { display: flex; background: var(--card); border: 1px solid var(--border); border-radius: 14px; margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: 1; text-align: center; padding: 13px 12px; font-size: 14px; font-weight: 600; color: var(--text-2); border-bottom: 2.5px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); border-bottom-color: var(--text); }

/* ===== Аватары и бейджи ===== */
.av { border-radius: 50%; overflow: hidden; background: #71717a; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; position: relative; color: #fff; font-weight: 800; }
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.av-wrap { position: relative; display: inline-flex; flex-shrink: 0; }
.av-wrap .dot { position: absolute; bottom: 1px; right: 1px; width: 28%; height: 28%; min-width: 9px; min-height: 9px; background: var(--online); border-radius: 50%; border: 2px solid var(--card); }
.ring { padding: 2.5px; border-radius: 50%; background: var(--text); display: inline-flex; }
.ring.seen { background: var(--border-2); }
.ring > .av { border: 2.5px solid var(--card); }
.badge { display: inline-flex; align-items: center; justify-content: center; vertical-align: -3px; margin-left: 3px; }
.badge svg { width: 16px; height: 16px; }
.name-line { display: inline-flex; align-items: center; gap: 2px; min-width: 0; font-weight: 700; }
.plus-tag { font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: 6px; background: var(--brand); color: var(--on-brand); margin-left: 4px; vertical-align: 2px; }
.emoji-status { margin-left: 3px; }

/* ===== Пост ===== */
.post { padding: 16px 18px; }
.post-head { display: flex; gap: 12px; }
.post-body { flex: 1; min-width: 0; }
.post-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; }
.post-meta .handle, .post-meta .time { color: var(--text-2); font-size: 13px; }
.post-meta .time:hover { text-decoration: underline; }
.post-text { margin: 6px 0 10px; line-height: 1.6; word-wrap: break-word; overflow-wrap: anywhere; white-space: normal; }
.post-text.clamp { max-height: 220px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.rt-tag, .rt-mention, .rt-link { color: var(--link); font-weight: 500; }
.rt-tag:hover, .rt-mention:hover, .rt-link:hover { text-decoration: underline; }
.read-more { background: none; border: none; color: var(--link); font-weight: 700; cursor: pointer; font-size: 13px; padding: 0 0 8px; }
.repost-label { font-size: 12.5px; color: var(--text-2); font-weight: 600; display: flex; align-items: center; gap: 6px; margin: 0 0 8px 54px; }
.quote { border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; background: var(--card-2); }
.media { border-radius: 16px; overflow: hidden; margin-bottom: 10px; background: #000; border: 1px solid var(--border); }
.media img, .media video { display: block; width: 100%; max-height: 560px; object-fit: contain; cursor: zoom-in; }
.media video { cursor: auto; }
.media-grid { display: grid; gap: 3px; border-radius: 16px; overflow: hidden; margin-bottom: 10px; border: 1px solid var(--border); }
.media-grid.n2 { grid-template-columns: 1fr 1fr; } .media-grid.n3, .media-grid.n4, .media-grid.nmany { grid-template-columns: 1fr 1fr; }
.media-grid > * { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; cursor: zoom-in; background: #000; }
.media-grid.n3 > :first-child { grid-row: span 2; aspect-ratio: auto; height: 100%; }
.post-actions { display: flex; align-items: center; gap: 2px; margin-left: -8px; flex-wrap: wrap; }
.act { display: inline-flex; align-items: center; gap: 6px; background: none; border: none; cursor: pointer; font-size: 13px; color: var(--text-2); padding: 7px 10px; border-radius: 20px; font-weight: 600; transition: color .15s, background .15s; }
.act svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.act:hover { background: var(--hover); color: var(--text); }
.act.like.on, .act.like:hover { color: var(--like); } .act.like.on svg { fill: var(--like); }
.act.whale.on { color: var(--whale); }
.act.repost.on, .act.repost:hover { color: var(--success); }
.act.bm.on { color: var(--bookmark); } .act.bm.on svg { fill: var(--bookmark); }
.act .pop { animation: pop .35s ease; }
@keyframes pop { 50% { transform: scale(1.35); } }
.reaction-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.reaction-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; background: var(--input); font-size: 13px; border: 1.5px solid transparent; cursor: pointer; }
.reaction-pill.mine { border-color: var(--text-3); background: var(--card); }
.react-picker { position: absolute; bottom: 110%; left: 0; background: var(--card); border: 1px solid var(--border); border-radius: 999px; padding: 4px 6px; box-shadow: var(--shadow); display: flex; gap: 2px; z-index: 30; }
.react-picker button { font-size: 22px; background: none; border: none; cursor: pointer; padding: 4px; border-radius: 50%; transition: transform .1s; }
.react-picker button:hover { transform: scale(1.25); }
.post-tags { display: flex; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.pill-info { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--input); color: var(--text-2); }

.poll { border: 1.5px solid var(--border); border-radius: 14px; padding: 14px; margin-bottom: 10px; }
.poll-q { font-weight: 700; margin-bottom: 10px; }
.poll-opt { position: relative; display: block; width: 100%; margin-bottom: 8px; border-radius: 10px; padding: 10px 14px; background: var(--input); border: 1.5px solid var(--border); overflow: hidden; text-align: left; font-size: 14px; color: var(--text); cursor: pointer; }
.poll-opt:hover { border-color: var(--text-3); }
.poll-opt .bar { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--text) 8%, transparent); transition: width .5s; }
.poll-opt.mine .bar { background: color-mix(in srgb, var(--text) 16%, transparent); }
.poll-opt .lbl { position: relative; display: flex; justify-content: space-between; gap: 10px; }
.poll-opt.done { cursor: default; } .poll-opt.done:hover { border-color: var(--border); }

/* ===== Меню / модалки / тосты ===== */
.menu-wrap { position: relative; margin-left: auto; }
.menu { position: absolute; right: 0; top: 100%; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 6px; min-width: 210px; z-index: 40; box-shadow: var(--shadow); display: none; }
.menu.open { display: block; animation: fadein .12s; }
.menu button, .menu a { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 12px; border-radius: 9px; background: none; border: none; cursor: pointer; font-size: 14px; color: var(--text); }
.menu button:hover, .menu a:hover { background: var(--hover); }
.menu .danger { color: var(--danger); }
@keyframes fadein { from { opacity: 0; transform: translateY(-4px); } }
.modal-bg { position: fixed; inset: 0; background: rgba(8, 6, 16, .55); z-index: 200; display: none; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(4px); }
.modal-bg.open { display: flex; animation: fadein .15s; }
.modal { background: var(--card); border-radius: 20px; width: 100%; max-width: 520px; max-height: 88vh; overflow: auto; padding: 20px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; font-weight: 800; font-size: 17px; }
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .92); z-index: 300; display: none; align-items: center; justify-content: center; cursor: zoom-out; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 96vw; max-height: 94vh; object-fit: contain; }
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 400; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--text); color: var(--card); padding: 11px 18px; border-radius: 12px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow); animation: toastin .25s; max-width: 90vw; }
.toast.error { background: var(--danger); color: #fff; }
@keyframes toastin { from { opacity: 0; transform: translateY(10px); } }
.incoming-call { position: fixed; top: 16px; right: 16px; z-index: 500; background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 14px; box-shadow: var(--shadow); display: none; align-items: center; gap: 12px; min-width: 300px; }
.incoming-call.open { display: flex; animation: fadein .2s; }
.announce { border-radius: 14px; padding: 12px 16px; margin-bottom: 12px; font-size: 14px; font-weight: 600; display: flex; gap: 10px; align-items: center; color: var(--text); background: var(--card); border: 1px solid var(--border); }
.announce.warning { border-color: color-mix(in srgb, var(--warn) 50%, transparent); }
.announce.success { border-color: color-mix(in srgb, var(--success) 50%, transparent); }

/* ===== Композер ===== */
.composer textarea { border: none; background: transparent; padding: 6px 0; font-size: 17px; min-height: 60px; resize: none; }
.composer textarea:focus { background: transparent; }
.composer-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--border); padding-top: 10px; margin-top: 6px; flex-wrap: wrap; }
.composer-tools .tools { display: flex; gap: 2px; flex-wrap: wrap; }
.tool { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; border: none; background: none; cursor: pointer; color: var(--brand); }
.tool:hover { background: var(--hover); }
.tool svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tool.on { background: var(--input); color: var(--text); }
.counter { font-size: 12px; color: var(--text-3); font-weight: 600; }
.counter.warn { color: var(--warn); } .counter.over { color: var(--danger); }
.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; margin: 8px 0; }
.previews .pv { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: #000; }
.previews .pv img, .previews .pv video { width: 100%; height: 100%; object-fit: cover; }
.previews .pv button { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: none; background: rgba(0, 0, 0, .65); color: #fff; cursor: pointer; }
.composer-extra { border-top: 1px dashed var(--border); padding-top: 10px; margin-top: 10px; }
.composer-extra input, .composer-extra select { margin-bottom: 8px; }
.suggest { position: absolute; z-index: 60; background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); min-width: 220px; overflow: hidden; display: none; }
.suggest.open { display: block; }
.suggest div { display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; font-size: 14px; }
.suggest div.sel, .suggest div:hover { background: var(--hover); }

/* ===== Истории ===== */
.stories { display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 6px; scrollbar-width: none; }
.stories::-webkit-scrollbar { display: none; }
.story-item { display: flex; flex-direction: column; align-items: center; gap: 6px; flex-shrink: 0; width: 70px; }
.story-item span { font-size: 11.5px; font-weight: 600; max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story-add { width: 64px; height: 64px; border-radius: 50%; border: 2px dashed var(--border-2); display: flex; align-items: center; justify-content: center; color: var(--brand); }

/* ===== Профиль ===== */
.cover { height: 190px; background: var(--input); background-size: cover; background-position: center; position: relative; }
.profile-top { padding: 0 20px 18px; position: relative; }
.profile-av { margin-top: -56px; border: 4px solid var(--card); border-radius: 50%; display: inline-flex; background: var(--card); }
.profile-name { font-size: 22px; font-weight: 800; letter-spacing: -.4px; margin-top: 8px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.profile-stats { display: flex; gap: 18px; margin-top: 12px; font-size: 14px; flex-wrap: wrap; }
.profile-stats b { font-weight: 800; }
.profile-actions { position: absolute; right: 20px; top: 12px; display: flex; gap: 8px; }
.profile-links { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 13.5px; color: var(--text-2); }
.profile-links a { color: var(--link); font-weight: 600; }
.lvl-bar { height: 6px; background: var(--input); border-radius: 6px; overflow: hidden; }
.lvl-bar > div { height: 100%; background: var(--text); border-radius: 6px; }
.follows-you { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--input); color: var(--text-2); }
.highlights { display: flex; gap: 16px; overflow-x: auto; padding: 4px 20px 16px; scrollbar-width: none; }
.highlight { display: flex; flex-direction: column; align-items: center; gap: 6px; flex-shrink: 0; }
.highlight .hl { width: 62px; height: 62px; border-radius: 50%; border: 2px solid var(--border-2); overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--input); }
.highlight .hl img, .highlight .hl video { width: 100%; height: 100%; object-fit: cover; }
.media-tile { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 6px; background: #000; display: block; }
.media-tile img, .media-tile video { width: 100%; height: 100%; object-fit: cover; }
.media-tile .over { position: absolute; inset: auto 6px 6px auto; color: #fff; font-size: 12px; font-weight: 700; text-shadow: 0 1px 3px #000; }

/* ===== Люди ===== */
.user-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.user-row + .user-row { border-top: 1px solid var(--border); }
.user-row .info { flex: 1; min-width: 0; }
.user-row .info .bio { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-follow { padding: 7px 16px; border-radius: 999px; font-size: 13px; }

/* ===== Сообщения ===== */
.chat-list a.chat { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.chat-list a.chat:hover { background: var(--hover); }
.chat-list a.chat:last-child { border-bottom: none; }
.chat .preview { font-size: 13.5px; color: var(--text-2); }
.chat .preview.unread { color: var(--text); font-weight: 600; }
.unread-dot { background: var(--brand); color: var(--on-brand); font-size: 11px; font-weight: 800; border-radius: 10px; padding: 1px 7px; }
.convo { display: flex; flex-direction: column; height: calc(100vh - 40px); height: calc(100dvh - 40px); }
.convo-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--card); border: 1px solid var(--border); border-radius: 16px; margin-bottom: 8px; }
.convo-box { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 4px; background: var(--card); border: 1px solid var(--border); border-radius: 16px; }
.msg { display: flex; flex-direction: column; max-width: 78%; align-self: flex-start; position: relative; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.bubble { padding: 9px 13px; border-radius: 18px 18px 18px 6px; background: var(--input); word-wrap: break-word; overflow-wrap: anywhere; line-height: 1.45; position: relative; }
.msg.mine .bubble { background: var(--brand); color: var(--on-brand); border-radius: 18px 18px 6px 18px; }
.msg.mine .bubble a { color: inherit; text-decoration: underline; }
.bubble.deleted { background: transparent !important; color: var(--text-3) !important; font-style: italic; border: 1px dashed var(--border-2); }
.bubble img.att { display: block; max-width: 280px; max-height: 340px; border-radius: 12px; cursor: zoom-in; margin: -3px -7px 4px; }
.bubble video.circle { width: 210px; height: 210px; border-radius: 50%; object-fit: cover; display: block; }
.bubble audio { height: 34px; max-width: 240px; display: block; }
.msg.mine .bubble audio { filter: invert(1) hue-rotate(180deg); }
.bubble .file { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.msg-meta { font-size: 10.5px; color: var(--text-3); padding: 2px 6px; display: flex; gap: 6px; align-items: center; }
.msg-reply { font-size: 12px; padding: 5px 10px; border-left: 3px solid var(--text-3); background: var(--card-2); border-radius: 8px; margin-bottom: 3px; color: var(--text-2); max-width: 260px; cursor: pointer; }
.msg-fwd { font-size: 11.5px; color: var(--text-2); font-weight: 600; margin-bottom: 2px; }
.msg-reacts { display: flex; gap: 3px; margin-top: -6px; z-index: 1; }
.msg-reacts span { background: var(--card); border: 1px solid var(--border); border-radius: 999px; font-size: 12px; padding: 0 6px; }
.msg-tools { position: absolute; top: -14px; display: none; gap: 2px; background: var(--card); border: 1px solid var(--border); border-radius: 999px; padding: 2px 4px; box-shadow: var(--shadow); z-index: 5; }
.msg:not(.mine) .msg-tools { left: 10px; } .msg.mine .msg-tools { right: 10px; }
.msg:hover .msg-tools, .msg.tools-open .msg-tools { display: flex; }
.msg-tools button { background: none; border: none; cursor: pointer; padding: 3px 5px; border-radius: 50%; font-size: 14px; color: var(--text-2); }
.msg-tools button:hover { background: var(--hover); }
.msg.highlight .bubble { box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 60%, transparent); }
.day-sep { align-self: center; font-size: 11.5px; color: var(--text-2); background: var(--input); padding: 3px 10px; border-radius: 999px; margin: 8px 0; font-weight: 600; }
.convo-input { margin-top: 8px; background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 8px; }
.convo-input textarea { min-height: 42px; max-height: 140px; resize: none; border-radius: 20px; padding: 10px 14px; }
.reply-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-left: 3px solid var(--text-3); background: var(--card-2); border-radius: 8px; margin-bottom: 6px; font-size: 13px; }
.typing { font-size: 12px; color: var(--text-2); font-weight: 600; }
.emoji-panel { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 4px 2px; }
.emoji-panel button { font-size: 24px; background: none; border: none; cursor: pointer; padding: 4px; border-radius: 8px; }
.emoji-panel button:hover { background: var(--hover); }
.pinned-msg { display: flex; gap: 8px; align-items: center; padding: 8px 12px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; font-size: 13px; cursor: pointer; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }

/* ===== Истории (просмотр) ===== */
.story-stage { position: fixed; inset: 0; background: #000; z-index: 150; display: flex; align-items: center; justify-content: center; }
.story-frame { position: relative; width: 100%; max-width: 440px; height: 100%; max-height: 860px; background: #111; overflow: hidden; border-radius: 0; }
@media (min-width: 700px) { .story-frame { height: 92vh; border-radius: 18px; } }
.story-media { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.story-media img, .story-media video { width: 100%; height: 100%; object-fit: contain; }
.story-text { position: absolute; left: 20px; right: 20px; top: 50%; transform: translateY(-50%); text-align: center; color: #fff; font-size: 24px; font-weight: 800; text-shadow: 0 2px 10px rgba(0, 0, 0, .5); word-wrap: break-word; }
.story-text.over { top: auto; bottom: 110px; transform: none; font-size: 18px; background: rgba(0, 0, 0, .4); border-radius: 12px; padding: 8px 12px; }
.story-bars { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; gap: 4px; z-index: 5; }
.story-bars div { flex: 1; height: 3px; background: rgba(255, 255, 255, .3); border-radius: 3px; overflow: hidden; }
.story-bars div i { display: block; height: 100%; width: 0; background: #fff; }
.story-top { position: absolute; top: 22px; left: 12px; right: 12px; display: flex; align-items: center; gap: 10px; color: #fff; z-index: 5; }
.story-top .icon-btn { color: #fff; }
.story-nav { position: absolute; top: 80px; bottom: 90px; width: 35%; z-index: 4; cursor: pointer; }
.story-nav.prev { left: 0; } .story-nav.next { right: 0; }
.story-bottom { position: absolute; left: 12px; right: 12px; bottom: 14px; z-index: 6; display: flex; gap: 8px; align-items: center; }
.story-bottom input { background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .25); color: #fff; border-radius: 999px; }
.story-bottom input::placeholder { color: rgba(255, 255, 255, .7); }
.story-bottom button.r { background: none; border: none; font-size: 24px; cursor: pointer; transition: transform .1s; }
.story-bottom button.r:hover { transform: scale(1.2); } .story-bottom button.r.on { transform: scale(1.25); filter: drop-shadow(0 0 6px #fff); }

/* ===== Рилсы ===== */
.reels { height: 100vh; overflow-y: scroll; scroll-snap-type: y mandatory; scrollbar-width: none; }
.reels::-webkit-scrollbar { display: none; }
.reel { height: 100vh; scroll-snap-align: start; display: flex; align-items: center; justify-content: center; position: relative; }
.reel-frame { position: relative; height: 94vh; aspect-ratio: 9/16; max-width: 100vw; background: #000; border-radius: 18px; overflow: hidden; }
.reel-frame video { width: 100%; height: 100%; object-fit: cover; }
.reel-info { position: absolute; left: 14px; right: 70px; bottom: 18px; color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
.reel-side { position: absolute; right: 10px; bottom: 24px; display: flex; flex-direction: column; gap: 16px; align-items: center; color: #fff; }
.reel-side button, .reel-side a { background: rgba(0, 0, 0, .35); border: none; color: #fff; width: 46px; height: 46px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.reel-side small { font-size: 12px; font-weight: 700; margin-top: -10px; }
.reel-side button.on { color: var(--like); }
.reel-side svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2; }
.reel-side button.on svg { fill: var(--like); }

/* ===== Мобильная навигация ===== */
.mobile-top { display: none; position: sticky; top: 0; z-index: 90; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); padding: 10px 12px; align-items: center; justify-content: space-between; }
.mobile-nav { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--border); z-index: 100; padding-bottom: env(safe-area-inset-bottom); }
.mobile-nav-inner { display: flex; justify-content: space-around; align-items: center; height: 58px; }
.mobile-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-3); flex: 1; height: 58px; position: relative; gap: 2px; font-size: 10px; font-weight: 700; }
.mobile-nav a.active { color: var(--text); }
.mobile-nav a.active svg { color: var(--text); }
.mobile-nav svg { width: 23px; height: 23px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mobile-nav .fab { width: 46px; height: 46px; border-radius: 15px; background: var(--brand); display: flex; align-items: center; justify-content: center; color: var(--on-brand);  }
.mobile-nav .fab svg { color: var(--on-brand) !important; }
.mobile-nav .mbadge { position: absolute; top: 6px; left: calc(50% + 4px); background: var(--danger); color: #fff; font-size: 9.5px; font-weight: 800; border-radius: 8px; padding: 0 5px; min-width: 16px; text-align: center; line-height: 16px; }

/* ===== Прочее ===== */
.stat-tile { background: var(--card-2); border: 1px solid var(--border); border-radius: 14px; padding: 14px; }
.stat-tile b { display: block; font-size: 24px; font-weight: 800; letter-spacing: -.5px; }
.stat-tile span { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; }
.bars .b { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; align-items: center; }
.bars .b i { display: block; width: 100%; border-radius: 4px 4px 0 0; background: var(--brand); min-height: 2px; }
.bars .b i.p { background: var(--brand-2); }
.bars .b small { font-size: 9.5px; color: var(--text-3); }
.task { display: flex; align-items: center; gap: 14px; padding: 12px 0; }
.task + .task { border-top: 1px solid var(--border); }
.task .emo { width: 44px; height: 44px; border-radius: 13px; background: var(--input); display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.task.done .emo { background: color-mix(in srgb, var(--success) 14%, transparent); }
.task.done .t { color: var(--text-3); text-decoration: line-through; }
.hero { background: var(--card); }

.hero .lvl-bar { background: var(--input); }
.hero .lvl-bar > div { background: var(--text); }
.rank { width: 28px; font-weight: 800; color: var(--text-3); text-align: center; flex-shrink: 0; }
.rank.top { color: var(--warn); }
.ach { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 14px 8px; border-radius: 14px; background: var(--card-2); border: 1px solid var(--border); }
.ach .e { font-size: 30px; } .ach.locked { opacity: .45; filter: grayscale(1); }
.settings-nav { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-bottom: 12px; }
.settings-nav::-webkit-scrollbar { display: none; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { color: var(--text-2); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; }
.table-wrap { overflow-x: auto; }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: var(--bg); }
.auth-card { width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--border); border-radius: 24px; padding: 30px; box-shadow: var(--shadow); }
.auth-logo { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 22px; text-align: center; }
.auth-logo img { width: 58px; height: 58px; border-radius: 16px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 12px; margin: 16px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.kbd { display: inline-block; padding: 1px 7px; border-radius: 6px; border: 1px solid var(--border-2); background: var(--input); font-size: 12px; font-family: ui-monospace, monospace; }
.skeleton { background: linear-gradient(90deg, var(--input), var(--card-2), var(--input)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }
.load-more { display: block; width: 100%; padding: 14px; text-align: center; color: var(--text-2); font-weight: 600; }
.qr-box { background: #fff; padding: 16px; border-radius: 18px; display: inline-block; }

/* ===== Адаптивность ===== */
@media (max-width: 1100px) { .right { display: none; } }
@media (max-width: 900px) { .sidebar { width: 76px; } .logo-text, .nav-label, .nav-cta .lbl, .nav-sep { display: none; } .nav-item { justify-content: center; } .nav-item .badge-count { position: absolute; top: 4px; right: 6px; } .nav-cta .btn { padding: 12px; } }
@media (max-width: 640px) {
  .sidebar { display: none; } .mobile-nav { display: block; } .mobile-top { display: flex; }
  .layout { padding: 0 8px; gap: 0; } .main { padding: 6px 0 80px; }
  .card { border-radius: 16px; padding: 14px; } .post { padding: 14px; }
  .hide-mobile { display: none !important; }
  .act { padding: 7px 7px; gap: 4px; }
  .mobile-top .logo-text { display: inline; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .cover { height: 130px; } .profile-top { padding: 0 14px 14px; } .profile-actions { right: 14px; }
  .msg { max-width: 88%; }
  .chat-page .mobile-nav, .chat-page .mobile-top { display: none !important; }
  .chat-page .main { padding: 0; }
  .chat-page .convo { height: 100vh; height: 100dvh; padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); }
  .chat-page .convo-head { margin-bottom: 6px; }
  .chat-page .convo-input { margin-top: 6px; }
  .chat-page .convo-input textarea { font-size: 16px; }
  .reel-frame { height: 100vh; border-radius: 0; width: 100vw; aspect-ratio: auto; }
  .incoming-call { left: 12px; right: 12px; min-width: 0; }
}
