/* onWave UI: профиль в стиле ленты, карточка и настройки «мессенджера», анимации и свечение.
   Подключается после styles.css и использует его переменные (--teal меняется в персонализации). */
:root {
  --glow: color-mix(in srgb, var(--teal) 45%, transparent);
  --glow-soft: color-mix(in srgb, var(--teal) 14%, transparent);
  --ease: cubic-bezier(.2, .8, .2, 1);
}
@property --ring-angle { syntax: "<angle>"; inherits: false; initial-value: 0deg; }

/* ---------- Анимации ---------- */
@keyframes pageIn { from { opacity: 0; transform: translateY(14px) scale(.992); } to { opacity: 1; transform: none; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetUp { from { opacity: 0; transform: translateY(100%); } to { opacity: 1; transform: none; } }
@keyframes sheetIn { from { opacity: 0; transform: translateY(26px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes ringSpin { to { --ring-angle: 360deg; } }
@keyframes drift { from { transform: translate3d(-3%, -2%, 0) scale(1); } to { transform: translate3d(3%, 3%, 0) scale(1.08); } }
@keyframes pulseDot { 0% { box-shadow: 0 0 0 0 rgba(61, 220, 132, .55); } 70% { box-shadow: 0 0 0 7px rgba(61, 220, 132, 0); } 100% { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0); } }
@keyframes sheen { from { transform: translateX(-120%) skewX(-20deg); } to { transform: translateX(220%) skewX(-20deg); } }

.workspace::before { content: ""; position: absolute; inset: -25%; z-index: 0; pointer-events: none; background: radial-gradient(circle at 18% 22%, var(--glow-soft), transparent 38%), radial-gradient(circle at 82% 72%, rgba(33, 150, 243, .1), transparent 42%); animation: drift 18s ease-in-out infinite alternate; }
.page { position: relative; z-index: 1; }
.page:not(.hidden) { animation: pageIn .4s var(--ease) both; }
#settingsHome:not(.hidden), #settingsSection:not(.hidden), .settings-panel:not(.hidden) { animation: pageIn .32s var(--ease) both; }
.modal:not(.hidden) { animation: fadeIn .2s ease both; backdrop-filter: blur(4px); }
.modal:not(.hidden) > .modal-card { animation: sheetIn .34s var(--ease) both; }
.conv-row, .person-row { animation: fadeUp .35s var(--ease) both; }

/* ---------- Подсветка при наведении ---------- */
.primary-button, .secondary-button, .icon-btn, .choice, .tab, .round-button, .toggle-row, .setting-row, .person-row, .conv-row, .swatch, .nav-item, .popup-menu button, .tg-act, .text-button {
  transition: background-color .22s ease, box-shadow .25s ease, transform .22s var(--ease), border-color .22s ease, color .2s ease, filter .22s ease;
}
.primary-button, .secondary-button { position: relative; overflow: hidden; }
.primary-button::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 40%; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent); transform: translateX(-120%) skewX(-20deg); pointer-events: none; }
.primary-button:not(:disabled):hover { box-shadow: 0 0 22px var(--glow), 0 6px 18px rgba(0, 0, 0, .25); transform: translateY(-1px); }
.primary-button:not(:disabled):hover::after { animation: sheen .9s ease; }
.secondary-button:not(:disabled):hover, .icon-btn:hover, .choice:hover, .round-button:not(:disabled):hover { box-shadow: 0 0 16px var(--glow-soft), inset 0 0 0 1px var(--glow); transform: translateY(-1px); }
.primary-button:active, .secondary-button:active, .icon-btn:active, .tg-act:active, .nav-item:active { transform: scale(.97); }
.toggle-row:hover, .conv-row:hover, .person-row:hover { box-shadow: 0 0 18px var(--glow-soft), inset 0 0 0 1px var(--glow-soft); filter: none; }
.conv-row:hover { transform: translateX(3px); }
.swatch:hover { transform: scale(1.12); box-shadow: 0 0 14px currentColor; }
.popup-menu button:hover { background: var(--glow-soft); }
.search-box input:focus-visible, button:focus-visible, input:focus-visible { outline-color: var(--teal); }

/* ---------- Навигация ---------- */
.tabbar { position: relative; z-index: 3; gap: 4px; border: 1px solid color-mix(in srgb, var(--teal) 14%, transparent); box-shadow: 0 -6px 28px rgba(0, 0, 0, .2); }
.nav-item { position: relative; padding: 9px 4px; font-size: 11.5px; color: var(--muted); }
.nav-item .ico { display: grid; place-items: center; width: 26px; height: 26px; font-size: inherit; }
.nav-item .ico svg, .tg-act svg, .search-box svg, .ig-tabs svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-item .ico svg { width: 24px; height: 24px; transition: transform .28s var(--ease), filter .28s ease; }
.nav-item:hover { color: var(--ink); background: var(--glow-soft); box-shadow: 0 0 20px var(--glow-soft); }
.nav-item:hover .ico svg { transform: translateY(-2px) scale(1.1); filter: drop-shadow(0 0 6px var(--glow)); }
.nav-item.active { color: var(--teal); background: linear-gradient(110deg, var(--panel-raised), color-mix(in srgb, var(--panel-raised) 60%, var(--teal) 40%), var(--panel-raised)); background-size: 220% 100%; animation: shimmer 7s linear infinite; box-shadow: 0 0 24px var(--glow-soft); }
.nav-item.active .ico svg { filter: drop-shadow(0 0 7px var(--glow)); }
.nav-item b { font-weight: 600; }

/* ---------- Аватары и кольца ---------- */
.avatar.xl { width: 92px; height: 92px; font-size: 34px; background: var(--panel-raised); border: 3px solid var(--panel); }
.avatar.huge { width: 112px; height: 112px; font-size: 44px; background: var(--panel-raised); }
.avatar-ring, .avatar.ring { background: linear-gradient(var(--panel-raised), var(--panel-raised)) padding-box, conic-gradient(from var(--ring-angle), var(--teal), #2196f3, #9b8cff, #e39b76, var(--teal)) border-box; border: 3px solid transparent; animation: ringSpin 7s linear infinite; }
.avatar-ring { display: grid; place-items: center; width: 104px; height: 104px; padding: 0; border-radius: 50%; background: linear-gradient(var(--panel), var(--panel)) padding-box, conic-gradient(from var(--ring-angle), var(--teal), #2196f3, #9b8cff, #e39b76, var(--teal)) border-box; box-shadow: 0 0 30px var(--glow-soft); }
.avatar.ring { box-sizing: border-box; box-shadow: 0 0 18px var(--glow-soft); }
.avatar.ring.big { border-width: 3px; }
.feed-card .avatar.ring { width: 40px; height: 40px; border-width: 2px; font-size: 15px; }
.avatar-wrap { position: relative; flex: 0 0 auto; }
.online-dot { position: absolute; right: -1px; bottom: -1px; width: 13px; height: 13px; border-radius: 50%; background: #3ddc84; border: 2px solid var(--panel-raised); animation: pulseDot 2.2s ease-out infinite; }

/* ---------- Профиль (лента-стиль) ---------- */
.ig-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.ig-top h1 { margin: 0; font-size: 22px; overflow-wrap: anywhere; background: linear-gradient(90deg, var(--ink) 0%, var(--teal) 50%, var(--ink) 100%); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 8s linear infinite; }
.ig-head { display: flex; align-items: center; gap: 26px; margin-bottom: 14px; }
.ig-stats { display: flex; flex: 1; justify-content: space-around; text-align: center; }
.ig-stats div { display: grid; gap: 2px; }
.ig-stats b { font-size: 20px; }
.ig-stats span { color: var(--muted); font-size: 13px; }
.ig-bio { min-height: 8px; margin-bottom: 14px; display: grid; gap: 4px; }
.ig-bio p { margin: 0; overflow-wrap: anywhere; line-height: 1.5; }
.ig-actions { display: flex; gap: 10px; margin-bottom: 22px; }
.ig-actions button { flex: 1; min-height: 40px; }
.ig-tabs { display: flex; justify-content: center; gap: 0; margin: 0; border-top: 1px solid var(--line); background: none; }
.ig-tabs .tab { display: flex; align-items: center; justify-content: center; gap: 8px; max-width: 220px; padding: 12px 20px; background: none; border: 0; border-radius: 0; color: var(--muted); font-size: 13px; font-weight: 600; position: relative; }
.ig-tabs .tab.active { color: var(--teal); }
.ig-tabs .tab.active::before { content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 2px; background: linear-gradient(90deg, transparent, var(--teal), #2196f3, var(--teal), transparent); background-size: 200% 100%; animation: shimmer 4s linear infinite; box-shadow: 0 0 10px var(--glow); }
.ig-tabs svg { width: 18px; height: 18px; }

/* Сетка публикаций */
.posts-grid.insta { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; margin-top: 3px; }
.post-tile { position: relative; display: block; aspect-ratio: 1; padding: 0; overflow: hidden; background: var(--panel-raised); border: 0; border-radius: 4px; cursor: pointer; animation: fadeUp .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
.post-tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s var(--ease), filter .3s ease; }
.post-tile::after { content: ""; position: absolute; inset: 0; opacity: 0; background: linear-gradient(160deg, var(--glow-soft), transparent 60%); box-shadow: inset 0 0 0 2px var(--glow); transition: opacity .25s ease; pointer-events: none; }
.post-tile:hover img { transform: scale(1.07); filter: brightness(1.08); }
.post-tile:hover::after { opacity: 1; }
.skeleton { background: linear-gradient(100deg, var(--panel-raised) 30%, color-mix(in srgb, var(--panel-raised) 70%, #fff 12%) 50%, var(--panel-raised) 70%); background-size: 200% 100%; animation: shimmer 1.5s linear infinite; }

/* ---------- Поиск ---------- */
.search-box.pill { align-items: center; gap: 10px; padding: 2px 16px; margin: 16px 0 12px; background: var(--panel-raised); border: 1px solid var(--line); border-radius: 14px; transition: border-color .25s ease, box-shadow .25s ease; }
.search-box.pill svg { flex: 0 0 auto; width: 20px; height: 20px; color: var(--muted); transition: color .25s ease; }
.search-box.pill:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px var(--glow-soft), 0 0 24px var(--glow-soft); }
.search-box.pill:focus-within svg { color: var(--teal); }
#searchPage .tab-row { margin: 4px 0 14px; }
.tab-row.seg { gap: 6px; padding: 4px; background: var(--panel-raised); border-radius: 14px; }
.tab-row.seg .tab { padding: 9px; background: transparent; border-radius: 10px; }
.tab-row.seg .tab.active { background: var(--panel); border-color: transparent; box-shadow: 0 0 16px var(--glow-soft), inset 0 0 0 1px var(--glow); }
.tab-row.ig-tabs { padding: 0; border-radius: 0; background: none; }

/* ---------- Лента ---------- */
.feed-head { display: flex; align-items: center; justify-content: space-between; max-width: 520px; margin: 0 auto 14px; }
.feed-head h1 { margin: 0; }
.feed-list { display: grid; gap: 18px; max-width: 520px; margin: 0 auto; }
.feed-card { overflow: hidden; background: var(--panel-raised); border: 1px solid var(--line); border-radius: 20px; animation: fadeUp .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); transition: box-shadow .3s ease, border-color .3s ease, transform .3s var(--ease); }
.feed-card:not(.skeleton):hover { border-color: color-mix(in srgb, var(--teal) 40%, var(--line)); box-shadow: 0 0 28px var(--glow-soft), 0 14px 34px rgba(0, 0, 0, .25); transform: translateY(-2px); }
.feed-card.skeleton { height: 420px; }
.feed-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; }
.post-author { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 0; color: var(--ink); background: none; border: 0; text-align: left; }
.post-author strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-author:hover strong { color: var(--teal); }
.feed-img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; cursor: pointer; background: var(--panel); }
.post-caption { margin: 0; padding: 12px 14px 14px; line-height: 1.5; overflow-wrap: anywhere; user-select: text; }
.post-caption strong { margin-right: 4px; }
#feedMore { margin: 16px auto 0; max-width: 520px; display: block; width: 100%; }
.wide { width: 100%; }

/* Просмотр публикации */
.post-view { width: min(520px, 100%); padding: 0; gap: 0; overflow: auto; }
.post-view-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; }
.post-view-img { display: block; width: 100%; max-height: 62vh; object-fit: contain; background: #050d17; }
.post-view .post-caption { padding-bottom: 4px; }
.post-view > small { padding: 0 14px 12px; }
.danger-outline { margin: 0 14px 14px; color: var(--danger); background: transparent; border: 1px solid color-mix(in srgb, var(--danger) 55%, transparent); }
.danger-outline:not(:disabled):hover { box-shadow: 0 0 16px color-mix(in srgb, var(--danger) 30%, transparent); }

/* ---------- Карточка человека ---------- */
.tg-card { justify-items: stretch; width: min(440px, 100%); max-height: min(92vh, 860px); padding: 0; gap: 0; overflow: auto; }
.tg-card .card-top { position: sticky; top: 0; z-index: 3; padding: 12px 12px 0; pointer-events: none; }
.tg-card .card-top > * { pointer-events: auto; }
.tg-hero { display: grid; justify-items: center; gap: 6px; margin-top: -30px; padding: 30px 16px 18px; background: radial-gradient(ellipse at 50% 0%, var(--glow-soft), transparent 70%); }
.tg-hero h2 { margin: 8px 0 0; font-size: 24px; font-weight: 700; text-align: center; }
.tg-status { margin: 0; color: var(--muted); font-size: 14px; }
.tg-status.online { color: var(--teal); }
.tg-status.online::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: #3ddc84; animation: pulseDot 2.2s ease-out infinite; }
.tg-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 0 14px; }
.tg-act { display: grid; justify-items: center; gap: 6px; padding: 12px 4px 10px; color: var(--teal); background: var(--panel-raised); border: 1px solid transparent; border-radius: 14px; font-size: 12px; }
.tg-act svg { width: 24px; height: 24px; }
.tg-act span { color: var(--ink); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-act:not(:disabled):hover { border-color: var(--glow); box-shadow: 0 0 18px var(--glow-soft); transform: translateY(-2px); }
.tg-act:disabled { opacity: .45; cursor: not-allowed; }
.tg-act.off svg { opacity: .55; }
.tg-info { margin: 14px; overflow: hidden; background: var(--panel-raised); border-radius: 14px; }
.tg-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; }
.tg-row + .tg-row { border-top: 1px solid var(--line); }
.tg-row > div { min-width: 0; }
.tg-row small { display: block; margin-bottom: 3px; color: var(--muted); font-size: 12px; }
.tg-row strong, .tg-row span { overflow-wrap: anywhere; user-select: text; }
.accent { color: var(--teal); }
.icon-btn.flat { background: none; border: 0; border-radius: 10px; }
.tg-tabs { display: flex; padding: 0 14px; border-bottom: 1px solid var(--line); }
.tg-tabs button { position: relative; padding: 12px 6px; color: var(--teal); background: none; border: 0; font-weight: 600; }
.tg-tabs button::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--teal), #2196f3, var(--teal)); background-size: 200% 100%; animation: shimmer 4s linear infinite; box-shadow: 0 0 10px var(--glow); }
.tg-card #cardPosts { padding: 3px 14px 18px; margin: 0; }
.tg-card #cardPostsEmpty { margin: 22px 0; }

/* ---------- Настройки ---------- */
.tg-settings { max-width: 640px; }
.tg-profile { display: flex; align-items: center; gap: 16px; width: 100%; margin-top: 14px; padding: 16px; color: var(--ink); text-align: left; background: var(--panel-raised); border: 1px solid transparent; border-radius: 18px; transition: box-shadow .25s ease, border-color .25s ease, transform .22s var(--ease); }
.tg-profile:hover { border-color: var(--glow); box-shadow: 0 0 26px var(--glow-soft); transform: translateY(-1px); }
.tg-profile > span { display: grid; flex: 1; gap: 3px; min-width: 0; }
.tg-profile strong { font-size: 18px; overflow-wrap: anywhere; }
.tg-profile small { color: var(--teal); }
.tg-profile i { color: var(--muted); font-style: normal; }
.tg-profile .avatar.big { width: 64px; height: 64px; font-size: 24px; }
.group-title { margin: 24px 8px 8px; color: var(--teal); font-size: 13px; font-weight: 700; letter-spacing: .4px; }
.settings-list.group { margin: 0; overflow: hidden; background: var(--panel-raised); border-radius: 16px; }
.settings-list.group + .settings-list.group { margin-top: 14px; }
.settings-list.group .setting-row { width: 100%; padding: 12px 16px; border-radius: 0; }
.settings-list.group .setting-row + .setting-row { border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.settings-list.group .setting-row:hover { background: var(--glow-soft); box-shadow: none; transform: none; }
.setting-icon { display: grid; place-items: center; flex: 0 0 auto; width: 38px; height: 38px; border-radius: 11px; font-size: 18px; transition: transform .25s var(--ease), box-shadow .25s ease; }
.setting-row:hover .setting-icon { transform: scale(1.1) rotate(-4deg); box-shadow: 0 0 16px var(--glow); }
.setting-icon.c1 { background: linear-gradient(135deg, #ff6b6b, #ff9a6b); }
.setting-icon.c2 { background: linear-gradient(135deg, #1fb87a, #4fe3a2); }
.setting-icon.c3 { background: linear-gradient(135deg, #2196f3, #5cc0ff); }
.setting-icon.c4 { background: linear-gradient(135deg, #7a67f0, #b3a6ff); }
.setting-icon.c5 { background: linear-gradient(135deg, #f0a030, #ffcf6b); }
.setting-icon.c6 { background: linear-gradient(135deg, #e0559f, #ff8ac7); }
.setting-icon.c7 { background: linear-gradient(135deg, #d9434f, #ff7b86); }
.settings-panel .toggle-row, .settings-panel .panel-block { border: 1px solid transparent; }
.settings-panel .toggle-row:hover { border-color: var(--glow-soft); }
.switch { transition: background .25s ease, box-shadow .25s ease; }
.switch:checked { box-shadow: 0 0 14px var(--glow); }
.back-link { display: inline-flex; padding: 8px 4px; }
.back-link:hover { text-shadow: 0 0 14px var(--glow); }

/* ---------- Чаты: статус присутствия ---------- */
.chat-title { display: grid; gap: 1px; min-width: 0; cursor: pointer; }
.chat-title h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-status { min-height: 14px; color: var(--muted); font-size: 12px; }
.chat-status.online { color: var(--teal); }
.conv-row > span:last-child { position: relative; flex: 1; }
.conv-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; }
.conv-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pres { flex: 0 0 auto; color: var(--muted); font-size: 11px; font-style: normal; white-space: nowrap; }
.pres.online { color: var(--teal); }
.conv-row small { padding-right: 30px; }
.unread-badge { position: absolute; right: 0; bottom: 1px; min-width: 20px; padding: 1px 6px; color: #05212b; background: var(--teal); border-radius: 10px; font-size: 11px; font-weight: 700; text-align: center; box-shadow: 0 0 12px var(--glow); }
.bubble { animation: fadeUp .25s var(--ease) both; }

@media (max-width: 760px) {
  .nav-item { font-size: 10.5px; padding: 8px 2px; }
  .ig-head { gap: 18px; }
  .avatar-ring { width: 92px; height: 92px; }
  .avatar.xl { width: 80px; height: 80px; font-size: 30px; }
  .feed-list, .feed-head { max-width: none; }
  .tg-card { max-height: 94vh; }
}
/* ---- Этап 10: стильные модальные окна, лайки, комментарии, группы ---- */
.fancy-modal .modal-card, .post-view, .group-card { position: relative; background: linear-gradient(160deg, color-mix(in srgb, var(--panel) 92%, var(--teal) 8%), var(--panel) 55%, color-mix(in srgb, var(--panel) 90%, #2196f3 10%)); border: 1px solid color-mix(in srgb, var(--teal) 28%, var(--line)); box-shadow: 0 0 0 1px var(--glow-soft), 0 0 38px var(--glow-soft), 0 24px 60px rgba(0, 0, 0, .45); }
.fancy-modal .modal-card::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; background: conic-gradient(from var(--ring-angle), transparent 0 55%, var(--teal), #2196f3, #9b8cff, transparent 90%); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; animation: ringSpin 9s linear infinite; opacity: .75; }
.fancy-modal .modal-card h2 { background: linear-gradient(90deg, var(--ink), var(--teal)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.fancy-modal .field-col > span { color: var(--teal); font-size: 13px; letter-spacing: .02em; }
.fancy-modal input, .fancy-modal textarea { background: color-mix(in srgb, var(--panel-raised) 80%, #000 20%) !important; border: 1px solid var(--line) !important; transition: border-color .25s ease, box-shadow .25s ease; }
.fancy-modal input:focus, .fancy-modal textarea:focus { outline: none; border-color: var(--teal) !important; box-shadow: 0 0 0 3px var(--glow-soft), 0 0 18px var(--glow-soft); }
.fancy-modal .modal-actions .secondary-button { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.fancy-modal .modal-actions .primary-button { background: linear-gradient(110deg, var(--teal), #2196f3, var(--teal)); background-size: 200% 100%; color: #04121c; font-weight: 700; animation: shimmer 6s linear infinite; box-shadow: 0 0 20px var(--glow-soft); }
#editPhone { letter-spacing: .03em; }

.ig-stats { gap: 16px; }
.ig-stats > div { min-width: 0; }
.section-title { margin: 18px 0 8px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted, #8fa7b3); }
.person-info { display: grid; min-width: 0; } .person-info strong { overflow: hidden; text-overflow: ellipsis; }
.avatar.channel { border-radius: 14px; background: linear-gradient(135deg, var(--teal), #2196f3); color: #04121c; }
#communityBlock { display: grid; gap: 10px; }

.post-actions { display: flex; align-items: center; gap: 6px; padding: 8px 12px 0; }
.post-actions small { margin-left: auto; }
.act-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 12px; color: var(--ink); background: transparent; border: 0; border-radius: 999px; cursor: pointer; transition: background .2s ease, color .2s ease, box-shadow .2s ease, transform .2s var(--ease); }
.act-btn.static { cursor: default; }
.act-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: fill .2s ease, transform .25s var(--ease); }
.act-btn:not(.static):hover { background: var(--glow-soft); box-shadow: 0 0 16px var(--glow-soft); }
.act-btn.liked { color: #ff5c8a; }
.act-btn.liked svg { fill: #ff5c8a; animation: heartPop .35s var(--ease); }
@keyframes heartPop { 0% { transform: scale(.7); } 60% { transform: scale(1.3); } 100% { transform: scale(1); } }

.comments { display: grid; gap: 10px; max-height: 210px; overflow: auto; padding: 8px 14px; }
.comment { display: flex; align-items: flex-start; gap: 10px; animation: fadeUp .3s var(--ease) both; }
.comment .avatar { width: 30px; height: 30px; font-size: 12px; flex: none; }
.comment-text { flex: 1; min-width: 0; line-height: 1.4; overflow-wrap: anywhere; user-select: text; }
.comment .icon-btn { width: 28px; height: 28px; min-height: 0; padding: 0; font-size: 12px; }
.comment-form { display: flex; gap: 8px; padding: 8px 14px 14px; }
.comment-form input { flex: 1; min-width: 0; padding: 11px 14px; color: var(--ink); background: var(--panel-raised); border: 1px solid var(--line); border-radius: 999px; transition: border-color .25s ease, box-shadow .25s ease; }
.comment-form input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--glow-soft); }
.comment-form .primary-button { min-height: 42px; padding: 0 16px; border-radius: 999px; }

.group-card { width: min(480px, 100%); padding: 0; gap: 0; overflow: hidden; }
.group-card > .modal-actions { padding: 0 14px 14px; }
.group-card > p { padding: 0 14px; margin: 0 0 8px; }
.group-head { display: flex; align-items: center; gap: 12px; min-width: 0; } .group-head > div:last-child { display: grid; min-width: 0; }
.group-head .avatar { width: 44px; height: 44px; }
.group-messages { display: flex; flex-direction: column; gap: 8px; height: min(46vh, 380px); overflow: auto; padding: 10px 14px; }
.gmsg { max-width: 82%; padding: 8px 12px; background: var(--panel-raised); border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; animation: fadeUp .25s var(--ease) both; }
.gmsg.mine { align-self: flex-end; background: linear-gradient(135deg, color-mix(in srgb, var(--teal) 26%, var(--panel-raised)), var(--panel-raised)); border-radius: 16px 16px 4px 16px; }
.gmsg small { display: block; color: var(--teal); font-size: 11px; } .gmsg p { margin: 2px 0; overflow-wrap: anywhere; user-select: text; } .gmsg time { font-size: 10px; color: var(--muted, #8fa7b3); }

@media (prefers-reduced-motion: reduce) {
  .fancy-modal .modal-card::before, .fancy-modal .modal-actions .primary-button, .act-btn.liked svg { animation: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  .workspace::before, .avatar-ring, .avatar.ring, .nav-item.active, .ig-top h1 { animation: none !important; }
}

/* ---- Этап 11: звонки ---- */
.chat-tools { display: flex; gap: 6px; margin-left: auto; }
.chat-tools .icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chat-tools .icon-btn:disabled { opacity: .35; pointer-events: none; }
.call-view { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: radial-gradient(circle at 50% 28%, color-mix(in srgb, var(--teal) 22%, #07131c), #050d17 72%); animation: fadeIn .25s ease both; }
.remote-video { position: absolute; inset: 0; display: none; width: 100%; height: 100%; object-fit: cover; background: #000; }
.call-view.video .remote-video { display: block; }
.call-info { position: relative; z-index: 1; display: grid; justify-items: center; gap: 10px; padding: 0 20px; text-align: center; text-shadow: 0 2px 12px rgba(0, 0, 0, .6); }
.call-info h2 { margin: 0; font-size: clamp(22px, 5vw, 30px); }
.call-info p { margin: 0; font-variant-numeric: tabular-nums; }
.call-view.video.live .call-info { position: absolute; top: calc(18px + env(safe-area-inset-top)); left: 0; right: 0; }
.call-view.video.live .call-info .avatar { display: none; }
.local-video { position: absolute; top: calc(16px + env(safe-area-inset-top)); right: 16px; z-index: 2; width: clamp(96px, 22vw, 180px); aspect-ratio: 3 / 4; object-fit: cover; border: 2px solid var(--teal); border-radius: 16px; transform: scaleX(-1); background: #000; box-shadow: 0 0 24px var(--glow-soft), 0 10px 30px rgba(0, 0, 0, .5); }
.call-controls { position: absolute; bottom: calc(30px + env(safe-area-inset-bottom)); z-index: 2; display: flex; gap: 20px; }
.call-btn { display: grid; place-items: center; width: 64px; height: 64px; padding: 0; color: #fff; background: rgba(255, 255, 255, .16); border: 0; border-radius: 50%; backdrop-filter: blur(10px); cursor: pointer; transition: transform .2s var(--ease), box-shadow .25s ease, background .2s ease; }
.call-btn svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.call-btn:hover { transform: translateY(-2px); box-shadow: 0 0 24px rgba(255, 255, 255, .25); }
.call-btn:active { transform: scale(.94); }
.call-btn.end { background: #e5484d; } .call-btn.end:hover { box-shadow: 0 0 26px rgba(229, 72, 77, .6); }
.call-btn.end svg { transform: rotate(135deg); }
.call-btn.ok { background: #2fbf71; } .call-btn.ok:hover { box-shadow: 0 0 26px rgba(47, 191, 113, .6); }
.call-btn.off { color: #07131c; background: #fff; }
.call-btn .slash { display: none; } .call-btn.off .slash { display: inline; }
.incoming-card { justify-items: center; text-align: center; }
.incoming-card h2 { margin: 0; } .incoming-card p { margin: 0; }
.incoming-card .modal-actions { justify-content: center; gap: 44px; }
.incoming-card .call-btn { flex: none; min-height: 64px; }
.avatar.pulse { animation: ringSpin 7s linear infinite, callPulse 1.6s ease-out infinite; }
@keyframes callPulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--teal) 55%, transparent); } 100% { box-shadow: 0 0 0 26px transparent; } }

/* ---- Этап 11: адаптивность (телефон / планшет / ПК) ---- */
html, body { height: 100%; }
.app-shell { height: 100vh; height: 100dvh; }
input, textarea, select { font-size: 16px; } /* iOS не приближает страницу при фокусе */
img, video { max-width: 100%; }

@media (min-width: 1024px) {
  .app-shell { flex-direction: row; gap: 16px; }
  .tabbar { order: -1; flex: none; flex-direction: column; justify-content: flex-start; width: 96px; padding: 12px 8px; gap: 8px; box-shadow: 0 0 28px rgba(0, 0, 0, .2); }
  .tabbar .nav-item { flex: none; padding: 14px 4px; }
  .workspace { min-width: 0; }
  .page:not(.chats-page) { padding: 40px max(32px, calc((100% - 860px) / 2)) 56px; }
  .feed-list, .feed-head { margin-inline: auto; }
  .modal-card { width: min(440px, 100%); }
  .post-view, .group-card { width: min(560px, 100%); }
}
@media (min-width: 761px) and (max-width: 1023px) {
  .page:not(.chats-page) { padding-inline: max(24px, calc((100% - 720px) / 2)); }
}
@media (min-width: 1440px) {
  .app-shell { padding: 24px; max-width: 1760px; margin-inline: auto; }
  .tabbar { width: 108px; }
}
@media (max-width: 760px) {
  .app-shell { gap: 8px; padding: calc(8px + env(safe-area-inset-top)) calc(8px + env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) calc(8px + env(safe-area-inset-left)); }
  .workspace { border-radius: 20px; }
  .tabbar { padding: 6px; border-radius: 20px; }
  .nav-item { min-height: 52px; border-radius: 16px; }
  .page { padding: 20px 14px 32px; }
  .page h1 { font-size: 22px; }
  .chats-page.active-page { padding: 0; }
  .chat-pane { padding: 14px 12px; }
  .modal { align-items: end; padding: 0; }
  .modal-card { width: 100%; max-height: 92%; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; }
  .modal:not(.hidden) > .modal-card { animation-name: sheetUp; }
  #incomingCall { align-items: center; padding: 16px; }
  #incomingCall .modal-card { border-radius: 24px; padding-bottom: 20px; }
  .tg-card, .post-view, .group-card { max-height: 96%; border-radius: 24px 24px 0 0; }
  .post-view-img { max-height: 42vh; }
  .group-messages { height: 44vh; }
  .modal-actions button, .primary-button, .secondary-button { min-height: 46px; }
  .toast { left: 14px; right: 14px; bottom: 14px; max-width: none; }
  .call-controls { gap: 16px; }
  .call-btn { width: 60px; height: 60px; }
  .ig-stats span { font-size: 11px; }
}
@media (max-width: 380px) {
  .nav-item b { font-size: 9.5px; }
  .ig-head { gap: 12px; }
  .ig-stats { gap: 8px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .page { padding-top: 12px; }
  .call-info .avatar { display: none; }
  .call-controls { bottom: 12px; }
  .local-video { width: 90px; }
}
@media (hover: none) {
  .nav-item:hover, .person-row:hover, .conv-row:hover, .feed-card:hover { transform: none; }
}
@media (prefers-reduced-motion: reduce) { .avatar.pulse, .call-view { animation: none !important; } }

/* Этап 13: кнопки звонка, демонстрация экрана, без мигания списка чатов */
.conv-row.still { animation: none; }
.call-btn.on { color: #07131c; background: var(--teal); box-shadow: 0 0 22px var(--glow); }
.local-video.screen { transform: none; object-fit: contain; }
.call-controls { flex-wrap: wrap; justify-content: center; max-width: 94vw; }
@media (min-width: 761px) { .remote-video { object-fit: contain; } }
@media (max-width: 480px) { .call-controls { gap: 12px; } .call-btn { width: 54px; height: 54px; } .call-btn svg { width: 24px; height: 24px; } }
