/* =========================================================
   Темы оформления. Каждая тема — полный набор цветов.
   --a1 / --a2 — два цвета градиента, --on-a — текст на градиенте.
   ========================================================= */
[data-theme="lavender"]   { color-scheme: light; --bg:#f4f0ff; --surface:#ffffff; --surface-2:#ece6ff; --text:#1d1433; --muted:#776c93; --line:#e4dcf8; --a1:#7b3dff; --a2:#ff3fb4; --on-a:#ffffff; }
[data-theme="neon"]       { color-scheme: dark;  --bg:#0f0a1c; --surface:#1a1230; --surface-2:#251a43; --text:#f4efff; --muted:#a294c9; --line:#30245a; --a1:#ff2f92; --a2:#7c4dff; --on-a:#ffffff; }
[data-theme="sunset"]     { color-scheme: light; --bg:#fff3ea; --surface:#ffffff; --surface-2:#ffe6d6; --text:#2a140c; --muted:#957062; --line:#f6dccc; --a1:#ff5a1f; --a2:#ff2e74; --on-a:#ffffff; }
[data-theme="ocean"]      { color-scheme: light; --bg:#eaf5fc; --surface:#ffffff; --surface-2:#d9edf9; --text:#0b2233; --muted:#5a7889; --line:#d0e5f2; --a1:#0071f2; --a2:#00bfbb; --on-a:#ffffff; }
[data-theme="forest"]     { color-scheme: dark;  --bg:#0c1712; --surface:#13241b; --surface-2:#1b3226; --text:#e9f7ee; --muted:#90b29d; --line:#244335; --a1:#2fd982; --a2:#c8f031; --on-a:#062012; }
[data-theme="cosmos"]     { color-scheme: dark;  --bg:#070b1a; --surface:#0f1630; --surface-2:#182246; --text:#eaf0ff; --muted:#8c99c6; --line:#222e5a; --a1:#3d6bff; --a2:#00d9ff; --on-a:#ffffff; }
[data-theme="lemonade"]   { color-scheme: light; --bg:#fffbe3; --surface:#ffffff; --surface-2:#fff2b8; --text:#2b2300; --muted:#857a47; --line:#f2e6a6; --a1:#ff7a00; --a2:#ffc400; --on-a:#2b1600; }
[data-theme="graphite"]   { color-scheme: dark;  --bg:#141518; --surface:#1d1f23; --surface-2:#272a30; --text:#f1f2f4; --muted:#8f949d; --line:#30333a; --a1:#ffffff; --a2:#a9b1be; --on-a:#141518; }
[data-theme="strawberry"] { color-scheme: light; --bg:#fff0f2; --surface:#ffffff; --surface-2:#ffe0e6; --text:#2e0b14; --muted:#9c6371; --line:#f7d4dc; --a1:#ec1c4b; --a2:#ff8a3d; --on-a:#ffffff; }
[data-theme="mint"]       { color-scheme: light; --bg:#ebfaf4; --surface:#ffffff; --surface-2:#d6f5e9; --text:#072a20; --muted:#578676; --line:#cceee1; --a1:#00a77d; --a2:#00b3ec; --on-a:#ffffff; }
[data-theme="cherry"]     { color-scheme: dark;  --bg:#19090f; --surface:#261019; --surface-2:#351624; --text:#ffeef3; --muted:#bb8c9c; --line:#441d2e; --a1:#ff3b5c; --a2:#ffb03b; --on-a:#ffffff; }
[data-theme="aurora"]     { color-scheme: dark;  --bg:#061615; --surface:#0c2422; --surface-2:#12322f; --text:#e6fffb; --muted:#86b5ae; --line:#1a403b; --a1:#00e0b0; --a2:#b04dff; --on-a:#04201b; }

[data-theme] {
  --grad: linear-gradient(120deg, var(--a1), var(--a2));
  --a-soft: color-mix(in srgb, var(--a1) 14%, transparent);
  --a-text: color-mix(in srgb, var(--a1) 82%, var(--text));
  --danger: #f0384f;
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 10px;
  --topbar: 64px;
  --display: "Unbounded", "Manrope", system-ui, sans-serif;
  --head: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --body: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* =========================================================
   Основа
   ========================================================= */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 500 15px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s, color .3s;
}
a { color: var(--a-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--a1) 60%, transparent); outline-offset: 2px; border-radius: 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sub { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.lead { margin: -6px 0 20px; color: var(--muted); }
.mobile-only { display: none !important; }

/* Иконки */
.i {
  width: 22px; height: 22px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.i .fill { fill: currentColor; stroke: none; }
.i.end { margin-left: auto; color: var(--muted); }

/* =========================================================
   Шапка
   ========================================================= */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1080px; height: 100%; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 24px;
}
.logo {
  font: 800 22px/1 var(--display);
  letter-spacing: -.02em;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.logo:hover { text-decoration: none; }
.search {
  flex: 1; max-width: 340px; position: relative; display: flex; align-items: center;
  margin-left: 32px;
}
.search .i { position: absolute; left: 14px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; height: 42px; padding: 0 16px 0 42px;
  border: 1.5px solid transparent; border-radius: 999px;
  background: var(--surface); color: var(--text); font: inherit;
}
.search input:focus { outline: none; border-color: var(--a1); }
.top-me { margin-left: auto; border-radius: 50%; }
.top-btn { color: var(--text); display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; }

/* =========================================================
   Раскладка
   ========================================================= */
.layout {
  max-width: 1080px; margin: 0 auto; padding: 24px 20px 48px;
  display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start;
}
.is-guest .layout { grid-template-columns: 1fr; }
.content { min-width: 0; }

.sidebar {
  position: sticky; top: calc(var(--topbar) + 24px);
  display: flex; flex-direction: column; gap: 2px;
}
.sidebar a, .nav-btn {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 14px; border-radius: 10px;
  color: var(--text); font-weight: 600; font-size: 15px;
  background: none; border: 0; cursor: pointer; text-align: left; width: 100%;
}
.sidebar a:hover, .nav-btn:hover { background: var(--surface); text-decoration: none; }
.sidebar a.active { background: var(--surface); color: var(--a-text); }
.sidebar a.active .i { color: var(--a1); }
.sidebar form { margin: 0; }
.nav-btn { color: var(--muted); }
.nav-sep { height: 1px; background: var(--line); margin: 10px 14px; }

.badge {
  margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px;
  display: inline-grid; place-items: center;
  border-radius: 999px; background: var(--a1); color: var(--on-a);
  font-size: 12px; font-weight: 800;
}

/* =========================================================
   Карточки, заголовки
   ========================================================= */
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 16px;
}
.card.narrow, .narrow { max-width: 600px; }
.page-title {
  font: 800 26px/1.15 var(--head);
  letter-spacing: -.02em;
  margin: 4px 0 20px;
}
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.page-head .page-title { margin-bottom: 20px; }
.card-head {
  display: flex; align-items: baseline; gap: 8px;
  font-weight: 800; font-size: 16px; margin-bottom: 14px;
}
.card-head a { color: var(--text); }
.card-head .count { color: var(--muted); font-weight: 600; }
.back-link {
  display: inline-flex; align-items: center; gap: 4px; margin-bottom: 8px;
  color: var(--muted); font-weight: 600;
}
.back-link .i { width: 18px; height: 18px; }
.note { color: var(--muted); }
.highlight { box-shadow: inset 0 0 0 2px var(--a-soft); }
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--a-soft); color: var(--a-text);
  border-radius: 999px; padding: 4px 10px; font-size: 12.5px; font-weight: 700;
}
.tag .i { width: 15px; height: 15px; }

/* =========================================================
   Кнопки
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px;
  border: 0; border-radius: 10px; cursor: pointer;
  background: var(--a1); color: var(--on-a);
  font: 700 15px/1 var(--body); white-space: nowrap;
  transition: transform .12s ease, filter .2s;
}
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn:active { transform: scale(.97); }
.btn .i { width: 19px; height: 19px; }
.btn-soft { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 14px; }
.btn-wide { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; flex-shrink: 0;
  border: 0; border-radius: 10px; cursor: pointer;
  background: transparent; color: var(--muted);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.icon-btn.small { width: 30px; height: 30px; }
.icon-btn.small .i { width: 16px; height: 16px; }
.icon-btn.accent { color: var(--a1); }
.icon-btn .i { width: 20px; height: 20px; }

/* =========================================================
   Формы
   ========================================================= */
:where(input[type=text], input[type=password], input[type=email], input[type=date], input:not([type]), textarea, select) {
  width: 100%; padding: 12px 16px;
  border: 1.5px solid var(--line); border-radius: var(--r-sm);
  background: var(--bg); color: var(--text);
  font: 500 15px/1.4 var(--body);
  transition: border-color .15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--a1); }
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea { resize: vertical; }
.form > div { margin-bottom: 16px; }
.form label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.form .helptext, .form [id$=_helptext] { display: block; color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.form [id$=_helptext] ul { margin: 4px 0 0; padding-left: 18px; }
.form .btn { margin-top: 4px; }
.errorlist { list-style: none; margin: 6px 0 0; padding: 0; color: var(--danger); font-size: 13.5px; font-weight: 600; }
.form-error {
  background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger);
  padding: 12px 14px; border-radius: var(--r-sm); font-weight: 600; margin-bottom: 14px;
}
.check { display: flex !important; align-items: center; gap: 10px; font-weight: 600 !important; margin: 4px 0 18px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--a1); margin: 0; }
.file-btn, .chip { position: relative; overflow: hidden; cursor: pointer; }
.file-btn input[type=file], .chip input[type=file], .drop-label input[type=file] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%;
}
.avatar-edit { display: flex; align-items: center; gap: 18px; margin-bottom: 20px !important; }
.avatar-edit .check { margin: 10px 0 0; font-size: 14px; }
.links-card { padding: 8px; }

/* =========================================================
   Аватары и кольца
   ========================================================= */
.avatar {
  width: var(--s, 40px); height: var(--s, 40px);
  border-radius: 50%; object-fit: cover; flex-shrink: 0;
  display: inline-grid; place-items: center;
}
.avatar-square { border-radius: 30%; }
.avatar-empty {
  background: color-mix(in srgb, var(--a1) 18%, var(--surface-2)); color: var(--a-text);
  font: 800 calc(var(--s, 40px) * .4)/1 var(--head);
}
.avatar-empty .i { width: 40%; height: 40%; }
.ring {
  padding: 4px; border-radius: 50%; background: var(--surface);
  display: inline-grid; flex-shrink: 0;
}
.ring > *, .ring > a > * { box-shadow: none; }
.ring-square { border-radius: 34%; }
.ring-sm { padding: 2px; background: var(--a1); }
.ring-sm > * { box-shadow: 0 0 0 3px var(--bg); }

/* =========================================================
   Профиль и группа: обложка-переливание
   ========================================================= */
.hero { padding: 0; overflow: hidden; }
.cover {
  height: 170px;
  position: relative;
  background: linear-gradient(135deg, var(--a1), var(--a2));
  background-size: cover; background-position: center;
}
.cover.has-img { background-color: var(--surface-2); }
.hero-body {
  position: relative; z-index: 1;
  display: flex; align-items: flex-start; gap: 20px;
  padding: 0 24px; margin-top: -56px;
}
.hero-text { flex: 1; min-width: 0; padding-top: 68px; }
.hero-name { font: 800 26px/1.15 var(--head); letter-spacing: -.02em; margin-bottom: 2px; overflow-wrap: anywhere; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; color: var(--muted); font-weight: 600; font-size: 14px; }
.facts span, .facts a { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.facts .i { width: 17px; height: 17px; }
.hero-actions { display: flex; gap: 8px; padding-top: 72px; }
.hero-actions form { margin: 0; }
.bio { margin: 16px 24px 0; max-width: 62ch; }
.stats { display: flex; gap: 8px; padding: 18px 24px 22px; }
.stats a {
  display: flex; align-items: baseline; gap: 6px;
  padding: 8px 14px; border-radius: 10px; background: var(--surface-2); color: var(--text);
}
.stats a:hover { text-decoration: none; background: var(--a-soft); }
.stats b { font: 800 16px/1 var(--head); }
.stats span { color: var(--muted); font-size: 13.5px; font-weight: 600; }

.profile-grid { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; align-items: start; }
.profile-side, .profile-main { min-width: 0; }
.people-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 6px; }
.person { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text); font-size: 13px; font-weight: 600; min-width: 0; }
.person:hover { text-decoration: none; color: var(--a-text); }
.person span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; border-radius: var(--r-sm); overflow: hidden; }
.thumbs img { width: 100%; aspect-ratio: 1; object-fit: cover; transition: opacity .2s; }
.thumbs a:hover img { opacity: .85; }
.row-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px; border-radius: 14px; color: var(--text); font-weight: 600;
}
.row-link:hover { background: var(--surface-2); text-decoration: none; }

/* =========================================================
   Записи
   ========================================================= */
.composer { padding: 16px 18px; }
.composer-row { display: flex; gap: 12px; align-items: flex-start; }
.composer textarea {
  border: 0; background: transparent; padding: 10px 0 6px; min-height: 48px;
  font-size: 16px; resize: none;
}
.composer-preview { margin: 8px 0 0 54px; max-height: 220px; width: auto; border-radius: var(--r-sm); }
.composer-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 10px; padding-left: 54px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px;
  border-radius: 10px; background: var(--surface-2); color: var(--text); font-weight: 700; font-size: 14px;
  max-width: 60%;
}
button.chip { border: 0; font-family: inherit; line-height: 1; }
button.chip:hover { color: var(--a1); }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .i { width: 19px; height: 19px; color: var(--a1); }

.post { padding: 18px 20px 14px; }
.post-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.post-tools { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.post-tools form { margin: 0; display: flex; gap: 2px; }
.icon-btn:disabled { opacity: .3; cursor: default; background: transparent; }
.post-meta { flex: 1; min-width: 0; line-height: 1.3; }
.name { font-weight: 800; color: var(--text); }
.name:hover { color: var(--a-text); }
.to { display: inline-flex; align-items: center; gap: 2px; font-weight: 700; }
.to .i { width: 15px; height: 15px; color: var(--muted); }
.post-text { font-size: 15.5px; line-height: 1.55; overflow-wrap: anywhere; margin-bottom: 12px; }
.post-media { display: block; margin: 0 -20px 12px; background: var(--surface-2); }
.post-media img { width: 100%; max-height: 640px; object-fit: contain; }
.post-actions { display: flex; gap: 8px; align-items: center; }
.post-actions form { margin: 0; }
.pill {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px;
  border: 0; border-radius: 10px; cursor: pointer;
  background: var(--surface-2); color: var(--muted); font-weight: 800; font-size: 14px;
}
.pill:hover { color: var(--text); }
.pill .i { width: 20px; height: 20px; }
.like.liked { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.like.liked .i { fill: currentColor; }
.like.pop .i { animation: pop .35s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }

.comments { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.comment { display: flex; gap: 10px; align-items: flex-start; }
.comment-body { min-width: 0; flex: 1; }
.bubble-c {
  display: inline-block; max-width: 100%;
  background: var(--surface-2); border-radius: 4px 12px 12px 12px; padding: 8px 12px;
  overflow-wrap: anywhere; font-size: 14.5px;
}
.bubble-c .name { font-size: 13.5px; }
.comment-body .sub { padding: 3px 0 0 6px; }
.comment-form { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.comment-form input { border-radius: 10px; background: var(--surface-2); border-color: transparent; height: 40px; padding: 0 16px; }
.comment-form input:focus { background: var(--bg); }

.pagination { display: flex; justify-content: center; align-items: center; gap: 14px; margin: 8px 0 24px; }

/* Пустые состояния */
.empty { text-align: center; padding: 40px 24px; }
.empty h2 { font: 800 20px/1.2 var(--head); margin-bottom: 6px; }
.empty p { margin: 0 auto 18px; max-width: 42ch; }
.empty-icon {
  width: 60px; height: 60px; margin: 0 auto 16px; border-radius: 14px;
  display: grid; place-items: center; background: var(--a-soft); color: var(--a1);
}
.empty-icon .i { width: 30px; height: 30px; }
.empty-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.small-empty { padding: 16px; }
.empty.wide { grid-column: 1 / -1; }

/* =========================================================
   Списки людей и групп
   ========================================================= */
.searchbar {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border-radius: 12px; padding: 6px 6px 6px 16px; margin-bottom: 16px;
}
.searchbar .i { color: var(--muted); }
.searchbar input { border: 0; background: transparent; padding: 8px 4px; }
.user-row { display: flex; align-items: center; gap: 14px; padding: 10px 6px; border-radius: 16px; color: var(--text); }
.user-row + .user-row { border-top: 1px solid var(--line); }
.row-hover:hover { background: var(--surface-2); text-decoration: none; }
.user-row-info { flex: 1; min-width: 0; line-height: 1.35; }
.user-row-info .name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-row-actions { display: flex; gap: 6px; align-items: center; }
.user-row-actions form { margin: 0; }

.group-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.group-tile {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
  padding: 16px 10px; border-radius: var(--r-md); background: var(--surface-2); color: var(--text);
}
.group-tile:hover { text-decoration: none; background: var(--a-soft); }
.group-tile b { font-size: 14px; line-height: 1.25; overflow-wrap: anywhere; }

.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.danger-zone p { margin: 2px 0 0; }
.danger-zone form { margin: 0; }

/* =========================================================
   Фото
   ========================================================= */
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.album-tile {
  position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden;
  border-radius: var(--r-lg); background: var(--surface-2); color: #fff;
}
.album-tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.album-tile:hover img { transform: scale(1.04); }
.album-tile:hover { text-decoration: none; }
.album-empty { display: grid; place-items: center; height: 100%; background: var(--surface-2); color: var(--muted); }
.album-empty .i { width: 44px; height: 44px; stroke-width: 1.5; }
.album-caption {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  padding: 36px 16px 14px; background: linear-gradient(transparent, rgba(0, 0, 0, .62));
}
.album-caption b { font: 800 15px/1.2 var(--head); }
.album-caption span { font-size: 13px; opacity: .85; white-space: nowrap; }

.dropzone { border: 2px dashed var(--line); background: transparent; }
.drop-label {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 18px; border-radius: var(--r-md); background: var(--surface); cursor: pointer;
  font-weight: 700; color: var(--text); text-align: center;
}
.drop-label .i { width: 30px; height: 30px; color: var(--a1); }
.drop-label:hover { background: var(--a-soft); }
.drop-row { display: flex; gap: 10px; margin-top: 12px; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.photo { position: relative; margin: 0; }
.photo img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--r-md); }
.photo figcaption { font-size: 13px; color: var(--muted); padding: 6px 4px 0; font-weight: 600; }
.photo form { position: absolute; top: 8px; right: 8px; margin: 0; }
.photo-del {
  display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(0, 0, 0, .55); color: #fff; opacity: 0; transition: opacity .15s;
}
.photo-del .i { width: 16px; height: 16px; }
.photo:hover .photo-del, .photo-del:focus-visible { opacity: 1; }

.lightbox {
  position: fixed; inset: 0; z-index: 100; padding: 24px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .9); cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 12px; }

/* =========================================================
   Сообщения
   ========================================================= */
.stories { display: flex; gap: 14px; overflow-x: auto; padding: 2px 2px 16px; margin-bottom: 4px; scrollbar-width: none; }
.stories::-webkit-scrollbar { display: none; }
.story { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text); font-size: 12.5px; font-weight: 700; width: 72px; flex-shrink: 0; }
.story span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story:hover { text-decoration: none; }
.list-card { padding: 8px; }
.dialog-row { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 18px; color: var(--text); }
.dialog-row:hover { background: var(--surface-2); text-decoration: none; }
.dialog-row.unread { background: var(--a-soft); }
.dialog-info { flex: 1; min-width: 0; }
.dialog-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.dialog-last { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14.5px; }
.unread .dialog-last { color: var(--text); font-weight: 600; }
.you { color: var(--a-text); font-weight: 700; }

.chat-card {
  display: flex; flex-direction: column; padding: 0; margin: 0; overflow: hidden;
  height: calc(100dvh - var(--topbar) - 48px);
}
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); line-height: 1.3; }
.chat {
  flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 4px;
  background: var(--bg);
}
.msg { display: flex; }
.msg.mine { justify-content: flex-end; }
.bubble {
  max-width: min(72%, 520px); padding: 8px 12px 7px; border-radius: 14px 14px 14px 4px;
  background: var(--surface); overflow-wrap: anywhere; font-size: 15px; line-height: 1.4;
}
.mine .bubble { background: var(--a1); color: var(--on-a); border-radius: 14px 14px 4px 14px; }
.msg-time { display: inline-flex; align-items: center; gap: 2px; float: right; margin: 6px 0 -2px 10px; font-size: 11px; opacity: .7; font-weight: 700; }
.msg-time .i { width: 15px; height: 15px; }
.day-sep { text-align: center; margin: 12px 0 8px; }
.day-sep span { background: var(--surface-2); color: var(--muted); padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.chat-empty { margin: auto; text-align: center; color: var(--muted); font-weight: 600; }
.chat-empty .i { width: 40px; height: 40px; color: var(--a1); }
.chat-form { display: flex; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); align-items: flex-end; background: var(--surface); }
.chat-form textarea { border-radius: 12px; resize: none; max-height: 160px; padding: 11px 18px; background: var(--surface-2); border-color: transparent; }
.send-btn {
  width: 46px; height: 46px; flex-shrink: 0; border: 0; border-radius: 12px; cursor: pointer;
  display: grid; place-items: center; background: var(--a1); color: var(--on-a);
}
.send-btn .i { width: 21px; height: 21px; margin-left: -2px; }
.chat-note { text-align: center; color: var(--muted); padding: 16px; margin: 0; border-top: 1px solid var(--line); }

/* =========================================================
   Выбор темы
   ========================================================= */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.theme-tile {
  display: flex; flex-direction: column; gap: 10px; padding: 8px 8px 12px;
  border: 2px solid transparent; border-radius: var(--r-lg); background: var(--surface);
  cursor: pointer; text-align: left;
  transition: transform .15s, border-color .15s;
}
.theme-tile:hover { border-color: var(--line); }
.theme-tile.current { border-color: var(--a1); }
.tp {
  position: relative; display: block; height: 128px; border-radius: 10px; overflow: hidden;
  background: var(--bg); padding: 10px;
}
.tp-cover { position: absolute; left: 0; right: 0; top: 0; height: 44px; background: var(--grad); }
.tp-card {
  position: relative; display: flex; align-items: center; gap: 8px;
  margin-top: 22px; padding: 8px; border-radius: 12px; background: var(--surface);
}
.tp-ava { width: 26px; height: 26px; border-radius: 50%; background: var(--a1); }
.tp-lines { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.tp-lines i { display: block; height: 6px; border-radius: 3px; background: var(--text); opacity: .85; width: 70%; }
.tp-lines i + i { background: var(--muted); opacity: .6; width: 45%; }
.tp-bubbles { position: relative; display: flex; flex-direction: column; gap: 5px; margin-top: 8px; }
.tp-bubbles i { display: block; height: 14px; border-radius: 8px; }
.tp-bubbles .in { width: 50%; background: var(--surface-2); }
.tp-bubbles .out { width: 40%; align-self: flex-end; background: var(--a1); }
.tt-label { display: flex; align-items: center; gap: 8px; padding: 0 6px; font-weight: 800; }
.tt-kind { color: var(--muted); font-weight: 600; font-size: 13px; }
.tt-check {
  margin-left: auto; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; background: var(--a1); color: var(--on-a);
  opacity: 0; transform: scale(.6); transition: opacity .15s, transform .2s;
}
.tt-check .i { width: 16px; height: 16px; stroke-width: 3; }
.current .tt-check { opacity: 1; transform: none; }

/* =========================================================
   Вход и регистрация
   ========================================================= */
.auth { display: grid; grid-template-columns: 1fr 420px; gap: 24px; align-items: stretch; max-width: 940px; margin: 24px auto; }
.auth-art {
  border-radius: var(--r-lg); min-height: 420px; position: relative; overflow: hidden;
  display: flex; align-items: flex-end; padding: 32px;
  background:
    radial-gradient(60% 60% at 20% 20%, color-mix(in srgb, var(--a2) 85%, white), transparent 70%),
    radial-gradient(60% 70% at 85% 80%, var(--a1), transparent 70%),
    var(--grad);
}
.auth-logo { font: 800 clamp(40px, 6vw, 68px)/.95 var(--display); color: var(--on-a); letter-spacing: -.03em; overflow-wrap: anywhere; }
.auth-box { padding: 32px; margin: 0; }
.auth-box h1 { font: 800 26px/1.15 var(--head); margin-bottom: 6px; }
.auth-box > .muted { margin: 0 0 24px; }
.auth-switch { text-align: center; margin: 18px 0 0; color: var(--muted); font-weight: 600; }

/* Уведомления */
.toasts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.toast {
  padding: 12px 16px; border-radius: var(--r-md); font-weight: 700;
  background: var(--surface); box-shadow: inset 4px 0 0 var(--a1);
  animation: toast-in .3s ease;
}
.toast-error { box-shadow: inset 4px 0 0 var(--danger); color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }

/* Нижняя панель и меню — только телефон */
.tabbar, .scrim, .sheet-grip { display: none; }

/* =========================================================
   Планшеты и телефоны
   ========================================================= */
@media (max-width: 960px) {
  .layout { grid-template-columns: 76px minmax(0, 1fr); gap: 20px; }
  .sidebar a span, .nav-btn span { display: none; }
  .sidebar a, .nav-btn { justify-content: center; position: relative; padding: 13px; }
  .sidebar .badge { position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; font-size: 10.5px; padding: 0 5px; }
  .profile-grid { grid-template-columns: 1fr; }
  .profile-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 16px; }
}

@media (max-width: 720px) {
  :root { --topbar: 56px; }
  [data-theme] { --r-lg: 14px; }
  .mobile-only { display: grid !important; }
  .topbar-inner { padding: 0 14px; gap: 6px; }
  .logo { font-size: 20px; }
  .search { display: none; }
  .top-me { margin-left: 0; }
  .topbar .mobile-only { margin-left: auto; }

  .layout { display: block; padding: 14px 12px calc(96px + env(safe-area-inset-bottom)); }
  .is-guest .layout { padding-bottom: 32px; }
  .card { padding: 16px; margin-bottom: 12px; }
  .card.hero, .card.chat-card { padding: 0; }
  .card.list-card, .card.links-card { padding: 8px; }
  .page-title { font-size: 24px; margin-bottom: 14px; }

  /* Меню «Ещё» выезжает снизу */
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 60;
    background: var(--surface); border-radius: 18px 18px 0 0;
    padding: 8px 12px calc(16px + env(safe-area-inset-bottom));
    transform: translateY(105%); transition: transform .28s cubic-bezier(.2, .8, .2, 1);
    max-height: 85dvh; overflow-y: auto;
  }
  .sidebar a span, .nav-btn span { display: inline; }
  .sidebar a, .nav-btn { justify-content: flex-start; padding: 14px; font-size: 16px; }
  .sidebar .badge { position: static; }
  .sheet-grip { display: block !important; width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 10px; }
  .menu-open .sidebar { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .45); opacity: 0; pointer-events: none; transition: opacity .25s; }
  .menu-open .scrim { opacity: 1; pointer-events: auto; }

  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
    position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 40;
    height: 64px; padding: 0 6px; border-radius: 18px;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, .14), 0 0 0 1px var(--line);
  }
  .tabbar a, .tabbar button {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px;
    border: 0; background: none; cursor: pointer; padding: 6px 0;
    color: var(--muted); font-size: 11px; font-weight: 700;
  }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a.active { color: var(--a-text); }
  .tabbar .i { width: 24px; height: 24px; }
  .tabbar .tab-create {
    justify-self: center; width: 52px; height: 52px; padding: 0; justify-content: center;
    border-radius: 14px; background: var(--a1); color: var(--on-a);
    box-shadow: none;
  }
  .tabbar .tab-create .i { width: 26px; height: 26px; stroke-width: 2.4; }
  .tab-badge {
    position: absolute; top: 0; left: 50%; margin-left: 6px;
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
    display: grid; place-items: center; font-size: 10.5px; font-weight: 800;
    background: var(--a1); color: var(--on-a); box-shadow: 0 0 0 2px var(--surface);
  }

  .cover { height: 120px; }
  .hero-body { flex-direction: column; align-items: center; text-align: center; margin-top: -60px; padding: 0 16px; gap: 10px; }
  .hero-text, .hero-actions { padding-top: 0; }
  .hero-body .avatar { --s: 108px !important; }
  .facts { justify-content: center; }
  .hero-actions { flex-wrap: wrap; justify-content: center; }
  .bio { margin: 12px 16px 0; text-align: center; }
  .stats { justify-content: center; padding: 16px; }
  .profile-side { display: block; }

  .post { padding: 14px 16px 12px; }
  .post-media { margin: 0 -16px 12px; }
  .composer-bar, .composer-preview { padding-left: 0; margin-left: 0; }
  .composer .btn span { display: none; }
  .composer .btn { width: 44px; padding: 0; }

  .chat-card { height: calc(100dvh - var(--topbar) - 28px - 86px - env(safe-area-inset-bottom)); border-radius: var(--r-lg); }
  .bubble { max-width: 84%; }

  .album-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .photo-grid { grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .photo img { border-radius: 10px; }
  .photo-del { opacity: 1; width: 28px; height: 28px; }
  .theme-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .tp { height: 112px; }
  .tt-kind { display: none; }
  .drop-row { flex-direction: column; }
  .page-head .btn span { display: none; }
  .page-head .btn { width: 44px; padding: 0; }

  .auth { grid-template-columns: 1fr; margin: 0; gap: 12px; }
  .auth-art { min-height: 150px; padding: 22px; }
  .auth-box { padding: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* =========================================================
   Обложка: кнопки на странице профиля
   ========================================================= */
.cover-tools { position: absolute; right: 14px; top: 14px; display: flex; gap: 8px; }
.cover-tools form { margin: 0; }
.cover-btn {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 12px; border: 0; border-radius: 10px; cursor: pointer;
  background: rgba(0, 0, 0, .45); color: #fff; font-weight: 700; font-size: 13.5px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.cover-btn:hover { background: rgba(0, 0, 0, .6); }
.cover-btn .i { width: 18px; height: 18px; }
.cover-btn.icon-only { width: 36px; padding: 0; justify-content: center; }
.cover-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Превью в настройках */
.crop-preview { flex-shrink: 0; overflow: hidden; }
.crop-preview.round { width: 88px; height: 88px; border-radius: 50%; }
.crop-preview.square { width: 88px; height: 88px; border-radius: 30%; }
.crop-preview > img { width: 100%; height: 100%; object-fit: cover; }
.cover-edit { margin-bottom: 20px !important; }
.cover-preview { width: 100%; aspect-ratio: 3.2 / 1; border-radius: var(--r-md); background: var(--surface-2); }
.cover-preview .cover { height: 100%; }
.cover-edit-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 10px; }
.cover-edit-row .check { margin: 0; }

/* =========================================================
   Окно подгонки фото
   ========================================================= */
.cropper {
  position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 16px;
  background: rgba(0, 0, 0, .6);
}
.cropper[hidden] { display: none; }
.cropper-box {
  width: min(600px, 100%); max-height: 100%; overflow: auto;
  background: var(--surface); border-radius: var(--r-lg); padding: 18px;
}
.cropper-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
.cropper-head b { font-size: 17px; }
.cropper-stage { display: grid; place-items: center; overflow: hidden; background: #0d0d10; border-radius: var(--r-md); padding: 18px; }
.cropper-view {
  position: relative; overflow: visible; touch-action: none; cursor: grab;
  user-select: none; -webkit-user-select: none;
}
.cropper-view:active { cursor: grabbing; }
.cropper-view img {
  position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0;
  pointer-events: none; -webkit-user-drag: none;
}
.cropper-frame {
  position: absolute; inset: 0; pointer-events: none;
  box-shadow: 0 0 0 999px rgba(13, 13, 16, .6), inset 0 0 0 2px rgba(255, 255, 255, .9);
}
.cropper.crop-avatar .cropper-frame { border-radius: 50%; }
.cropper.crop-square .cropper-frame { border-radius: 30%; }
.cropper.crop-cover .cropper-frame { border-radius: 8px; }
.cropper-zoom { display: flex; align-items: center; gap: 12px; margin: 16px 4px; color: var(--muted); }
.cropper-zoom input { flex: 1; accent-color: var(--a1); }
.cropper-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* Подсказки */
.forgot { display: inline-block; margin-top: 8px; font-size: 13.5px; font-weight: 600; }
.nudge { display: flex; align-items: center; gap: 12px; color: var(--text); box-shadow: inset 4px 0 0 var(--a1); }
.nudge:hover { text-decoration: none; background: var(--surface-2); }
.nudge > .i:first-child { color: var(--a1); }

/* =========================================================
   Музыка: строки треков
   ========================================================= */
.tracklist { display: flex; flex-direction: column; }
.track {
  position: relative; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 6px; border-radius: 12px;
}
.track + .track { border-top: 1px solid var(--line); }
.track:hover { background: var(--surface-2); }
.track-play {
  width: 40px; height: 40px; flex-shrink: 0; border: 0; border-radius: 10px; cursor: pointer;
  display: grid; place-items: center; background: var(--a-soft); color: var(--a1);
}
.track-play .i { width: 20px; height: 20px; }
.track-play .i-pause, .track.is-playing .track-play .i-play { display: none; }
.track.is-playing .track-play .i-pause { display: block; }
.track.is-current .track-play { background: var(--a1); color: var(--on-a); }
.track-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.track-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.track-artist { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13.5px; }
.track.is-current .track-title { color: var(--a-text); }
.track-dur { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.track form { margin: 0; }
.track-edit { flex-basis: 100%; display: flex; gap: 8px; flex-wrap: wrap; padding: 6px 0 2px 52px; }
.track-edit input { flex: 1 1 180px; padding: 8px 12px; }
.track.is-editing { background: var(--surface-2); }
.tracklist.compact .track { padding: 6px 2px; gap: 10px; }
.tracklist.compact .track-play { width: 34px; height: 34px; }
.tracklist.compact .track-dur { display: none; }
.post-track { margin: 0 -6px 12px; padding: 4px; border-radius: 14px; background: var(--surface-2); }
.post-track .track:hover { background: transparent; }
.drop-note { flex: 1; margin: 0; }
.drop-label .sub { font-weight: 500; }

/* Музыка в форме записи */
.composer-attach { display: flex; gap: 8px; flex-wrap: wrap; min-width: 0; }
.chip-select { padding-right: 6px; max-width: 100%; }
.chip-select select {
  border: 0; background: transparent; color: var(--text); font: inherit; font-weight: 700;
  max-width: 200px; padding: 0 4px; cursor: pointer;
}
.chip-select select:focus { outline: none; }

/* =========================================================
   Проигрыватель внизу экрана
   ========================================================= */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  background: var(--surface); border-top: 1px solid var(--line);
  box-shadow: 0 -6px 24px rgba(0, 0, 0, .08);
}
.player[hidden] { display: none; }
.player-progress { height: 4px; position: relative; }
.p-seek {
  position: absolute; left: 0; right: 0; top: -6px; width: 100%; height: 16px; margin: 0;
  accent-color: var(--a1); cursor: pointer; background: transparent;
}
.player-row {
  max-width: 1080px; margin: 0 auto; padding: 8px 20px 10px;
  display: flex; align-items: center; gap: 16px;
}
.p-controls { display: flex; align-items: center; gap: 4px; }
.p-btn {
  width: 40px; height: 40px; border: 0; border-radius: 10px; cursor: pointer;
  display: grid; place-items: center; background: transparent; color: var(--text);
}
.p-btn:hover { background: var(--surface-2); }
.p-btn .i { width: 20px; height: 20px; }
.p-main { width: 44px; height: 44px; background: var(--a1); color: var(--on-a); }
.p-main:hover { background: var(--a1); filter: brightness(1.08); }
.p-main .i-pause, .player.is-playing .p-main .i-play { display: none; }
.player.is-playing .p-main .i-pause { display: block; }
.p-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.p-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-artist { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-time { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.p-vol-wrap { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.p-vol-wrap .i { width: 19px; height: 19px; }
.p-vol { width: 90px; accent-color: var(--a1); }
.p-close { color: var(--muted); }
html.has-player .layout { padding-bottom: 110px; }

/* Индикатор перехода между страницами */
html.is-loading::before {
  content: ""; position: fixed; left: 0; top: 0; height: 3px; width: 100%; z-index: 200;
  background: var(--a1); transform-origin: 0 50%; animation: loadbar 1.2s ease-out forwards;
}
@keyframes loadbar { from { transform: scaleX(.05); } to { transform: scaleX(.85); } }

/* =========================================================
   Страница приложения
   ========================================================= */
.app-hero { display: flex; gap: 24px; align-items: center; }
.app-hero img { width: 112px; height: 112px; border-radius: 26px; flex-shrink: 0; }
.app-hero h1 { font: 800 26px/1.15 var(--head); margin-bottom: 6px; }
.app-steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.app-steps li::marker { color: var(--a1); font-weight: 800; }

@media (max-width: 720px) {
  .player { bottom: calc(84px + env(safe-area-inset-bottom)); left: 10px; right: 10px; border-radius: 16px; border: 0; box-shadow: 0 6px 24px rgba(0, 0, 0, .16), 0 0 0 1px var(--line); overflow: hidden; }
  .player-row { padding: 6px 10px 8px; gap: 8px; }
  .p-controls { order: 2; gap: 0; }
  .p-info { order: 1; }
  .p-close { order: 3; }
  .p-btn { width: 36px; height: 36px; }
  .p-main { width: 40px; height: 40px; }
  .p-time, .p-vol-wrap { display: none; }
  .p-seek { top: -6px; }
  html.has-player .layout { padding-bottom: calc(170px + env(safe-area-inset-bottom)); }
  .track-edit { padding-left: 0; }
  .track-dur { display: none; }
  .chip-select select { max-width: 120px; }
  .app-hero { flex-direction: column; text-align: center; }
}
html.has-player .chat-card { height: calc(100dvh - var(--topbar) - 48px - 70px); }
@media (max-width: 720px) {
  html.has-player .chat-card { height: calc(100dvh - var(--topbar) - 28px - 86px - 70px - env(safe-area-inset-bottom)); }
}

.in-app .app-link { display: none !important; }

/* =========================================================
   Видео
   ========================================================= */
.post-video { margin: 0 -20px 12px; background: #000; }
.post-video video { display: block; width: 100%; max-height: 640px; background: #000; }
.composer-video { display: block; margin: 8px 0 0 54px; max-height: 240px; max-width: calc(100% - 54px); border-radius: var(--r-sm); background: #000; }
.upload-progress {
  position: relative; height: 30px; margin-top: 10px; border-radius: 8px; overflow: hidden;
  background: var(--surface-2); display: flex; align-items: center; justify-content: center;
}
.upload-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--a-soft); transition: width .2s; }
.upload-text { position: relative; font-size: 13px; color: var(--a-text); }
.video-thumbs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; border-radius: var(--r-sm); overflow: hidden; }
.video-thumbs a { position: relative; display: block; aspect-ratio: 16 / 10; background: #000; }
.video-thumbs video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.vt-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0, 0, 0, .55); color: #fff;
}
.vt-play .i { width: 16px; height: 16px; margin-left: 2px; }
@media (max-width: 720px) {
  .post-video { margin: 0 -16px 12px; }
  .composer-video { margin-left: 0; max-width: 100%; }
}

/* Закреплённые записи */
.post.is-pinned { box-shadow: inset 0 0 0 2px var(--a-soft); }
.pinned-tag {
  display: inline-flex; align-items: center; gap: 5px; margin: -4px 0 10px;
  padding: 3px 10px 3px 7px; border-radius: 8px; background: var(--a-soft); color: var(--a-text);
  font-size: 12.5px; font-weight: 800;
}
.pinned-tag .i { width: 15px; height: 15px; }
@media (max-width: 720px) {
  .post-tools .icon-btn { width: 34px; height: 34px; }
}

/* =========================================================
   Запись видео с камеры
   ========================================================= */
body.modal-open { overflow: hidden; }
.recorder {
  position: fixed; inset: 0; z-index: 130; display: grid; place-items: center; padding: 16px;
  background: rgba(0, 0, 0, .7);
}
.recorder[hidden] { display: none; }
.recorder-box {
  width: min(760px, 100%); max-height: 100%; display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-lg); padding: 16px; overflow: hidden;
}
.recorder-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.recorder-head b { font-size: 17px; flex: 1; }
.rec-time { display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--muted); font-size: 14px; }
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); opacity: .5; }
.recorder[data-state="recording"] .rec-dot { background: #ff2d46; opacity: 1; animation: rec-blink 1s steps(2) infinite; }
.recorder[data-state="recording"] .rec-time, .recorder[data-state="paused"] .rec-time { color: var(--text); }
@keyframes rec-blink { 50% { opacity: .2; } }
.recorder-stage {
  position: relative; flex: 1; min-height: 0; display: grid; place-items: center;
  background: #000; border-radius: var(--r-md); overflow: hidden; aspect-ratio: 16 / 10; max-height: calc(100vh - 210px);
}
.recorder-stage video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.recorder-stage video[hidden] { display: none; }
.rec-live.mirror { transform: scaleX(-1); }
.rec-msg { position: absolute; inset: 0; display: grid; place-items: center; padding: 28px; text-align: center; color: #fff; font-weight: 600; line-height: 1.5; }
.rec-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255, 255, 255, .15); }
.rec-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--a1), var(--a2)); transition: width .25s linear; }
.recorder[data-state="review"] .rec-progress { display: none; }
.recorder-actions { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin-top: 14px; }
.rec-side { display: flex; }
.rec-side:last-child { justify-content: flex-end; }
.rec-center { display: flex; align-items: center; justify-content: center; gap: 14px; }
.rec-round {
  width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center;
  background: var(--surface-2); color: var(--text);
}
.rec-round:hover { color: var(--a1); }
.rec-round .i { width: 22px; height: 22px; }
.rec-shutter {
  width: 64px; height: 64px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; padding: 0;
  background: transparent; border: 4px solid var(--a1);
}
.rec-shutter span { width: 46px; height: 46px; border-radius: 50%; background: #ff2d46; transition: all .2s ease; }
.rec-shutter:hover span { transform: scale(.92); }
.rec-shutter.is-rec span { width: 24px; height: 24px; border-radius: 6px; }
.recorder-actions [hidden] { display: none !important; }
@media (max-width: 640px) {
  .recorder { padding: 0; }
  .recorder-box { width: 100%; height: 100%; border-radius: 0; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); }
  .recorder-stage { aspect-ratio: auto; max-height: none; }
}

/* =========================================================
   Беседы (чаты на несколько человек)
   ========================================================= */
.i.mini { width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; color: var(--a1); }
.avatar-chat { background: linear-gradient(135deg, var(--a1), var(--a2)) !important; color: var(--on-a) !important; }
.chat-title { display: inline-flex; align-items: center; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head-info { flex: 1; min-width: 0; }
.chat-head-info .name { display: block; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.gmsg { align-items: flex-end; gap: 8px; }
.gmsg-ava { width: 32px; flex-shrink: 0; }
.gmsg + .gmsg { margin-top: 2px; }
.gmsg-name { display: block; font-size: 12.5px; font-weight: 800; color: var(--a-text, var(--a1)); margin-bottom: 1px; }
.sys-msg { text-align: center; margin: 8px 0; }
.sys-msg span { display: inline-block; max-width: 90%; color: var(--muted); font-size: 12.5px; font-weight: 600; padding: 4px 12px; border-radius: 999px; background: var(--surface-2); }
.chat-link { display: flex; align-items: center; gap: 12px; padding: 8px 6px; border-radius: 14px; color: var(--text); font-weight: 700; }
.chat-link:hover { background: var(--surface-2); text-decoration: none; }
.chat-link span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-link .i.end { width: 18px; height: 18px; color: var(--muted); }
.card-head .icon-btn { margin-left: auto; }
.card-head.pad { padding: 8px 8px 0; }
.chat-summary { display: flex; align-items: center; gap: 16px; }
.pick-list { display: grid; gap: 4px; margin: 6px 0 18px; max-height: 360px; overflow-y: auto; }
.pick-row { display: flex !important; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 14px; cursor: pointer; font-weight: 700 !important; margin: 0 !important; }
.pick-row:hover { background: var(--surface-2); }
.pick-row input { position: absolute; opacity: 0; pointer-events: none; }
.pick-row > span:nth-of-type(2) { flex: 1; }
.pick-mark { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line); color: transparent; flex-shrink: 0; }
.pick-mark .i { width: 16px; height: 16px; }
.pick-row input:checked ~ .pick-mark { background: var(--a1); border-color: var(--a1); color: var(--on-a); }
.pick-row input:focus-visible ~ .pick-mark { outline: 2px solid var(--a1); outline-offset: 2px; }

/* Переключатель «Звук сообщений» */
.switch-row { display: flex; align-items: center; gap: 14px; margin: 0; }
.switch-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--a1); flex-shrink: 0; }
.switch-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; line-height: 1.35; }
.switch { position: relative; width: 52px; height: 30px; flex-shrink: 0; cursor: pointer; margin: 0 !important; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .2s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + span { background: var(--a1); }
.switch input:checked + span::after { transform: translateX(22px); }
.switch input:focus-visible + span { outline: 2px solid var(--a1); outline-offset: 2px; }
.switch.saved span { animation: saved-pulse .5s ease; }
@keyframes saved-pulse { 50% { box-shadow: 0 0 0 6px var(--a-soft); } }
.link-btn { display: inline-flex; align-items: center; gap: 8px; margin: 12px 0 0 56px; padding: 0; border: 0; background: none; color: var(--a1); font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; }
.link-btn .i { width: 16px; height: 16px; }

/* Установка приложения */
.btn-big { height: 52px; padding: 0 26px; font-size: 16.5px; margin-top: 6px; }
.app-columns { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
.app-columns > .card { margin: 0 0 20px; }
.install-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.install-steps li { display: flex; gap: 14px; align-items: flex-start; }
.install-steps p { margin: 2px 0 0; font-size: 14.5px; }
.step-num { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; font-weight: 800; color: var(--on-a); background: linear-gradient(135deg, var(--a1), var(--a2)); }
.qr-card { text-align: center; }
.qr { width: 200px; height: 200px; margin: 4px auto 12px; background: #fff; border-radius: 16px; padding: 8px; }
.qr svg { width: 100%; height: 100%; display: block; }
.short-link { color: var(--text); font-size: 16px; user-select: all; }
.app-banner { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
.app-banner[hidden] { display: none; }
.app-banner img { width: 40px; height: 40px; border-radius: 10px; }
.app-banner div { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; font-size: 14px; }
.app-banner span { color: var(--muted); font-size: 12.5px; }
@media (max-width: 720px) {
  .app-columns { grid-template-columns: 1fr; }
  .qr-card { display: none; }
  .link-btn { margin-left: 0; }
}
