/* =========================================================
   Xitter: чёрно-белый интерфейс, персиковый вход, анимации как в iOS
   ========================================================= */

:root {
  --bg: #ffffff;
  --text: #0a0a0a;
  --text-2: #8a8a8e;
  --text-3: #b9b9bd;
  --sep: rgba(0, 0, 0, 0.08);
  --fill: #f2f2f4;
  --fill-2: #e8e8eb;
  --ink: #0a0a0a;        /* чёрные кнопки и свои сообщения */
  --on-ink: #ffffff;
  --bubble-them: #efeff1;
  --pink: #ff2d6f;
  --like: #ff2d55;
  --peach: linear-gradient(180deg, #ffd2b8 0%, #ffe3d1 38%, #fff3ea 70%, #ffffff 100%);
  --bar: rgba(255, 255, 255, 0.86);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
  --desk: #f1efed;

  --spring: cubic-bezier(0.32, 0.72, 0, 1);
  --bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --bar-h: 50px;
  --tab-h: 52px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #000000; --text: #f5f5f7; --text-2: #8d8d93; --text-3: #5a5a5f; --sep: rgba(255, 255, 255, 0.1);
    --fill: #1c1c1e; --fill-2: #2c2c2e; --ink: #f5f5f7; --on-ink: #000000; --bubble-them: #262628;
    --peach: linear-gradient(180deg, #4a2414 0%, #2a150c 40%, #120a06 75%, #000 100%);
    --bar: rgba(0, 0, 0, 0.82); --shadow: 0 10px 40px rgba(0, 0, 0, 0.6); --desk: #111;
    color-scheme: dark;
  }
}
:root[data-theme="orange"] {
  --bg: #fff6ee; --text: #2b1406; --text-2: #a5765a; --text-3: #d2b29c; --sep: rgba(120, 50, 0, 0.12);
  --fill: #ffe9d8; --fill-2: #ffdcc2; --ink: #ff6a1a; --on-ink: #ffffff; --bubble-them: #ffe4cf;
  --bar: rgba(255, 246, 238, 0.86); --desk: #ffe6d1;
}
/* своя тема (Plus): --bg, --text, --ink, --bubble-them задаются из настроек */
:root[data-theme="custom"] {
  --text-2: color-mix(in srgb, var(--text) 55%, var(--bg)); --text-3: color-mix(in srgb, var(--text) 30%, var(--bg));
  --sep: color-mix(in srgb, var(--text) 12%, transparent); --fill: color-mix(in srgb, var(--text) 7%, var(--bg));
  --fill-2: color-mix(in srgb, var(--text) 12%, var(--bg)); --bar: color-mix(in srgb, var(--bg) 86%, transparent);
  --desk: color-mix(in srgb, var(--bg) 90%, #000); --peach: linear-gradient(180deg, color-mix(in srgb, var(--ink) 35%, var(--bg)), var(--bg));
}
:root[data-theme="dark"] {
  --bg: #000000; --text: #f5f5f7; --text-2: #8d8d93; --text-3: #5a5a5f; --sep: rgba(255, 255, 255, 0.1);
  --fill: #1c1c1e; --fill-2: #2c2c2e; --ink: #f5f5f7; --on-ink: #000000; --bubble-them: #262628;
  --peach: linear-gradient(180deg, #4a2414 0%, #2a150c 40%, #120a06 75%, #000 100%);
  --bar: rgba(0, 0, 0, 0.82); --shadow: 0 10px 40px rgba(0, 0, 0, 0.6); --desk: #111;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body {
  background: var(--desk);
  color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none; user-select: none;
}
input, textarea { -webkit-user-select: text; user-select: text; font: inherit; color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
b { font-weight: 600; }

/* на планшете — колонка шириной с телефон, на компьютере — весь экран (см. конец файла) */
#app {
  position: relative; height: 100%; max-width: 480px; margin: 0 auto; overflow: hidden;
  background: var(--bg);
}
@media (min-width: 560px) and (max-width: 899px) {
  #app { box-shadow: 0 0 0 0.5px var(--sep), 0 20px 80px rgba(0, 0, 0, 0.08); }
}
.side-logo, .tabbar .side-only, .tabbar button > span:not(.tab-avatar) { display: none; }
.screen { position: absolute; inset: 0; }

@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes pop { from { transform: scale(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- кнопки и поля ---------- */
.btn-black {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 48px;
  border-radius: 12px; background: var(--ink); color: var(--on-ink); font-weight: 600; font-size: 15px;
  transition: transform 0.25s var(--bounce), opacity 0.2s;
}
.btn-black:active { transform: scale(0.97); opacity: 0.85; }
.btn-black.small { width: auto; height: 32px; padding: 0 14px; border-radius: 9px; font-size: 14px; }
.btn-black.loading { pointer-events: none; color: transparent; position: relative; }
.btn-black.loading::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--on-ink); border-right-color: transparent; animation: spin 0.7s linear infinite;
}
.btn-soft {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 48px;
  border-radius: 12px; background: var(--fill); font-weight: 600; font-size: 15px;
  transition: transform 0.25s var(--bounce), background 0.2s;
}
.btn-soft:active { transform: scale(0.97); background: var(--fill-2); }
.btn-soft.left { justify-content: flex-start; padding: 0 14px; width: auto; }
.btn-soft.danger { color: #ff3b30; }
.btn-soft .brand { width: 20px; height: 20px; stroke: none; }
.btn-out {
  height: 32px; padding: 0 16px; border-radius: 9px; font-weight: 600; font-size: 14px; flex: none;
  background: var(--ink); color: var(--on-ink); transition: transform 0.25s var(--bounce), background 0.2s, color 0.2s;
}
.btn-out.on { background: var(--fill); color: var(--text); }
.btn-out:active { transform: scale(0.94); }
.link-btn { font-size: 15px; color: var(--text); padding: 6px 2px; }
.link-btn.strong { font-weight: 600; }
.link-btn:active { opacity: 0.5; }
.input {
  width: 100%; height: 48px; border-radius: 12px; border: 1px solid var(--sep); background: var(--bg);
  padding: 0 14px; outline: none; font-size: 15px; transition: border-color 0.2s, box-shadow 0.2s;
}
.input:focus { border-color: var(--text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 8%, transparent); }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; position: relative; }
.icon-btn:active { opacity: 0.45; }
.badge {
  position: absolute; top: 4px; right: 2px; min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px;
  background: var(--pink); color: #fff; font: 700 10.5px/17px system-ui, sans-serif; font-style: normal; text-align: center;
  box-shadow: 0 0 0 2px var(--bg); animation: pop 0.35s var(--bounce);
}
.badge:empty { min-width: 9px; width: 9px; height: 9px; padding: 0; top: 7px; right: 7px; }

/* ---------- аватары ---------- */
.avatar {
  --c1: #ffb35c; --c2: #ff4d2e;
  width: 44px; height: 44px; border-radius: 50%; flex: none; position: relative;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 16px; letter-spacing: 0.3px;
  background: linear-gradient(135deg, var(--c1), var(--c2)) center / cover no-repeat;
}
.avatar.photo { color: transparent; }
.avatar.xs { width: 30px; height: 30px; font-size: 11px; }
.avatar.s { width: 36px; height: 36px; font-size: 13px; }
.avatar.l { width: 56px; height: 56px; font-size: 20px; }
.avatar.xl { width: 88px; height: 88px; font-size: 32px; }
.avatar .dot {
  position: absolute; right: 0; bottom: 0; width: 12px; height: 12px; border-radius: 50%;
  background: #34c759; border: 2px solid var(--bg); display: none;
}
.avatar.online .dot { display: block; }

/* ---------- вход ---------- */
#auth {
  overflow-x: hidden !important; /* Намертво блокирует горизонтальный скролл на экране входа */
  position: relative;
}
.auth-bg { position: absolute; inset: 0; background: var(--peach); }
.auth-bg::after {
  content: ""; position: absolute; left: -20%; right: -20%; top: -10%; height: 55%;
  background: radial-gradient(closest-side, rgba(255, 160, 110, 0.45), transparent);
  filter: blur(20px); animation: breathe 7s ease-in-out infinite alternate;
}
@keyframes breathe { to { transform: translateY(20px) scale(1.08); opacity: 0.7; } }
.auth-wrap {
  position: relative; min-height: 100%; padding: calc(var(--safe-t) + 14vh) 28px calc(var(--safe-b) + 28px);
  display: flex; flex-direction: column; align-items: stretch; text-align: center;
}
.auth-logo { margin: 0 0 9vh; font-size: 34px; font-weight: 800; letter-spacing: -1px; animation: rise 0.7s var(--ease-out) both; }
.auth-step { display: none; flex-direction: column; gap: 12px; position: relative; }
.auth-step.active { display: flex; animation: stepIn 0.5s var(--spring) both; }
.auth-step.back-anim { animation-name: stepBack; }
@keyframes stepIn { from { opacity: 0; transform: translateX(40px); } }
@keyframes stepBack { from { opacity: 0; transform: translateX(-40px); } }
.auth-step h2 { margin: 0; font-size: 17px; font-weight: 700; }
.auth-step > p { margin: -6px 0 6px; color: var(--text-2); font-size: 14px; }
.auth-back { position: absolute; left: -8px; top: -6px; width: 36px; height: 36px; display: grid; place-items: center; }
.or { display: flex; align-items: center; gap: 12px; color: var(--text-2); font-size: 13px; margin: 6px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--sep); }
.fine { color: var(--text-2); font-size: 12px; line-height: 1.45; margin: 10px 8px 0; }
.fine b { color: var(--text); font-weight: 600; }
.fine.center { text-align: center; }
.auth-error { color: #ff3b30; font-size: 14px; min-height: 20px; margin: 14px 0 0; }
.dl-link { display: inline-block; margin-top: auto; padding-top: 20px; color: var(--text); font-weight: 600; font-size: 14px; }

/* ---------- навигационный стек ---------- */
#main { overflow: hidden; }
.stack { position: absolute; inset: 0; overflow: hidden; }
.page {
  position: absolute; inset: 0; background: var(--bg); display: flex; flex-direction: column;
  transition: transform 0.5s var(--spring), filter 0.5s var(--spring);
  will-change: transform;
}
.page.pushed { transform: translateX(100%); visibility: hidden; transition: transform 0.5s var(--spring), visibility 0s 0.5s; }
.page.open { transform: none; visibility: visible; transition: transform 0.5s var(--spring), visibility 0s; box-shadow: -10px 0 40px rgba(0, 0, 0, 0.08); }
.page.covered { transform: translateX(-28%); filter: brightness(0.94); }
.page.dragging { transition: none !important; }
.db-banner {
  position: absolute; z-index: 50; left: 10px; right: 10px; top: calc(var(--safe-t) + 56px);
  padding: 10px 14px; border-radius: 14px; background: #ff3b30; color: #fff; font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow); animation: rise 0.5s var(--spring);
}

/* ---------- шапки ---------- */
.bar {
  position: relative; z-index: 5; flex: none; height: calc(var(--bar-h) + var(--safe-t)); padding: var(--safe-t) 6px 0;
  display: grid; grid-template-columns: 48px 1fr 48px; align-items: center;
  background: var(--bar); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
}
.bar.lined { box-shadow: 0 0.5px 0 var(--sep); }
.bar-side { justify-self: start; }
.bar-side.right { justify-self: end; }
.bar-title { text-align: center; font-size: 16px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-title-left { grid-column: 1 / -1; margin: 0 0 0 12px; font-size: 26px; font-weight: 800; letter-spacing: -0.6px; }
.seg-text { display: flex; justify-content: center; gap: 22px; position: relative; }
.seg-text button { font-size: 15px; font-weight: 600; color: var(--text-3); padding: 10px 0; position: relative; transition: color 0.25s; }
.seg-text button.active { color: var(--text); }
.seg-text button::after {
  content: ""; position: absolute; left: 50%; bottom: 3px; width: 18px; height: 2.5px; margin-left: -9px; border-radius: 2px;
  background: var(--text); transform: scaleX(0); transition: transform 0.35s var(--bounce);
}
.seg-text button.active::after { transform: scaleX(1); }

/* ---------- вкладки ---------- */
#tabsPage { padding-bottom: 0; }
.tab { position: absolute; inset: 0; bottom: calc(var(--tab-h) + var(--safe-b)); display: none; flex-direction: column; }
.tab.active { display: flex; animation: fadeIn 0.25s ease both; }
.scroller { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: flex; justify-content: space-around; align-items: center;
  background: var(--bar); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 -0.5px 0 var(--sep);
}
.tabbar button { width: 56px; height: 44px; display: grid; place-items: center; position: relative; color: var(--text-2); transition: color 0.2s, transform 0.3s var(--bounce); }
.tabbar button:active { transform: scale(0.86); }
.tabbar button.active { color: var(--text); }
.tabbar button svg { width: 26px; height: 26px; }
.tabbar button.active svg { stroke-width: 2.3; }
.tabbar button[data-tab="feed"].active svg, .tabbar button[data-tab="activity"].active svg { fill: currentColor; }
.tabbar .badge { top: 5px; right: 10px; }
.tab-avatar { width: 28px; height: 28px; border-radius: 50%; display: block; overflow: hidden; box-shadow: 0 0 0 1.5px transparent; transition: box-shadow 0.2s; }
.tab-avatar .avatar { width: 100%; height: 100%; font-size: 11px; }
.tabbar button.active .tab-avatar { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--text); }

/* ---------- лента ---------- */
.post { padding: 14px 16px 6px; border-bottom: 0.5px solid var(--sep); animation: rise 0.45s var(--ease-out) both; animation-delay: calc(min(var(--i, 0), 8) * 35ms); }
.settled .post { animation: none; }
.post-head { display: flex; align-items: center; gap: 10px; }
.post-head .who { flex: 1; min-width: 0; display: grid; text-align: left; line-height: 1.25; }
.post-head .who b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-head .who small { color: var(--text-2); font-size: 13px; }
.post-head .more { color: var(--text-2); width: 32px; height: 32px; }
.post-text { margin: 10px 0 0; font-size: 15px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; -webkit-user-select: text; user-select: text; }
.post-img { position: relative; margin-top: 10px; border-radius: 16px; overflow: hidden; background: var(--fill); }
.post-img img { display: block; width: 100%; max-height: 560px; object-fit: cover; }
.post-img .big-heart {
  position: absolute; left: 50%; top: 50%; width: 96px; height: 96px; margin: -48px 0 0 -48px; color: #fff;
  fill: #fff; stroke: none; filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.3)); pointer-events: none;
  animation: bigHeart 0.9s var(--spring) both;
}
@keyframes bigHeart { 0% { transform: scale(0); opacity: 0; } 25% { transform: scale(1.15); opacity: 1; } 45% { transform: scale(0.95); } 70% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.1) translateY(-30px); opacity: 0; } }
.post-actions { display: flex; align-items: center; gap: 18px; margin-top: 8px; color: var(--text); }
.post-actions button { display: flex; align-items: center; gap: 6px; height: 36px; font-size: 14px; font-weight: 500; }
.post-actions button svg { width: 23px; height: 23px; transition: transform 0.35s var(--bounce); }
.post-actions button:active svg { transform: scale(0.8); }
.post-actions .like.on { color: var(--like); }
.post-actions .like.on svg { fill: currentColor; stroke: currentColor; animation: likePop 0.45s var(--bounce); }
@keyframes likePop { 0% { transform: scale(0.6); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
.post-actions .share { margin-left: auto; }
.empty { display: grid; justify-items: center; gap: 6px; padding: 70px 30px; text-align: center; color: var(--text-2); animation: rise 0.5s var(--ease-out); }
.empty b { color: var(--text); font-size: 17px; }
.empty .btn-black { margin-top: 10px; }

/* комментарии */
.post-scroller .post { border-bottom: 0.5px solid var(--sep); }
.comments { list-style: none; margin: 0; padding: 6px 0 20px; }
.comment { display: flex; gap: 10px; padding: 10px 16px; animation: rise 0.35s var(--ease-out) both; }
.comment .c-main { flex: 1; min-width: 0; }
.comment .c-main b { font-size: 14px; margin-right: 6px; }
.comment .c-main time { color: var(--text-2); font-size: 12px; }
.comment p { margin: 2px 0 0; font-size: 14px; white-space: pre-wrap; word-wrap: break-word; -webkit-user-select: text; user-select: text; }
.comment-form {
  flex: none; display: flex; align-items: center; gap: 10px; padding: 8px 14px calc(8px + var(--safe-b));
  box-shadow: 0 -0.5px 0 var(--sep); background: var(--bg);
}
.comment-form input { flex: 1; height: 40px; border-radius: 20px; border: 1px solid var(--sep); background: var(--bg); padding: 0 14px; outline: none; font-size: 15px; }

/* ---------- поиск и люди ---------- */
.search {
  display: flex; align-items: center; gap: 8px; margin: 6px 14px 8px; height: 38px; padding: 0 12px;
  border-radius: 11px; background: var(--fill); color: var(--text-2);
}
.search svg { width: 18px; height: 18px; }
.search input { flex: 1; border: 0; outline: none; background: none; font-size: 15px; color: var(--text); min-width: 0; }
.search input::-webkit-search-cancel-button { display: none; }
.people, .activity, .chats { list-style: none; margin: 0; padding: 0 0 20px; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 9px 16px; cursor: pointer; position: relative;
  animation: rise 0.4s var(--ease-out) both; animation-delay: calc(min(var(--i, 0), 10) * 30ms);
  transition: background 0.15s;
}
.settled .row { animation: none; }
.row:active { background: var(--fill); }
.row-main { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.row-main b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main span, .row-main p { margin: 0; color: var(--text-2); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main p.wrap { white-space: normal; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.row-main p.wrap time { color: var(--text-2); }
.row.unread .row-main b, .chats .row.unread .row-main p { color: var(--text); font-weight: 600; }
.row-main p.wrap b { font-weight: 600; }
.row .udot { width: 9px; height: 9px; border-radius: 50%; background: var(--pink); flex: none; animation: pop 0.3s var(--bounce); }
.row .thumb { width: 44px; height: 44px; border-radius: 8px; flex: none; background: var(--fill) center / cover; display: grid; place-items: center; overflow: hidden; font-size: 9px; color: var(--text-2); padding: 3px; line-height: 1.2; text-align: center; }
.row .pick { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--text-3); display: grid; place-items: center; flex: none; transition: background 0.2s, border-color 0.2s; }
.row .pick svg { width: 15px; height: 15px; stroke-width: 3; color: var(--on-ink); opacity: 0; }
.row.picked .pick { background: var(--ink); border-color: var(--ink); }
.row.picked .pick svg { opacity: 1; }
.chips { flex: none; display: flex; gap: 8px; padding: 2px 14px 10px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button {
  height: 34px; padding: 0 16px; border-radius: 17px; font-size: 14px; font-weight: 600; flex: none;
  background: var(--fill); transition: background 0.25s, color 0.25s, transform 0.25s var(--bounce);
}
.chips button:active { transform: scale(0.94); }
.chips button.active { background: var(--ink); color: var(--on-ink); }
.act-section { padding: 14px 16px 4px; font-size: 15px; font-weight: 700; }
.row-action { display: block; width: calc(100% - 28px); margin: 0 14px 8px; padding: 12px 14px; border-radius: 12px; background: var(--fill); text-align: left; font-weight: 600; }

/* ---------- профиль ---------- */
.profile { padding: 18px 16px 10px; animation: fadeIn 0.3s ease; }
.profile-top { display: flex; align-items: center; gap: 18px; }
.stats { flex: 1; display: flex; justify-content: space-around; text-align: center; }
.stats div { display: grid; line-height: 1.2; }
.stats b { font-size: 17px; font-weight: 700; }
.stats span { font-size: 13px; color: var(--text-2); }
.profile h2 { margin: 12px 0 0; font-size: 16px; font-weight: 700; }
.profile .handle { color: var(--text-2); font-size: 14px; }
.profile .bio { margin: 6px 0 0; font-size: 14px; white-space: pre-wrap; }
.profile-btns { display: flex; gap: 8px; margin-top: 14px; }
.profile-btns > * { flex: 1; height: 36px; border-radius: 10px; font-size: 14px; }
.profile-btns .btn-soft { height: 36px; }
.profile-posts { border-top: 0.5px solid var(--sep); margin-top: 14px; }
.profile-posts .empty { padding: 50px 30px; }

/* ---------- чаты ---------- */
.chats .row-main p time { color: var(--text-2); font-weight: 400; }
.chats .typing { color: var(--text); font-style: italic; }

/* ---------- переписка ---------- */
.chat-bar { grid-template-columns: 44px 1fr auto; box-shadow: 0 0.5px 0 var(--sep); }
.chat-who { display: flex; align-items: center; gap: 10px; min-width: 0; text-align: left; padding: 4px 0; }
.who-text { display: grid; min-width: 0; line-height: 1.2; }
.who-text b { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-text small { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-text small.live { color: #34c759; }
.chat-actions { display: flex; gap: 0; padding-right: 2px; }
.chat-actions svg { width: 24px; height: 24px; }

.messages {
  flex: 1; overflow-y: auto; overflow-x: hidden; padding: 10px 14px 12px; display: flex; flex-direction: column; gap: 2px;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
.day { align-self: center; color: var(--text-2); font-size: 11.5px; font-weight: 500; margin: 14px 0 8px; }
.day b { font-weight: 600; }
.msg { max-width: 76%; display: flex; flex-direction: column; position: relative; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg.them { align-self: flex-start; align-items: flex-start; }
.msg.tail { margin-bottom: 8px; }
.msg.new { animation: msgIn 0.45s var(--bounce) both; }
.msg.me.new { transform-origin: bottom right; }
.msg.them.new { transform-origin: bottom left; }
@keyframes msgIn { from { opacity: 0; transform: translateY(14px) scale(0.7); } }
.sender { color: var(--text-2); font-size: 11.5px; margin: 6px 0 2px 12px; }
.bubble {
  position: relative; padding: 9px 14px; border-radius: 20px; font-size: 15.5px; line-height: 1.35;
  white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; -webkit-user-select: text; user-select: text;
}
.me .bubble { background: var(--ink); color: var(--on-ink); }
.them .bubble { background: var(--bubble-them); color: var(--text); }
.me.tail .bubble:not(.emoji-only):not(.img-bubble) { border-bottom-right-radius: 6px; }
.them.tail .bubble:not(.emoji-only):not(.img-bubble) { border-bottom-left-radius: 6px; }
.bubble.emoji-only { background: none !important; font-size: 44px; line-height: 1.1; padding: 2px 0; }
.bubble.img-bubble { padding: 0; overflow: hidden; background: var(--fill) !important; border-radius: 18px; }
.bubble.img-bubble img { display: block; max-width: 240px; max-height: 320px; width: 100%; object-fit: cover; cursor: zoom-in; }
.voice { display: flex; align-items: center; gap: 10px; min-width: 190px; padding: 8px 14px 8px 8px; }
.voice .vplay { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; background: color-mix(in srgb, currentColor 16%, transparent); }
.voice .vplay svg { width: 16px; height: 16px; }
.voice .wave { flex: 1; height: 26px; display: flex; align-items: center; gap: 2px; }
.voice .wave i { flex: 1; min-width: 2px; border-radius: 2px; background: currentColor; opacity: 0.35; transition: opacity 0.15s; }
.voice .wave i.on { opacity: 1; }
.voice time { font-size: 12px; font-variant-numeric: tabular-nums; opacity: 0.75; min-width: 30px; text-align: right; }
.msg.pending .bubble { opacity: 0.6; }
.receipt { align-self: flex-end; font-size: 11px; color: var(--text-2); margin: -4px 4px 6px 0; animation: fadeIn 0.4s ease both; }
.receipt b { font-weight: 600; }
.typing-row .bubble { display: flex; gap: 4px; padding: 13px 14px; }
.typing-row i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-2); animation: blink 1.2s infinite; }
.typing-row i:nth-child(2) { animation-delay: 0.15s; }
.typing-row i:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-4px); opacity: 1; } }
.chat-empty { margin: auto; display: grid; justify-items: center; gap: 6px; text-align: center; color: var(--text-2); padding: 30px; animation: rise 0.5s var(--ease-out); }
.chat-empty h3 { margin: 8px 0 0; color: var(--text); font-size: 18px; }
.chat-empty p { margin: 0; font-size: 14px; }
.chat-empty .btn-soft { width: auto; height: 34px; padding: 0 16px; margin-top: 8px; font-size: 14px; }

.composer { flex: none; padding: 8px 12px calc(10px + var(--safe-b)); background: var(--bg); position: relative; }
.composer-field {
  display: flex; align-items: flex-end; min-height: 44px; border-radius: 22px; padding: 0 6px 0 16px;
  border: 1px solid var(--sep); background: var(--bg); transition: border-color 0.2s;
}
.composer-field:focus-within { border-color: color-mix(in srgb, var(--text) 25%, transparent); }
.composer-field textarea {
  flex: 1; border: 0; outline: none; background: none; resize: none; padding: 11px 0; font-size: 15.5px; line-height: 20px;
  max-height: 132px; min-width: 0;
}
.composer-field textarea::placeholder { color: var(--text-2); }
.composer-tools { display: flex; align-items: center; height: 42px; gap: 2px; transition: opacity 0.2s, transform 0.3s var(--spring); }
.composer-tools .tool { width: 36px; height: 36px; display: grid; place-items: center; color: var(--text); }
.composer-tools .tool:active { opacity: 0.4; }
.composer-tools .tool svg { width: 23px; height: 23px; }
.send {
  width: 32px; height: 32px; margin: 5px 0; border-radius: 50%; display: none; place-items: center; flex: none;
  background: var(--ink); color: var(--on-ink);
}
.send svg { width: 18px; height: 18px; stroke-width: 2.6; }
.composer.has-text .composer-tools { display: none; }
.composer.has-text .send { display: grid; animation: pop 0.3s var(--bounce); }
.recording {
  position: absolute; inset: 8px 12px calc(10px + var(--safe-b)); display: flex; align-items: center; gap: 10px;
  padding: 0 6px 0 16px; border-radius: 22px; background: var(--fill); animation: fadeIn 0.2s;
}
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #ff3b30; animation: blink 1s infinite; }
.recording #recTime { font-variant-numeric: tabular-nums; font-weight: 600; }
.rec-hint { flex: 1; color: var(--text-2); font-size: 14px; }
.rec-cancel { color: #ff3b30; font-size: 15px; padding: 0 6px; }
.recording .send { display: grid; }
.emoji-pop {
  position: absolute; z-index: 8; right: 12px; bottom: calc(66px + var(--safe-b)); width: min(320px, calc(100% - 24px));
  padding: 10px; border-radius: 18px; background: var(--bg); box-shadow: var(--shadow), 0 0 0 0.5px var(--sep);
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; transform-origin: bottom right;
  animation: popIn 0.35s var(--bounce);
}
@keyframes popIn { from { opacity: 0; transform: scale(0.6); } }
.emoji-pop button { font-size: 24px; height: 36px; border-radius: 8px; }
.emoji-pop button:active { background: var(--fill); transform: scale(1.2); }

/* ---------- шторки ---------- */
.sheet-backdrop {
  position: absolute; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.35); opacity: 0; pointer-events: none;
  transition: opacity 0.4s var(--spring);
}
body.sheet-open .sheet-backdrop { opacity: 1; pointer-events: auto; }
body.sheet-open #main { transform: scale(0.94) translateY(calc(var(--safe-t) + 6px)); border-radius: 14px; filter: brightness(0.9); }
#main { transition: transform 0.5s var(--spring), border-radius 0.5s var(--spring), filter 0.5s; transform-origin: center top; }
.sheet {
  position: absolute; z-index: 41; left: 0; right: 0; bottom: 0; height: calc(100% - var(--safe-t) - 24px);
  border-radius: 14px 14px 0 0; background: var(--bg); display: flex; flex-direction: column;
  transform: translateY(105%); transition: transform 0.5s var(--spring); box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.12);
}
.sheet.short { height: auto; max-height: 80%; }
.sheet.open { transform: none; }
.sheet.dragging { transition: none; }
.grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--text-3); margin: 6px auto 0; flex: none; }
.sheet-head { flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 6px 14px 10px; }
.sheet-head > :first-child { justify-self: start; }
.sheet-head > :last-child { justify-self: end; }
.sheet-head b { font-size: 16px; }
.sheet-body { flex: 1; overflow-y: auto; padding: 4px 16px calc(20px + var(--safe-b)); display: flex; flex-direction: column; gap: 12px; }
#peopleSheet .sheet-body { padding-left: 0; padding-right: 0; gap: 0; }
#peopleSheet .input { margin: 0 14px 8px; width: calc(100% - 28px); }
.compose-row { display: flex; gap: 12px; align-items: flex-start; }
.compose-row textarea { flex: 1; border: 0; outline: none; background: none; resize: none; font-size: 16px; line-height: 1.45; padding: 7px 0; min-height: 110px; }
.compose-image { position: relative; border-radius: 14px; overflow: hidden; animation: rise 0.35s var(--ease-out); }
.compose-image img { display: block; width: 100%; max-height: 360px; object-fit: cover; }
.compose-image .remove { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, 0.6); color: #fff; }
.compose-image .remove svg { width: 16px; height: 16px; stroke-width: 2.4; }
.edit-avatar { display: grid; justify-items: center; gap: 8px; padding-top: 4px; }
.edit-avatar button { font-weight: 600; font-size: 14px; }
.swatches { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--c1), var(--c2)); transition: transform 0.25s var(--bounce), box-shadow 0.2s; }
.swatches button.active { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text); transform: scale(1.08); }
.field { display: grid; gap: 6px; }
.field span { font-size: 13px; color: var(--text-2); font-weight: 500; }
.group { border-radius: 14px; background: var(--fill); overflow: hidden; }
.group-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; padding: 0 14px; }
.group-row + .group-row { box-shadow: 0 -0.5px 0 var(--sep); }
.group-row b { font-weight: 500; color: var(--text-2); font-size: 14px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.seg { display: flex; background: var(--fill-2); border-radius: 9px; padding: 2px; }
.seg button { padding: 5px 10px; border-radius: 7px; font-size: 13px; font-weight: 500; transition: background 0.2s, box-shadow 0.2s; }
.seg button.active { background: var(--bg); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12); font-weight: 600; }

/* меню действий */
.action-sheet {
  position: absolute; z-index: 60; left: 8px; right: 8px; bottom: calc(8px + var(--safe-b)); display: grid; gap: 8px;
  animation: asIn 0.45s var(--spring);
}
.action-sheet.closing { animation: asOut 0.3s var(--spring) forwards; }
@keyframes asIn { from { transform: translateY(110%); } }
@keyframes asOut { to { transform: translateY(110%); } }
.as-group { border-radius: 14px; overflow: hidden; background: color-mix(in srgb, var(--bg) 92%, transparent); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.as-group button { display: block; width: 100%; height: 56px; font-size: 17px; box-shadow: 0 -0.5px 0 var(--sep); }
.as-group button:first-child { box-shadow: none; }
.as-group button.danger { color: #ff3b30; }
.as-cancel { height: 56px; border-radius: 14px; background: var(--bg); font-size: 17px; font-weight: 600; }
body.as-open .sheet-backdrop { opacity: 1; pointer-events: auto; z-index: 55; }

/* ---------- тост и просмотр фото ---------- */
.toast {
  position: absolute; z-index: 100; left: 50%; top: calc(var(--safe-t) + 12px); max-width: calc(100% - 32px);
  padding: 10px 16px; border-radius: 14px; background: var(--ink); color: var(--on-ink); font-size: 14px; font-weight: 500;
  transform: translate(-50%, -140%); opacity: 0; transition: transform 0.5s var(--spring), opacity 0.3s; pointer-events: none;
  box-shadow: var(--shadow); text-align: center;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.viewer { position: absolute; inset: 0; z-index: 95; background: rgba(0, 0, 0, 0.94); display: grid; place-items: center; animation: fadeIn 0.25s; cursor: zoom-out; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; animation: popIn 0.4s var(--spring); }

/* ---------- звонок (как в iOS) ---------- */
.call {
  position: fixed; inset: 0; z-index: 90; color: #fff; overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  display: flex; flex-direction: column; align-items: center;
  padding: calc(var(--safe-t) + 54px) 24px calc(var(--safe-b) + 40px);
  animation: callIn 0.5s var(--spring) both;
}
.call.closing { animation: callOut 0.4s var(--spring) both; }
@keyframes callIn { from { opacity: 0; transform: translateY(40px) scale(0.98); } }
@keyframes callOut { to { opacity: 0; transform: scale(0.96); } }
.call-bg { position: absolute; inset: 0; z-index: -2; background: linear-gradient(180deg, #707076 0%, #5a5a60 45%, #3d3d42 100%); }
#remoteVideo {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1;
  opacity: 0; transition: opacity 0.5s;
}
.call.video.active #remoteVideo { opacity: 1; }
.call.video.active .call-bg::after { content: ""; position: absolute; inset: 0; }
.call.video.active::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,.45) 0%, transparent 25%, transparent 60%, rgba(0,0,0,.55) 100%);
}
#localVideo {
  position: absolute; z-index: 3; right: 16px; top: calc(var(--safe-t) + 96px); width: 104px; height: 150px;
  object-fit: cover; border-radius: 18px; background: #000; touch-action: none; cursor: grab;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  transition: translate 0.5s var(--bounce), opacity 0.3s;
  display: none;
}
.call.video #localVideo { display: block; }
.call.cam-off #localVideo { opacity: 0.2; }
#localVideo.mirror { transform: scaleX(-1); }
.call-i { position: absolute; top: calc(var(--safe-t) + 14px); right: 18px; color: rgba(255,255,255,.75); }
.call-i svg { width: 24px; height: 24px; stroke-width: 1.6; }
.call-info { text-align: center; }
.call-info p {
  margin: 0; font-size: 17px; font-weight: 600; color: rgba(255, 255, 255, 0.62); letter-spacing: 0.2px;
  font-variant-numeric: tabular-nums;
}
.call-info h2 { margin: 2px 0 0; font: 700 32px/1.15 -apple-system, "SF Pro Display", system-ui, sans-serif; letter-spacing: 0.3px; }
.call.video.active .call-info { text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35); }

.cbtn { display: grid; justify-items: center; gap: 7px; font-size: 13px; font-weight: 500; color: #fff; }
.cbtn i {
  width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%);
  transition: background 0.2s, color 0.2s, transform 0.3s var(--bounce);
}
.cbtn i svg { width: 30px; height: 30px; stroke-width: 1.8; }
.cbtn:active i { transform: scale(0.9); background: rgba(255, 255, 255, 0.35); }
.cbtn.on i { background: #fff; color: #3d3d42; }
.cbtn .slash { opacity: 0; }
.cbtn.on .slash { opacity: 1; }
.cbtn.dim { opacity: 0.45; }
.cbtn.end i { background: #ff3b30; }
.cbtn.end i svg { width: 34px; height: 34px; }
.cbtn.accept i { background: #34c759; }
.cbtn.accept i svg { width: 30px; height: 30px; }
.cbtn.end:active i { background: #d92d23; }
.cbtn.small { font-size: 12px; gap: 6px; }
.cbtn.small i { width: 44px; height: 44px; background: rgba(255, 255, 255, 0.16); }
.cbtn.small i svg { width: 22px; height: 22px; }

.call-grid {
  margin-top: auto; width: 100%; max-width: 300px;
  display: grid; grid-template-columns: repeat(3, 1fr); row-gap: 18px; justify-items: center;
  animation: rise 0.5s var(--ease-out) 0.05s both;
}
.call .video-only { display: none; }
.call.video .video-only { display: grid; }
.call.video .audio-only { display: none; }
.call.incoming .call-grid { display: none; }

.call-incoming { display: none; margin-top: auto; width: 100%; max-width: 320px; }
.call.incoming .call-incoming { display: block; }
.inc-small, .inc-big { display: flex; justify-content: space-between; padding: 0 6px; }
.inc-small { padding: 0 20px; margin-bottom: 30px; }
.inc-small .cbtn { min-width: 76px; }

/* клавиши */
.keypad {
  position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding: 0 24px calc(var(--safe-b) + 40px); background: linear-gradient(180deg, transparent, rgba(40,40,44,.6) 30%);
  opacity: 0; pointer-events: none; transform: translateY(20px); transition: opacity 0.25s, transform 0.4s var(--spring);
}
.call.keypad-open .keypad { opacity: 1; pointer-events: auto; transform: none; }
.call.keypad-open .call-grid { opacity: 0; pointer-events: none; }
.keypad-digits { min-height: 44px; font-size: 34px; font-weight: 400; letter-spacing: 2px; margin-bottom: 14px; }
.keypad-grid { display: grid; grid-template-columns: repeat(3, 78px); gap: 16px 26px; }
.keypad-grid button {
  width: 78px; height: 78px; border-radius: 50%; color: #fff; font-size: 34px; font-weight: 400; line-height: 1;
  display: grid; place-content: center; background: rgba(255, 255, 255, 0.16);
  transition: background 0.15s;
}
.keypad-grid button small { font-size: 10px; font-weight: 600; letter-spacing: 2px; margin-top: 2px; }
.keypad-grid button:active { background: rgba(255, 255, 255, 0.45); }
.keypad-foot { display: grid; grid-template-columns: repeat(3, 78px); gap: 26px; margin-top: 18px; justify-items: center; align-items: center; }
.keypad-hide { color: #fff; font-size: 17px; }


/* ---------- записи о звонках ---------- */
.callbubble { display: flex; align-items: center; gap: 10px; padding: 9px 16px 9px 10px; cursor: pointer; min-width: 220px; }
.cb-icon {
  width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.24);
}
.them .cb-icon { background: color-mix(in srgb, var(--text) 10%, transparent); color: var(--text); }
.cb-icon svg { width: 18px; height: 18px; }
.cb-text { display: grid; line-height: 1.2; text-align: left; }
.cb-text b { font-size: 16px; font-weight: 600; white-space: nowrap; }
.cb-text small { font-size: 13px; opacity: 0.75; margin-top: 2px; }
.callrow { display: flex; align-items: center; gap: 10px; padding: 6px 4px; cursor: pointer; color: var(--text); }
.callrow .cr-icon { width: 26px; height: 26px; display: grid; place-items: center; color: #8e8e93; flex: none; }
.callrow .cr-icon svg { width: 22px; height: 22px; }
.callrow.missed .cr-icon { color: #ff3b30; }
.callrow .cb-text b { font-size: 15px; font-weight: 500; }
.callrow .cb-text small { color: #8e8e93; opacity: 1; }
.callbubble:active, .callrow:active { opacity: 0.6; }
.fine a { color: inherit; }

/* ---------- компьютер: весь экран, меню слева ---------- */
@media (min-width: 900px) {
  :root { --side: 248px; --col: 640px; --list: 380px; }
  #app { max-width: none; }

  /* боковое меню вместо нижней панели */
  .tabbar {
    top: 0; right: auto; width: var(--side); height: auto; padding: 18px 12px; z-index: 30;
    flex-direction: column; justify-content: flex-start; align-items: stretch; gap: 4px;
    background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: 0.5px 0 0 var(--sep);
  }
  .side-logo { display: block; font-size: 28px; font-weight: 800; letter-spacing: -0.8px; padding: 4px 14px 20px; }
  .tabbar .side-only { display: flex; }
  .tabbar button {
    width: auto; height: 50px; padding: 0 14px; border-radius: 14px; display: flex; align-items: center; gap: 16px;
    justify-content: flex-start; font-size: 17px; font-weight: 500;
  }
  .tabbar button > span:not(.tab-avatar) { display: inline; }
  .tabbar button:hover { background: var(--fill); }
  .tabbar button:active { transform: scale(0.97); }
  .tabbar button.active { font-weight: 700; }
  .tabbar button[data-tab="me"] { margin-top: auto; }
  .tabbar .badge { top: 8px; right: auto; left: 32px; }
  .tabbar button[data-tab="compose"] { background: var(--ink); color: var(--on-ink); margin: 6px 0; }
  .tabbar button[data-tab="compose"]:hover { opacity: 0.88; }

  /* вкладки и страницы — справа от меню, содержимое по центру */
  .tab { left: var(--side); bottom: 0; }
  .page:not(#tabsPage) { left: var(--side); }
  .tab, #userPage, #postPage { padding: 0 max(0px, calc((100vw - var(--side) - var(--col)) / 2)); }
  .tab > .scroller, #userPage > .scroller, #postPage > .scroller { box-shadow: 0.5px 0 0 var(--sep), -0.5px 0 0 var(--sep); }
  .page.pushed { transform: translateX(28px); opacity: 0; transition: transform 0.35s var(--spring), opacity 0.2s, visibility 0s 0.35s; }
  .page.open { transform: none; opacity: 1; box-shadow: none; transition: transform 0.35s var(--spring), opacity 0.2s, visibility 0s; }
  .page.covered { transform: none; filter: none; }
  .feed-bar #openChats { display: none; }

  /* сообщения в две колонки: список слева, переписка справа */
  #chatsPage > * { width: var(--list); }
  #chatsPage { box-shadow: none; }
  #chatsPage::after {
    content: "Выберите чат, чтобы начать переписку"; position: absolute; top: 0; bottom: 0; left: var(--list); right: 0;
    display: grid; place-items: center; color: var(--text-2); font-size: 15px; box-shadow: -0.5px 0 0 var(--sep);
  }
  #chatsPage > .bar [data-pop] { visibility: hidden; }
  .page#chatPage { left: calc(var(--side) + var(--list)); box-shadow: -0.5px 0 0 var(--sep); }
  #chatPage.pushed { transform: none; }
  #chatPage .chat-bar > [data-pop] { visibility: hidden; }
  #chatsPage.covered { transform: none; }
  .bubble { max-width: min(70%, 520px); }
  .toast { left: calc(50% + var(--side) / 2); }

  /* шторки — окна по центру экрана */
  body.sheet-open #main { transform: none; border-radius: 0; filter: none; }
  .sheet {
    left: 50%; right: auto; bottom: auto; top: 50%; width: min(560px, calc(100% - 48px)); height: min(720px, calc(100% - 80px));
    border-radius: 18px; opacity: 0; pointer-events: none; box-shadow: 0 30px 90px rgba(0, 0, 0, 0.25);
    transform: translate(-50%, -46%) scale(0.97); transition: transform 0.35s var(--spring), opacity 0.2s;
  }
  .sheet.short { height: auto; max-height: calc(100% - 80px); }
  .sheet.open { transform: translate(-50%, -50%); opacity: 1; pointer-events: auto; }
  .sheet .grabber { visibility: hidden; }
  .sheet-body { padding-bottom: 20px; }
  .action-sheet { left: 50%; right: auto; width: 380px; margin-left: -190px; bottom: 32px; }

  /* вход — карточка по центру */
  .auth-wrap { max-width: 440px; margin: 0 auto; }
}
.scroller { scrollbar-width: thin; }

/* ---------- Plus: ник, галочка, обводки, баннеры ---------- */
.uname { font: inherit; }
.vbadge { width: 1.05em; height: 1.05em; margin-left: 3px; vertical-align: -0.16em; fill: #1d9bf0; stroke: none; display: inline-block; }
.vbadge .tick { fill: none; stroke: #fff; stroke-width: 2.4; }
.nemoji { margin-left: 4px; font-size: 0.95em; display: inline-block; }
.font-serif { font-family: Georgia, "Times New Roman", serif !important; font-style: italic; }
.font-mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace !important; letter-spacing: -0.3px; }
.font-round { font-family: "Nunito", "Varela Round", ui-rounded, "SF Pro Rounded", system-ui, sans-serif !important; }
.font-hand { font-family: "Comic Sans MS", "Marker Felt", "Segoe Print", cursive !important; }
.font-pixel { font-family: "Press Start 2P", "Courier New", monospace !important; font-size: 0.78em; letter-spacing: 0.5px; }
.font-heavy { font-family: Impact, "Arial Black", system-ui, sans-serif !important; font-weight: 900 !important; letter-spacing: 0.4px; text-transform: uppercase; }

.avatar.ring { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ring, #ff7a1a); }
.avatar.ring-gold { --ring: #e8b931; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px #e8b931, 0 0 12px rgba(232, 185, 49, 0.55); }
.avatar.ring-ink { --ring: var(--text); }
.avatar.ring-ice { --ring: #8fd8ff; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px #8fd8ff, 0 0 14px rgba(143, 216, 255, 0.7); }
.avatar.ring-neon { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px #39ff88, 0 0 16px #39ff88; }
/* переливание цвета — прозрачностью второго слоя, без перерисовки тени на каждом кадре */
.avatar.ring-neon::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px #00e1ff, 0 0 20px #00e1ff; animation: neon 1.6s ease-in-out infinite alternate;
}
@keyframes neon { from { opacity: 0; } to { opacity: 1; } }
.avatar.ring-fire::before, .avatar.ring-rainbow::before {
  content: ""; position: absolute; inset: -5px; border-radius: 50%; z-index: -1;
  background: conic-gradient(#ff4d2e, #ffb300, #ff2d6f, #ff4d2e); animation: spin 2.4s linear infinite;
  -webkit-mask: radial-gradient(closest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px)); mask: radial-gradient(closest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px));
}
.avatar.ring-rainbow::before { background: conic-gradient(#ff2d55, #ff9500, #ffcc00, #34c759, #00c7ff, #5856d6, #ff2d55); }
.avatar.ring-fire, .avatar.ring-rainbow { box-shadow: none; isolation: isolate; }
.avatar .amedia { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar.has-media { color: transparent; }

.banner { position: relative; height: 150px; background: linear-gradient(135deg, var(--fill), var(--fill-2)); overflow: hidden; }
.banner .amedia { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.banner .fx { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
/* эффекты двигаются через transform/opacity: их считает видеокарта, а не процессор */
.fx-shine .fx { right: auto; width: 60%; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.55) 48%, transparent 66%); transform: translateX(-100%); animation: shine 3.2s ease-in-out infinite; }
@keyframes shine { to { transform: translateX(270%); } }
.fx-snow .fx, .fx-stars .fx {
  background-image: radial-gradient(2px 2px at 20px 30px, #fff, transparent), radial-gradient(2px 2px at 80px 70px, #fff, transparent),
    radial-gradient(3px 3px at 140px 20px, #fff, transparent), radial-gradient(2px 2px at 200px 110px, #fff, transparent),
    radial-gradient(2.5px 2.5px at 260px 50px, #fff, transparent), radial-gradient(2px 2px at 320px 130px, #fff, transparent);
  background-size: 340px 150px; opacity: 0.9;
}
.fx-snow .fx { top: -150px; left: -40px; animation: snow 6s linear infinite; }
@keyframes snow { to { transform: translate(40px, 150px); } }
.fx-stars .fx { animation: twinkle 1.8s ease-in-out infinite alternate; }
@keyframes twinkle { from { opacity: 0.25; } to { opacity: 1; } }
.fx-aurora .fx { right: -200%; bottom: -200%; background: linear-gradient(120deg, rgba(0, 255, 170, 0.35), rgba(120, 80, 255, 0.35), rgba(255, 60, 160, 0.3)); mix-blend-mode: screen; animation: aurora 6s ease-in-out infinite alternate; }
@keyframes aurora { to { transform: translate(-66.6%, -16.6%); } }
.fx-glitch .amedia { animation: glitch 2.4s steps(1) infinite; }
@keyframes glitch { 0%, 88%, 100% { transform: none; filter: none; } 90% { transform: translate(-6px, 2px); filter: hue-rotate(90deg) saturate(2); } 93% { transform: translate(5px, -2px); filter: hue-rotate(-60deg); } 96% { transform: translate(-2px, 0); } }
.profile.has-banner { padding-top: 0; }
.profile.has-banner .profile-top { margin-top: -30px; position: relative; z-index: 2; }
.profile.has-banner .profile-top .avatar { box-shadow: 0 0 0 4px var(--bg); }
.profile.has-banner .profile-top .avatar.ring { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--ring, #ff7a1a); }
.profile .badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.plus-badge {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 10px; font-size: 11px; font-weight: 800; letter-spacing: 0.4px;
  color: #fff; background: linear-gradient(90deg, #ff7a1a, #ff2d6f, #8e2de2); vertical-align: middle;
}
.lune-chip { height: 22px; padding: 0 10px; border-radius: 11px; background: var(--fill); font-size: 12px; font-weight: 700; }
.music-card {
  display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 12px; padding: 10px 12px; border-radius: 14px;
  background: var(--fill); text-align: left;
}
.music-card .mplay { width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: var(--on-ink); display: grid; place-items: center; flex: none; }
.music-card .mplay svg { width: 18px; height: 18px; }
.music-card .mtext { flex: 1; min-width: 0; display: grid; }
.music-card .mtext b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-card small { color: var(--text-2); font-size: 12px; }
.music-card .eq { display: flex; align-items: flex-end; gap: 2px; height: 16px; }
.music-card .eq i { width: 3px; height: 30%; border-radius: 2px; background: var(--text-3); }
.music-card.playing .eq i { background: var(--ink); animation: eq 0.9s ease-in-out infinite alternate; }
.music-card.playing .eq i:nth-child(2) { animation-delay: -0.3s; } .music-card.playing .eq i:nth-child(3) { animation-delay: -0.6s; } .music-card.playing .eq i:nth-child(4) { animation-delay: -0.15s; }
@keyframes eq { from { height: 20%; } to { height: 100%; } }

/* редактирование: Plus и музыка */
.chips.wrap { flex-wrap: wrap; overflow: visible; padding: 0; }
.chips.wrap input[type=color] { width: 36px; height: 30px; border: 0; padding: 0; background: none; }
.media-edit { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.media-edit .media-name { flex: 1; min-width: 100px; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-soft.small { width: auto; height: 32px; padding: 0 14px; font-size: 13px; border-radius: 10px; }
.plus-zone { display: grid; gap: 12px; padding: 14px; border-radius: 16px; background: linear-gradient(135deg, color-mix(in srgb, #ff7a1a 10%, var(--bg)), color-mix(in srgb, #8e2de2 10%, var(--bg))); }
.plus-zone h4 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.plus-zone.locked > :not(h4):not(.plus-lock) { opacity: 0.45; pointer-events: none; }
.plus-lock { margin: -4px 0 0; font-size: 13px; color: var(--text-2); }
#fontChips button { font-size: 14px; }

/* настройки */
.group-row.col { flex-direction: column; align-items: stretch; padding: 12px 14px; gap: 10px; }
.group-row small { display: block; color: var(--text-2); font-size: 12px; font-weight: 400; }
.link-row { width: 100%; text-align: left; font: inherit; }
.custom-colors { display: flex; gap: 14px; flex-wrap: wrap; }
.custom-colors label { display: grid; justify-items: center; gap: 4px; font-size: 12px; color: var(--text-2); }
.custom-colors input { width: 40px; height: 40px; border: 0; border-radius: 50%; padding: 0; background: none; cursor: pointer; }
.icon-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 10px; }
.icon-picker button { display: grid; justify-items: center; gap: 4px; font-size: 11px; color: var(--text-2); }
.icon-picker img { width: 52px; height: 52px; border-radius: 13px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); transition: transform 0.25s var(--bounce); }
.icon-picker button.active img { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ink); transform: scale(1.05); }
.icon-picker button.active span { color: var(--text); font-weight: 600; }

/* кошелёк */
.wallet-top { display: grid; justify-items: center; gap: 2px; padding: 10px 0 6px; }
.lune-coin { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 34px; color: #fff; background: radial-gradient(circle at 30% 30%, #b9a6ff, #5b3df5 70%); box-shadow: 0 8px 24px rgba(91, 61, 245, 0.35); }
.wallet-top b { font-size: 32px; font-weight: 800; }
.wallet-top small { color: var(--text-2); font-weight: 600; letter-spacing: 1px; }
.chip-static { height: 30px; padding: 0 12px; border-radius: 15px; background: var(--fill); display: inline-flex; align-items: center; font-size: 14px; font-weight: 600; }
.buy-row { display: flex; gap: 8px; align-items: center; }
.buy-row .input { flex: 1; min-width: 0; height: 40px; }
.buy-row .btn-black.small, .buy-row .btn-soft.small { height: 40px; flex: none; }
.btn-wrap { display: flex; gap: 8px; flex-wrap: wrap; }

/* админ-панель */
#adminPage > .seg-text { flex: none; padding: 0 0 4px; box-shadow: 0 0.5px 0 var(--sep); }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 14px 16px; }
.stat { padding: 16px; border-radius: 16px; background: var(--fill); display: grid; gap: 2px; animation: rise 0.4s var(--ease-out) both; }
.stat b { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; }
.stat span { font-size: 13px; color: var(--text-2); }
.stat:nth-child(-n+2) { background: var(--ink); color: var(--on-ink); }
.stat:nth-child(-n+2) span { color: color-mix(in srgb, var(--on-ink) 70%, transparent); }
#adminList .row { cursor: pointer; }
.tags { display: flex; gap: 4px; flex: none; }
.tag { font-style: normal; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 8px; background: var(--fill-2); }
.tag.plus { background: linear-gradient(90deg, #ff7a1a, #ff2d6f); color: #fff; }
.tag.red { background: #ff3b30; color: #fff; }
.tag.amber { background: #ff9f0a; color: #fff; }
.au-head { display: flex; align-items: center; gap: 12px; }
.au-head > div { display: grid; min-width: 0; }
.au-head small { color: var(--text-2); }
.group.pad { padding: 12px 14px; display: grid; gap: 10px; }
.au-line { display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.switch { width: 51px; height: 31px; border-radius: 16px; background: var(--fill-2); position: relative; flex: none; transition: background 0.25s; }
.switch i { position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); transition: transform 0.3s var(--bounce); }
.switch.on { background: #34c759; }
.switch.on i { transform: translateX(20px); }

/* заблокированный аккаунт */
.banned { position: absolute; inset: 0; z-index: 70; display: grid; place-items: center; background: var(--bg); text-align: center; padding: 30px; }
.banned b { font-size: 22px; }
.banned p { color: var(--text-2); }

/* ---------- стикеры ---------- */
.sticker-pop {
  position: absolute; left: 10px; right: 10px; bottom: calc(64px + var(--safe-b)); z-index: 8; max-height: 46%; overflow-y: auto;
  padding: 8px 10px 12px; border-radius: 18px; background: color-mix(in srgb, var(--bg) 94%, transparent);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); box-shadow: var(--shadow); animation: popIn 0.3s var(--bounce);
}
.sp-title { font-size: 12px; font-weight: 700; color: var(--text-2); padding: 8px 4px 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.sp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 6px; }
.sp-grid button { height: 62px; border-radius: 14px; font-size: 40px; display: grid; place-items: center; transition: transform 0.2s var(--bounce); }
.sp-grid button:hover { background: var(--fill); }
.sp-grid button:active { transform: scale(1.15); }
.sp-text { font-size: 11px; font-weight: 900; line-height: 1.1; padding: 6px 6px; border-radius: 8px; color: #fff; background: linear-gradient(135deg, #ff7a1a, #ff2d6f); transform: rotate(-4deg); }
.sticker { font-size: 96px; line-height: 1.1; padding: 2px 4px; }
.sticker span { display: inline-block; }
.msg.me .sticker { text-align: right; }
.anim-beat span { animation: st-beat 1.2s ease-in-out infinite; }
.anim-shake span { animation: st-shake 0.9s ease-in-out infinite; }
.anim-float span { animation: st-float 2.2s ease-in-out infinite; }
.anim-wobble span { animation: st-wobble 1.6s ease-in-out infinite; }
.anim-pop span { animation: st-pop 1.4s var(--bounce) infinite; }
.anim-bounce span { animation: st-bounce 1s cubic-bezier(0.3, 0, 0.5, 1) infinite; }
.anim-tilt span { animation: st-tilt 2s ease-in-out infinite; transform-origin: 50% 90%; }
.anim-spin span { animation: spin 3s linear infinite; }
.anim-fly span { animation: st-fly 1.8s ease-in-out infinite; }
@keyframes st-beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.18); } 30% { transform: scale(0.96); } 45% { transform: scale(1.1); } }
@keyframes st-shake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-10deg); } 75% { transform: rotate(10deg); } }
@keyframes st-float { 50% { transform: translateY(-10px); } }
@keyframes st-wobble { 0%, 100% { transform: scale(1, 1); } 30% { transform: scale(1.15, 0.85); } 60% { transform: scale(0.9, 1.1); } }
@keyframes st-pop { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.22) rotate(6deg); } }
@keyframes st-bounce { 0%, 100% { transform: translateY(0) scale(1, 1); } 45% { transform: translateY(-18px) scale(0.95, 1.05); } 90% { transform: translateY(0) scale(1.1, 0.9); } }
@keyframes st-tilt { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }
@keyframes st-fly { 0%, 100% { transform: translate(0, 0) rotate(0); } 50% { transform: translate(8px, -14px) rotate(-8deg); } }
.text-sticker span {
  font-size: 30px; font-weight: 900; letter-spacing: 0.5px; padding: 12px 18px; border-radius: 18px; color: #fff; line-height: 1.05;
  background: linear-gradient(135deg, #ff7a1a, #ff2d6f); box-shadow: 0 8px 24px rgba(255, 45, 111, 0.35); transform: rotate(-4deg);
  animation: st-pop 2.4s var(--bounce) infinite; max-width: 240px; text-align: center;
}
.st-t-ok span { background: linear-gradient(135deg, #34c759, #00a3ff); }
.st-t-thx span { background: linear-gradient(135deg, #ffb300, #ff6a00); }
.st-t-wait span { background: linear-gradient(135deg, #5856d6, #af52de); }
.st-t-love span { background: linear-gradient(135deg, #ff2d55, #ff7ab6); }
.st-t-gn span { background: linear-gradient(135deg, #1e3c72, #5b3df5); font-size: 22px; }
.st-t-lol span { background: linear-gradient(135deg, #ffcc00, #ff9500); color: #2b1406; }

/* файлы в чате */
.file-bubble { display: flex; align-items: center; gap: 10px; cursor: pointer; min-width: 200px; }
.file-bubble .ficon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, currentColor 14%, transparent); flex: none; }
.file-bubble .fmeta { display: grid; min-width: 0; }
.file-bubble .fmeta b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.file-bubble small { opacity: 0.65; font-size: 12px; }
.file-bubble.loading { opacity: 0.6; }
.upload-bar { flex: none; display: grid; gap: 6px; padding: 8px 16px; font-size: 13px; color: var(--text-2); background: var(--bg); }
.upload-bar i { height: 4px; border-radius: 2px; background: var(--fill-2); overflow: hidden; }
.upload-bar b { display: block; height: 100%; width: 0; background: var(--ink); transition: width 0.2s; }
.viewer video { max-width: 100%; max-height: 100%; }

@media (min-width: 900px) {
  #adminPage { padding: 0 max(0px, calc((100vw - var(--side) - var(--col)) / 2)); }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .banner { height: 200px; }
  .sticker-pop { left: auto; width: 420px; }
}
.profile.has-banner .stats { margin-top: 30px; }
.group .btn-soft { background: var(--bg); }

/* ---------- подарки и NFT ---------- */
.gift-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.gift-tile { position: relative; display: grid; justify-items: center; align-content: center; gap: 2px; aspect-ratio: 1; border-radius: 16px; background: var(--fill); overflow: hidden; transition: transform 0.25s var(--bounce), box-shadow 0.2s; }
.gift-tile:active { transform: scale(0.95); }
.gift-tile.big { aspect-ratio: auto; padding: 12px 6px 10px; gap: 4px; }
.gift-tile.sel { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ink); }
.gift-tile.nft { padding: 0; background: none; }
.gift-tile.big.nft { padding: 0 0 8px; background: var(--fill); }
.gift-tile.nft .nft-art { width: 100%; border-radius: 16px; }
.gift-tile small { position: absolute; right: 4px; bottom: 4px; font-size: 11px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
.gift-tile small .avatar { box-shadow: 0 0 0 2px var(--bg); }
.gift-art { font-size: 44px; line-height: 1.1; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15)); }
.gift-tile.big .gift-art { font-size: 48px; }
.gift-tile .gname { font-size: 12px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 6px; }
.gift-tile .price { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 10px; background: var(--ink); color: var(--on-ink); }
.avatar.xxs { width: 20px; height: 20px; font-size: 8px; }
.row .thumb.gift-thumb { font-size: 26px; padding: 0; }
#giftSheet .seg-text, #marketPage .seg-text { flex: none; padding: 0 0 4px; box-shadow: 0 0.5px 0 var(--sep); }

.profile-gifts { margin-top: 14px; display: grid; gap: 8px; }
.pg-head { display: flex; align-items: center; justify-content: space-between; font-size: 15px; }
.pg-strip { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.pg-strip::-webkit-scrollbar { display: none; }
.pg-strip .gift-tile { flex: none; width: 76px; }
.pg-strip .gift-art { font-size: 38px; }
.gift-btn { flex: none !important; width: 40px !important; padding: 0 !important; display: grid; place-items: center; }
.gift-btn svg { width: 19px; height: 19px; }

.nft-art {
  position: relative; display: grid; place-items: center; aspect-ratio: 1; width: 100%; border-radius: 14px; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, var(--b1, #6aa0ff), var(--b2, #1a2a6c) 75%);
}
.nft-art::before {
  content: ''; position: absolute; inset: 0; opacity: 0.18;
  background: radial-gradient(circle, #fff 1.5px, transparent 2px) 0 0 / 22px 22px;
}
.nft-img { position: relative; font-size: 46px; line-height: 1; filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.3)); width: 64%; height: 64%; display: grid; place-items: center; }
.nft-img .amedia { width: 100%; height: 100%; object-fit: contain; }
.nft-art.big { width: 200px; border-radius: 24px; box-shadow: 0 14px 40px color-mix(in srgb, var(--b2, #000) 45%, transparent); }
.nft-art.big .nft-img { font-size: 96px; }
.nft-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; padding: 14px 16px calc(20px + var(--safe-b)); }
.nft-card { display: grid; gap: 4px; padding: 8px 8px 10px; border-radius: 18px; background: var(--fill); cursor: pointer; animation: rise 0.4s var(--ease-out) both; }
.nft-card b { font-size: 14px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nft-card small { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.price-btn { margin-top: 4px; height: 32px; border-radius: 16px; background: var(--ink); color: var(--on-ink); font-size: 13px; font-weight: 700; transition: transform 0.2s var(--bounce); }
.price-btn:active { transform: scale(0.95); }
.price-btn.resale { background: linear-gradient(90deg, #2f80ff, #8e2de2); color: #fff; }
.sold { margin-top: 4px; font-size: 12px; font-weight: 600; color: var(--text-2); text-align: center; padding: 7px 0; border-radius: 16px; background: var(--fill-2); }
.nft-hero { display: grid; justify-items: center; gap: 8px; padding: 6px 0 4px; }
.nft-hero h3 { margin: 6px 0 0; font-size: 20px; }
.nft-hero .fine { margin: 0; }

.gift-bubble { display: grid; justify-items: center; gap: 2px; min-width: 150px; padding: 8px 6px; text-align: center; }
.gift-bubble .gift-art { font-size: 56px; }
.gift-bubble b { font-size: 15px; }
.gift-bubble small { font-size: 12px; opacity: 0.7; }
.gift-bubble p { margin: 4px 0 0; font-size: 14px; }
.gift-bubble.nft { width: 170px; cursor: pointer; }
.gift-bubble.nft .nft-art { margin-bottom: 6px; }

.nft-creator { display: grid; gap: 12px; padding: 14px 16px 30px; }
.nft-creator h3 { margin: 6px 0 0; font-size: 17px; }
.nft-creator .buy-row .field { flex: 1; }
.nft-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.bd-chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px 0 6px; border-radius: 16px; background: var(--fill); font-size: 13px; font-weight: 600; opacity: 0.55; transition: opacity 0.2s; }
.bd-chip.active { opacity: 1; box-shadow: inset 0 0 0 1.5px var(--ink); }
.bd-chip i { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, var(--b1), var(--b2)); }

.upd-top { display: grid; justify-items: center; gap: 4px; padding: 6px 0; text-align: center; }
.upd-top img { width: 76px; height: 76px; border-radius: 18px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18); margin-bottom: 6px; }
.upd-top b { font-size: 20px; }
.upd-top small { color: var(--text-2); font-size: 13px; }
.upd-state { margin: 0; text-align: center; font-weight: 600; color: var(--text-2); }
.upd-state.ok { color: #34c759; }
#versionInfo.accent { color: #34c759; font-weight: 700; }
.bar .lune-chip.bar-side { justify-self: end; width: auto; }

@media (min-width: 900px) {
  #marketPage { padding: 0 max(0px, calc((100vw - var(--side) - var(--col)) / 2)); }
  .nft-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
}
#giftSheet .sheet-body { padding-top: 12px; }
.lune-chip { white-space: nowrap; flex: none; }
.bar .lune-chip.bar-side { min-width: max-content; height: 28px; border-radius: 14px; }
.nft-card .nft-img { font-size: 64px; }
.row .nft-art { width: 44px; flex: none; border-radius: 10px; }
.row .nft-art .nft-img { font-size: 24px; }
.row .nft-art::before { background-size: 10px 10px; }

/* ---------- профиль в стиле Telegram ---------- */
:root { --link: #2f86e8; }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) { --link: #5eb5f7; } }
:root[data-theme="dark"] { --link: #5eb5f7; }
.profile.tg { padding: 0 0 6px; display: grid; gap: 10px; }
.tg-head { position: relative; display: grid; justify-items: center; gap: 2px; padding: 26px 16px 16px; overflow: hidden; text-align: center; }
.tg-head.tinted { background: linear-gradient(180deg, transparent 55%, var(--bg)), radial-gradient(130% 100% at 50% 30%, color-mix(in srgb, var(--b1) 38%, var(--bg)), color-mix(in srgb, var(--b2) 20%, var(--bg)) 65%, var(--bg)); }
.tg-head > .banner { position: absolute; inset: 0; height: auto; z-index: 0; }
.tg-head > .banner::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.55)); }
.tg-head.has-banner h2, .tg-head.has-banner .tg-seen { color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); }
.tg-head .avatar.xl { width: 96px; height: 96px; font-size: 34px; position: relative; z-index: 2; }
.tg-head h2 { position: relative; z-index: 2; margin: 10px 0 0; font-size: 21px; font-weight: 700; display: flex; align-items: center; gap: 4px; justify-content: center; }
.tg-seen { position: relative; z-index: 2; color: var(--text-2); font-size: 14px; display: flex; align-items: center; gap: 6px; }
.gift-pattern { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.gift-pattern span { position: absolute; transform: translate(-50%, -50%); line-height: 1; filter: drop-shadow(0 0 6px color-mix(in srgb, var(--b1, #ffd166) 70%, transparent)); animation: giftFloat 3.2s ease-in-out infinite alternate; }
.gift-pattern span:nth-child(3n) { animation-delay: -1.1s; } .gift-pattern span:nth-child(3n+1) { animation-delay: -2.2s; }
.gift-pattern i { display: block; width: 1em; height: 1em; position: relative; }
.gift-pattern i .amedia { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
@keyframes giftFloat { from { transform: translate(-50%, -50%) scale(0.9); } to { transform: translate(-50%, -54%) scale(1.08); } }
.tg-acts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 0 16px; }
.tg-act { display: grid; justify-items: center; align-content: center; gap: 4px; height: 58px; border-radius: 12px; background: var(--fill); font-size: 11.5px; letter-spacing: -0.1px; font-weight: 500; color: var(--text); transition: transform 0.2s var(--bounce), background 0.2s; min-width: 0; }
.tg-act span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; }
.tg-act svg { width: 22px; height: 22px; }
.tg-act .moon { font-size: 19px; line-height: 22px; }
.tg-act:active { transform: scale(0.95); background: var(--fill-2); }
.tg-act.on { background: var(--ink); color: var(--on-ink); }
.profile.tg .music-card { margin: 0 16px; width: auto; }
.tg-card { margin: 0 16px; border-radius: 14px; background: var(--fill); overflow: hidden; }
.tg-row { display: flex; align-items: center; gap: 16px; width: 100%; padding: 11px 14px; text-align: left; font: inherit; font-size: 15px; color: var(--text); min-height: 48px; }
.tg-row + .tg-row { box-shadow: inset 0 0.5px 0 var(--sep); }
.tg-row > div { display: grid; gap: 1px; min-width: 0; }
.tg-row small { color: var(--text-2); font-size: 13px; }
.tg-row .link { color: var(--link); font-weight: 500; }
.tg-row .bio { margin: 0; font-size: 15px; white-space: pre-wrap; }
.tg-row > svg { width: 22px; height: 22px; color: var(--text-2); flex: none; }
button.tg-row:active { background: var(--fill-2); }
.tg-row .gicons { font-style: normal; margin-left: 4px; letter-spacing: 1px; }
.profile-tabs { position: sticky; top: 0; z-index: 3; background: var(--bg); box-shadow: 0 0.5px 0 var(--sep); }
.profile-gifts { margin: 0; padding: 14px 16px 24px; }
.profile-gifts .gift-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
.gcount { position: absolute; top: 6px; right: 6px; font-style: normal; font-size: 11px; font-weight: 800; padding: 1px 6px; border-radius: 8px; background: var(--ink); color: var(--on-ink); }

/* количество подарков */
.gift-count { display: flex; align-items: center; gap: 8px; }
.gift-count span { flex: 1; font-size: 15px; font-weight: 600; }
.gift-count button { width: 40px; height: 40px; border-radius: 12px; background: var(--fill); font-size: 22px; font-weight: 600; }
.gift-count button:active { background: var(--fill-2); }
.gift-count .input { width: 76px; height: 40px; text-align: center; font-weight: 700; padding: 0 6px; }

/* NFT на весь экран */
.nft-art.full::before { display: none; }
.nft-art.full .nft-img { width: 100%; height: 100%; filter: none; }
.nft-art.full .nft-img .amedia { object-fit: cover; }
.check-row { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; font-weight: 500; cursor: pointer; }
.check-row input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--ink); flex: none; }
.check-row small { display: block; font-size: 12px; font-weight: 400; color: var(--text-2); margin-top: 2px; }
.check-row:has(input:disabled) { opacity: 0.5; }
/* ---------- оценка приложения ---------- */
.rate-card { display: grid; gap: 12px; margin: 12px 16px 6px; padding: 16px; border-radius: 18px; background: var(--fill); animation: rise 0.4s var(--ease-out) both; }
.rate-head { display: grid; gap: 2px; }
.rate-head b { font-size: 17px; }
.rate-head .fine { margin: 0; }
.rate-stars { display: flex; gap: 6px; }
.rate-stars button { width: 40px; height: 40px; display: grid; place-items: center; transition: transform 0.25s var(--bounce); }
.rate-stars button:active { transform: scale(0.85); }
.rate-stars svg { width: 32px; height: 32px; fill: none; stroke: var(--text-2); stroke-width: 1.6; stroke-linejoin: round; transition: fill 0.15s, stroke 0.15s; }
.rate-stars button.on svg { fill: var(--text); stroke: var(--text); }
.rate-text { height: auto; min-height: 76px; padding: 12px 14px; resize: none; line-height: 1.4; }
.rate-row { display: flex; gap: 10px; }
.rate-row > * { flex: 1; }
.rate-done { text-align: center; padding: 6px 0; font-weight: 700; }
.rate-card:not(.done) .rate-done, .rate-card.done > :not(.rate-done) { display: none; }
.rate-admin { margin: 0 16px 14px; display: grid; gap: 8px; }
.rate-admin h3 { margin: 4px 0 2px; font-size: 16px; }
.rate-item { padding: 12px 14px; border-radius: 14px; background: var(--fill); display: grid; gap: 4px; }
.rate-item .who { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.rate-item .who span { color: var(--text-2); }
.rate-item p { margin: 0; white-space: pre-wrap; word-break: break-word; font-size: 15px; }
.rate-item .st { letter-spacing: 1px; }
.turn-box { display: grid; gap: 10px; margin: 6px 16px 24px; padding: 14px; border-radius: 16px; background: var(--fill); }
.turn-box h3 { margin: 0; font-size: 16px; }
.turn-box .fine { margin: 0; }
.turn-box .buy-row .field { flex: 1; min-width: 0; }
.turn-box .input { background: var(--bg); }
.gift-art.hero { font-size: 110px; filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.2)); }

/* ---------- документы, cookie, данные ---------- */
.group-title { margin: 6px 4px -4px; font-size: 13px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.4px; }
.danger-row > span:first-child { color: #ff3b30; }
#legalSheet iframe { flex: 1; width: 100%; border: 0; background: var(--bg); }
.cookie-banner {
  position: fixed; z-index: 90; left: 12px; right: 12px; bottom: calc(12px + var(--safe-b)); max-width: 560px; margin: 0 auto;
  display: grid; gap: 10px; padding: 14px 16px; border-radius: 18px; background: var(--bg); color: var(--text);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25), 0 0 0 0.5px var(--sep); animation: rise 0.4s var(--ease-out);
}
.cookie-banner p { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--text-2); }
.cookie-banner p b { display: block; color: var(--text); font-size: 15px; margin-bottom: 2px; }
.cookie-banner a { color: var(--text); font-weight: 600; }
.cookie-btns { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.cookie-btns button { flex: 1; min-width: 150px; height: 38px; }

/* фокус с клавиатуры виден, мышью — нет */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--link, #2f86e8); outline-offset: 2px; border-radius: 8px; }
.msg:focus-visible { outline-offset: -2px; border-radius: 18px; }
li.row:focus-visible, .nft-card:focus-visible { outline-offset: -2px; }
.sheet-body > * { flex-shrink: 0; }
.input:focus-visible, input:focus-visible, textarea:focus-visible { outline: none; }
.market-note { margin: 0; padding: 0 16px calc(24px + var(--safe-b)); text-align: center; }

/* свёрнутый звонок: полоска сверху, приложение сдвигается под неё */
.call.mini { display: none; }
.call-min { position: absolute; top: calc(var(--safe-t) + 12px); left: 14px; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: rgba(255, 255, 255, 0.14); backdrop-filter: blur(10px); }
.call-min svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.call.incoming .call-min { display: none; }
.call-bar {
  position: fixed; z-index: 85; top: 0; left: 0; right: 0; height: calc(var(--safe-t) + 34px); padding: var(--safe-t) 16px 0;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: #34c759; color: #fff; font-size: 14px; font-weight: 600; white-space: nowrap; animation: barIn 0.3s var(--ease-out);
}
.call-bar i { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: pulse 1.2s ease-in-out infinite; flex: none; }
.call-bar span { overflow: hidden; text-overflow: ellipsis; }
.call-bar b { font-variant-numeric: tabular-nums; }
.call-bar small { opacity: 0.85; font-size: 12px; font-weight: 500; }
@keyframes pulse { 50% { opacity: 0.3; } }
@keyframes barIn { from { transform: translateY(-100%); } }
body.call-mini #main { top: calc(env(safe-area-inset-top, 0px) + 34px); --safe-t: 0px; }

/* файлы в постах */
.compose-add { display: flex; gap: 8px; flex-wrap: wrap; }
.compose-file { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--fill); }
.compose-file > svg { width: 22px; height: 22px; flex: none; }
.compose-file b { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compose-file .remove { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--fill-2); flex: none; }
.compose-file .remove svg { width: 14px; height: 14px; stroke-width: 2.4; }
.post .post-file { margin: 10px 0 0; padding: 10px 12px; border-radius: 16px; background: var(--fill); color: var(--text); max-width: none; }
.post .post-file .ficon svg { width: 20px; height: 20px; }
.post .post-file .fmeta b { max-width: none; }
.post .post-file.loading { opacity: 0.6; }

/* система просит меньше движения — бесконечные украшения стоят */
@media (prefers-reduced-motion: reduce) {
  .avatar.ring-neon::after, .avatar.ring-fire::before, .avatar.ring-rainbow::before, .banner .fx, .fx-glitch .amedia,
  .gift-pattern span, .music-card.playing .eq i, [class*="anim-"] span { animation: none !important; }
}

/* юзернеймы: продажа в кошельке и карточки в маркете */
#myUsernames { display: grid; gap: 8px; }
.nick-row { display: flex; align-items: center; gap: 8px; }
.nick-row b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nick-row .input { width: 90px; height: 34px; padding: 0 10px; }
.nick-card .nick-art { aspect-ratio: 1; border-radius: 14px; display: grid; place-items: center; padding: 8px; background: linear-gradient(135deg, var(--fill), var(--fill-2)); font-weight: 800; font-size: 18px; word-break: break-all; text-align: center; }
