@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Variable.woff2') format('woff2-variations'),
       url('../fonts/Vazirmatn-Variable.woff2') format('woff2 supports variations');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #f2f2f7;
  --bg-2: #ececf0;
  --panel: #ffffff;
  --panel-2: #f6faff;
  --ink: #0e2942;
  --ink-soft: #1d3a58;
  --muted: #5c6c82;
  --line: #dfe8f2;
  --brand: #0ea5e9;
  --brand-2: #2563eb;
  --brand-3: #06b6d4;
  --grad: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
  --grad-soft: linear-gradient(135deg, rgba(14,165,233,.14), rgba(37,99,235,.14));
  --gold: #b45309;
  --gold-soft: #fdf3e2;
  --ok: #0a7a55;
  --ok-bg: #eafaf3;
  --err: #c22b2b;
  --err-bg: #fdeeee;
  --warn: #9a5b0a;
  --warn-bg: #fff6e8;
  --shadow-sm: 0 1px 2px rgba(15, 42, 68, .05), 0 2px 6px rgba(15, 42, 68, .04);
  --shadow: 0 1px 3px rgba(15, 42, 68, .06), 0 16px 40px -18px rgba(15, 42, 68, .22);
  --shadow-lg: 0 8px 20px -8px rgba(14, 116, 199, .45), 0 24px 60px -20px rgba(15, 42, 68, .3);
  --radius: 18px;
  --radius-sm: 12px;
  --r-pill: 999px;
  --r-card: 24px;
  --r-control: 20px;
  --r-inner: 16px;
  --r-tabbar: 28px;
  --r-avatar-square: 28%;
  --r-bubble: 20px;
  --r-tail: 6px;
  --tabbar-h: 66px;
  --tabbar-offset: 12px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #000000;
  --bg-2: #0a0a0c;
  --panel: #1c1c1e;
  --panel-2: #0a0a0c;
  --ink: #e7eefb;
  --ink-soft: #cddcf0;
  --muted: #8ba3c0;
  --line: #1b2c46;
  --brand: #38bdf8;
  --brand-2: #6d7cff;
  --brand-3: #22d3ee;
  --grad: linear-gradient(135deg, #38bdf8 0%, #6d7cff 100%);
  --grad-soft: linear-gradient(135deg, rgba(56,189,248,.16), rgba(109,124,255,.16));
  --gold: #fbbf24;
  --gold-soft: #2a2108;
  --ok: #34d399;
  --ok-bg: #06261c;
  --err: #f87171;
  --err-bg: #2b1012;
  --warn: #fbbf24;
  --warn-bg: #291c04;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
  --shadow: 0 1px 3px rgba(0,0,0,.4), 0 20px 48px -20px rgba(0,0,0,.65);
  --shadow-lg: 0 10px 28px -10px rgba(56, 130, 220, .45), 0 30px 70px -24px rgba(0,0,0,.7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html, body { max-width: 100%; overflow-x: hidden; }
html { scroll-behavior: smooth; }
.aura { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }

body {
  font-family: 'Vazirmatn', 'Vazir', 'IRANSansX', 'IRANSans', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.9;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .35s ease, color .35s ease;
}

main#main { flex: 1 0 auto; width: 100%; }

.container { max-width: 1100px; margin-inline: auto; padding-inline: 22px; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: none; }

img { max-width: 100%; display: block; }

.muted { color: var(--muted); }
.small { font-size: .8rem; }
.divider { height: 1px; background: var(--line); border: 0; margin: 22px 0; }

::selection { background: color-mix(in srgb, var(--brand) 25%, transparent); color: var(--ink); }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--brand) 35%, var(--line)); border-radius: var(--r-pill); border: 3px solid var(--bg-2); }
::-webkit-scrollbar-thumb:hover { background: var(--brand); }

.skip-link {
  position: absolute; inset-inline-start: -999px; top: 8px;
  background: var(--brand); color: #fff; padding: 8px 14px; border-radius: var(--r-pill); z-index: 200;
}
.skip-link:focus { inset-inline-start: 8px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--r-control); border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); cursor: pointer;
  transition: border-color .2s ease, color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.icon-btn:active { transform: scale(.95); }
.i-sun, .i-moon { display: inline-flex; }
[data-theme="dark"] .i-sun { display: none; }
html:not([data-theme="dark"]) .i-moon { display: none; }

/* ===== آیکون‌های رسمی iOS تلگرام ===== */
.tg-ios-icon {
  display: inline-block; flex: none;
  vertical-align: -0.15em;
  fill: currentColor;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border-radius: var(--r-control); border: 1px solid transparent;
  font: inherit; font-weight: 700; cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn.primary { background: var(--grad); color: #fff; box-shadow: 0 10px 24px -10px rgba(30, 120, 210, .6); position: relative; overflow: hidden; }
.btn.primary::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.22) 50%, transparent 70%);
  transform: translateX(-120%); transition: transform .5s ease;
}
.btn.primary:hover::after { transform: translateX(120%); }
.btn.primary:hover { box-shadow: 0 14px 32px -10px rgba(30, 120, 210, .75); }
.btn.ghost { background: var(--panel); color: var(--ink); border-color: var(--line); box-shadow: var(--shadow-sm); }
.btn.ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn.danger { background: var(--err-bg); color: var(--err); border-color: color-mix(in srgb, var(--err) 28%, transparent); }
.btn.danger:hover { background: var(--err); color: #fff; }
.btn.sm { padding: 7px 14px; font-size: .85rem; border-radius: var(--r-control); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-card); box-shadow: var(--shadow); padding: 26px;
  transition: box-shadow .25s ease, border-color .25s ease;
}

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 15px; border-radius: var(--r-pill); font-size: .82rem; font-weight: 700;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  transition: border-color .2s ease, color .2s ease, background .2s ease;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.on { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 6px 16px -8px rgba(30,120,210,.6); }
.chip.on .chip-n { color: rgba(255,255,255,.85); }
.chip-n { font-size: .75rem; color: var(--muted); }




.section-title { font-size: 1.4rem; font-weight: 900; letter-spacing: -.3px; position: relative; }
.section-title.sm { font-size: 1.18rem; margin-bottom: 18px; }
.count-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 28px; height: 28px; padding: 0 10px; border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); font-size: .82rem;
  vertical-align: middle;
}




.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 900; font-size: 1.12rem; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%; color: #fff; font-size: 1.2rem; font-weight: 900;
  background: var(--grad); box-shadow: 0 8px 20px -8px rgba(30, 120, 210, .7);
}
.brand-mark.sm { width: 30px; height: 30px; font-size: 1rem; border-radius: 50%; }
.brand-img {
  width: 34px; height: 34px; border-radius: 50%; object-fit: cover;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 30%, transparent), 0 6px 16px -6px rgba(15,42,68,.35);
}

.auth-brand .brand-img { width: 40px; height: 40px; border-radius: 50%; }

























.feed-section { padding: 34px 0 56px; }
.feed-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }

.quick-chat-section { padding: 20px 0 8px; }
.quick-chat {
  display: grid; grid-template-columns: 1fr 1.15fr; gap: 30px; align-items: center;
  position: relative; overflow: hidden;
}
.quick-chat::before {
  content: ''; position: absolute; inset-inline-end: -90px; top: -90px;
  width: 250px; height: 250px; border-radius: 50%; background: var(--grad); opacity: .07; filter: blur(6px); pointer-events: none;
}
.quick-chat h2 { margin-bottom: 10px; }
.quick-chat .muted.small { margin-top: 10px; }
.quick-form { position: relative; z-index: 1; }
@media (max-width: 720px) { .quick-chat { grid-template-columns: 1fr; gap: 18px; } }
.search { display: flex; gap: 8px; }
.search input {
  width: 270px; max-width: 62vw; padding: 11px 18px; border-radius: var(--r-control);
  border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 15%, transparent); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }

.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 22px; }
.post-card {
  position: relative; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-card); overflow: hidden; box-shadow: var(--shadow-sm);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
  display: flex; flex-direction: column;
}
.post-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--brand) 25%, var(--line)); }
.post-card.pinned { border-color: color-mix(in srgb, var(--gold) 45%, transparent); }
.pin-badge {
  position: absolute; top: 14px; inset-inline-end: 14px; z-index: 2;
  background: color-mix(in srgb, var(--gold) 16%, var(--panel)); color: var(--gold);
  border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent);
  font-size: .75rem; font-weight: 800; padding: 4px 11px; border-radius: var(--r-pill);
  box-shadow: var(--shadow-sm); backdrop-filter: blur(4px);
}
.post-cover { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--panel-2); }
.post-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .45s ease; }
.post-card:hover .post-cover img { transform: scale(1.05); }
.post-body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 11px; flex: 1; }
.post-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: .78rem; color: var(--muted); }
.post-meta.lg { font-size: .86rem; }
.post-meta time { display: inline-flex; align-items: center; gap: 5px; }
.post-meta time::before { content: ''; width: 4px; height: 4px; border-radius: 50%; background: var(--brand); opacity: .7; }
.cat-chip {
  color: var(--brand); background: color-mix(in srgb, var(--brand) 11%, transparent);
  padding: 3px 11px; border-radius: var(--r-pill); font-weight: 800;
}
.post-card h3 { font-size: 1.1rem; font-weight: 800; line-height: 1.7; }
.post-card h3 a { color: var(--ink); transition: color .2s ease; }
.post-card h3 a:hover { color: var(--brand); }
.post-excerpt { color: var(--muted); font-size: .92rem; flex: 1; }
.post-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); padding-top: 13px; }
.post-stats { display: flex; gap: 15px; color: var(--muted); font-size: .8rem; }
.post-stats span { display: inline-flex; align-items: center; gap: 5px; }
.readmore { font-weight: 800; font-size: .85rem; white-space: nowrap; color: var(--brand); }
.readmore:hover { transform: translateX(-3px); }
.readmore { transition: transform .2s ease; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 34px; }
.page-now { color: var(--muted); font-size: .85rem; background: var(--panel); border: 1px solid var(--line); padding: 8px 18px; border-radius: var(--r-pill); }

.page-head { padding: 42px 0 12px; }
.page-head h1 { font-size: 1.9rem; font-weight: 900; letter-spacing: -.4px; }
.page-head.sm { padding: 26px 0 18px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.empty {
  text-align: center; padding: 64px 22px; background: var(--panel);
  border: 1px dashed var(--line); border-radius: var(--r-card); color: var(--muted);
}
.empty .btn { margin-top: 12px; }








.post-page 



.like-btn {
  display: inline-flex; align-items: center; gap: 9px; padding: 11px 20px;
  border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--panel);
  color: var(--err); font: inherit; font-weight: 800; cursor: pointer;
  transition: transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
  box-shadow: var(--shadow-sm);
}
.like-btn:hover { transform: scale(1.04); background: var(--err-bg); border-color: color-mix(in srgb, var(--err) 40%, transparent); }
.like-btn.liked { background: var(--err-bg); border-color: var(--err); }
.like-btn.liked svg { animation: heart-pop .4s ease; }
@keyframes heart-pop { 0% { transform: scale(1); } 40% { transform: scale(1.45); } 100% { transform: scale(1); } }
.like-count { min-width: 20px; display: inline-block; }

.comments-section { padding-bottom: 64px; }














.form-row { margin-bottom: 15px; }
.form-row label { display: block; font-weight: 700; font-size: .85rem; margin-bottom: 7px; }
.form-row input[type="text"], .form-row input[type="search"], .form-row input[type="password"],
.form-row input[type="email"], .form-row textarea {
  width: 100%; padding: 12px 15px; border-radius: var(--r-control);
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); font: inherit;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.form-row input:focus, .form-row textarea:focus {
  outline: none; border-color: var(--brand); background: var(--panel);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent);
}
.form-row textarea { resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0 18px; }
.form-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 8px; }
.check-row { display: flex; gap: 22px; flex-wrap: wrap; margin: 8px 0 14px; }
.check { display: inline-flex; align-items: center; gap: 9px; font-weight: 650; font-size: .9rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }











.hp-field {
  position: absolute !important; inset-inline-start: -9999px !important;
  width: 1px !important; height: 1px !important; opacity: 0 !important;
}






.t-row { display: flex; margin-top: 12px; }
.t-row .bubble {
  flex: 1; padding: 13px 17px; border-radius: var(--r-bubble);
  background: var(--panel-2); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.t-row.admin .bubble {
  background: color-mix(in srgb, var(--brand) 10%, transparent);
  border-color: color-mix(in srgb, var(--brand) 26%, transparent);
}
.t-row .bubble p { font-size: .95rem; }
.t-meta { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.t-meta b { font-size: .86rem; }
.t-meta time { color: var(--muted); font-size: .76rem; }




.thread-mini { margin-top: 12px; }
.tag { padding: 4px 11px; border-radius: var(--r-pill); font-size: .74rem; font-weight: 800; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.muted-tag { background: var(--bg-2); color: var(--muted); }
.reply-box { position: relative; }
.reply-box summary { list-style: none; }
.reply-box summary::-webkit-details-marker { display: none; }
.reply-form { margin-top: 10px; width: 270px; max-width: 100%; }
.reply-form textarea {
  width: 100%; padding: 11px 13px; border-radius: var(--r-control); font: inherit;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); resize: vertical;
}
.reply-btns { display: flex; gap: 8px; margin-top: 8px; }














.toast {
  position: fixed; bottom: 26px; inset-inline-start: 50%; transform: translateX(50%);
  display: flex; align-items: center; gap: 14px; z-index: 300;
  padding: 14px 20px; border-radius: var(--r-card); font-size: .9rem; font-weight: 650;
  box-shadow: var(--shadow-lg); border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(10px); color: var(--ink);
  max-width: min(92vw, 500px); animation: toast-in .3s cubic-bezier(.2,.9,.3,1.2);
}
.toast.ok { border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: var(--ok-bg); color: var(--ok); }
.toast.err { border-color: color-mix(in srgb, var(--err) 40%, transparent); background: var(--err-bg); color: var(--err); }
.toast.warn { border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: var(--warn-bg); color: var(--warn); }
.toast-x { border: 0; background: none; color: inherit; font-size: 1.2rem; cursor: pointer; line-height: 1; }
@keyframes toast-in { from { opacity: 0; transform: translateX(50%) translateY(16px) scale(.96); } }
.toast.hide { opacity: 0; transform: translateX(50%) translateY(8px); transition: opacity .3s ease, transform .3s ease; }

@media (max-width: 720px) {
  .feed-head { flex-direction: column; align-items: stretch; }
  .search input { width: 100%; max-width: none; flex: 1; }
  .search { width: 100%; }
}

a, button, input, textarea, select, .btn, .chip, .tabbar-item, .tabbar-cell { -webkit-tap-highlight-color: transparent; }

:focus { outline: none; }
:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 30%, transparent); border-radius: var(--r-pill); }
a:focus-visible, .btn:focus-visible, .chip:focus-visible, .tabbar-item:focus-visible { box-shadow: none; }
.form-row input:focus-visible, .form-row textarea:focus-visible, .search input:focus-visible, .chat-input textarea:focus-visible, .tg-chan-search input:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ===== Messenger app ===== */
.app-body { display: flex; flex-direction: column; min-height: 100dvh; }
.app-top {
  position: sticky; top: 0; z-index: 100; display: flex; align-items: center; gap: 10px;
  height: 52px;
  height: calc(52px + env(safe-area-inset-top, 0px));
  padding: 0 16px;
  padding-top: env(safe-area-inset-top, 0px);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
}
.app-top-title { font-weight: 800; font-size: 1.08rem; flex: 1; text-align: center; }
.app-back { color: var(--brand); font-weight: 800; font-size: 1.5rem; line-height: 1; width: 34px; }
.app-back.placeholder { display: inline-block; }
.app-top-side { flex: none; width: 34px; display: flex; align-items: center; }
.app-top-center { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 9px; text-align: center; }
.app-top-side, .app-top-info, .ios-chat-main, .ios-chat-line1, .ios-chat-line2, .app-chatrow-main, .app-chatrow-line1, .app-chatrow-line2 { min-width: 0; }
.app-top-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: none; }
.app-top-avatar.is-initial { display: grid; place-items: center; background: var(--grad); color: #fff; font-weight: 900; font-size: 1rem; }
.app-top-info { min-width: 0; }
.app-top-name { font-weight: 600; font-size: 1.05rem; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-top-sub { font-size: .72rem; color: var(--nb-text-mute); line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-top-actions { width: 34px; display: flex; justify-content: flex-end; }
.sm-btn { width: 34px; height: 34px; }
.app-top-list { justify-content: space-between; }
.app-list-title { flex: 1; text-align: start; font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.4; }
.app-top-list .app-top-actions { width: auto; }
.app-action { border: 0; background: none; color: var(--brand); font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer; padding: 4px 6px; }
html[dir="rtl"] .app-back .tg-ios-icon { transform: scaleX(-1); }
.app-main { flex: 1 0 auto; width: 100%; padding-bottom: calc(var(--tabbar-h) + var(--tabbar-offset) + 24px); padding-bottom: calc(var(--tabbar-h) + var(--tabbar-offset) + 24px + env(safe-area-inset-bottom, 0px)); }
.app-main.pad-chat { padding-bottom: 160px; padding-bottom: calc(160px + env(safe-area-inset-bottom, 0px)); }
/* ===== Floating TabBar (Liquid Glass Pill) ===== */
:root {
  --nb-bg: #F2F2F7;
  --nb-surface: #ffffff;
  --nb-surface-hi: #E9E9EE;
  --nb-surface-glass: rgba(255, 255, 255, 0.85);
  --nb-line: #E5E5EA;
  --nb-line-soft: rgba(60, 60, 67, 0.1);
  --nb-text: #000000;
  --nb-text-dim: #3C3C43;
  --nb-text-mute: #8E8E93;
}
[data-theme="dark"] {
  --nb-bg: #000000;
  --nb-surface: #1C1C1E;
  --nb-surface-hi: #2C2C2E;
  --nb-surface-glass: rgba(28, 28, 30, 0.82);
  --nb-line: rgba(255, 255, 255, 0.12);
  --nb-line-soft: rgba(255, 255, 255, 0.08);
  --nb-text: #FFFFFF;
  --nb-text-dim: #EBEBF5;
  --nb-text-mute: #8E8E93;
}
.tabbar {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 480px;
  width: min(calc(100% - 32px), 480px);
  box-sizing: border-box;
  z-index: 40;
  margin: 0;
  border: 1px solid var(--nb-line);
  border-radius: var(--r-tabbar);
  background: var(--nb-surface-glass);
  overflow: hidden;
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  box-shadow: 0 8px 32px -8px rgba(2, 6, 23, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
[data-theme="light"] .tabbar,
html:not([data-theme="dark"]) .tabbar {
  box-shadow: 0 8px 32px -8px rgba(15, 23, 42, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.tabbar-inner {
  display: flex;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  align-items: stretch;
  gap: 4px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 6px;
}
.tabbar-item {
  flex: 1 1 0; width: 100%; min-width: 0; box-sizing: border-box; border: 0; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center;
  font-size: 10px; font-weight: 600; line-height: 1.6;
  color: var(--nb-text-mute);
  transition: color .2s ease;
  font-family: inherit;
  padding: 0;
}
.tabbar-item.active { color: var(--brand); }
.tabbar-item:hover { color: var(--brand); }
.tabbar-cell {
  position: relative; display: flex; width: 100%; max-width: 100%; flex-direction: column;
  align-items: center; gap: 4px; border-radius: var(--r-control); padding: 6px 4px;
  box-sizing: border-box; overflow: hidden;
}
.tabbar-icon { position: relative; display: grid; place-items: center; }
.tabbar-icon svg { width: 20px; height: 20px; display: block; }
.tabbar-icon img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; display: block; }
.tabbar-cell { transition: transform .12s ease; }
.tabbar-item:active .tabbar-cell { transform: scale(.94); }
.tabbar-label {
  position: relative; white-space: nowrap;
  font-size: clamp(8px, 2.8vw, 10px); line-height: 16px;
}
.tabbar-avatar {
  width: 20px; height: 20px; border-radius: 50%; object-fit: cover;
}
.tabbar-initial {
  display: grid; place-items: center; width: 20px; height: 20px;
  border-radius: 50%; background: color-mix(in srgb, var(--brand) 20%, transparent);
  color: var(--brand); font-size: 9px; font-weight: 800;
}
.tabbar-item.active .tabbar-avatar,
.tabbar-item.active .tabbar-initial { box-shadow: 0 0 0 2px var(--brand); }
.app-pad { margin: 22px 16px; }
body:not(.app-body) main#main { padding-bottom: calc(var(--tabbar-h) + var(--tabbar-offset) + 24px); padding-bottom: calc(var(--tabbar-h) + var(--tabbar-offset) + 24px + env(safe-area-inset-bottom, 0px)); }

.chat-scroll { max-width: 640px; margin-inline: auto; padding: 14px 16px 24px; }
.chat-system { max-width: 88%; margin: 4px auto 14px; text-align: center; font-size: .76rem; line-height: 1.8; color: var(--nb-text-mute); }

.chat-messages { display: flex; flex-direction: column; }
.msg-row { display: flex; margin-bottom: 6px; }
.msg-row.owner { justify-content: flex-end; }
.msg-row.me { justify-content: flex-start; }
.msg-bubble { max-width: 82%; padding: 7px 12px 6px; border-radius: var(--r-bubble); font-size: .95rem; line-height: 1.7; word-break: break-word; box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
.msg-row.owner .msg-bubble { background: var(--nb-surface); border: 0; border-start-end-radius: var(--r-tail); }
.msg-row.me .msg-bubble { background: var(--brand); color: #fff; border-start-start-radius: var(--r-tail); }
.msg-row.me .msg-bubble a { color: #fff; text-decoration: underline; }
.msg-text { overflow-wrap: anywhere; }
.msg-meta { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 3px; font-size: .66rem; line-height: 1; white-space: nowrap; opacity: .72; }
.msg-check { display: inline-flex; align-items: center; }
.msg-row.is-sending .msg-bubble { opacity: .62; }
.msg-state { font-size: .66rem; opacity: .85; }
.msg-retry { border: 0; background: none; color: inherit; font: inherit; font-size: .66rem; padding: 0; text-decoration: underline; cursor: pointer; }
.chat-jump {
  position: fixed; bottom: 84px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%);
  z-index: 106; border: 1px solid var(--nb-line); border-radius: var(--r-pill); padding: 7px 14px;
  background: var(--nb-surface); color: var(--nb-text); font: inherit; font-size: .76rem; font-weight: 600;
  box-shadow: 0 6px 20px -8px rgba(15, 23, 42, .25); cursor: pointer;
}
.chat-jump[hidden] { display: none; }
.chat-input[hidden], .chat-locked[hidden] { display: none; }
.chat-locked {
  position: fixed; bottom: 78px; bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  left: 16px; right: 16px; z-index: 104; margin: 0 auto; max-width: 480px;
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px; border-radius: var(--r-card);
  background: var(--nb-surface-glass);
  border: 1px solid var(--nb-line);
  backdrop-filter: blur(24px) saturate(160%); -webkit-backdrop-filter: blur(24px) saturate(160%);
  box-shadow: 0 8px 32px -8px rgba(2, 6, 23, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: var(--nb-text-mute);
}
html:not([data-theme="dark"]) .chat-locked { box-shadow: 0 8px 32px -8px rgba(15, 23, 42, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.8); }
.chat-locked-ico { flex: none; display: inline-flex; color: var(--nb-text-mute); }
.chat-locked-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.chat-locked-main b { font-size: .84rem; font-weight: 600; color: var(--nb-text-dim); line-height: 1.7; }
.chat-locked-main small { font-size: .72rem; line-height: 1.7; color: var(--nb-text-mute); }
.chat-screen .chat-locked { bottom: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
.chat-screen .chat-input { bottom: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
.chat-screen .app-main.pad-chat { padding-bottom: 104px; padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px)); }
.chat-input {
  position: fixed; bottom: 78px; bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  left: 16px; right: 16px; z-index: 105; margin: 0 auto; max-width: 480px;
  display: flex; gap: 6px; align-items: flex-end;
  padding: 7px 8px; border-radius: var(--r-control);
  background: var(--nb-surface-glass);
  border: 0;
  backdrop-filter: blur(24px) saturate(160%); -webkit-backdrop-filter: blur(24px) saturate(160%);
  box-shadow: 0 8px 32px -8px rgba(2, 6, 23, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: border-color .18s ease, box-shadow .18s ease;
}
html:not([data-theme="dark"]) .chat-input { box-shadow: 0 8px 32px -8px rgba(15, 23, 42, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.8); }
.chat-input:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent), 0 8px 32px -8px rgba(15, 23, 42, 0.15); }
.chat-input textarea {
  flex: 1; max-height: 130px; min-height: 40px; padding: 9px 12px; border-radius: var(--r-control); font: inherit;
  font-size: .92rem; line-height: 1.5;
  border: 0; background: transparent; color: var(--nb-text); resize: none; outline: none; box-shadow: none;
  overflow-y: auto; scrollbar-width: none; -ms-overflow-style: none;
}
.chat-input textarea::-webkit-scrollbar { display: none; }
.chat-input textarea:focus,
.chat-input textarea:focus-visible { outline: none; box-shadow: none; }
.chat-send {
  flex: none; align-self: flex-end; width: 40px; height: 40px; border-radius: var(--r-pill); border: 0; cursor: pointer;
  background: var(--grad); color: #fff; display: grid; place-items: center;
  box-shadow: 0 8px 20px -8px rgba(30, 120, 210, .6);
  transition: transform .15s ease, filter .15s ease;
}
.chat-send:hover { transform: scale(1.06); }
.chat-send:active { transform: scale(.94); }
.chat-send svg { width: 20px; height: 20px; }
.like-ico { display: inline-flex; }
.like-btn.liked .like-ico svg { animation: heart-pop .4s ease; }





.ch-avatar { flex: none; width: 50px; height: 50px; border-radius: 50%; background: var(--grad); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 1.2rem; object-fit: cover; }
.ch-avatar.sm { width: 46px; height: 46px; font-size: 1.1rem; }
.ch-body { flex: 1; min-width: 0; }
.ch-name { font-size: .8rem; font-weight: 800; color: var(--brand); }
.ch-title { font-weight: 800; }
.ch-excerpt { font-size: .84rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-side { text-align: center; font-size: .72rem; color: var(--muted); flex: none; line-height: 1.7; }

.account-wrap { max-width: 460px; margin-inline: auto; padding: 22px 16px; }
.auth-card-app h3 { font-weight: 800; margin-bottom: 12px; }
.account-card-app { text-align: center; }
.acc-avatar { width: 72px; height: 72px; border-radius: 50%; background: var(--grad); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.8rem; font-weight: 900; margin: 0 auto 14px; box-shadow: 0 10px 24px -10px rgba(30,120,210,.55); }
.account-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.account-actions form { display: contents; }

.app-main .post-page, .app-main .comments-section { padding-top: 10px; }
.app-main 
.app-main 

/* ===== Telegram iOS-like pages ===== */
.ios-page { max-width: 640px; margin-inline: auto; padding: 10px 0 24px; }
.ios-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 8px 4px 10px; }
.ios-page-title { font-size: 1.85rem; font-weight: 900; letter-spacing: -.02em; line-height: 1.35; }
.ios-page-sub { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.ios-round-btn { flex: none; width: 38px; height: 38px; border-radius: var(--r-pill); border: 0; background: var(--nb-surface); color: var(--brand); display: grid; place-items: center; box-shadow: var(--shadow-sm); cursor: pointer; }
.ios-search { display: flex; align-items: center; gap: 8px; margin: 4px 16px 10px; padding: 0 12px; height: 40px; border-radius: var(--r-control); background: var(--nb-surface-hi); border: 1px solid color-mix(in srgb, var(--nb-line) 70%, transparent); color: var(--muted); transition: border-color .18s ease, background .18s ease; }
.ios-search:focus-within { border-color: color-mix(in srgb, var(--brand) 55%, var(--nb-line)); background: var(--nb-surface); }
.ios-search-icon { display: inline-flex; flex: none; }
.ios-search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--nb-text); font: inherit; font-size: .9rem; padding: 8px 0; outline: none; }
.ios-search input:focus,
.ios-search input:focus-visible { outline: none; box-shadow: none; }
.ios-search-clear { color: var(--muted); font-size: 1.2rem; line-height: 1; padding: 4px; }
.ios-list { display: flex; flex-direction: column; background: var(--nb-surface); border: 1px solid var(--nb-line); border-radius: var(--r-card); overflow: hidden; margin: 0 16px 12px; }
.ios-list form { display: contents; }
.ios-list-chat { background: transparent; border: 0; border-radius: 0; overflow: visible; margin: 0; }
.ios-list-chat .ios-chat-row { background: transparent; padding: 11px 16px; }
.ios-list-chat .ios-chat-row.is-pinned { background: var(--nb-surface); }
.ios-list-chat .ios-chat-row:hover,
.ios-list-chat .ios-chat-row:active { background: var(--nb-surface-hi); }
.ios-section-title { font-size: .72rem; font-weight: 700; color: var(--nb-text-mute); padding: 20px 16px 7px; }
.ios-chat-row, .ios-contact-row { position: relative; display: flex; align-items: center; gap: 12px; padding: 11px 16px; color: var(--nb-text); background: var(--nb-surface); border: 0; transition: background .15s ease; text-align: start; width: 100%; font: inherit; cursor: pointer; }
.ios-contact-row:not(:last-child)::after,
.ios-chat-row:not(:last-child)::after { content: ''; position: absolute; bottom: 0; inset-inline: 0; height: 1px; background: var(--nb-line); }
.ios-contact-row:not(:last-child)::after { inset-inline-start: 66px; }
.ios-chat-row:not(:last-child)::after { inset-inline-start: 78px; }
.ios-list-chat .ios-chat-row::after { content: ''; position: absolute; bottom: 0; inset-inline-start: calc(56px + 16px); inset-inline-end: 0; height: .5px; background: var(--nb-line); }
.ios-list-chat .ios-chat-row:last-child::after { display: none; }
.ios-list > :last-child { border-bottom: 0; }
.ios-chat-row:hover, .ios-contact-row:hover { background: var(--nb-surface-hi); color: var(--nb-text); }
.ios-chat-avatar { position: relative; flex: none; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; background: var(--grad-soft); box-shadow: 0 0 0 1px var(--nb-line-soft); }
.ios-chat-avatar::after { content: ''; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22); pointer-events: none; }
.ios-chat-avatar.is-support { background: color-mix(in srgb, var(--brand) 12%, var(--nb-surface-hi)); color: var(--brand); }
.ios-avatar-support { display: grid; place-items: center; width: 100%; height: 100%; }
.ios-check { flex: none; display: inline-flex; align-items: center; color: var(--nb-text-mute); }
.ios-chat-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ios-avatar-initial { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; background: var(--grad); color: #fff; font-weight: 900; font-size: 1.25rem; }
.ios-chat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ios-chat-line1, .ios-chat-line2 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ios-chat-name { font-size: 1rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ios-chat-time { margin-right: auto; margin-inline-start: auto; flex: none; font-size: .72rem; color: var(--nb-text-mute); }
.ios-chat-preview { flex: 1; min-width: 0; font-size: .82rem; color: var(--nb-text-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ios-unread { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); background: var(--brand); color: #fff; font-size: .7rem; font-weight: 700; display: grid; place-items: center; }
.ios-unread.is-muted { background: var(--nb-text-mute); }
.ios-pin { flex: none; display: inline-flex; align-items: center; color: var(--nb-text-mute); }
.ios-empty { padding: 22px 16px; text-align: center; color: var(--muted); font-size: .9rem; }
.ios-contact-icon { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; background: var(--nb-surface-hi); color: var(--brand); }
.ios-contact-icon img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.ios-contact-icon .ios-avatar-initial { border-radius: 50%; font-size: 1rem; }
.ios-contact-icon.ico-blue { background: rgba(0, 122, 255, .14); color: #007aff; }
.ios-contact-icon.ico-green { background: rgba(52, 199, 89, .16); color: #34c759; }
.ios-contact-icon.ico-purple { background: rgba(175, 82, 222, .15); color: #af52de; }
.ios-contact-icon.ico-gold { background: rgba(255, 149, 0, .15); color: #ff9500; }
.ios-contact-icon.ico-red { background: rgba(255, 59, 48, .14); color: #ff3b30; }
.ios-contact-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ios-contact-main b { font-size: .92rem; font-weight: 800; }
.ios-contact-main > span { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ios-chevron { flex: none; color: var(--nb-text-mute); display: inline-flex; }
.ios-switch { flex: none; position: relative; width: 51px; height: 31px; border-radius: var(--r-pill); background: #e9e9ea; transition: background .2s ease; }
.ios-switch span { position: absolute; top: 2px; inset-inline-start: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .2); transition: transform .2s ease; }
html[data-theme="dark"] .ios-switch { background: #34c759; }
html[data-theme="dark"] .ios-switch span { transform: translateX(-20px); }
.ios-profile { text-align: center; padding: 22px 16px 16px; }
.ios-profile-avatar { width: 84px; height: 84px; border-radius: 50%; margin: 0 auto 12px; display: grid; place-items: center; background: var(--grad); color: #fff; font-size: 2rem; font-weight: 900; box-shadow: 0 12px 30px -12px rgba(30,120,210,.55); }
img.ios-profile-avatar { object-fit: cover; }
.ios-profile-name { font-size: 1.35rem; font-weight: 800; line-height: 1.5; }
.ios-profile-username { color: var(--nb-text-mute); font-size: .9rem; }
.ios-profile-meta { color: var(--nb-text-mute); font-size: .72rem; margin-top: 2px; }
.ios-list-danger .ios-contact-row { color: var(--err); }
.ios-list-danger .ios-contact-icon { background: var(--err-bg); }

/* ===== Discussion / comments chat ===== */





/* ===== Telegram-style comments under post ===== */
.tg-comments { max-width: 640px; margin-inline: auto; padding: 0 16px 10px; }
.tg-comments-head { display: flex; align-items: center; gap: 8px; margin: 14px 0 8px; }
.tg-comments-head h2 { font-size: 1.02rem; font-weight: 800; }
.tg-comments-count { color: var(--nb-text-mute); font-size: .8rem; }
.tg-comments-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.tg-comment-form { display: flex; gap: 8px; align-items: flex-end; padding: 8px 10px; border-radius: var(--r-control); background: var(--nb-surface); border: 1px solid var(--nb-line); }
.tg-comment-form textarea { flex: 1; min-width: 0; max-height: 120px; min-height: 40px; padding: 9px 14px; border-radius: var(--r-control); font: inherit; font-size: .9rem; border: 1px solid var(--nb-line); background: var(--nb-surface-hi); color: var(--nb-text); resize: none; outline: none; }
.tg-comment-form textarea:focus { border-color: var(--brand); }
.tg-comment-closed { text-align: center; color: var(--nb-text-mute); font-size: .85rem; padding: 14px; background: var(--nb-surface); border: 1px solid var(--nb-line); border-radius: var(--r-card); }

/* ===== Inline reactions & comments in channel ===== */
.tg-react {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--r-pill); border: 0;
  background: transparent; color: var(--nb-text-mute);
  font: inherit; font-size: .78rem; font-weight: 600; cursor: pointer;
  box-shadow: none; transition: color .15s ease, background .15s ease;
}
.tg-react:hover { color: var(--brand); background: var(--nb-surface-hi); }
.tg-react.liked { color: #ff3b30; }
.tg-react.liked svg { animation: heart-pop .4s ease; }
.tg-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tg-post-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0; }
.tg-comments-box { background: var(--nb-surface-hi); border: 1px solid var(--nb-line); border-top: 0; border-radius: 0 0 var(--r-card) var(--r-card); padding: 8px 12px; }
.tg-comments-box-head { display: flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; color: var(--nb-text-mute); margin-bottom: 6px; }
.tg-comments-box-count { font-weight: 700; }

/* ===== Telegram-style auth (login / register) ===== */
.tg-auth { max-width: 400px; margin-inline: auto; text-align: center; padding: 26px 22px; }
.tg-auth-logo { width: 76px; height: 76px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-size: 1.9rem; font-weight: 900; margin: 0 auto 14px; box-shadow: 0 12px 28px -12px rgba(30, 120, 210, .55); }
.tg-auth h2 { font-size: 1.4rem; font-weight: 800; margin-bottom: 4px; }
.tg-auth-sub { color: var(--nb-text-mute); font-size: .88rem; margin-bottom: 18px; }
.tg-input { width: 100%; padding: 13px 16px; border-radius: var(--r-control); border: 1px solid transparent; background: var(--nb-surface-hi); color: var(--nb-text); font: inherit; margin-bottom: 10px; text-align: start; }
.tg-input:focus { outline: none; border-color: var(--brand); background: var(--nb-surface); }
.tg-input.tg-ltr:not(:placeholder-shown) { text-align: left; direction: ltr; }
.tg-input[dir="auto"]:placeholder-shown { direction: rtl; text-align: right; }
.tg-auth .btn { border-radius: var(--r-control); margin-top: 4px; }
.tg-auth-sep { display: flex; align-items: center; gap: 12px; color: var(--nb-text-mute); font-size: .8rem; margin: 20px 0 14px; }
.tg-auth-sep::before, .tg-auth-sep::after { content: ''; flex: 1; height: 1px; background: var(--nb-line); }
.tg-react-pill { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: var(--r-pill); background: var(--nb-surface-hi); border: 1px solid var(--nb-line); font-size: .75rem; color: var(--nb-text-dim); }
.tg-react-picker { display: inline-flex; gap: 6px; margin-top: 6px; padding: 5px 9px; background: var(--nb-surface-hi); border-radius: var(--r-pill); border: 1px solid var(--nb-line); }
.tg-react-emoji { border: 0; background: none; font-size: 1.2rem; line-height: 1; cursor: pointer; padding: 2px 3px; }
.tg-comments-none { color: var(--nb-text-mute); font-size: .78rem; }
.tg-comments-link { text-decoration: none; }
.tg-post-comments { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--nb-line); }
.tg-comments-count { display: inline-flex; align-items: center; gap: 5px; color: var(--nb-text-mute); font-size: .74rem; margin-bottom: 6px; }
.tg-comments-empty { color: var(--nb-text-mute); font-size: .8rem; padding: 2px 0; }

/* ---------- read-only legacy conversation + attach ---------- */
.chat-screen.chat-readonly .app-main { padding-bottom: 24px; padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
.chat-screen.chat-readonly .chat-jump { bottom: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
.chat-attach { max-width: 88%; margin: 4px auto 14px; text-align: center; }
.chat-attach-btn { border: 0; border-radius: var(--r-control); padding: 8px 14px; background: var(--brand); color: #fff; font: inherit; font-size: .78rem; font-weight: 600; cursor: pointer; }
.chat-system a { color: var(--brand); font-weight: 600; }

/* ---------- chats: message-admin hint ---------- */
.chat-admin-hint { padding: 14px 16px 102px; padding-bottom: calc(var(--tabbar-h) + var(--tabbar-offset) + 24px + env(safe-area-inset-bottom, 0px)); text-align: center; font-size: .78rem; line-height: 1.8; color: var(--nb-text-mute); }
.chat-admin-hint a { color: var(--brand); font-weight: 600; text-decoration: none; }
.chat-admin-hint a:hover { text-decoration: underline; }
.chat-admin-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 50vh; padding: 24px 16px 102px; padding-bottom: calc(var(--tabbar-h) + var(--tabbar-offset) + 24px + env(safe-area-inset-bottom, 0px)); text-align: center; }
.chat-admin-empty p { font-size: .82rem; line-height: 1.8; color: var(--nb-text-mute); }
.chat-admin-empty a { color: var(--brand); font-weight: 600; text-decoration: none; }
.chat-admin-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 10px 18px; border-radius: var(--r-control); background: var(--brand); color: #fff; font: inherit; font-size: .82rem; font-weight: 600; text-decoration: none; }

/* ===== Motion & loading polish (transform/opacity only) ===== */
:root {
  --nx-ease: cubic-bezier(.2, .8, .2, 1);
  --nx-dur: .2s;
}

@keyframes nx-page-in { from { opacity: 0; transform: translateX(var(--nx-shift-x, 0px)); } }
@keyframes nx-msg-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes nx-vt-out { to { opacity: 0; transform: translateX(calc(var(--nx-shift-x, 0px) * -.25)); } }
@keyframes nx-vt-in { from { opacity: 0; transform: translateX(calc(var(--nx-shift-x, 0px) * .25)); } }

.msg-row.is-new { animation: nx-msg-in .18s var(--nx-ease) both; }

/* soft row press highlight (opacity-only overlay) */
.app-chatrow { position: relative; }
.ios-chat-row::before,
.app-chatrow::before,
.ios-contact-row::before,
.ui-row::before {
  content: ''; position: absolute; inset: 0;
  background: var(--nb-surface-hi);
  opacity: 0; pointer-events: none;
  transition: opacity .15s var(--nx-ease);
}
.ios-chat-row:active::before,
.app-chatrow:active::before,
.ios-contact-row:active::before,
.ui-row:active::before { opacity: .9; }

/* sliding active pill */
.tabbar-inner { position: relative; }
.tabbar-pill {
  position: absolute; top: 6px; bottom: 6px; inset-inline-start: 6px;
  width: calc(50% - 8px);
  border-radius: var(--r-control);
  background: rgba(14, 165, 233, .15);
  background: color-mix(in srgb, var(--brand) 15%, transparent);
  transform: translateX(calc(var(--tab-index, 0) * -100% - var(--tab-index, 0) * 4px));
  transition: transform var(--nx-dur) var(--nx-ease);
  pointer-events: none;
  z-index: 0;
  view-transition-name: tab-pill;
}
.tabbar-item { position: relative; z-index: 1; }

/* cross-document view transitions (progressive enhancement) */
@view-transition { navigation: auto; }
.app-top { view-transition-name: app-header; }
.tabbar { view-transition-name: app-tabbar; }
main#main { view-transition-name: app-main; }

/* Chrome (header + tabbar) swaps instantly: with animation:none the OLD
   snapshot would stay fully opaque on top for the whole transition and then
   pop — a lingering trace of the previous page. So the new chrome is kept
   static and the old one is dropped from the first frame. */
::view-transition-group(app-header),
::view-transition-group(app-tabbar),
::view-transition-new(app-header),
::view-transition-new(app-tabbar) { animation: none; }
::view-transition-old(app-header),
::view-transition-old(app-tabbar) { animation: none; opacity: 0; }

::view-transition-old(app-main) { animation: nx-vt-out var(--nx-dur) var(--nx-ease) both; }
::view-transition-new(app-main) { animation: nx-vt-in var(--nx-dur) var(--nx-ease) both; }
::view-transition-group(tab-pill) { animation-duration: var(--nx-dur); animation-timing-function: var(--nx-ease); }
/* No cross-fade for the pill: a ghost lingering on the old tab reads as
   lag. The group morph slides the pill from tab to tab on its own. */
::view-transition-old(tab-pill),
::view-transition-new(tab-pill) { animation: none; }

/* page/tab entrance fallback when cross-document VT is unavailable */
html:not(.nx-vt).nx-tab-enter main#main,
html:not(.nx-vt).nx-chat-enter main#main,
html:not(.nx-vt).nx-chat-back main#main { animation: nx-page-in .22s var(--nx-ease) both; }
html:not(.nx-vt).nx-pill-from .tabbar-pill {
  /* Keyframe, not a transition: the slide starts from the very first
     painted frame, so the pill never holds on the previous tab. */
  animation: nx-pill-slide var(--nx-dur) var(--nx-ease) both;
}
@keyframes nx-pill-slide {
  from { transform: translateX(calc(var(--nx-pill-from, 0) * -100% - var(--nx-pill-from, 0) * 4px)); }
}

/* skeleton loading */
.nx-skeleton {
  position: fixed;
  top: 52px;
  top: calc(52px + env(safe-area-inset-top, 0px));
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  background: var(--bg);
  opacity: 1;
  transition: opacity .18s var(--nx-ease);
  pointer-events: none;
  overflow: hidden;
  animation: nx-sk-in .18s ease;
}
.nx-skeleton--full { top: 0; }
.nx-skeleton.is-out { opacity: 0; }
@media (min-width: 900px) { .nx-skeleton { display: none; } }
@keyframes nx-sk-in { from { opacity: 0; } }

.nx-sk { position: relative; overflow: hidden; background: var(--nb-line); border-radius: var(--r-pill); }
.nx-sk::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 55%;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .55) 50%, transparent 80%);
  transform: translateX(-120%);
  animation: nx-sk-shimmer 1.2s linear infinite;
  animation-delay: var(--nx-sk-d, 0s);
}
[data-theme="dark"] .nx-sk::after { background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .1) 50%, transparent 80%); }
@keyframes nx-sk-shimmer { to { transform: translateX(260%); } }

.nx-sk-search { display: block; margin: 4px 16px 10px; height: 40px; border-radius: var(--r-control); }
.nx-sk-list { background: var(--nb-surface); }
.nx-sk-row { display: flex; align-items: center; gap: 12px; padding: 11px 16px; background: var(--nb-surface); }
.nx-sk-avatar { flex: none; display: block; width: 56px; height: 56px; border-radius: 50%; }
.nx-sk-avatar.lg { width: 64px; height: 64px; border-radius: var(--r-avatar-square); margin: 0 auto; }
.nx-sk-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.nx-sk-line1, .nx-sk-line2 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.nx-sk-line { display: block; height: 11px; border-radius: var(--r-pill); }
.nx-sk-line.w25 { width: 25%; }
.nx-sk-line.w40 { width: 40%; }
.nx-sk-line.w45 { width: 45%; }
.nx-sk-line.w60 { width: 60%; }
.nx-sk-line.w70 { width: 70%; }
.nx-sk-line.w80 { width: 80%; }
.nx-sk-time { flex: none; display: block; width: 42px; height: 10px; margin-inline-start: auto; border-radius: var(--r-pill); }
.nx-sk-pin { flex: none; display: block; width: 13px; height: 13px; border-radius: 5px; }
.nx-sk-hint { display: block; width: 38%; height: 11px; margin: 14px auto 0; }
.nx-sk-chat { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 96px; }
.nx-sk-bubble { display: block; width: 62%; height: 36px; border-radius: var(--r-bubble); }
.nx-sk-bubble.alt { align-self: flex-end; }
.nx-sk-bubble.w38 { width: 38%; }
.nx-sk-bubble.w42 { width: 42%; }
.nx-sk-bubble.w48 { width: 48%; }
.nx-sk-bubble.w55 { width: 55%; }
.nx-sk-bubble.w64 { width: 64%; }
.nx-sk-bubble.w70 { width: 70%; }
.nx-sk-bubble.h36 { height: 36px; }
.nx-sk-bubble.h48 { height: 48px; }
.nx-sk-bubble.h56 { height: 56px; }
.nx-sk-bubble.h72 { height: 72px; }
.nx-sk-composer { position: absolute; left: 16px; right: 16px; bottom: 12px; height: 54px; border-radius: var(--r-control); }
.nx-sk-profile { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 22px 16px 16px; }
.nx-sk-profile .nx-sk-line { height: 13px; }
.nx-sk-card { margin: 0 16px; border-radius: var(--r-card); overflow: hidden; background: var(--nb-surface); }
.nx-sk-card .nx-sk-row { padding: 11px 16px; }
.nx-sk-icon { flex: none; display: block; width: 40px; height: 40px; border-radius: 50%; }
.nx-skeleton-on .chat-input,
.nx-skeleton-on .chat-locked { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .nx-skeleton { display: none; }
  html:not(.nx-vt).nx-pill-from .tabbar-pill { animation: none !important; }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*),
  ::view-transition-image-pair(*) { animation: none !important; }
}

/* Superellipse corners for every surface using the radius tokens */
@supports (corner-shape: squircle) {
  *, *::before, *::after { corner-shape: squircle; }
}
