/* ══════════════════════════════════════════════════════
   TIMELESS — CSS  (Cinematic Purple + Dark Mode)
   Reference: dark charcoal, lavender accent, gold premium
   ══════════════════════════════════════════════════════ */

/* ── Variables ──────────────────────────────────────── */
:root {
  /* Accent kept as --red for legacy selectors; value is lavender */
  --red:         #A88BFF;
  --red-dark:    #7B62E8;
  --red-light:   #C6B4FF;
  --red-bg:      rgba(168, 139, 255, 0.12);
  --red-rgb:     168, 139, 255;
  --accent:      #A88BFF;
  --accent-hi:   #C6B4FF;
  --gold:        #D4B65F;
  --gold-rgb:    212, 182, 95;
  --glass:       rgba(42, 42, 48, 0.75);
  --accent-grad: linear-gradient(145deg, var(--red-light) 0%, var(--red) 55%, var(--red-dark) 100%);
  --accent-grad-h: linear-gradient(100deg, var(--red-light), var(--red));
  --gold-grad:   linear-gradient(135deg, #E8D08A 0%, #D4B65F 45%, #B8923E 100%);

  --bg:          #F4F3F8;
  --surface:     #EBEAF2;
  --card:        #FFFFFF;
  --border:      #DCD8E8;

  --text:        #16161A;
  --text2:       #6B6B78;
  --text3:       #9A9AA8;

  /* SVG icon palette (overridden per chat-theme) */
  --ico-warm:    #D4B65F;
  --ico-cool:    #A88BFF;
  --ico-nature:  #22C55E;
  --ico-pink:    #C6B4FF;
  /* Белые mono-SVG: на светлых темах → тёмные; night/colored без фильтра */
  --tl-ico-filter: brightness(0) opacity(0.88);

  --shadow:      0 2px 16px rgba(40, 30, 70, 0.08);
  --shadow-lg:   0 12px 40px rgba(40, 30, 70, 0.14);

  --radius:      18px;
  --radius-sm:   12px;
  --radius-xs:   8px;
  --radius-pill: 999px;

  --nav-h:       64px;
  --bar-h:       52px;

  --transition:  0.22s cubic-bezier(0.22, 1, 0.36, 1);

  /* Реальная высота вьюпорта (обновляется через JS) */
  --real-vh:     1dvh;

  --font: 'Outfit', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

[data-theme="dark"] {
  --bg:       #101012;
  --surface:  #1E1E22;
  --card:     #24242A;
  --border:   rgba(255, 255, 255, 0.08);
  --text:     #F5F5F7;
  --text2:    #A7A7B3;
  --text3:    #6E6E7A;
  --shadow:      0 4px 20px rgba(0, 0, 0, 0.45);
  --shadow-lg:   0 16px 48px rgba(0, 0, 0, 0.55);
  --red-bg:   rgba(168, 139, 255, 0.14);
  --glass:    rgba(42, 42, 48, 0.72);
  --space-1:  8px;
  --space-2:  12px;
  --space-3:  16px;
  --space-4:  24px;
  --tl-ico-filter: none;
}

/* ── Reset ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
* { -webkit-tap-highlight-color: transparent; }
html {
  font-size: 16px;
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
  height: 100%;
  /* Фон страницы за пределами приложения (виден на десктопе) */
  background: #0a0a0c;
}
button, input, textarea, select {
  font-family: inherit;
}
[data-theme="dark"] { background: #0a0a0a; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  height: calc(var(--real-vh) * 100);
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  /* iOS: не даём «резиновому» overscroll ломать ленту */
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
}
#app {
  height: calc(var(--real-vh) * 100);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
button { cursor: pointer; border: none; background: none; font: inherit; }
input, textarea { font: inherit; outline: none; border: none; }
a { color: inherit; text-decoration: none; }
img { display: block; width: 100%; object-fit: cover; }
svg { width: 24px; height: 24px; flex-shrink: 0; }

/* ── Screens ─────────────────────────────────────────── */
.screen { height: calc(var(--real-vh) * 100); overflow: hidden; }
.hidden { display: none !important; }

/* ══════════════════════════════════════════════════════
   AUTH SCREEN  (sign-in / register — mountain glass)
   ══════════════════════════════════════════════════════ */
#auth-screen {
  --auth-pink: #C6B4FF;
  --auth-magenta: #A88BFF;
  --auth-grad: linear-gradient(100deg, #C6B4FF 0%, #A88BFF 55%, #7B62E8 100%);
  --auth-glass: rgba(30, 30, 36, 0.72);
  --auth-field: rgba(16, 16, 20, 0.55);
  --auth-border: rgba(255, 255, 255, 0.12);
  --auth-muted: rgba(255, 255, 255, 0.55);
  --auth-text: #FFFFFF;
  /* Обои / лого: меняй в public/js/auth-config.js */
  --auth-wallpaper: url('/images/auth-bg.jpg');
  --auth-wallpaper-pos: center center;
  --auth-overlay: linear-gradient(180deg, rgba(10,10,18,0.35) 0%, rgba(10,10,18,0.62) 55%, rgba(10,10,18,0.88) 100%);
  --auth-logo-h: 190px;
}
.auth-bg {
  /* 100% of #auth-screen — NOT --real-vh. On desktop the phone frame is
     shorter than the window; using vh here pushed welcome buttons below the clip. */
  height: 100%;
  min-height: 100%;
  background:
    var(--auth-overlay),
    var(--auth-wallpaper) var(--auth-wallpaper-pos) / cover no-repeat;
  background-color: #0a0610;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px 16px;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.auth-bg::before { display: none; }
.auth-bg > * { position: relative; z-index: 1; }

.auth-logo {
  text-align: center;
  margin-bottom: 0;
  color: #fff;
  flex: 0 1 auto;
  min-height: 0;
}
.auth-logo-icon {
  width: auto;
  height: auto;
  max-height: none;
  background: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  margin: 0 auto 2px;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  filter: drop-shadow(0 0 22px rgba(168, 139, 255, 0.45));
}
.auth-logo-infinity {
  width: auto;
  height: auto;
  /* Большое лого, но не больше ~20% экрана — форма остаётся в кадре */
  max-height: min(var(--auth-logo-h, 190px), 20vh);
  max-width: min(320px, 78vw);
  object-fit: contain;
  display: block;
}
.auth-logo-text {
  font-size: clamp(24px, 4.2vh, 32px);
  font-weight: 800;
  letter-spacing: -0.4px;
  color: #fff;
  text-shadow: 0 2px 16px rgba(0,0,0,0.45);
  line-height: 1.15;
}
.auth-logo-sub {
  font-size: 13px;
  color: rgba(255,255,255,0.9);
  margin-top: 2px;
  font-weight: 400;
  text-shadow: 0 1px 10px rgba(0,0,0,0.35);
}

.auth-card {
  background: var(--auth-glass);
  border: 1px solid var(--auth-border);
  border-radius: 22px;
  padding: 14px 16px 16px;
  width: 100%;
  max-width: 380px;
  flex: 0 0 auto;
  box-shadow: 0 20px 50px rgba(0,0,0,0.35);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
}
@media (min-height: 780px) {
  .auth-logo-infinity {
    max-height: min(var(--auth-logo-h, 190px), 24vh);
  }
}
@media (max-height: 700px) {
  .auth-logo-sub { display: none; }
  .auth-logo-infinity { max-height: min(var(--auth-logo-h, 190px), 16vh); }
  .auth-bg { gap: 6px; padding: 8px 16px 12px; }
  .auth-card { padding: 12px 14px 14px; }
  #auth-screen .auth-form { gap: 10px; }
}
.auth-tabs {
  display: flex;
  background: rgba(0,0,0,0.28);
  border-radius: 14px;
  padding: 4px;
  margin-bottom: 16px;
  gap: 4px;
}
.auth-tab {
  flex: 1;
  padding: 11px 8px;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 650;
  color: rgba(255,255,255,0.55);
  transition: color 0.2s, background 0.2s, box-shadow 0.2s;
}
.auth-tab.active {
  background: var(--auth-grad);
  color: #fff;
  box-shadow: 0 6px 18px rgba(168, 139, 255, 0.4);
}
.auth-form { display: flex; flex-direction: column; gap: 12px; }

#auth-screen .input-group {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--auth-field);
  border-radius: 14px;
  border: 1px solid var(--auth-border);
  padding: 0 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#auth-screen .input-group:focus-within {
  border-color: rgba(255, 75, 110, 0.55);
  box-shadow: 0 0 0 3px rgba(246, 46, 142, 0.15);
}
#auth-screen .input-icon {
  margin-right: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.45);
}
#auth-screen .input-icon svg { width: 18px; height: 18px; }
#auth-screen .input-group input {
  flex: 1;
  padding: 14px 0;
  background: none;
  color: #fff;
  font-size: 15px;
}
#auth-screen .input-group input::placeholder { color: rgba(255,255,255,0.38); }
#auth-screen .auth-code-input {
  letter-spacing: 6px;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
}

#auth-screen .form-error {
  color: #FF8A9A;
  font-size: 13px;
  min-height: 16px;
}
#auth-screen .btn-primary {
  background: var(--auth-grad);
  color: #fff;
  border-radius: 14px;
  padding: 15px;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 8px 22px rgba(246, 46, 142, 0.4);
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
  border: none;
}
#auth-screen .btn-primary:active {
  transform: scale(0.98);
  box-shadow: 0 4px 14px rgba(246, 46, 142, 0.3);
}
.btn-full { width: 100%; }

.auth-forgot-wrap { text-align: center; margin-top: 2px; }
.auth-forgot-link,
.auth-back-link {
  background: none;
  border: none;
  color: rgba(255,255,255,0.72);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 6px;
}
.auth-back-link {
  width: 100%;
  margin-top: 4px;
  text-decoration: none;
  color: var(--auth-muted);
}

.auth-panel-head { text-align: center; margin-bottom: 6px; }
.auth-panel-ico {
  margin-bottom: 8px;
  display: flex; justify-content: center;
  color: rgba(255,255,255,0.7);
}
.auth-panel-ico svg { width: 36px; height: 36px; }
.auth-panel-title { font-weight: 700; font-size: 16px; color: #fff; }
.auth-panel-sub { font-size: 13px; color: var(--auth-muted); margin-top: 4px; line-height: 1.35; }
.auth-success {
  text-align: center;
  padding: 14px;
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 12px;
  color: #A7F3D0;
  font-size: 13px;
  font-weight: 600;
}

/* ── Auth lang switch ── */
#auth-screen .auth-lang-switch {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
  background: rgba(0,0,0,0.32);
  border: 1px solid var(--auth-border);
  border-radius: 30px;
  padding: 3px;
  gap: 0;
  width: fit-content;
  min-width: 148px;
  align-self: center;
  overflow: hidden;
}
#auth-screen .lang-pill {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  padding: 7px 14px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  color: rgba(255,255,255,0.55);
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  cursor: pointer;
  transition: color 0.25s;
  user-select: none;
}
#auth-screen .lang-pill::before { display: none !important; }
#auth-screen .lang-pill.active { color: #fff; }
.lang-flag {
  display: inline-block;
  width: 18px;
  height: 12px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
  pointer-events: none;
}
#auth-screen .lang-pill-slider {
  position: absolute;
  top: 3px;
  left: 3px;
  height: calc(100% - 6px);
  width: calc((100% - 6px) / 2);
  background: var(--auth-grad);
  border-radius: 30px;
  transition: transform 0.28s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 2px 10px rgba(246, 46, 142, 0.4);
  z-index: 0;
  pointer-events: none;
}
.auth-lang-switch[data-lang="en"] .lang-pill-slider {
  transform: translateX(100%);
}

/* Auth tabs: flat (no liquid glass) */
#auth-screen .auth-tab.tl-liquid-btn,
#auth-screen .auth-tab {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  overflow: visible;
}
#auth-screen .auth-tab::before { display: none !important; }
#auth-screen .auth-tab.active {
  background: var(--auth-grad) !important;
  color: #fff;
  box-shadow: 0 6px 18px rgba(168, 139, 255, 0.4) !important;
}

/* Lang slider keeps liquid glass wash on purple pill */
#auth-screen .lang-pill-slider.tl-liquid-btn {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.35) 0%, rgba(198, 180, 255, 0.35) 35%, rgba(123, 98, 232, 0.55) 100%),
    var(--auth-grad) !important;
  border: 1px solid rgba(255, 255, 255, 0.35) !important;
  box-shadow:
    0 4px 14px rgba(246, 46, 142, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -1px 0 rgba(0, 0, 0, 0.12) !important;
}

@keyframes langFlash {
  0%   { opacity: 1; }
  30%  { opacity: 0.35; transform: scale(0.985); }
  100% { opacity: 1; transform: scale(1); }
}
.auth-card.lang-flash { animation: langFlash 0.38s ease; }
#auth-screen .auth-hint {
  text-align: center;
  font-size: 12px;
  color: rgba(255,255,255,0.38);
  margin-top: 2px;
}

.username-field-wrap { display: flex; flex-direction: column; gap: 5px; }
.username-status { min-height: 18px; font-size: 13px; display: flex; align-items: center; gap: 6px; padding-left: 2px; }
.ucheck-ok  { color: #00b894; font-weight: 500; }
.ucheck-err { color: var(--red); font-weight: 500; }
.ucheck-spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid var(--border); border-top-color: var(--red);
  border-radius: 50%;
  animation: uspin 0.7s linear infinite;
}
@keyframes uspin { to { transform: rotate(360deg); } }

#auth-screen .eye-btn {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; padding: 4px;
  color: rgba(255,255,255,0.45); display: flex; align-items: center;
}
#auth-screen .eye-btn svg { width: 18px; height: 18px; }
#auth-screen .eye-btn:hover { color: rgba(255,255,255,0.85); }

#auth-screen .auth-social {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}
#auth-screen .auth-social.hidden { display: none; }
#auth-screen .auth-divider {
  display: flex; align-items: center; gap: 10px;
  color: rgba(255,255,255,0.45); font-size: 12px; margin: 2px 0;
}
#auth-screen .auth-divider::before,
#auth-screen .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: rgba(255,255,255,0.14);
}

/* Google button on auth — dark glass, not white frosted */
#auth-screen .btn-google-custom {
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.16);
  color: #fff;
  border-radius: 14px;
  height: 50px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: none;
  font-weight: 650;
}
#auth-screen .btn-google-custom::before { display: none; }
#auth-screen .btn-google-custom:hover {
  background: rgba(0,0,0,0.48);
  box-shadow: none;
}
#auth-screen .btn-google-custom:active { transform: scale(0.98); }

/* Fallback styles for non-auth .input-group / .btn-primary used elsewhere */
.input-group {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  padding: 0 12px;
  transition: border-color var(--transition);
}
.input-group:focus-within { border-color: var(--red); }
.input-icon {
  font-size: 18px; margin-right: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text2);
}
.input-icon .tl-ico { width: 18px; height: 18px; }
.input-group input {
  flex: 1;
  padding: 13px 0;
  background: none;
  color: var(--text);
  font-size: 15px;
}
.input-group input::placeholder { color: var(--text3); }
.form-error { color: var(--red); font-size: 13px; min-height: 18px; }
.btn-primary {
  background: var(--accent-grad);
  color: #fff;
  border-radius: var(--radius-pill);
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 6px 20px rgba(var(--red-rgb), 0.38);
  transition: transform var(--transition), box-shadow var(--transition), filter var(--transition);
}
.btn-primary:active { transform: scale(0.97); box-shadow: 0 2px 10px rgba(var(--red-rgb), 0.3); filter: brightness(0.96); }
.eye-btn {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; padding: 4px;
  color: var(--text2); display: flex; align-items: center;
}
.eye-btn svg { width: 18px; height: 18px; }
.eye-btn:hover { color: var(--text); }
.auth-divider {
  display: flex; align-items: center; gap: 10px;
  color: var(--text2); font-size: 12px; margin: 2px 0;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* Google Complete Registration Screen */
.gc-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
}
.gc-back {
  display: flex; align-items: center; gap: 4px;
  background: none; border: none; cursor: pointer;
  color: var(--text2); font-size: 13px; padding: 4px 0;
  flex-shrink: 0;
}
.gc-back:hover { color: var(--text); }
.gc-title { font-size: 16px; font-weight: 700; color: var(--text); }
.gc-google-info {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 4px;
}
.gc-google-avatar {
  width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
}
.gc-avatar-fallback {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--red); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 20px; flex-shrink: 0;
}
.gc-google-name  { font-size: 14px; font-weight: 600; color: var(--text); }
.gc-google-email { font-size: 13px; color: var(--text2); margin-top: 2px; }
.gc-email-lock   { font-size: 11px; color: var(--text2); margin-top: 3px; }

.btn-google-custom {
  position: relative;
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  height: 50px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.55);
  background: rgba(255,255,255,0.22);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  color: var(--text);
  font-size: 15px; font-weight: 700;
  letter-spacing: 0.1px;
  cursor: pointer;
  overflow: hidden;
  box-shadow:
    0 4px 20px rgba(0,0,0,0.10),
    0 1px 4px rgba(0,0,0,0.06),
    inset 0 1px 0 rgba(255,255,255,0.80),
    inset 0 -1px 0 rgba(0,0,0,0.05);
  transition: transform 0.14s, box-shadow 0.14s, background 0.14s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
/* стеклянный блик сверху */
.btn-google-custom::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  background: linear-gradient(160deg, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0.00) 50%);
  pointer-events: none;
}
.btn-google-custom:hover {
  background: rgba(255,255,255,0.32);
  box-shadow:
    0 6px 28px rgba(66,133,244,0.18),
    0 1px 4px rgba(0,0,0,0.08),
    inset 0 1px 0 rgba(255,255,255,0.90),
    inset 0 -1px 0 rgba(0,0,0,0.04);
}
.btn-google-custom:active {
  transform: scale(0.97);
  box-shadow: 0 1px 6px rgba(0,0,0,0.10), inset 0 1px 0 rgba(255,255,255,0.60);
}
[data-theme="dark"] .btn-google-custom {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.18);
  box-shadow:
    0 4px 20px rgba(0,0,0,0.30),
    0 1px 4px rgba(0,0,0,0.20),
    inset 0 1px 0 rgba(255,255,255,0.18),
    inset 0 -1px 0 rgba(0,0,0,0.15);
}
[data-theme="dark"] .btn-google-custom::before {
  background: linear-gradient(160deg, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0.00) 50%);
}
[data-theme="dark"] .btn-google-custom:hover {
  background: rgba(255,255,255,0.15);
  box-shadow: 0 6px 28px rgba(66,133,244,0.22), inset 0 1px 0 rgba(255,255,255,0.22);
}

/* ══════════════════════════════════════════════════════
   MAIN LAYOUT
   ══════════════════════════════════════════════════════ */
#top-bar {
  position: fixed;
  top: 0;
  left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  height: calc(var(--bar-h) + env(safe-area-inset-top, 0px));
  display: flex; align-items: center;
  padding: env(safe-area-inset-top, 0px) 4px 0;
  gap: 2px;
  z-index: 100;
  box-sizing: border-box;
  /* Solid по умолчанию (для чатов, настроек и пр.) */
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background 0.2s ease, border-color 0.2s ease;
}
[data-theme="dark"] #top-bar { background: rgba(18,18,18,0.95); }

/* ── Прозрачный режим (лента / друзья — TikTok стиль) ── */
#top-bar.transparent-mode {
  background: linear-gradient(to bottom, rgba(0,0,0,0.45) 0%, transparent 100%);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: none;
}
#top-bar.transparent-mode .top-tab,
#top-bar.transparent-mode .icon-btn {
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}
#top-bar.transparent-mode .top-tab.active {
  color: #fff;
  font-weight: 800;
}
#top-bar.transparent-mode .top-tab.active::after {
  background: #fff;
}
#top-bar.transparent-mode .streams-top-btn.active { color: #fff; }

.top-tab {
  flex: 1;
  height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 600;
  color: var(--text2);
  position: relative;
  transition: color var(--transition), font-weight var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.top-tab.active { color: var(--red); font-weight: 700; }
.top-tab.active::after {
  content: '';
  position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
  width: 18px; height: 2px;
  background: var(--red);
  border-radius: 2px;
}
.streams-top-btn.active { color: var(--red); }
.icon-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text2);
  transition: background var(--transition);
  position: relative;
}
.icon-btn:active { background: var(--surface); }
.icon-btn svg { width: 22px; height: 22px; }
.notif-badge {
  position: absolute; top: 4px; right: 4px;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
}

/* ── Nav Create Button (center FAB in bump) ─────────────── */
.nav-create-btn {
  flex: 1;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: center;
  position: relative;
  z-index: 2;
  -webkit-tap-highlight-color: transparent;
}
.nav-create-icon {
  width: 56px; height: 56px;
  margin-top: -24px;
  background: var(--accent-grad);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid rgba(255,255,255,0.4);
  box-shadow:
    0 10px 28px rgba(var(--red-rgb), 0.45),
    0 2px 8px rgba(var(--red-rgb), 0.25),
    inset 0 1px 0 rgba(255,255,255,0.5);
  transition: transform 0.28s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.2s ease;
  position: relative;
  z-index: 3;
}
.nav-create-btn:active .nav-create-icon {
  transform: scale(0.9);
  box-shadow: 0 4px 14px rgba(var(--red-rgb), 0.35);
}
.nav-create-icon svg { width: 22px; height: 22px; stroke: #fff; }

/* ── Online Status ───────────────────────────────────── */
.avatar-online-wrap { position: relative; flex-shrink: 0; }
.avatar-online-wrap.is-online::after {
  content: '';
  position: absolute; bottom: 1px; right: 1px;
  width: 11px; height: 11px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid var(--bg);
}
.chat-view-status {
  font-size: 12px; color: var(--text3); margin-top: 1px;
  display: inline-block;
  background: var(--surface);
  padding: 1px 7px; border-radius: 999px;
}
.chat-view-status.online { color: #22c55e; background: rgba(34,197,94,0.12); }
.uprofile-online-status {
  font-size: 12px; color: var(--text3);
  margin-top: 4px; margin-bottom: 6px;
  display: inline-block;
  background: rgba(0,0,0,0.35);
  color: rgba(255,255,255,0.85);
  padding: 2px 10px; border-radius: 999px;
  backdrop-filter: blur(4px);
}
.uprofile-online-status.online { color: #22c55e; background: rgba(0,0,0,0.35); }

#screen-content {
  position: fixed;
  /* Content runs under the floating glass nav (Instagram-style) —
     no solid rear strip behind the pill */
  top: calc(var(--bar-h) + env(safe-area-inset-top, 0px));
  bottom: 0;
  left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: none;
  transition: top 0.15s ease;
  padding-bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom, 0px));
  will-change: transform;
  touch-action: pan-y;
}
/* Rubber-band pull (Instagram / Telegram) */
#screen-content.is-rubber-pulling {
  transition: none !important;
  touch-action: none;
}
#screen-content.is-rubber-releasing {
  transition: transform 0.42s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
.rubber-pull-hint {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%) scale(0.7);
  z-index: 50;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
[data-theme="dark"] .rubber-pull-hint {
  background: rgba(30, 30, 36, 0.55);
  border-color: rgba(255, 255, 255, 0.16);
}
.rubber-pull-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: rgba(198, 180, 255, 0.95);
  animation: rubberSpin 0.7s linear infinite;
}
@keyframes rubberSpin { to { transform: rotate(360deg); } }
/* Полноэкранный режим — контент идёт под прозрачную шапку (TikTok) */
#screen-content.full-screen {
  top: 0;
  padding-bottom: 0; /* feed manages its own height */
}
/* Топ-бар скрыт — убираем отступ */
#screen-content.no-topbar {
  top: 0;
}
/* Нижний нав скрыт (чат) — убираем отступ снизу */
#screen-content.no-bottom-nav {
  bottom: 0;
  padding-bottom: 0;
}

/* ══ Bottom Nav — Liquid Glass (Habr / Apple-like) ════════════ */
#bottom-nav {
  --nav-glass-bg: rgba(255, 255, 255, 0.16);
  --nav-glass-border: rgba(255, 255, 255, 0.42);
  --nav-icon: rgba(26, 26, 26, 0.82);
  position: fixed;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  left: 50%; transform: translateX(-50%);
  width: calc(100% - 28px);
  max-width: 430px;
  height: var(--nav-h);
  padding: 0 6px;

  background: transparent;
  border-radius: 40px;
  border: 1px solid var(--nav-glass-border);
  box-shadow:
    0 10px 36px rgba(0, 0, 0, 0.12),
    0 2px 8px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 rgba(255, 255, 255, 0.1);

  display: flex; align-items: center;
  z-index: 200;
  overflow: visible;
  isolation: isolate;
}

/* Слой стекла: blur + kube.io Liquid Glass refraction (Chrome) */
.nav-glass {
  display: block;
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--nav-glass-bg);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
/* Chromium: SVG displacement as backdrop-filter (https://kube.io/blog/liquid-glass-css-svg/) */
html.lg-svg-backdrop .nav-glass.lg-ready {
  backdrop-filter: var(--lg-filter, url(#liquidGlassNav)) saturate(165%);
  -webkit-backdrop-filter: var(--lg-filter, url(#liquidGlassNav)) saturate(165%);
}

/* Блик / объём */
#bottom-nav::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
  background: linear-gradient(
    125deg,
    rgba(255, 255, 255, 0.48) 0%,
    rgba(255, 255, 255, 0.1) 26%,
    transparent 52%,
    rgba(255, 255, 255, 0.06) 100%
  );
  opacity: 0.9;
}
#bottom-nav::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.22) 0%,
    rgba(255, 255, 255, 0) 42%
  );
  pointer-events: none;
  z-index: 0;
}

[data-theme="dark"] #bottom-nav {
  --nav-glass-bg: rgba(18, 20, 26, 0.38);
  --nav-glass-border: rgba(255, 255, 255, 0.2);
  --nav-icon: rgba(255, 255, 255, 0.92);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.42),
    0 2px 10px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -1px 0 rgba(0, 0, 0, 0.28);
}
[data-theme="dark"] #bottom-nav::before {
  background: linear-gradient(
    125deg,
    rgba(255, 255, 255, 0.18) 0%,
    rgba(255, 255, 255, 0.04) 30%,
    transparent 55%,
    rgba(255, 255, 255, 0.03) 100%
  );
}
[data-theme="dark"] #bottom-nav::after {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0) 45%
  );
}

/* Скользящий pill-индикатор активной вкладки
   Центрируем через top/bottom — без transform, чтобы Motion/scale не сбивал позицию */
.nav-pill {
  position: absolute;
  top: 6px;
  bottom: 6px;
  height: auto;
  border-radius: 22px;
  background: rgba(var(--red-rgb),0.10);
  transition: left 0.38s cubic-bezier(0.34, 1.2, 0.64, 1),
              width 0.38s cubic-bezier(0.34, 1.2, 0.64, 1),
              opacity 0.2s ease;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transform: none;
  will-change: left, width, opacity;
}
[data-theme="dark"] .nav-pill {
  background: rgba(var(--red-rgb),0.22);
}

/* Nav buttons — high contrast in light & dark */
.nav-btn {
  flex: 1;
  height: var(--nav-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  color: var(--nav-icon);
  transition: color 0.2s ease;
  position: relative;
  z-index: 1;
  -webkit-tap-highlight-color: transparent;
}

.nav-btn svg {
  width: 22px; height: 22px;
  stroke: currentColor;
  stroke-width: 2.15;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
  filter: drop-shadow(0 1px 1px rgba(255,255,255,0.35));
}

.nav-btn span {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

[data-theme="dark"] .nav-btn svg {
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.65));
}
[data-theme="dark"] .nav-btn span {
  text-shadow: 0 1px 2px rgba(0,0,0,0.55);
}

.nav-profile-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.nav-profile-avatar .avatar,
.nav-profile-avatar .avatar-text {
  width: 26px !important; height: 26px !important;
  font-size: 10px !important;
  border-radius: 50% !important;
}
.nav-btn.active .nav-profile-avatar {
  transform: scale(1.12);
  outline: 2px solid var(--red);
  outline-offset: 1px;
}
.nav-btn:active .nav-profile-avatar {
  transform: scale(0.85);
  transition: transform 0.1s ease;
}
.nav-btn.nav-bounce .nav-profile-avatar {
  animation: navIconBounce 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.nav-btn.active { color: var(--red); }

.nav-btn.active svg {
  transform: scale(1.12);
  filter: drop-shadow(0 1px 3px rgba(var(--red-rgb), 0.35));
}
[data-theme="dark"] .nav-btn.active {
  color: var(--red-light);
}
[data-theme="dark"] .nav-btn.active svg {
  filter: drop-shadow(0 1px 4px rgba(var(--red-rgb), 0.55));
}
[data-theme="dark"] .nav-btn.active span {
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* Press */
.nav-btn:active svg {
  transform: scale(0.5) !important;
  transition: transform 0.1s ease;
}

/* Bounce */
.nav-btn.nav-bounce svg {
  animation: navIconBounce 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes navIconBounce {
  0%   { transform: scale(1) translateY(0); }
  35%  { transform: scale(1.35) translateY(-3px); }
  65%  { transform: scale(0.9) translateY(0); }
  100% { transform: scale(1.12); }
}

.nav-badge {
  position: absolute; top: 7px; right: calc(50% - 18px);
  background: var(--red); color: #fff;
  font-size: 9px; font-weight: 700;
  min-width: 15px; height: 15px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
  z-index: 2;
}

/* ══════════════════════════════════════════════════════
   FEED SCREEN  (TikTok style)
   ══════════════════════════════════════════════════════ */
.feed-container {
  /* full-screen лента: высота = весь #screen-content (JS ставит --feed-h) */
  height: var(--feed-h, calc(var(--real-vh) * 100));
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
}
.feed-container::-webkit-scrollbar { display: none; }

.feed-card {
  /* Та же высота что и контейнер — так snap работает корректно на всех картах */
  height: var(--feed-h, calc(var(--real-vh) * 100));
  scroll-snap-align: start;
  scroll-snap-stop: always;
  position: relative;
  overflow: hidden;
  background: #000;
  display: flex; flex-direction: column;
}
.feed-card-bg {
  position: absolute; inset: 0;
  z-index: 0;
}
.feed-card-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,0.25) 0%,
    transparent 18%,
    transparent 55%,
    rgba(0,0,0,0.55) 100%
  );
  z-index: 1;
}
.feed-card-content {
  position: absolute;
  bottom: 4px; left: 0; right: 72px;
  padding: 16px;
  z-index: 2;
  color: #fff;
}
.feed-card[data-has-video="true"] .feed-card-content {
  /* над nav + над скруббером (полоска между ником и меню) */
  bottom: calc(14px + var(--nav-h) + env(safe-area-inset-bottom, 0px) + 28px);
}
.feed-card-user {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.feed-card-username { font-size: 15px; font-weight: 700; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,0.4); }
.feed-card-username.contrast-on-light,
.feed-card-user.contrast-on-light .feed-card-username {
  color: #111;
  text-shadow: 0 1px 2px rgba(255,255,255,0.85), 0 0 8px rgba(255,255,255,0.55);
}
.feed-card-username.contrast-on-dark,
.feed-card-user.contrast-on-dark .feed-card-username {
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.65), 0 0 10px rgba(0,0,0,0.35);
}
.feed-card-user .feed-follow-btn {
  display: inline-block;
  margin-top: 5px;
  min-width: 0;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1.5px solid rgba(255,255,255,0.72);
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  color: #fff;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.2px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.45);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s, background 0.12s;
  white-space: nowrap;
}
.feed-card-user .feed-follow-btn.is-following {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.45);
}
.feed-card-user .feed-follow-btn:active { transform: scale(0.92); background: rgba(255,255,255,0.30); }
.feed-card-text {
  font-size: 14px; line-height: 1.5; text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  white-space: pre-wrap; word-break: break-word;
}

/* ── Музыкальная полоска (ник трека внизу слева) ── */
.feed-music-strip {
  display: flex; align-items: center; gap: 5px;
  margin-top: 6px;
  font-size: 12px; color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  max-width: 100%; overflow: hidden;
}
.feed-music-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: musicScroll 10s linear infinite;
}
@keyframes musicScroll {
  0%,15%   { transform: translateX(0); }
  85%,100% { transform: translateX(-60%); }
}

/* ── Крутящийся диск ── */
@keyframes discSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.music-disc-wrap {
  display: flex; flex-direction: column; align-items: center;
  margin-top: 8px;
}
.music-disc {
  width: 44px; height: 44px; border-radius: 50%;
  background: #1a1a1a;
  border: 3px solid rgba(255,255,255,0.25);
  position: relative; overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.5);
}
.music-disc.spinning {
  animation: discSpin 3s linear infinite;
}
.music-disc-img {
  width: 100%; height: 100%;
  object-fit: cover; border-radius: 50%;
  display: block;
}
.music-disc-hole {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  width: 12px; height: 12px;
  background: #111; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  z-index: 1;
}

/* ── Музыкальный поиск (sheet) ── */
.music-source-tabs {
  display: flex; gap: 8px;
  padding: 0 16px 10px;
}
.music-source-tab {
  flex: 1; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--card); color: var(--text3);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.music-source-tab.active {
  color: var(--text); border-color: var(--red);
  background: color-mix(in srgb, var(--red) 12%, var(--card));
}
.music-source-tab.is-disabled { opacity: 0.45; }
.music-search-bar {
  padding: 0 16px 12px;
  display: flex; gap: 8px; align-items: center;
}
.music-search-input {
  flex: 1; min-width: 0; padding: 10px 14px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; color: var(--text); font-size: 14px;
  outline: none;
}
.music-search-input:focus { border-color: var(--red); }
.music-resolve-btn {
  flex-shrink: 0; padding: 10px 12px;
  border: none; border-radius: 12px;
  background: var(--red); color: #fff;
  font-size: 12px; font-weight: 700; cursor: pointer;
}
.music-resolve-btn.hidden { display: none; }
.music-search-results {
  max-height: 55vh; overflow-y: auto;
  padding: 0 8px 16px;
}
.music-search-hint {
  text-align: center; color: var(--text3);
  padding: 24px 0; font-size: 14px;
}
.music-track-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 8px; border-radius: 10px; cursor: pointer;
  transition: background var(--transition);
}
.music-track-item:hover { background: var(--border); }
.music-track-img {
  width: 46px; height: 46px; border-radius: 8px;
  object-fit: cover; flex-shrink: 0;
}
.music-track-info { flex: 1; min-width: 0; }
.music-track-title { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.music-track-artist { font-size: 12px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.music-track-preview {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--red); color: #fff; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; cursor: pointer;
}

/* ── Авто-музыка к текстовому посту ── */
.post-music-panel {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.post-music-panel.is-no-music {
  border-color: rgba(var(--red-rgb), 0.28);
  background: color-mix(in srgb, var(--surface) 88%, rgba(var(--red-rgb), 0.12));
}
.post-no-music-row {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 0; font-size: 13px; color: var(--text2); cursor: pointer;
  user-select: none;
}
.post-no-music-row.hidden { display: none; }
.post-no-music-row input {
  width: 18px; height: 18px; margin-top: 2px;
  accent-color: var(--red, #A88BFF); cursor: pointer; flex-shrink: 0;
}
.post-no-music-text {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.post-no-music-text strong {
  font-size: 14px; font-weight: 700; color: var(--text);
}
.post-no-music-text small {
  font-size: 12px; line-height: 1.35; color: var(--text3);
}
.post-no-music-banner {
  display: flex; align-items: flex-start; gap: 12px;
  margin-top: 12px; padding: 12px;
  border-radius: 14px;
  background: rgba(var(--red-rgb), 0.1);
  border: 1px dashed rgba(var(--red-rgb), 0.35);
}
.post-no-music-banner.hidden { display: none; }
.post-no-music-banner-ico {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  display: grid; place-items: center;
  background: rgba(var(--red-rgb), 0.16); color: var(--red);
}
.post-no-music-banner-title {
  font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 2px;
}
.post-no-music-banner-desc {
  font-size: 12px; line-height: 1.4; color: var(--text3);
}
.create-meta-btn.is-disabled {
  opacity: 0.45; pointer-events: none;
}
.post-music-auto-hint {
  margin-top: 10px; font-size: 12px; line-height: 1.35; color: var(--text3);
}
.post-music-auto-hint.hidden { display: none; }
.post-music-auto-badge {
  display: inline-block; margin-left: 6px; padding: 1px 6px;
  font-size: 10px; font-weight: 700; letter-spacing: .02em;
  color: var(--text2); background: rgba(128,128,128,.18); border-radius: 6px;
  vertical-align: middle;
}
.post-music-reshuffle {
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: 4px; width: 22px; height: 22px; border: none;
  border-radius: 50%; background: rgba(128,128,128,.2); color: var(--text2);
  font-size: 14px; cursor: pointer; vertical-align: middle;
}
.post-music-reshuffle:active { opacity: .7; }

/* ── Превью выбранного трека в форме поста ── */
.post-music-preview {
  display: flex; flex-direction: column; gap: 10px;
  padding: 10px 12px; margin-top: 8px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px;
}
.post-music-preview.hidden { display: none; }
.post-music-preview-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
}
.post-music-preview-img {
  width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex-shrink: 0;
}
.post-music-preview-info { flex: 1; min-width: 0; }
.post-music-preview-title { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-music-preview-artist { font-size: 12px; color: var(--text3); }
.post-music-remove {
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(128,128,128,.3); color: var(--text2);
  font-size: 14px; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.music-trim {
  display: flex; flex-direction: column; gap: 8px;
  padding-top: 4px; border-top: 1px solid var(--border);
}
.music-wave-trim {
  display: flex; flex-direction: column; gap: 8px;
  padding-top: 8px; border-top: 1px solid var(--border);
}
.music-wave-playhead {
  align-self: flex-start;
  font-size: 11px; font-weight: 700; color: #2f6bff;
  background: rgba(47,107,255,.12);
  border-radius: 999px; padding: 3px 8px;
  font-variant-numeric: tabular-nums;
}
.music-wave-track {
  position: relative;
  height: 64px; border-radius: 14px;
  background: #eef5ff;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}
.music-wave-bars {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1px; padding: 0 8px;
  opacity: .85;
}
.music-wave-bars i {
  flex: 1; min-width: 2px; max-width: 4px;
  background: #8eb6ff; border-radius: 2px;
  display: block;
}
.music-wave-sel {
  position: absolute; top: 0; bottom: 0;
  background: rgba(100,160,255,.35);
  border-left: 2px solid #111; border-right: 2px solid #111;
  pointer-events: none;
}
.music-wave-handle {
  position: absolute; top: 0; bottom: 0; width: 18px;
  transform: translateX(-50%);
  cursor: ew-resize; z-index: 2;
}
.music-wave-handle::before {
  content: '';
  position: absolute; left: 50%; top: 0; bottom: 0;
  width: 2px; background: #111; transform: translateX(-50%);
}
.music-wave-times {
  display: flex; justify-content: space-between; gap: 8px;
}
.music-wave-chip {
  font-size: 11px; font-weight: 700; color: #fff;
  background: #222; border-radius: 999px; padding: 4px 9px;
  font-variant-numeric: tabular-nums;
}
.music-wave-controls {
  display: flex; align-items: center; gap: 10px;
}
.music-wave-btn {
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--card);
  color: var(--text); display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.music-wave-btn:active { transform: scale(0.94); }
.books-popular-label {
  font-size: 12px; font-weight: 800; color: var(--text2);
  text-transform: uppercase; letter-spacing: .4px;
  margin: 4px 0 8px;
}

.feed-card-actions {
  position: absolute;
  right: -1px; bottom: 1px;
  z-index: 11;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
/* Над нижней навигацией + выше скруббера */
.feed-card[data-has-video="true"] .feed-card-actions {
  bottom: calc(14px + var(--nav-h) + env(safe-area-inset-bottom, 0px) + 28px);
}
.feed-action-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: #fff;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
  /* Зона касания минимум 44×44px (iOS HIG) */
  padding: 7px 12px;
  background: none; border: none; cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.feed-action-btn svg { width: 32px; height: 32px; stroke: #fff; }
.feed-action-btn span { font-size: 12px; font-weight: 600; text-shadow: 0 1px 3px rgba(0,0,0,0.5); }
.feed-action-btn.liked svg { fill: var(--red); stroke: var(--red); }
.feed-action-btn.bookmarked svg { fill: #fff; stroke: #fff; }

/* Кнопка-аватар (профиль автора) */
.feed-action-profile { border: none; background: none; }
.feed-action-profile .avatar,
.feed-action-profile .avatar-text,
.feed-action-profile .av-frame {
  width: 44px !important; height: 44px !important;
  border: 2.5px solid rgba(255,255,255,0.85);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}

/* ── Share Sheet ──────────────────────────────────────────────────────────── */
.share-sheet {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: flex-end;
}
.share-sheet-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.45);
  opacity: 0;
  transition: opacity 0.28s ease;
}
.share-sheet.open .share-sheet-backdrop { opacity: 1; }

.share-sheet-panel {
  position: relative;
  width: 100%; max-width: 480px; margin: 0 auto;
  background: var(--card);
  border-radius: 22px 22px 0 0;
  padding: 12px 0 calc(20px + env(safe-area-inset-bottom,0px));
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32,0.72,0,1);
  box-shadow: 0 -4px 32px rgba(0,0,0,0.18);
}
.share-sheet.open .share-sheet-panel { transform: translateY(0); }

.share-sheet-handle {
  width: 36px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 14px;
}
.share-sheet-title {
  font-size: 16px; font-weight: 700;
  color: var(--text);
  padding: 0 18px 12px;
  border-bottom: 1px solid var(--border);
}
.share-sheet-friends {
  display: flex;
  gap: 6px;
  padding: 14px 14px 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.share-sheet-friends::-webkit-scrollbar { display: none; }

.ss-friend {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  min-width: 64px;
  padding: 8px 6px;
  border-radius: 14px;
  background: none; border: none; cursor: pointer;
  transition: background 0.15s;
}
.ss-friend:active { background: var(--border); }
.ss-friend span {
  font-size: 11px; color: var(--text-secondary);
  white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 64px;
}
.ss-friend--sent span { color: var(--red); font-weight: 600; }
.ss-friend--sent .avatar,
.ss-friend--sent .avatar-text { opacity: 0.5; }

.share-sheet-empty {
  font-size: 13px; color: var(--text-secondary);
  padding: 20px; display: block; text-align: center;
}
.share-sheet-actions {
  padding: 10px 14px 0;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}
.share-sheet-repost {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 12px 8px;
  font-size: 15px; font-weight: 500; color: var(--text);
  background: none; border: none; cursor: pointer;
  border-radius: 10px;
  transition: background 0.15s;
}
.share-sheet-repost:active { background: var(--border); }

/* Feed top controls */
.feed-top-btn {
  position: absolute; top: 12px; right: 12px; z-index: 10;
  background: var(--red);
  color: #fff;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px; font-weight: 700;
  box-shadow: 0 2px 8px rgba(var(--red-rgb),0.4);
  display: flex; align-items: center; gap: 6px;
}
.feed-top-btn svg { width: 16px; height: 16px; stroke: #fff; }

/* Иконка паузы/воспроизведения при тапе на видео */
.feed-tap-icon {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.6);
  font-size: 52px;
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
}
.feed-tap-icon--show {
  animation: tapIconPop 0.55s ease forwards;
}
@keyframes tapIconPop {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(0.7); }
  40%  { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.3); }
}

/* ── Liquid Glass пилл: кнопка звука + слайдер ───────────────────────────── */
.feed-vol-wrap {
  position: absolute;
  top: calc(var(--bar-h) + 14px); left: 14px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 4px;
  height: 40px;
  border-radius: 999px;

  /* Liquid Glass */
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.42);
  box-shadow:
    0 4px 20px rgba(0,0,0,0.28),
    0 1px 4px rgba(0,0,0,0.14),
    inset 0 1px 0 rgba(255,255,255,0.65),
    inset 0 -1px 0 rgba(0,0,0,0.08);

  overflow: hidden;
  transition: padding 0.22s ease;
}

/* Стеклянный блик сверху */
.feed-vol-wrap::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    160deg,
    rgba(255,255,255,0.38) 0%,
    rgba(255,255,255,0.00) 55%
  );
  pointer-events: none;
}

/* Кнопка звука — прозрачная внутри пилла */
.feed-sound-btn {
  position: relative;
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  border: none; cursor: pointer;
  transition: transform 0.15s, background 0.15s;
  z-index: 1;
}
.feed-sound-btn:active { transform: scale(0.85); background: rgba(255,255,255,0.12); }
.feed-sound-btn svg { width: 17px; height: 17px; stroke: #fff; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4)); }

/* Слайдер громкости */
.feed-vol-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 28px;
  border-radius: 999px;
  background: transparent;
  outline: none;
  cursor: pointer;
  margin-right: 6px;
  touch-action: none;
  transition: opacity 0.22s ease, width 0.22s ease;
  position: relative; z-index: 1;
}
.feed-vol-slider.hidden {
  display: block !important; /* переопределяем глобальный .hidden для анимации */
  width: 0;
  opacity: 0;
  pointer-events: none;
  margin-right: 0;
}
.feed-vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: #fff;
  box-shadow:
    0 1px 4px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.9);
  cursor: pointer;
}
.feed-vol-slider::-moz-range-thumb {
  width: 13px; height: 13px;
  border-radius: 50%;
  background: #fff;
  border: none;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
  cursor: pointer;
}
.feed-vol-slider::-webkit-slider-runnable-track {
  height: 3px;
  background: linear-gradient(
    to right,
    rgba(255,255,255,0.92) var(--vol, 20%),
    rgba(255,255,255,0.22) var(--vol, 20%)
  );
  border-radius: 999px;
}

/* ── Скруббер перемотки видео ─────────────────────────────────────────────── */
/* Над floating nav, под ником/actions — не у самого низа и не у самого верха */
.video-scrubber {
  position: absolute;
  left: 0; right: 0;
  top: auto;
  bottom: calc(12px + var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding: 20px 14px 8px;
  background: linear-gradient(to top, rgba(0,0,0,0.4) 0%, transparent 100%);
  z-index: 12;
  touch-action: none;
  user-select: none;
  pointer-events: auto;
}

/* Ползунок музыки на фото/тексте */
.audio-scrubber {
  top: auto;
  bottom: calc(12px + var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding: 20px 14px 10px;
  z-index: 20;
  background: linear-gradient(to top, rgba(0,0,0,0.3) 0%, transparent 100%);
  pointer-events: auto;
  touch-action: none;
}
.audio-scrubber .video-scrubber-track {
  height: 4px;
}
.audio-scrubber.scrubbing .video-scrubber-track {
  height: 6px;
}
.audio-scrubber .video-scrubber-thumb {
  transform: translate(-50%, -50%) scale(0.85);
}
.audio-scrubber.scrubbing .video-scrubber-thumb {
  transform: translate(-50%, -50%) scale(1);
}
.audio-scrubber-bubble {
  position: absolute;
  left: 50%;
  bottom: calc(100% - 14px);
  top: auto;
  transform: translate(-50%, 8px) scale(0.92);
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  z-index: 13;
}
.audio-scrubber.scrubbing .audio-scrubber-bubble {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0) scale(1);
}
.feed-card--text[data-has-audio-scrub="true"] .feed-text-stack {
  margin-bottom: 36px;
}

.video-scrubber-track {
  position: relative;
  height: 3px;
  background: rgba(255,255,255,0.28);
  border-radius: 10px;
  cursor: pointer;
  transition: height 0.15s;
}
.video-scrubber:hover .video-scrubber-track,
.video-scrubber.scrubbing .video-scrubber-track {
  height: 5px;
}
.video-scrubber-fill {
  position: absolute;
  top: 0; left: 0; height: 100%;
  width: 0%;
  background: #fff;
  border-radius: 10px;
  pointer-events: none;
  transition: width 0.08s linear;
}
.video-scrubber.scrubbing .video-scrubber-fill { transition: none; }
.video-scrubber-thumb {
  position: absolute;
  top: 50%; left: 0%;
  transform: translate(-50%, -50%) scale(0);
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  pointer-events: none;
  transition: transform 0.15s, left 0.08s linear;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.video-scrubber.scrubbing .video-scrubber-thumb { transition: none; }
.video-scrubber:hover .video-scrubber-thumb,
.video-scrubber.scrubbing .video-scrubber-thumb {
  transform: translate(-50%, -50%) scale(1);
}

/* Card gradient backgrounds */
.grad-1 { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.grad-2 { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.grad-3 { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.grad-4 { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }
.grad-5 { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); }
.grad-6 { background: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%); }
.grad-7 { background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%); }
.grad-8 { background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%); }
.grad-9 { background: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%); }
.grad-10{ background: linear-gradient(135deg, #fd7043 0%, #e53935 100%); }

/* ══════════════════════════════════════════════════════
   SEARCH SCREEN
   ══════════════════════════════════════════════════════ */
.search-container { padding: 12px 16px; }
.search-bar {
  display: flex; align-items: center;
  background: var(--surface);
  border-radius: 50px;
  padding: 0 16px;
  border: 1.5px solid var(--border);
  transition: border-color var(--transition);
  margin-bottom: 16px;
}
.search-bar:focus-within { border-color: var(--red); }

/* Search tabs — TikTok style */
.search-tabs {
  display: flex;
  border-bottom: 1.5px solid var(--border);
  margin-bottom: 14px;
}
.search-tab {
  flex: 1; padding: 8px 0;
  font-size: 15px; font-weight: 700;
  color: var(--text3);
  background: none; border: none;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -1.5px;
  transition: color 0.2s, border-color 0.2s;
}
.search-tab.active {
  color: var(--text);
  border-bottom-color: var(--red);
}

/* Search posts grid */
.search-posts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.search-post-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 9/14;
  background: var(--bg2);
  cursor: pointer;
}
.search-post-media {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.search-post-video-badge {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0,0,0,0.55);
  color: #fff; font-size: 11px;
  border-radius: 6px; padding: 2px 6px;
}
.search-post-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.72));
  padding: 18px 8px 8px;
  color: #fff;
}
.search-post-user {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 700;
  margin-bottom: 3px;
}
.search-post-text {
  font-size: 11px; opacity: 0.9;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 3px;
}
.search-post-likes { font-size: 11px; opacity: 0.85; }
.search-bar svg { width: 18px; height: 18px; color: var(--text3); flex-shrink: 0; }
.search-bar input {
  flex: 1; padding: 12px 10px;
  background: none; color: var(--text); font-size: 15px;
}
.search-bar input::placeholder { color: var(--text3); }

.users-grid { display: flex; flex-direction: column; gap: 10px; }
.user-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.user-card-info { flex: 1; min-width: 0; }
.user-card-name { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.user-card-bio { font-size: 13px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card-stats { font-size: 11px; color: var(--text3); margin-top: 3px; }

.search-placeholder {
  text-align: center; color: var(--text3);
  padding: 48px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.search-placeholder svg { width: 48px; height: 48px; opacity: 0.3; }
.search-placeholder p { font-size: 15px; }

/* ══════════════════════════════════════════════════════
   STREAMS SCREEN
   ══════════════════════════════════════════════════════ */
.streams-container { padding: 12px 16px; }
.streams-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.streams-header h2 { font-size: 18px; font-weight: 800; }
.streams-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.stream-card {
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 9/14;
  position: relative;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.stream-card-bg {
  position: absolute; inset: 0;
}
.stream-card-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.1), rgba(0,0,0,0.65));
}
.stream-card-live {
  position: absolute; top: 8px; left: 8px;
  background: var(--red);
  color: #fff;
  font-size: 10px; font-weight: 800;
  padding: 3px 7px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  display: flex; align-items: center; gap: 4px;
}
.live-dot {
  width: 6px; height: 6px;
  background: #fff;
  border-radius: 50%;
  animation: pulse 1.2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}
.stream-card-info {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 8px;
  color: #fff;
}
.stream-card-title { font-size: 12px; font-weight: 700; line-height: 1.3; margin-bottom: 4px; }
.stream-card-user { font-size: 11px; opacity: 0.85; margin-bottom: 3px; }
.stream-card-viewers { font-size: 11px; opacity: 0.75; display: flex; align-items: center; gap: 3px; }
.stream-card-viewers svg { width: 11px; height: 11px; }

/* Stream Viewer */
.stream-viewer {
  height: 100%;
  display: flex; flex-direction: column;
  background: #000;
}
.stream-viewer-bg {
  flex: 1;
  position: relative;
  min-height: 0;
  background: #000;
}
.stream-viewer-bg .stream-bg-gradient {
  position: absolute; inset: 0;
}
.stream-video-bg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: 0;
  background: #000;
}
.stream-viewer-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  background: linear-gradient(to bottom, rgba(0,0,0,0.3) 0%, transparent 30%, rgba(0,0,0,0.5) 70%, rgba(0,0,0,0.9) 100%);
}
.stream-top-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  color: #fff;
}
.stream-back-btn {
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px);
  color: #fff;
}
.stream-back-btn svg { width: 20px; height: 20px; }
.stream-info { flex: 1; margin: 0 12px; }
.stream-info-title { font-size: 14px; font-weight: 700; }
.stream-info-user { font-size: 12px; opacity: 0.8; margin-top: 2px; }
.stream-viewers-badge {
  background: rgba(0,0,0,0.4);
  border-radius: 20px;
  padding: 6px 10px;
  font-size: 12px; font-weight: 600; color: #fff;
  display: flex; align-items: center; gap: 4px;
  backdrop-filter: blur(8px);
}
.stream-viewers-badge svg { width: 14px; height: 14px; }

.stream-live-chat {
  flex: 1;
  display: flex; flex-direction: column;
  justify-content: flex-end;
  padding: 8px 12px;
  overflow: hidden;
}
.stream-messages {
  display: flex; flex-direction: column; gap: 6px;
  overflow-y: auto;
  max-height: 160px;
  scrollbar-width: none;
}
.stream-messages::-webkit-scrollbar { display: none; }
.stream-msg {
  background: rgba(0,0,0,0.45);
  border-radius: 12px;
  padding: 6px 10px;
  color: #fff;
  font-size: 13px;
  backdrop-filter: blur(4px);
  width: fit-content;
  max-width: 80%;
}
.stream-msg strong { color: var(--red-light); }
.stream-gift-msg {
  background: linear-gradient(135deg, rgba(var(--red-rgb), 0.6), color-mix(in srgb, var(--red-light) 40%, transparent));
  animation: giftAnim 0.5s ease;
  font-size: 14px;
}
@keyframes giftAnim {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.stream-bottom {
  background: var(--card);
  padding: 12px 16px 10px;
  border-radius: 20px 20px 0 0;
}
.stream-chat-input {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface);
  border-radius: 50px;
  padding: 0 8px 0 16px;
  border: 1.5px solid var(--border);
  margin-bottom: 14px;
}
.stream-chat-input input {
  flex: 1; padding: 10px 0;
  background: none; color: var(--text); font-size: 14px;
}
.stream-chat-input input::placeholder { color: var(--text3); }
.stream-send-btn {
  width: 34px; height: 34px;
  background: var(--red);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stream-send-btn svg { width: 16px; height: 16px; stroke: #fff; }

.gifts-row {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px;
  scrollbar-width: none;
}
.gifts-row::-webkit-scrollbar { display: none; }
.gift-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: var(--surface);
  border-radius: 10px;
  padding: 8px 12px;
  flex-shrink: 0;
  border: 1.5px solid var(--border);
  transition: border-color var(--transition), background var(--transition);
}
.gift-btn:active { background: var(--red-bg); border-color: var(--red); }
.gift-emoji { font-size: 24px; }
.gift-name { font-size: 10px; color: var(--text2); font-weight: 600; }
.gift-cost { font-size: 11px; color: var(--red); font-weight: 700; }

/* ══════════════════════════════════════════════════════
   CHAT SCREEN
   ══════════════════════════════════════════════════════ */
.chat-container { padding: 12px 16px; }
.chat-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 12px;
}
.chat-header h2 { font-size: 20px; font-weight: 800; }

/* Истории сверху чатов (как в Telegram) */
.stories-rail {
  margin: 0 -4px 10px;
  padding: 2px 0 4px;
}
.stories-rail-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 4px 6px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.stories-rail-scroll::-webkit-scrollbar { display: none; }
.story-rail-item {
  position: relative;
  flex: 0 0 auto;
  width: 72px;
  border: none;
  background: transparent;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text);
}
.story-rail-hit {
  border: none !important;
  outline: none;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 50%;
  -webkit-tap-highlight-color: transparent;
}
.story-rail-hit.tl-liquid-btn,
.story-rail-hit.tl-liquid-btn::before,
.story-rail-add.tl-liquid-btn,
.story-rail-add.tl-liquid-btn::before {
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.story-rail-hit.tl-liquid-btn::before,
.story-rail-add.tl-liquid-btn::before {
  display: none !important;
  content: none !important;
}
.story-rail-avatar {
  position: relative;
  width: 60px; height: 60px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  padding: 3px;
  box-sizing: border-box;
  overflow: hidden;
}
.story-rail-item.ring-unseen .story-rail-avatar {
  background: conic-gradient(from 180deg, #34C759, #2AABEE, #7C4DFF, #FF2D55, #34C759);
}
.story-rail-item.ring-seen .story-rail-avatar {
  background: var(--border);
}
.story-rail-item.ring-empty .story-rail-avatar {
  background: transparent;
  box-shadow: none;
  padding: 0;
  width: 56px;
  height: 56px;
}
.story-rail-avatar .avatar,
.story-rail-avatar .avatar-text,
.story-rail-avatar .av-frame {
  width: 52px !important;
  height: 52px !important;
  border-radius: 50%;
}
.story-rail-item.ring-empty .story-rail-avatar .avatar,
.story-rail-item.ring-empty .story-rail-avatar .avatar-text,
.story-rail-item.ring-empty .story-rail-avatar .av-frame {
  width: 56px !important;
  height: 56px !important;
}
.story-rail-avatar .avatar-text {
  display: flex !important;
  align-items: center;
  justify-content: center;
  line-height: 1;
  letter-spacing: 0;
  text-align: center;
  padding: 0;
  box-sizing: border-box;
}
.story-rail-avatar .av-frame {
  display: flex !important;
  align-items: center;
  justify-content: center;
}
.story-rail-add {
  position: absolute;
  right: 4px; bottom: 18px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--primary, #2AABEE);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 2px solid var(--bg, #0d1117);
  box-sizing: border-box;
  z-index: 3;
  cursor: pointer;
}
.story-rail-item.has-story.is-me .story-rail-add {
  /* + не перекрывает центр аватара — тап по кругу открывает просмотр */
  right: 2px;
  bottom: 16px;
}
.story-rail-name {
  font-size: 11px;
  line-height: 1.2;
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text2);
  text-align: center;
}
.story-rail-item.is-me .story-rail-name { color: var(--text); font-weight: 600; }

/* Полноэкранный просмотр истории */
.story-viewer {
  position: fixed;
  inset: 0;
  z-index: 12000;
  background: #000;
  display: flex;
  align-items: stretch;
  justify-content: center;
}
.story-viewer-bg {
  position: absolute; inset: 0;
  background: #0a0a0a;
}
.story-viewer-ui {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  height: 100%;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
}
.story-progress {
  display: flex; gap: 3px;
  padding: max(8px, env(safe-area-inset-top)) 10px 0;
  flex-shrink: 0;
}
.story-progress-seg {
  flex: 1;
  height: 2.5px;
  border-radius: 2px;
  background: rgba(255,255,255,.28);
  overflow: hidden;
}
.story-progress-seg.done { background: #fff; }
.story-progress-fill {
  height: 100%;
  width: 0;
  background: #fff;
  border-radius: 2px;
}
.story-progress-seg.active .story-progress-fill {
  width: 100%;
}
@keyframes storyProgress {
  from { width: 0; }
  to { width: 100%; }
}
.story-viewer-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  flex-shrink: 0;
  color: #fff;
}
.story-viewer-user {
  display: flex; align-items: center; gap: 10px;
  min-width: 0; cursor: pointer;
}
.story-viewer-meta { min-width: 0; }
.story-viewer-name {
  font-size: 14px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.story-viewer-time {
  font-size: 11px; opacity: .75; margin-top: 1px;
}
.story-viewer-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.story-viewer-btn {
  width: 36px; height: 36px;
  border: none; border-radius: 50%;
  background: rgba(255,255,255,.12);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 18px;
}
.story-viewer-btn:active { background: rgba(255,255,255,.22); }
.story-viewer-media {
  flex: 1;
  min-height: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 4px 0;
  position: relative;
}
.story-viewer-media img,
.story-viewer-media video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
}
.story-viewer-caption {
  flex-shrink: 0;
  padding: 10px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  color: #fff;
  font-size: 15px;
  line-height: 1.35;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
}
.story-viewer-caption.hidden { display: none; }
.story-tap {
  position: absolute;
  top: 70px; bottom: 80px;
  width: 30%;
  border: none;
  background: transparent;
  z-index: 3;
  padding: 0;
  cursor: pointer;
}
.story-tap-left { left: 0; }
.story-tap-right { right: 0; width: 70%; }

.chat-header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.chat-folders-edit-btn {
  position: relative;
  width: 36px; height: 36px; border: none; border-radius: 10px;
  background: var(--surface); color: var(--text2);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.chat-folders-edit-btn:active { background: var(--border); }
.chat-folders-edit-btn svg { width: 20px; height: 20px; }

/* ── Timeless SVG icons (palette follows chat theme) ── */
/* Перебиваем глобальный img { width:100% } — иначе иконки раздувают меню */
.tl-ico {
  display: block;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  max-width: none;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  filter: var(--tl-ico-filter);
}
/* Цветные картинки (emoji/стикеры) — не перекрашивать */
.folder-emoji-img,
.profile-sticker-img,
.sticker-pick-img,
.sticker-pick-btn .tl-ico {
  filter: none !important;
}
/* Белые иконки на тёмном хроме даже в светлой теме */
.lg-glass-btn .tl-ico,
.lg-settings-btn .tl-ico,
.lg-qr-btn .tl-ico,
.lg-edit-btn .tl-ico,
.lg-stat .tl-ico,
.lg-cam-btn .tl-ico,
.msg-menu-item .tl-ico,
.conv-ctx-item .tl-ico,
.media-ctx-item .tl-ico,
.media-viewer-btn .tl-ico,
.media-viewer-close .tl-ico,
.media-viewer-more-item .tl-ico,
.pe-root .tl-ico,
.pe-root .pe-ico {
  filter: none;
}
.lg-tab.uprofile-tab.active .tl-ico {
  filter: brightness(0) invert(1);
}
.chat-folder-tab-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.chat-folder-tab-label .tl-ico { width: 15px; height: 15px; }
.folder-emoji-char { font-size: 1em; line-height: 1; }
.folder-emoji-pick .tl-ico { width: 22px; height: 22px; }
.setting-icon .tl-ico { width: 20px; height: 20px; }
.setting-icon .tl-ico.settings-lock-ico { width: 26px; height: 26px; }
.setting-icon.tl-si {
  background: color-mix(in srgb, var(--red) 14%, var(--surface));
  color: var(--red);
}
.setting-icon.tl-si-muted {
  background: color-mix(in srgb, var(--text2) 12%, var(--surface));
}
.setting-icon.tl-si-warm {
  background: color-mix(in srgb, var(--ico-warm) 22%, var(--surface));
}
.setting-icon.tl-si-cool {
  background: color-mix(in srgb, var(--ico-cool) 18%, var(--surface));
}
.setting-icon.tl-si-danger {
  background: var(--red-bg);
}
.coins-icon { display: inline-flex; align-items: center; justify-content: center; }
.coins-icon .tl-ico { width: 28px; height: 28px; }
.conv-pin-ico { display: inline-flex; align-items: center; }
.conv-pin-ico .tl-ico { width: 12px; height: 12px; }
.sticker-pick-btn .tl-ico,
.sticker-pick-btn .sticker-pick-img { width: 28px; height: 28px; object-fit: contain; }
.profile-sticker.profile-sticker-img {
  display: inline-block;
  width: 1em;
  height: 1em;
  object-fit: contain;
  vertical-align: -0.12em;
}
.folder-row-btn .tl-ico { width: 18px; height: 18px; }
.streak-badge .tl-ico { width: 1em; height: 1em; display: inline-block; vertical-align: -0.12em; margin-right: 2px; }
.nav-btn .tl-ico,
.icon-btn .tl-ico { width: 22px; height: 22px; }
.nav-create-icon .tl-ico { width: 22px; height: 22px; filter: brightness(0) invert(1); }
.input-icon .tl-ico { width: 18px; height: 18px; opacity: 0.7; }
.eye-btn .tl-ico { width: 18px; height: 18px; }
.chat-notif-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 0 0 2px var(--bg, #0b0b0d);
}
.chat-notif-badge.hidden { display: none; }

/* Папки чатов (как в Telegram) */
.chat-folder-tabs {
  display: flex; align-items: center; gap: 6px;
  overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin: 0 -4px 12px;
  padding: 2px 4px 8px;
}
.chat-folder-tabs::-webkit-scrollbar { display: none; }
.chat-folder-tab {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  border: none; border-radius: 999px;
  background: transparent;
  color: var(--text2);
  font-size: 14px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  font-family: inherit;
}
.chat-folder-tab:hover { background: var(--surface); }
.chat-folder-tab.active {
  background: color-mix(in srgb, var(--red) 18%, var(--surface));
  color: var(--red);
}
[data-theme="dark"] .chat-folder-tab.active {
  background: rgba(42, 171, 238, 0.18);
  color: #6ec9f0;
}
.chat-folder-tab-badge {
  min-width: 18px; height: 18px; padding: 0 6px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--red) 85%, #000);
  color: #fff;
  font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
[data-theme="dark"] .chat-folder-tab.active .chat-folder-tab-badge {
  background: #2AABEE;
}
.chat-folder-tab:not(.active) .chat-folder-tab-badge {
  background: var(--text3);
}

.folders-hint {
  color: var(--text2); font-size: 13px; line-height: 1.4;
  margin: 0 0 8px; padding: 0 4px;
}
.folders-list { display: flex; flex-direction: column; gap: 4px; }
.folders-empty {
  text-align: center; color: var(--text3); font-size: 14px; padding: 24px 12px;
}
.folder-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 8px; border-radius: 12px;
  background: var(--surface);
}
.folder-row-emoji {
  font-size: 22px; width: 32px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.folder-row-emoji .ico-chat-folder { width: 22px; height: 22px; color: var(--text2); }
.folder-row-info { flex: 1; min-width: 0; }
.folder-row-name { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-row-meta { font-size: 12px; color: var(--text3); margin-top: 2px; }
.folder-row-btn {
  width: 36px; height: 36px; border: none; border-radius: 10px;
  background: var(--card); cursor: pointer; font-size: 15px;
}
.folder-row-btn.danger { color: var(--red); }
.folder-field-label {
  display: block; font-size: 12px; font-weight: 600; color: var(--text3);
  margin-bottom: 8px; text-transform: uppercase; letter-spacing: .04em;
}
.folder-emoji-row {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.folder-emoji-pick {
  width: 40px; height: 40px; border: none; border-radius: 10px;
  background: var(--surface); font-size: 20px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
}
.folder-emoji-pick .folder-emoji-img,
.folder-emoji-pick .tl-ico {
  width: 26px !important;
  height: 26px !important;
  object-fit: contain;
}
.folder-row-emoji .folder-emoji-img,
.folder-row-emoji .tl-ico,
.chat-folder-tab-label .folder-emoji-img {
  width: 1.15em !important;
  height: 1.15em !important;
  object-fit: contain;
  vertical-align: -0.15em;
}
.folder-emoji-pick.active {
  outline: 2px solid var(--red);
  background: color-mix(in srgb, var(--red) 12%, var(--surface));
}
.folder-name-input {
  width: 100%; height: 44px; padding: 0 14px;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 15px;
}
.folder-name-input:focus { border-color: var(--red); }
.conv-ctx-empty {
  padding: 10px 12px; font-size: 13px; color: rgba(255,255,255,.45);
}

.conv-list { display: flex; flex-direction: column; gap: 2px; }
.group-avatar {
  border-radius: 50%;
  background: color-mix(in srgb, var(--red) 16%, var(--surface));
  color: var(--red);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.group-avatar-sm { width: 38px; height: 38px; }
.conv-group-badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--red);
  background: color-mix(in srgb, var(--red) 12%, transparent);
  padding: 2px 6px; border-radius: 6px; margin-left: 6px;
  vertical-align: middle;
}
.group-member-pick {
  display: flex; flex-direction: column; gap: 4px;
  max-height: 42vh; overflow-y: auto; margin-top: 6px;
}
.group-member-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 6px; border-radius: 10px; cursor: pointer;
}
.group-member-row:hover { background: var(--surface); }
.group-member-row input { accent-color: var(--red); width: 18px; height: 18px; }
.group-member-name { flex: 1; font-size: 14px; font-weight: 600; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bubble-sender {
  font-size: 12px; font-weight: 700; color: var(--red);
  margin: 0 2px 4px; line-height: 1.2;
}
.chat-sys-msg, .chat-date-sep {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 6px 16px;
  width: 100%;
  box-sizing: border-box;
}
.chat-sys-pill {
  display: inline-block;
  max-width: 92%;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(40, 44, 52, 0.72);
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  backdrop-filter: blur(8px);
  word-break: break-word;
}
.chat-sys-name {
  font-weight: 800;
  color: #fff;
}
[data-theme="day"] .chat-sys-pill,
.theme-day .chat-sys-pill {
  background: rgba(0, 0, 0, 0.45);
}
.chat-bubble.theirs .bubble-sender { color: var(--red); }
.chat-header-icon-btn {
  width: 36px; height: 36px; border: none; border-radius: 50%;
  background: transparent; color: var(--text2);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  flex-shrink: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.chat-header-icon-btn:active { background: var(--surface); }
.chat-header-icon-btn.tl-liquid-btn,
.chat-header-icon-btn.tl-liquid-btn::before,
.chat-back-btn.tl-liquid-btn,
.chat-back-btn.tl-liquid-btn::before {
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.chat-header-icon-btn.tl-liquid-btn::before,
.chat-back-btn.tl-liquid-btn::before {
  display: none !important;
  content: none !important;
}

/* ── Group info page (Telegram-like) ── */
.ginfo-page {
  display: flex; flex-direction: column;
  min-height: 100%; background: var(--bg);
  color: var(--text);
}
.ginfo-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
}
.ginfo-icon-btn {
  width: 40px; height: 40px; border: none; border-radius: 50%;
  background: transparent; color: var(--text);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.ginfo-icon-btn:active { background: var(--surface); }
.ginfo-edit-btn {
  border: none; background: transparent; color: var(--red);
  font-size: 16px; font-weight: 600; padding: 8px 14px; cursor: pointer;
  border-radius: 999px;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.ginfo-edit-btn:active { background: color-mix(in srgb, var(--red) 12%, transparent); }
.ginfo-hero {
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 20px 18px; text-align: center;
}
.ginfo-avatar {
  width: 96px; height: 96px; border-radius: 50%;
  background: color-mix(in srgb, var(--red) 16%, var(--surface));
  color: var(--red);
  display: flex; align-items: center; justify-content: center;
  overflow: visible; margin-bottom: 12px;
  border: none; padding: 0; position: relative; cursor: default;
}
.ginfo-avatar.can-edit { cursor: pointer; }
.ginfo-avatar > img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
  display: block;
}
.ginfo-avatar > .tl-ico {
  width: 48px; height: 48px;
  pointer-events: none;
}
.ginfo-avatar-cam {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #5a9fd4;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 2px 8px rgba(0,0,0,.35);
  border: 2px solid var(--bg, #1c1c1e);
  z-index: 2;
  line-height: 0;
  padding: 0;
  box-sizing: border-box;
  pointer-events: none;
}
.ginfo-avatar-cam .tl-ico {
  width: 14px !important;
  height: 14px !important;
  display: block;
  margin: 0;
  filter: brightness(0) invert(1);
}
.ginfo-avatar-cam.hidden { display: none; }
.group-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.ginfo-edit-avatar-btn {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px;
  border: none; background: transparent; color: var(--red);
  font-size: 14px; font-weight: 600; cursor: pointer; margin-bottom: 14px;
}
.ginfo-name { font-size: 24px; font-weight: 700; line-height: 1.2; }
.ginfo-sub { margin-top: 4px; font-size: 14px; color: var(--text2); }
.ginfo-actions {
  display: flex; gap: 10px; padding: 0 16px 16px; justify-content: center;
}
.ginfo-action {
  flex: 1; max-width: 110px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 8px; border: 1px solid var(--border); border-radius: 16px;
  background: var(--surface); color: var(--text);
  font-size: 12px; font-weight: 600; cursor: pointer;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.ginfo-action-ico {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  color: var(--red); font-size: 22px; line-height: 1;
}
.ginfo-action.is-muted .ginfo-action-ico { color: var(--text2); }
.ginfo-tabs {
  display: flex; gap: 6px; padding: 0 12px 10px;
  overflow-x: auto; scrollbar-width: none;
}
.ginfo-tabs::-webkit-scrollbar { display: none; }
.ginfo-tab {
  flex-shrink: 0; border: 1px solid var(--border); border-radius: 999px;
  padding: 8px 14px; font-size: 13px; font-weight: 600;
  background: var(--surface); color: var(--text2); cursor: pointer;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.ginfo-tab.active { background: color-mix(in srgb, var(--red) 18%, var(--surface)); color: var(--text); border-color: transparent; }
.ginfo-body { padding: 0 0 24px; flex: 1; }
.ginfo-add-row {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border: none; background: transparent;
  color: var(--red); font-size: 15px; font-weight: 600; cursor: pointer; text-align: left;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.ginfo-add-row:active { background: color-mix(in srgb, var(--surface) 80%, transparent); }
.ginfo-add-ico {
  width: 44px; height: 44px; border-radius: 50%;
  background: color-mix(in srgb, var(--red) 14%, transparent);
  display: flex; align-items: center; justify-content: center;
}
.ginfo-member-list { display: flex; flex-direction: column; }
.ginfo-member {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; cursor: pointer;
}
.ginfo-member:hover { background: color-mix(in srgb, var(--surface) 80%, transparent); }
.ginfo-member-meta { flex: 1; min-width: 0; }
.ginfo-member-name {
  font-size: 15px; font-weight: 600;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.ginfo-status { display: block; font-size: 12px; color: var(--text2); margin-top: 2px; }
.ginfo-status.online { color: #2aa8ff; }
.ginfo-owner-badge {
  font-size: 11px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #7c5cff, #a855f7);
  padding: 2px 8px; border-radius: 999px;
}
.ginfo-kick-btn {
  width: 34px; height: 34px; border: none; border-radius: 50%;
  background: transparent; color: var(--text2); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.ginfo-kick-btn:hover { color: var(--red); background: color-mix(in srgb, var(--red) 12%, transparent); }
.ginfo-empty {
  padding: 40px 20px; text-align: center; color: var(--text2); font-size: 14px;
}
.ginfo-media-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 2px;
}
.ginfo-media-cell {
  aspect-ratio: 1; overflow: hidden; background: var(--surface);
}
.ginfo-media-cell img, .ginfo-media-cell video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.ginfo-file-cell, .ginfo-fav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; color: var(--text); text-decoration: none;
}
.ginfo-file-ico {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--surface); display: flex; align-items: center; justify-content: center;
}
.ginfo-fav-list { display: flex; flex-direction: column; }
.ginfo-fav-meta { flex: 1; min-width: 0; }
.ginfo-more-root {
  position: fixed; inset: 0; z-index: 2147483000;
}
.ginfo-more-menu {
  position: absolute; min-width: 240px; max-width: 280px;
  background: rgba(36, 40, 48, 0.96);
  backdrop-filter: blur(16px);
  border-radius: 14px; padding: 6px 0;
  box-shadow: 0 12px 40px rgba(0,0,0,.45);
  color: #f2f2f7;
}
.ginfo-more-item {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border: none; background: transparent;
  color: inherit; font-size: 15px; cursor: pointer; text-align: left;
}
.ginfo-more-item + .ginfo-more-item { border-top: 1px solid rgba(255,255,255,.08); }
.ginfo-more-item:hover { background: rgba(255,255,255,.06); }
.ginfo-more-item.danger { color: #ff5c6a; }
.ginfo-more-ico {
  width: 22px; display: flex; align-items: center; justify-content: center; opacity: .9;
}
.ginfo-more-meta {
  margin-left: auto; font-size: 12px; color: rgba(255,255,255,.45);
}
.ginfo-ttl-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.ginfo-ttl-opt {
  border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; background: var(--surface); color: var(--text);
  font-size: 15px; font-weight: 600; cursor: pointer; text-align: left;
}
.ginfo-ttl-opt.active { border-color: var(--red); color: var(--red); }
.ginfo-ttl-opt:disabled { opacity: .55; cursor: default; }
.conv-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition);
  position: relative;
  -webkit-user-select: none; user-select: none;
}
.conv-item:active { background: var(--surface); }
.conv-item.ctx-active { background: rgba(var(--red-rgb), 0.12); }
.conv-item-activity {
  position: sticky; top: 0; z-index: 3;
  background: var(--bg, #0e0e14);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.activity-row-av {
  width: 50px; height: 50px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #ff2d55, #ff6b9d);
  color: #fff; display: flex; align-items: center; justify-content: center;
}
.conv-item-channel .conv-group-badge { opacity: 0.9; }

/* ── Compose sheet ───────────────────────────────────── */
.compose-sheet { padding: 4px 4px 12px; }
.compose-sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.compose-sheet-title { font-size: 17px; font-weight: 800; }
.compose-close {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 16px;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.compose-search-wrap {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border-radius: 12px; padding: 0 12px; margin-bottom: 10px;
  border: 1px solid var(--border);
}
.compose-search {
  flex: 1; border: none; background: transparent; color: var(--text);
  height: 40px; font-size: 15px; outline: none;
}
.compose-actions { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.compose-action {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 8px; border-radius: 12px;
  border: none;
  background: transparent;
  color: var(--text); font-weight: 600; font-size: 15px;
  text-align: left; width: 100%;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.compose-action:active { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.compose-action-ico { width: 28px; display: flex; justify-content: center; color: var(--red); }
.compose-action.tl-liquid-btn,
.compose-action.tl-liquid-btn::before {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}
.compose-section-label {
  font-size: 13px; font-weight: 700; color: var(--text2);
  text-transform: uppercase; letter-spacing: .04em; margin: 8px 4px;
}
.compose-people { display: flex; flex-direction: column; max-height: 42vh; overflow-y: auto; gap: 4px; }
.compose-person {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: left; width: 100%; color: var(--text);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.compose-person:active { background: color-mix(in srgb, var(--surface) 85%, var(--text) 8%); }
.compose-person-meta { display: flex; flex-direction: column; min-width: 0; }
.compose-person-name { font-weight: 700; font-size: 15px; }
.compose-person-sub { font-size: 12px; color: var(--text2); }
.compose-sheet .compose-close.tl-liquid-btn,
.compose-sheet .compose-person.tl-liquid-btn {
  background: var(--surface) !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.compose-sheet .tl-liquid-btn::before {
  display: none !important;
  content: none !important;
  background: none !important;
}

/* ── Channel create ──────────────────────────────────── */
.channel-create-modal { padding: 8px 4px 4px; }
.channel-create-row { display: flex; gap: 14px; align-items: flex-start; }
.channel-avatar-pick {
  pointer-events: auto; cursor: pointer; z-index: 2;
  width: 72px; height: 72px; border-radius: 50%; flex-shrink: 0;
  background: #3390ec; color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.channel-create-fields { flex: 1; min-width: 0; padding-top: 4px; }
.channel-field-label {
  display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: var(--text2);
}
.channel-field-label.accent { color: #3390ec; }
.channel-field-label.muted { color: var(--text2); }
.channel-underline-input {
  width: 100%; border: none; border-bottom: 2px solid rgba(127,127,127,.35);
  background: transparent; color: var(--text); font-size: 16px; padding: 6px 0; outline: none;
}
.channel-underline-input.accent { border-bottom-color: #3390ec; }
.channel-create-actions {
  display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; padding-top: 8px;
}
.channel-text-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .02em;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.channel-text-btn.accent {
  color: #fff;
  background: #3390ec;
  border-color: #3390ec;
}
.channel-text-btn.tl-liquid-btn,
.channel-text-btn.tl-liquid-btn::before {
  border-radius: 999px !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.channel-text-btn.tl-liquid-btn::before {
  display: none !important;
  content: none !important;
}
.channel-text-btn.accent.tl-liquid-btn {
  background: #3390ec !important;
}
.channel-radio-row {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 4px; cursor: pointer;
  position: relative;
}
.tl-radio { position: absolute; opacity: 0; width: 0; height: 0; }
.tl-radio-ui {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid #3390ec; flex-shrink: 0; margin-top: 2px;
  display: inline-flex; align-items: center; justify-content: center;
}
.tl-radio-ui::after {
  content: ''; width: 12px; height: 12px; border-radius: 50%; background: #3390ec;
  transform: scale(0); transition: transform .12s;
}
.tl-radio:checked + .tl-radio-ui::after { transform: scale(1); }
.channel-radio-text { display: flex; flex-direction: column; gap: 2px; }
.channel-radio-text strong { font-size: 15px; }
.channel-radio-text small { font-size: 12px; color: var(--text2); line-height: 1.35; }
.channel-link-block { margin-top: 10px; padding: 0 4px; }
.channel-link-row { display: flex; align-items: baseline; gap: 2px; }
.channel-link-prefix { color: #3390ec; font-weight: 600; }
.channel-invite-preview { color: #3390ec; font-size: 14px; word-break: break-all; margin-top: 6px; }
.channel-username-status { font-size: 12px; margin-top: 6px; color: var(--text2); }
.channel-username-status.ok { color: #3dd68c; }
.channel-username-status.bad { color: var(--red); }
.channel-username-hint { font-size: 12px; color: var(--text3); margin-top: 4px; }
.channel-invite-link-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  color: #3390ec; font-weight: 600; font-size: 15px; padding: 10px 6px; margin-bottom: 8px;
}
.channel-add-members .group-member-name small { display: block; font-weight: 400; }
@keyframes channelEnterUp {
  from { transform: translateY(18px); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}
.channel-enter-anim { animation: channelEnterUp 0.28s ease both; }

.conv-info { flex: 1; min-width: 0; }
.conv-name {
  font-size: 15px; font-weight: 700; margin-bottom: 3px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.conv-pin-ico { font-size: 11px; opacity: .85; }
.conv-preview { font-size: 13px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-meta-badges { display: flex; align-items: center; gap: 6px; justify-content: flex-end; margin-top: 4px; }
.conv-mute-ico { color: var(--text3, #8e8e93); display: flex; }

.conv-archive-back {
  border: none; background: transparent; color: var(--red);
  font-size: 14px; font-weight: 600; cursor: pointer; padding: 6px 0;
}
.conv-archive-entry {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 12px; margin-bottom: 4px;
  border: none; border-radius: var(--radius);
  background: transparent; color: var(--text);
  font-size: 15px; font-weight: 600; cursor: pointer; text-align: left;
}
.conv-archive-entry:active { background: var(--surface); }
.conv-archive-entry-ico {
  width: 50px; height: 50px; border-radius: 50%;
  background: var(--surface); color: var(--text2);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.conv-archive-count {
  margin-left: auto;
  min-width: 22px; height: 22px; padding: 0 7px;
  border-radius: 11px; background: var(--red); color: #fff;
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* Контекстное меню списка чатов (как в Telegram) */
.conv-ctx-root {
  position: fixed; inset: 0;
  z-index: 2147483000;
  pointer-events: none;
}
.conv-ctx-menu {
  position: absolute;
  pointer-events: auto;
  min-width: 240px; max-width: min(300px, calc(100vw - 16px));
  max-height: min(420px, calc(100vh - 16px));
  overflow-x: hidden;
  overflow-y: auto;
  padding: 6px;
  background: rgba(40, 44, 48, 0.97);
  border-radius: 12px;
  box-shadow: 0 10px 36px rgba(0,0,0,.45);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  color: #f2f2f7;
  opacity: 1;
  box-sizing: border-box;
}
.conv-ctx-sep {
  height: 1px; background: rgba(255,255,255,.1);
  margin: 4px 6px;
}
.conv-ctx-item {
  position: relative;
  width: 100%;
  box-sizing: border-box;
  display: flex; align-items: center; gap: 12px;
  flex-wrap: nowrap;
  padding: 10px 12px;
  border: none; border-radius: 8px;
  background: transparent;
  color: inherit;
  font-size: 15px; font-weight: 450; text-align: left;
  cursor: pointer;
  font-family: inherit;
}
/* Flat rows — no liquid glass on context menu */
.conv-ctx-item.tl-liquid-btn,
.conv-ctx-menu .tl-liquid-btn,
.conv-ctx-root button.tl-liquid-btn {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  overflow: visible !important;
  isolation: auto !important;
}
.conv-ctx-item.tl-liquid-btn::before,
.conv-ctx-menu .tl-liquid-btn::before,
.conv-ctx-root button.tl-liquid-btn::before {
  display: none !important;
}
.conv-ctx-item.tl-liquid-btn:hover,
.conv-ctx-item.tl-liquid-btn:active {
  background: rgba(70, 74, 80, .9) !important;
}
.conv-ctx-item > span:first-of-type {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conv-ctx-item:hover, .conv-ctx-item:active { background: rgba(70, 74, 80, .9); }
.conv-ctx-item .tl-ico,
.conv-ctx-item svg {
  width: 20px !important;
  height: 20px !important;
  flex-shrink: 0;
  opacity: .92;
  object-fit: contain;
}
.conv-ctx-item.danger { color: #ff5a67; }
.conv-ctx-chevron {
  margin-left: auto;
  opacity: .45;
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  transition: transform .15s ease;
}
.conv-ctx-item.has-sub {
  padding-right: 8px;
  flex-wrap: wrap;
  cursor: pointer;
}
.conv-ctx-sub {
  display: none;
  flex-basis: 100%;
  width: 100%;
  margin-top: 4px;
  padding: 4px;
  border-radius: 8px;
  background: rgba(0, 0, 0, .28);
  box-sizing: border-box;
}
.conv-ctx-item.has-sub.open > .conv-ctx-sub {
  display: block;
}
.conv-ctx-item.has-sub.open > .conv-ctx-chevron {
  transform: rotate(90deg);
}
.conv-ctx-sub .conv-ctx-item {
  padding: 9px 10px;
  font-size: 14px;
}

/* Огоньки (стрики) */
.streak-badge {
  display: inline-flex; align-items: center; gap: 1px;
  font-weight: 800; line-height: 1;
  background: linear-gradient(135deg, #ff6b00, #ff2d55);
  color: #fff;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.streak-badge--conv {
  font-size: 11px;
  padding: 2px 7px 2px 5px;
}
.streak-badge--chat {
  font-size: 12px;
  padding: 2px 7px 2px 5px;
  vertical-align: middle;
}
.streak-badge.streak-at-risk {
  animation: streakPulse 1.1s ease-in-out infinite;
  background: linear-gradient(135deg, #ff9500, #ff3b30);
}
@keyframes streakPulse {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.08); filter: brightness(1.15); }
}
.chat-streak-slot {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.streak-hint {
  flex-shrink: 0;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  color: #fff;
  background: linear-gradient(90deg, #ff6b00, #ff2d55);
}
.streak-hint.hidden { display: none; }
.streak-empty-tip {
  font-size: 13px !important;
  color: var(--text2) !important;
  margin-top: 8px;
  max-width: 260px;
  line-height: 1.4;
}
.conv-meta { text-align: right; flex-shrink: 0; }
.conv-time { font-size: 11px; color: var(--text3); margin-bottom: 4px; }
.conv-unread {
  background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700;
  width: 18px; height: 18px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  margin-left: auto;
}

/* Chat View */
.chat-view {
  height: 100%;
  display: flex; flex-direction: column;
  background: var(--bg);
}
.chat-view-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.chat-back-btn {
  width: 36px; height: 36px;
  border: none;
  border-radius: 50%;
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  color: var(--red);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.chat-back-btn:active { background: var(--surface); }
.chat-back-btn svg { width: 22px; height: 22px; }
.chat-view-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  min-width: 0;
}
.chat-view-username {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
  scrollbar-width: none;
}
.chat-messages::-webkit-scrollbar { display: none; }

.chat-bubble {
  max-width: 75%;
  width: fit-content;
  padding: 7px 11px 6px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.35;
  position: relative;
  word-break: break-word;
  box-sizing: border-box;
}
.chat-bubble.mine {
  background: var(--chat-mine-bg, var(--red));
  color: var(--chat-mine-fg, #fff);
  border-radius: 16px;
  align-self: flex-end;
}
.chat-bubble.theirs {
  background: var(--chat-theirs-bg, var(--card));
  color: var(--chat-theirs-fg, var(--text));
  border-radius: 16px;
  align-self: flex-start;
  box-shadow: var(--shadow);
  border: 1px solid var(--chat-theirs-border, var(--border));
}
/* Контент + время: как в Telegram — время в правом нижнем углу последней строки */
.bubble-main {
  display: block;
}
.bubble-main::after {
  content: '';
  display: table;
  clear: both;
}
.bubble-time {
  float: right;
  margin: 5px 0 -3px 8px;
  font-size: 11px;
  line-height: 14px;
  opacity: 0.65;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
}
.chat-bubble.theirs .bubble-time { opacity: 0.55; }

/* Появление нового сообщения: отправка (справа) / приход (слева) */
.chat-bubble.bubble-appear-mine {
  transform-origin: bottom right;
  animation: bubbleAppearMine 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.chat-bubble.bubble-appear-theirs {
  transform-origin: bottom left;
  animation: bubbleAppearTheirs 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes bubbleAppearMine {
  0%   { opacity: 0; transform: translate3d(18px, 14px, 0) scale(0.86); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}
@keyframes bubbleAppearTheirs {
  0%   { opacity: 0; transform: translate3d(-18px, 10px, 0) scale(0.88); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .chat-bubble.bubble-appear-mine,
  .chat-bubble.bubble-appear-theirs { animation: none; }
}

/* Контекстное меню пузырька (удалить) */
.bubble-menu {
  position: fixed;
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.18), 0 1px 4px rgba(0,0,0,0.10);
  border: 1px solid var(--border);
  z-index: 999;
  overflow: hidden;
  white-space: nowrap;
  animation: bubbleMenuIn 0.15s ease;
  min-width: 160px;
}
.bubble-menu-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  font-size: 14px; color: var(--text);
  background: none; border: none; font: inherit;
  width: 100%; cursor: pointer; text-align: left;
  border-top: 1px solid var(--border);
}
.bubble-menu-btn:first-child { border-top: none; }
.bubble-menu-btn:active { background: var(--surface); }
.bubble-menu-btn.danger { color: var(--red); }
@keyframes bubbleMenuIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

/* Анимация удаления сообщения */
.bubble-deleting {
  animation: bubbleExit 0.34s cubic-bezier(.4,0,.8,.6) forwards !important;
  pointer-events: none;
  transform-origin: center;
}
@keyframes bubbleExit {
  0%   { opacity: 1; transform: scale(1); filter: blur(0); }
  60%  { opacity: .45; transform: scale(.82); filter: blur(1.5px); }
  100% { opacity: 0; transform: scale(.55); filter: blur(4px); }
}
/* После «испарения» высота схлопывается — соседние сообщения плавно съезжаются */
.chat-bubble.bubble-collapse {
  opacity: 0;
  margin-top: 0 !important; margin-bottom: 0 !important;
  padding-top: 0 !important; padding-bottom: 0 !important;
  border-width: 0 !important;
  transition: height .22s ease, margin .22s ease, padding .22s ease;
}
@keyframes particleFly {
  0%   { opacity: 1; transform: translate(0,0) scale(1); }
  100% { opacity: 0; transform: translate(var(--tx),var(--ty)) scale(0); }
}

/* Галочки доставки/прочтения */
.msg-tick {
  width: 14px; height: 10px;
  flex-shrink: 0;
  stroke: rgba(255,255,255,0.6);
}
.msg-tick.read {
  stroke: #fff;
}

.chat-mention {
  display: inline;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  color: #6ea8ff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.chat-bubble.mine .chat-mention { color: #fff; text-decoration: underline; text-underline-offset: 2px; }
.chat-mention:hover { text-decoration: underline; }
.chat-mention-suggest {
  margin: 0 10px 6px;
  max-height: 220px;
  overflow-y: auto;
  border-radius: 14px;
  background: var(--card, #1c1c1e);
  border: 1px solid var(--border);
  box-shadow: 0 10px 28px rgba(0,0,0,.35);
  -webkit-overflow-scrolling: touch;
}
.chat-mention-suggest.hidden { display: none; }
.chat-mention-suggest-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.chat-mention-suggest-item:last-child { border-bottom: 0; }
.chat-mention-suggest-item:active { background: var(--surface); }
.chat-mention-suggest-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}
.chat-mention-suggest-name {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-mention-suggest-user {
  font-size: 12px;
  color: var(--text2);
}
.comment-mention-suggest {
  margin: 0 10px 8px;
  max-height: 200px;
  z-index: 8;
}
.comments-sheet-compose-wrap .comment-mention-suggest,
.post-detail-comments-compose-wrap .comment-mention-suggest {
  margin: 0 12px 8px;
}
.chat-input-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  background: var(--card);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
}
.chat-compose {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface);
  border-radius: 24px;
  border: 1.5px solid var(--border);
  transition: border-color var(--transition);
  overflow: hidden;
}
.chat-compose.hidden { display: none; }
.chat-compose:focus-within { border-color: var(--red); }
.chat-compose.has-sticker { border-radius: 20px; }
.chat-input {
  flex: 1;
  width: 100%;
  background: transparent;
  border-radius: 0;
  padding: 11px 16px;
  font-size: 15px;
  color: var(--text);
  border: none;
  outline: none;
  box-shadow: none;
}
.chat-compose.has-sticker .chat-input { padding-top: 4px; padding-bottom: 11px; }
.chat-input:focus { border-color: transparent; }
.chat-input::placeholder { color: var(--text3); }
.chat-sticker-draft {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 10px 12px 4px 14px;
}
.chat-sticker-draft.hidden { display: none; }
.chat-sticker-draft-img {
  width: 88px;
  height: 88px;
  object-fit: contain;
  display: block;
  background: transparent;
  pointer-events: none;
}
.chat-sticker-draft-clear {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(128,128,128,.45);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.chat-sticker-draft-clear:active { background: rgba(var(--red-rgb),.7); }
.chat-send-mic-slot {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}
.chat-send-mic-slot.hidden { display: none; }
.chat-send-btn {
  width: 44px; height: 44px;
  background: var(--red);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border: none; padding: 0; cursor: pointer;
  box-shadow: 0 3px 10px rgba(var(--red-rgb), 0.35);
  transition: transform var(--transition);
}
.chat-send-btn:active { transform: scale(0.93); }
.chat-send-btn svg { width: 20px; height: 20px; stroke: #fff; }
.chat-send-btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }
.chat-mic-btn {
  width: 44px; height: 44px;
  background: var(--red);
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: #fff;
  border: none; padding: 0; cursor: pointer;
  line-height: 0;
  box-shadow: 0 3px 10px rgba(var(--red-rgb),0.35);
  transition: transform var(--transition);
}
.chat-mic-btn:active { transform: scale(0.93); }
.chat-mic-btn.hidden, .chat-send-btn.hidden { display: none; }

/* Плавная смена микрофон ↔ самолётик */
.chat-send-mic-slot > .chat-send-btn,
.chat-send-mic-slot > .chat-mic-btn {
  position: absolute;
  inset: 0;
  margin: 0;
  will-change: transform, opacity;
  transition:
    opacity 0.22s ease,
    transform 0.32s cubic-bezier(0.34, 1.45, 0.64, 1),
    visibility 0.22s;
}
.chat-send-mic-slot > .chat-send-btn.is-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(0.4) rotate(-40deg) translate(4px, 8px);
}
.chat-send-mic-slot > .chat-mic-btn.is-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(0.55);
}
.chat-send-mic-slot > .chat-send-btn:not(.is-out):active {
  transform: scale(0.93);
}
.chat-send-mic-slot > .chat-mic-btn:not(.is-out):active {
  transform: scale(0.93);
}
@media (prefers-reduced-motion: reduce) {
  .chat-send-mic-slot > .chat-send-btn,
  .chat-send-mic-slot > .chat-mic-btn {
    transition: opacity 0.12s ease, visibility 0.12s;
  }
  .chat-send-mic-slot > .chat-send-btn.is-out,
  .chat-send-mic-slot > .chat-mic-btn.is-out {
    transform: none;
  }
}

/* Запись голосового */
.chat-voice-bar {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border-radius: 24px;
  padding: 8px 10px 8px 12px;
  border: 1.5px solid var(--border);
}
.chat-voice-bar.hidden { display: none; }
.chat-voice-cancel {
  width: 32px; height: 32px; border-radius: 50%;
  border: none; background: rgba(var(--red-rgb),.12); color: var(--red);
  font-size: 14px; font-weight: 700; cursor: pointer; flex-shrink: 0;
}
.chat-voice-rec-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--red); flex-shrink: 0;
  animation: voiceRecPulse 1s ease-in-out infinite;
}
@keyframes voiceRecPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .35; transform: scale(.85); }
}
.chat-voice-timer {
  font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--text); min-width: 36px;
}
.chat-voice-hint {
  flex: 1; min-width: 0;
  font-size: 13px; color: var(--text2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-voice-send { width: 40px; height: 40px; box-shadow: none; }

/* Пузырь голосового — SVG-волна на всю ширину */
.chat-bubble:has(.bubble-voice) {
  width: 240px;
  max-width: 75%;
}
.bubble-voice {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  column-gap: 10px;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  padding: 2px 0 0;
  user-select: none;
}
.voice-play-btn {
  width: 42px; height: 42px; border-radius: 50%;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  grid-row: 1 / span 2;
  align-self: center;
}
.chat-bubble.mine .voice-play-btn {
  background: var(--chat-voice-btn-mine-bg, rgba(255,255,255,.92));
  color: var(--chat-voice-btn-mine-fg, var(--chat-mine-bg, var(--red)));
}
.chat-bubble.theirs .voice-play-btn {
  background: var(--chat-voice-btn-theirs-bg, rgba(120,140,160,.55));
  color: var(--chat-voice-btn-theirs-fg, #1a222a);
}
.voice-play-btn svg { width: 18px; height: 18px; }
.voice-body {
  min-width: 0;
  width: 100%;
}
.voice-wave {
  --p: 0%;
  position: relative;
  height: 34px;
  width: 100%;
  overflow: hidden;
  cursor: pointer;
  touch-action: none;
}
.voice-wave-svg {
  display: block;
  width: 100%;
  height: 34px;
}
.voice-wave-svg--dim {
  fill: var(--chat-voice-mine-dim, rgba(255,255,255,.38));
}
.chat-bubble.theirs .voice-wave-svg--dim {
  fill: var(--chat-voice-theirs-dim, rgba(160,180,200,.55));
}
/* яркая волна поверх — плавно открывается слева направо */
.voice-wave-svg--lit {
  position: absolute;
  left: 0; top: 0;
  width: 100%;
  height: 34px;
  fill: var(--chat-voice-mine-lit, rgba(255,255,255,.95));
  pointer-events: none;
  clip-path: inset(0 calc(100% - var(--p, 0%)) 0 0);
  will-change: clip-path;
}
.chat-bubble.theirs .voice-wave-svg--lit {
  fill: var(--chat-voice-theirs-lit, rgba(210,225,240,.95));
}
.voice-seek-head {
  position: absolute;
  top: 1px; bottom: 1px;
  left: var(--p, 0%);
  width: 2px;
  margin-left: -1px;
  border-radius: 2px;
  background: var(--chat-voice-mine-lit, #fff);
  box-shadow: 0 0 0 1px rgba(0,0,0,.15);
  pointer-events: none;
  opacity: 0;
  will-change: left;
}
.chat-bubble.theirs .voice-seek-head {
  background: var(--chat-voice-theirs-lit, #e8f0f8);
}
.bubble-voice.playing .voice-seek-head,
.voice-wave.has-progress .voice-seek-head,
.voice-wave:active .voice-seek-head {
  opacity: 1;
}
.voice-meta {
  margin-top: 2px;
  font-size: 11px;
  opacity: .75;
  font-variant-numeric: tabular-nums;
}
.voice-audio { display: none; }

/* ── Темы всего приложения (акцент + фон + чат) ── */
[data-chat-theme="classic"] {
  --red: #E8001D;
  --red-dark: #C4001A;
  --red-light: #FF4D64;
  --red-bg: #FFF0F2;
  --red-rgb: 232, 0, 29;
  --bg: #FFFFFF;
  --surface: #F5F5F7;
  --card: #FFFFFF;
  --border: #E8E8EC;
  --text: #1A1A1A;
  --text2: #6B6B6B;
  --text3: #9A9A9A;
  --tl-ico-filter: brightness(0) opacity(0.88);
  --ico-warm: #F59E0B;
  --ico-cool: #3B82F6;
  --ico-nature: #22C55E;
  --ico-pink: #F472B6;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --chat-mine-bg: #E8001D;
  --chat-mine-fg: #ffffff;
  --chat-theirs-bg: var(--card);
  --chat-theirs-fg: var(--text);
  --chat-theirs-border: var(--border);
  --chat-voice-mine-dim: rgba(255,255,255,.32);
  --chat-voice-mine-lit: rgba(255,255,255,.96);
  --chat-voice-theirs-dim: rgba(120,140,160,.5);
  --chat-voice-theirs-lit: rgba(90,120,155,.95);
  --chat-voice-btn-mine-bg: rgba(255,255,255,.92);
  --chat-voice-btn-mine-fg: #E8001D;
  --chat-voice-btn-theirs-bg: rgba(120,140,160,.45);
  --chat-voice-btn-theirs-fg: var(--card);
}
[data-chat-theme="day"] {
  --red: #4A9EDA;
  --red-dark: #2E7EB8;
  --red-light: #6BB3E8;
  --red-bg: #E3F2FC;
  --red-rgb: 74, 158, 218;
  --bg: #F3F9FD;
  --surface: #E8F2F9;
  --card: #FFFFFF;
  --border: #D0E4F2;
  --text: #152532;
  --text2: #5A7488;
  --text3: #8AA0B2;
  --tl-ico-filter: brightness(0) opacity(0.88);
  --ico-warm: #EAB308;
  --ico-cool: #0EA5E9;
  --ico-nature: #10B981;
  --ico-pink: #EC4899;
  --shadow: 0 2px 12px rgba(40,100,140,0.10);
  --shadow-lg: 0 8px 32px rgba(40,100,140,0.14);
  --chat-mine-bg: #4A9EDA;
  --chat-mine-fg: #ffffff;
  --chat-theirs-bg: #E8F4FC;
  --chat-theirs-fg: #1a2a36;
  --chat-theirs-border: #c5dff0;
  --chat-voice-mine-dim: rgba(255,255,255,.35);
  --chat-voice-mine-lit: #ffffff;
  --chat-voice-theirs-dim: rgba(74,158,218,.4);
  --chat-voice-theirs-lit: #2b7cb5;
  --chat-voice-btn-mine-bg: #ffffff;
  --chat-voice-btn-mine-fg: #4A9EDA;
  --chat-voice-btn-theirs-bg: rgba(74,158,218,.35);
  --chat-voice-btn-theirs-fg: #ffffff;
}
[data-chat-theme="colored"] {
  --red: #7C4DFF;
  --red-dark: #5E35D1;
  --red-light: #A78BFF;
  --red-bg: #2A2040;
  --red-rgb: 124, 77, 255;
  --bg: #12101A;
  --surface: #1A1628;
  --card: #241F35;
  --border: #352E4A;
  --text: #F2ECFF;
  --text2: #B8A8D8;
  --text3: #7E7098;
  --tl-ico-filter: none;
  --ico-warm: #FBBF24;
  --ico-cool: #A78BFF;
  --ico-nature: #34D399;
  --ico-pink: #F0ABFC;
  --shadow: 0 2px 12px rgba(0,0,0,0.45);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.55);
  --chat-mine-bg: #7C4DFF;
  --chat-mine-fg: #ffffff;
  --chat-theirs-bg: #2A2438;
  --chat-theirs-fg: #f0eaff;
  --chat-theirs-border: #3d3554;
  --chat-voice-mine-dim: rgba(255,255,255,.32);
  --chat-voice-mine-lit: #ffffff;
  --chat-voice-theirs-dim: rgba(180,150,255,.4);
  --chat-voice-theirs-lit: #c4b0ff;
  --chat-voice-btn-mine-bg: #ffffff;
  --chat-voice-btn-mine-fg: #7C4DFF;
  --chat-voice-btn-theirs-bg: rgba(180,150,255,.4);
  --chat-voice-btn-theirs-fg: #1e1830;
}
[data-chat-theme="night"] {
  --red: #8B9CB3;
  --red-dark: #6E7F96;
  --red-light: #A8B6C8;
  --red-bg: #1C222A;
  --red-rgb: 139, 156, 179;
  --bg: #0D0F12;
  --surface: #161A20;
  --card: #1E242C;
  --border: #2A323C;
  --text: #F0F2F5;
  --text2: #A0A8B4;
  --text3: #6A7380;
  --tl-ico-filter: none;
  --ico-warm: #D4A017;
  --ico-cool: #7DD3FC;
  --ico-nature: #4ADE80;
  --ico-pink: #F9A8D4;
  --shadow: 0 2px 12px rgba(0,0,0,0.45);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.55);
  --chat-mine-bg: #3D4654;
  --chat-mine-fg: #f2f4f7;
  --chat-theirs-bg: #2B333B;
  --chat-theirs-fg: #e8eaed;
  --chat-theirs-border: #3a4450;
  --chat-voice-mine-dim: rgba(180,200,220,.42);
  --chat-voice-mine-lit: rgba(230,240,250,.98);
  --chat-voice-theirs-dim: rgba(150,170,190,.42);
  --chat-voice-theirs-lit: rgba(210,225,240,.98);
  --chat-voice-btn-mine-bg: rgba(180,200,220,.55);
  --chat-voice-btn-mine-fg: #1a222a;
  --chat-voice-btn-theirs-bg: rgba(150,170,190,.5);
  --chat-voice-btn-theirs-fg: #1a222a;
}
/* Мужская — синяя */
[data-chat-theme="male"] {
  --red: #1B6BC7;
  --red-dark: #145499;
  --red-light: #4A90D9;
  --red-bg: #E4F0FB;
  --red-rgb: 27, 107, 199;
  --bg: #F2F7FC;
  --surface: #E6F0F9;
  --card: #FFFFFF;
  --border: #C8DCEC;
  --text: #122033;
  --text2: #5A738C;
  --text3: #849AB0;
  --tl-ico-filter: brightness(0) opacity(0.88);
  --ico-warm: #F59E0B;
  --ico-cool: #2563EB;
  --ico-nature: #10B981;
  --ico-pink: #F472B6;
  --shadow: 0 2px 12px rgba(27,107,199,0.10);
  --shadow-lg: 0 8px 32px rgba(27,107,199,0.16);
  --chat-mine-bg: #1B6BC7;
  --chat-mine-fg: #ffffff;
  --chat-theirs-bg: #E8F1FB;
  --chat-theirs-fg: #122033;
  --chat-theirs-border: #b8d2ea;
  --chat-voice-mine-dim: rgba(255,255,255,.35);
  --chat-voice-mine-lit: #ffffff;
  --chat-voice-theirs-dim: rgba(27,107,199,.38);
  --chat-voice-theirs-lit: #145499;
  --chat-voice-btn-mine-bg: #ffffff;
  --chat-voice-btn-mine-fg: #1B6BC7;
  --chat-voice-btn-theirs-bg: rgba(27,107,199,.32);
  --chat-voice-btn-theirs-fg: #ffffff;
}
/* Женская — красно-розовая (ближе к красному, не чисто розовая) */
[data-chat-theme="female"] {
  --red: #E8183A;
  --red-dark: #C40F2C;
  --red-light: #FF4D6A;
  --red-bg: #FFF0F2;
  --red-rgb: 232, 24, 58;
  --bg: #FFF8F9;
  --surface: #FCEAED;
  --card: #FFFFFF;
  --border: #F0CCD4;
  --text: #2A1218;
  --text2: #8A5560;
  --text3: #B8808C;
  --tl-ico-filter: brightness(0) opacity(0.88);
  --ico-warm: #F59E0B;
  --ico-cool: #60A5FA;
  --ico-nature: #34D399;
  --ico-pink: #F472B6;
  --shadow: 0 2px 12px rgba(232,24,58,0.10);
  --shadow-lg: 0 8px 32px rgba(232,24,58,0.16);
  --chat-mine-bg: #E8183A;
  --chat-mine-fg: #ffffff;
  --chat-theirs-bg: #FFF0F2;
  --chat-theirs-fg: #2A1218;
  --chat-theirs-border: #f0c4cc;
  --chat-voice-mine-dim: rgba(255,255,255,.35);
  --chat-voice-mine-lit: #ffffff;
  --chat-voice-theirs-dim: rgba(232,24,58,.38);
  --chat-voice-theirs-lit: #C40F2C;
  --chat-voice-btn-mine-bg: #ffffff;
  --chat-voice-btn-mine-fg: #E8183A;
  --chat-voice-btn-theirs-bg: rgba(232,24,58,.32);
  --chat-voice-btn-theirs-fg: #ffffff;
}
html[data-chat-theme="classic"],
html[data-chat-theme="day"],
html[data-chat-theme="male"],
html[data-chat-theme="female"] { background: #e8e8ec; }
html[data-chat-theme="colored"],
html[data-chat-theme="night"] { background: #0a0a0a; }

/* Карточки выбора темы чата */
.chat-theme-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 4px 0 8px;
}
.chat-theme-card {
  border: 2px solid transparent;
  border-radius: 14px;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  background: var(--surface);
  font-family: inherit;
  color: var(--text);
  text-align: left;
  transition: border-color .15s, transform .12s;
}
.chat-theme-card:active { transform: scale(.98); }
.chat-theme-card.active {
  border-color: var(--red);
  box-shadow: 0 0 0 1px var(--red);
}
.chat-theme-preview {
  height: 72px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 5px;
  background: var(--ctp-bg, #1a1a1a);
}
.chat-theme-preview .ctp-b {
  height: 14px;
  border-radius: 8px;
  max-width: 72%;
}
.chat-theme-preview .ctp-b.mine {
  align-self: flex-end;
  background: var(--ctp-mine, #E8001D);
  max-width: 58%;
}
.chat-theme-preview .ctp-b.theirs {
  align-self: flex-start;
  background: var(--ctp-theirs, #2B333B);
}
.chat-theme-name {
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 700;
}

/* Media attach button (скрепка) */
.chat-attach-wrap {
  position: relative;
  flex-shrink: 0;
}
.chat-media-btn,
.chat-emoji-btn {
  width: 40px; height: 40px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text3); border-radius: 50%;
  transition: color var(--transition), background var(--transition);
  background: none; border: none; padding: 0;
  line-height: 0;
}
.chat-media-btn:hover,
.chat-media-btn.active,
.chat-emoji-btn:hover,
.chat-emoji-btn.active { color: var(--red); background: rgba(var(--red-rgb),.08); }
.chat-media-btn svg,
.chat-emoji-btn svg,
.chat-mic-btn svg,
.chat-media-btn .tl-ico,
.chat-emoji-btn .tl-ico,
.chat-mic-btn .tl-ico {
  width: 24px !important;
  height: 24px !important;
  flex-shrink: 0;
  display: block;
  object-fit: contain;
  pointer-events: none;
}
.chat-emoji-btn { color: var(--text2); }

/* Telegram-like attach popup */
.chat-attach-menu {
  position: fixed;
  z-index: 1000;
  width: max-content;
  min-width: 220px;
  max-width: min(280px, calc(100vw - 16px));
  padding: 6px 0;
  box-sizing: border-box;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.22), 0 2px 8px rgba(0,0,0,0.12);
  transform-origin: 18px bottom;
  opacity: 0;
  transform: scale(0.55) translateY(8px);
  pointer-events: none;
  visibility: hidden;
  overflow: hidden;
  transition:
    opacity 0.14s ease,
    transform 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.25),
    visibility 0s linear 0.2s;
}
.chat-attach-menu.open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
  visibility: visible;
  transition:
    opacity 0.14s ease,
    transform 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.25),
    visibility 0s;
}
.chat-attach-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: auto;
  min-width: 100%;
  box-sizing: border-box;
  padding: 11px 20px 11px 14px;
  border: none;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}
.chat-attach-item:hover,
.chat-attach-item:active { background: var(--surface); }
.chat-attach-item .tl-ico,
.chat-attach-item svg {
  width: 22px !important;
  height: 22px !important;
  flex-shrink: 0;
  display: block;
  object-fit: contain;
  color: var(--text2);
  opacity: 0.92;
}
.chat-attach-label {
  flex: 0 1 auto;
  min-width: 0;
}
[data-theme="dark"] .chat-attach-menu {
  background: #2b2d31;
  border-color: rgba(255,255,255,0.06);
  box-shadow: 0 10px 32px rgba(0,0,0,0.45);
}
[data-theme="dark"] .chat-attach-item:hover,
[data-theme="dark"] .chat-attach-item:active {
  background: rgba(255,255,255,0.06);
}
[data-theme="dark"] .chat-attach-item .tl-ico,
[data-theme="dark"] .chat-attach-item svg { color: #c4c7cc; opacity: 1; }

/* Location bubble */
.bubble-location {
  display: block;
  width: min(240px, 72vw);
  border-radius: 14px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.bubble-location-map {
  height: 110px;
  background:
    radial-gradient(circle at 55% 42%, rgba(var(--red-rgb),0.35), transparent 28%),
    linear-gradient(135deg, #dfe7ef 0%, #b8c7d6 45%, #9eb0c4 100%);
  position: relative;
}
[data-theme="dark"] .bubble-location-map {
  background:
    radial-gradient(circle at 55% 42%, rgba(var(--red-rgb),0.45), transparent 28%),
    linear-gradient(135deg, #2a3340 0%, #1c2430 55%, #15202b 100%);
}
.bubble-location-pin {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -100%);
  width: 28px;
  height: 28px;
  color: var(--red);
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.25));
}
.bubble-location-meta {
  padding: 10px 12px;
}
.bubble-location-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.bubble-location-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text2);
}
.chat-bubble.mine:has(.bubble-location),
.chat-bubble.theirs:has(.bubble-location) {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 2px;
}
.chat-bubble.mine:has(.bubble-location) .bubble-time,
.chat-bubble.theirs:has(.bubble-location) .bubble-time {
  color: var(--text2);
  opacity: 0.85;
}

/* Liquid-glass emoji / stickers / GIF panel (iOS-style) */
.chat-emoji-panel {
  --cep-h: 300px;
  flex-shrink: 0;
  height: var(--cep-drag-h, var(--cep-h));
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 40;
  border-top: 1px solid rgba(255,255,255,0.18);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.22) 0%, rgba(255,255,255,0.06) 28%, rgba(20,20,24,0.55) 100%);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.25);
  transition: height 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
[data-theme="light"] .chat-emoji-panel {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.72) 0%, rgba(255,255,255,0.45) 40%, rgba(245,245,247,0.82) 100%);
  border-top-color: rgba(255,255,255,0.55);
  box-shadow: 0 -8px 32px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.8);
}
.chat-emoji-panel.cep-expanded {
  --cep-h: min(92vh, 820px);
  border-radius: 22px 22px 0 0;
}
.chat-emoji-panel.cep-dragging { transition: none; }
.chat-emoji-panel.hidden { display: none; }
.cep-sheet-handle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0 2px;
  cursor: grab;
  touch-action: none;
}
.cep-sheet-handle span {
  width: 36px;
  height: 4px;
  border-radius: 99px;
  background: rgba(255,255,255,0.35);
}
[data-theme="light"] .cep-sheet-handle span { background: rgba(0,0,0,0.18); }
.cep-tabs {
  display: flex;
  gap: 6px;
  padding: 6px 10px 8px;
  flex-shrink: 0;
}
.cep-tab {
  flex: 1;
  padding: 8px 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text2);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
[data-theme="light"] .cep-tab {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.06);
}
.cep-tab.active {
  color: #fff;
  background: rgba(var(--red-rgb),0.9);
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(var(--red-rgb),0.35);
}
.cep-grid {
  flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; padding: 8px;
  display: grid; gap: 4px;
  scrollbar-width: thin;
}
.cep-emoji-grid { grid-template-columns: repeat(6, 1fr); align-content: start; }
.cep-emoji img {
  width: 36px; height: 36px; object-fit: contain; display: block; margin: 0 auto;
  pointer-events: none;
}
.msg-react-pick img.react-ico,
.msg-react-chip img.react-ico,
.settings-radio-emoji img.react-ico,
.chat-dbl-react-pick img.react-ico {
  display: block; object-fit: contain; pointer-events: none;
}
.chat-send-btn .tl-ico,
.chat-mic-btn .tl-ico,
.chat-voice-send .tl-ico { filter: brightness(0) invert(1); }
.lg-cam-btn .tl-ico { filter: brightness(0) invert(1); }
.cep-sticker-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 10px; }
.cep-emoji {
  aspect-ratio: 1; font-size: 22px; border: none; background: none;
  border-radius: 10px; cursor: pointer; line-height: 1;
}
.cep-emoji:active { background: var(--surface); transform: scale(1.15); }
.cep-sticker {
  aspect-ratio: 1; border: none; padding: 0;
  background: var(--surface); border-radius: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
}
.cep-sticker img {
  width: 100%; height: 100%; object-fit: contain; display: block; padding: 4px;
}
.cep-sticker:active { transform: scale(0.94); background: var(--red-bg); }
.cep-sticker-add {
  font-size: 28px; color: var(--text2); border: 1.5px dashed var(--border);
  background: transparent;
}
.cep-sticker-body {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
}
.cep-pack-bar {
  flex-shrink: 0; display: flex; gap: 6px; align-items: center;
  padding: 6px 8px; border-top: 1px solid var(--border);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.cep-pack-bar::-webkit-scrollbar { display: none; }
.cep-pack-btn {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 10px;
  border: 2px solid transparent; background: var(--surface);
  overflow: hidden; cursor: pointer; display: flex;
  align-items: center; justify-content: center; font-size: 18px; color: var(--text2);
}
.cep-pack-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cep-pack-btn.active { border-color: var(--red); }
.cep-pack-btn.add { font-size: 22px; font-weight: 700; }
.cep-pack-title {
  flex-shrink: 0; display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px 0; font-size: 12px; font-weight: 700; color: var(--text2);
}
.cep-pack-del {
  font-size: 11px; color: var(--red); background: none; border: none;
  cursor: pointer; font-weight: 600; padding: 4px 6px;
}
.cep-create-form {
  padding: 12px; display: flex; flex-direction: column; gap: 8px;
}
.cep-create-form input {
  width: 100%; background: var(--surface); border-radius: 12px;
  padding: 10px 12px; color: var(--text); font-size: 14px;
  border: 1px solid var(--border);
}
.cep-create-actions { display: flex; gap: 8px; }
.cep-create-actions button {
  flex: 1; padding: 10px; border-radius: 12px; font-weight: 700; font-size: 13px;
  cursor: pointer; border: none;
}
.cep-create-actions .cep-btn-primary { background: var(--red); color: #fff; }
.cep-create-actions .cep-btn-ghost { background: var(--surface); color: var(--text2); }
.cep-gif-search {
  position: relative;
  padding: 4px 12px 10px;
  flex-shrink: 0;
}
.cep-gif-search-ico {
  position: absolute;
  left: 24px; top: 50%;
  transform: translateY(-55%);
  width: 16px; height: 16px;
  color: var(--text2);
  pointer-events: none;
}
.cep-gif-search input {
  width: 100%;
  background: rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 11px 14px 11px 38px;
  color: var(--text);
  font-size: 14px;
  border: 1.5px solid rgba(88, 150, 255, 0.55);
  outline: none;
  box-shadow: 0 0 0 3px rgba(88, 150, 255, 0.12);
}
[data-theme="light"] .cep-gif-search input {
  background: rgba(255,255,255,0.75);
  border-color: rgba(88, 150, 255, 0.65);
}
.cep-gif-search input:focus {
  border-color: rgba(88, 150, 255, 0.95);
  box-shadow: 0 0 0 4px rgba(88, 150, 255, 0.2);
}
.cep-gif-body {
  flex: 1; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 4px 10px 8px;
}
.cep-gif-cats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-content: start;
}
.cep-cat-tile {
  position: relative;
  height: 96px;
  border: none;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  background: rgba(255,255,255,0.06);
  color: #fff;
  text-align: center;
}
.cep-cat-tile img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  filter: brightness(0.72);
}
.cep-cat-shade {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.05), rgba(0,0,0,0.45));
}
.cep-cat-label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800;
  padding: 8px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.55);
  z-index: 1;
}
.cep-cat-fav {
  background: linear-gradient(145deg, #5b6cff 0%, #3b49d9 55%, #5865f2 100%);
}
.cep-cat-fav-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,0.25), transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(0,0,0,0.2), transparent 50%);
}
.cep-gif-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: flex-start;
}
.cep-gif-back {
  flex: 0 0 100%;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text2);
  font-size: 13px;
  font-weight: 700;
  padding: 4px 2px 8px;
  cursor: pointer;
}
.cep-gif {
  position: relative;
  box-sizing: border-box;
  width: calc(50% - 4px);
  flex: 0 0 calc(50% - 4px);
  height: 120px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0,0,0,0.2);
  cursor: pointer;
}
.cep-gif-img,
.cep-gif img {
  position: absolute !important;
  top: 0 !important; left: 0 !important;
  width: 100% !important; height: 100% !important;
  max-width: none !important; max-height: none !important;
  margin: 0 !important;
  object-fit: cover !important;
  display: block !important;
}
.cep-gif-star {
  position: absolute;
  top: 6px; right: 6px;
  z-index: 2;
  width: 28px; height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.45);
  color: rgba(255,255,255,0.75);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.cep-gif-star.on { color: #ffd84d; text-shadow: 0 0 8px rgba(255,216,77,0.55); }
.cep-klipy-attr {
  flex-shrink: 0;
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text3);
  padding: 2px 8px 8px;
  opacity: 0.8;
}
.cep-hint {
  width: 100%; flex: 0 0 100%;
  text-align: center; color: var(--text2);
  font-size: 13px; padding: 28px 12px;
}
.cep-gif-grid > .loading-spinner {
  width: 100%; flex: 0 0 100%; padding: 24px;
}
.bubble-sticker-emoji {
  font-size: 64px; line-height: 1; padding: 4px 0;
}
.bubble-sticker {
  width: 140px; height: 140px; object-fit: contain;
  display: block; background: transparent;
  image-rendering: auto;
  -ms-interpolation-mode: bicubic;
}
/* Эмодзи из /images/emojis — крупнее и чётче (после HD-апгрейда до 256px) */
.bubble-sticker--emoji {
  width: 160px; height: 160px;
}
.bubble-gif {
  max-height: 220px; border-radius: 14px; margin-bottom: 0;
}
.chat-bubble.mine:has(.bubble-sticker-emoji),
.chat-bubble.theirs:has(.bubble-sticker-emoji),
.chat-bubble.mine:has(.bubble-sticker),
.chat-bubble.theirs:has(.bubble-sticker),
.chat-bubble.bubble-media-only {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0;
  overflow: visible;
}
.bubble-media-wrap {
  position: relative;
  display: inline-block;
  max-width: 100%;
  line-height: 0;
  border-radius: 16px;
  overflow: hidden;
}
.bubble-media-wrap[data-action="open-media-viewer"] {
  cursor: pointer;
}

/* ── Media viewer (GIF lightbox) ─────────────────────── */
.media-viewer {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .18s ease;
  pointer-events: none;
}
.media-viewer.open {
  opacity: 1;
  pointer-events: auto;
}
.media-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .92);
}
.media-viewer-toolbar {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
}
.media-viewer-tools,
.media-viewer-close {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(40, 40, 42, .92);
  border: none;
  border-radius: 14px;
  color: rgba(235, 235, 240, .92);
  box-shadow: 0 2px 12px rgba(0,0,0,.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.media-viewer-tools {
  gap: 2px;
  padding: 4px;
}
.media-viewer-btn,
.media-viewer-close {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: inherit;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease;
}
.media-viewer-close {
  background: rgba(40, 40, 42, .92);
  flex-shrink: 0;
}
.media-viewer-btn:hover,
.media-viewer-close:hover {
  background: rgba(70, 70, 74, .95);
}
.media-viewer-btn:active,
.media-viewer-close:active {
  background: rgba(90, 90, 96, .95);
}
.media-viewer-btn .tl-ico,
.media-viewer-close .tl-ico,
.media-viewer-more-item .tl-ico {
  width: 20px !important;
  height: 20px !important;
  object-fit: contain;
  flex-shrink: 0;
  /* светлые иконки на тёмной панели; чёрные SVG → белые */
  filter: brightness(0) invert(1);
  opacity: 0.92;
}
.media-viewer-more-item .tl-ico {
  width: 18px !important;
  height: 18px !important;
}
.media-viewer-more-menu {
  position: absolute;
  top: calc(max(12px, env(safe-area-inset-top)) + 52px);
  right: max(12px, env(safe-area-inset-right));
  z-index: 4;
  min-width: 240px;
  padding: 6px;
  background: rgba(40, 40, 42, .96);
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(0,0,0,.45);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.media-viewer-more-menu.hidden { display: none; }
.media-viewer-more-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: rgba(245, 245, 247, .95);
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.media-viewer-more-item:hover {
  background: rgba(70, 70, 74, .9);
}
.media-viewer-more-item svg {
  flex-shrink: 0;
  opacity: .9;
}
.media-viewer-stage {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(92vw, 720px);
  height: min(78vh, 720px);
  pointer-events: none;
}
.media-viewer-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  transform-origin: center center;
  transition: transform .2s ease;
  pointer-events: auto;
  user-select: none;
  -webkit-user-drag: none;
}
.bubble-media-wrap .bubble-media {
  margin-bottom: 0;
  border-radius: 16px;
}
.bubble-gif-badge {
  position: absolute;
  top: 8px; left: 8px;
  z-index: 2;
  padding: 3px 7px;
  border-radius: 8px;
  background: rgba(0,0,0,.45);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 1.2;
  pointer-events: none;
}
.chat-bubble.bubble-media-only {
  position: relative;
  max-width: min(75%, 280px);
  width: fit-content;
}
.chat-bubble.bubble-media-only .bubble-media-meta {
  position: absolute;
  right: 8px; bottom: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(0,0,0,.45);
  color: #fff;
  font-size: 11px;
  line-height: 1.2;
  margin: 0;
  opacity: 1;
  pointer-events: none;
}
.chat-bubble.bubble-media-only .bubble-media-meta .msg-tick {
  stroke: #fff;
  width: 14px; height: 10px;
}
.chat-bubble.bubble-media-only .bubble-time { display: none; }

/* Preview strip */
.chat-media-preview {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px;
  background: var(--card);
  border-top: 1px solid var(--border);
}
.chat-media-preview.hidden { display: none; }
.chat-media-thumb {
  max-height: 80px; max-width: 140px;
  border-radius: 8px; object-fit: cover; display: block;
}
.chat-media-clear {
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(128,128,128,.45); color: #fff;
  font-size: 14px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  transition: background var(--transition);
}
.chat-media-clear:hover { background: rgba(var(--red-rgb),.7); }

/* Media inside message bubble */
.bubble-media {
  max-width: 100%; max-height: 260px;
  border-radius: 16px; display: block;
  margin-bottom: 4px; object-fit: contain;
  cursor: pointer;
}

/* Shared post card inside DM bubble */
.shared-post-card {
  width: 220px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 13px;
  user-select: none;
  cursor: pointer;
}
.shared-post-header {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px 6px;
}
.shared-post-author {
  font-weight: 600; font-size: 12px; color: var(--text);
}
.shared-post-media-wrap {
  position: relative;
  background: #000;
  line-height: 0;
}
.shared-post-media {
  width: 100%;
  display: block;
  max-height: 300px;
  object-fit: cover;
  background: #000;
  pointer-events: none;
}
video.shared-post-media {
  max-height: 300px;
  object-fit: contain;
  pointer-events: none;
}
.shared-post-play {
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.25);
  color: #fff;
  pointer-events: none;
}
.shared-post-play svg { filter: drop-shadow(0 1px 3px rgba(0,0,0,.5)); }
.shared-post-text {
  padding: 6px 10px 8px;
  color: var(--text2);
  font-size: 12px;
  line-height: 1.4;
  word-break: break-word;
}

.chat-empty {
  text-align: center; color: var(--text3);
  padding: 40px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.chat-empty svg { width: 48px; height: 48px; opacity: 0.25; }
.chat-empty-channel { gap: 10px; }
.chat-empty-inline {
  margin: 18px auto 8px;
  padding: 20px 16px;
  max-width: 280px;
}
.chat-empty-av {
  width: 72px; height: 72px; margin: 0 auto 4px;
  border-radius: 50%; overflow: hidden;
}
.chat-empty-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text2);
}
.chat-empty-cta {
  margin-top: 4px;
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  background: var(--red);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: none;
}
.chat-empty-cta:active { filter: brightness(0.94); }

/* ══════════════════════════════════════════════════════
   PROFILE SCREEN
   ══════════════════════════════════════════════════════ */
.profile-container { padding-bottom: 20px; }
.profile-hero {
  background: var(--profile-hero-bg, linear-gradient(135deg, var(--red), var(--red-light)));
  padding: 32px 20px 24px;
  display: flex; flex-direction: column; align-items: center;
  color: #fff;
  position: relative;
  overflow: hidden;
}

/* Стикеры на профиле — повторяющийся паттерн как в Telegram */
.profile-stickers {
  position: absolute;
  /* выходим за края, чтобы после поворота не было пустых углов */
  inset: -60%;
  pointer-events: none;
  z-index: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-content: flex-start;
  align-items: flex-start;
  /* диагональный наклон */
  transform: rotate(-22deg);
  animation: stickerPatternPulse 5s ease-in-out infinite alternate;
}
@keyframes stickerPatternPulse {
  from { opacity: 0.16; }
  to   { opacity: 0.28; }
}
.profile-sticker {
  font-size: 30px;
  line-height: 1;
  user-select: none;
  flex-shrink: 0;
}
.profile-sticker-img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}
/* Кнопка лого в пикере стикеров */
.sticker-pick-logo {
  padding: 4px;
}
.sticker-pick-img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  display: block;
}
.profile-hero > *:not(.profile-stickers):not(.profile-stickers-overlay) { position: relative; z-index: 1; }

/* Оверлей стикеров — внутри hero-блока, обрезается его overflow:hidden */
.profile-stickers-overlay {
  position: absolute;
  inset: -100%;
  pointer-events: none;
  z-index: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-content: flex-start;
  align-items: flex-start;
  transform: rotate(-22deg);
  animation: stickerPatternPulse 5s ease-in-out infinite alternate;
}

/* Стикер-пикер — радио-стиль (один выбор) */
.sticker-pick-btn.active {
  background: var(--red-bg);
  border-color: var(--red);
  box-shadow: 0 0 0 2px var(--red);
  transform: scale(1.12);
}

/* Настройки профиля — палитра цветов */
.profile-bg-picker {
  display: flex; flex-wrap: wrap; gap: 10px;
  padding: 4px 0 8px;
}
.profile-bg-swatch {
  width: 42px; height: 42px;
  border-radius: 12px;
  cursor: pointer;
  border: 3px solid transparent;
  transition: border-color 0.2s, transform 0.15s;
  flex-shrink: 0;
  /* Never liquid-glass — keep preset gradient from inline style */
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.profile-bg-swatch.tl-liquid-btn::before { display: none !important; }
.profile-bg-swatch:active { transform: scale(0.92); }
.profile-bg-swatch.selected { border-color: var(--red); }
.af-pick-btn.tl-liquid-btn,
.sticker-pick-btn.tl-liquid-btn {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: none !important;
}
.af-pick-btn.tl-liquid-btn::before,
.sticker-pick-btn.tl-liquid-btn::before { display: none !important; }

/* Стикер-пикер */
.sticker-picker {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 4px 0 8px;
}
.sticker-pick-btn {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  font-size: 24px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s, border-color 0.15s;
}
.sticker-pick-btn:active { transform: scale(0.88); background: var(--red-bg); border-color: var(--red); }
.sticker-pick-btn.active { background: var(--red-bg); border-color: var(--red); }
.sticker-clear-btn {
  font-size: 13px; color: var(--red);
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--red-bg);
  border: 1.5px solid var(--red);
  cursor: pointer;
  align-self: center;
  font-weight: 600;
}
.profile-avatar-wrap {
  width: 88px; height: 88px;
  margin-bottom: 12px;
}
.profile-name { font-size: 22px; font-weight: 800; margin-bottom: 2px; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,0.45); }
.profile-username {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  margin-bottom: 6px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.uprofile-username {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.75);
  margin-bottom: 6px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.uprofile-name { text-shadow: 0 1px 4px rgba(0,0,0,0.45); }

/* Адаптивный контраст имени на светлом / тёмном фоне профиля */
.profile-name.contrast-on-light,
.uprofile-name.contrast-on-light {
  color: #111 !important;
  text-shadow: 0 1px 2px rgba(255,255,255,0.9), 0 0 10px rgba(255,255,255,0.55);
}
.profile-username.contrast-on-light,
.uprofile-username.contrast-on-light {
  color: rgba(17,17,17,0.78) !important;
  text-shadow: 0 1px 2px rgba(255,255,255,0.85), 0 0 8px rgba(255,255,255,0.45);
}
.profile-bio.contrast-on-light,
.uprofile-bio.contrast-on-light {
  color: rgba(17,17,17,0.82) !important;
  text-shadow: 0 1px 2px rgba(255,255,255,0.8);
}
.profile-name.contrast-on-dark,
.uprofile-name.contrast-on-dark {
  color: #fff !important;
  text-shadow: 0 1px 4px rgba(0,0,0,0.65), 0 0 10px rgba(0,0,0,0.35);
}
.profile-username.contrast-on-dark,
.uprofile-username.contrast-on-dark {
  color: rgba(255,255,255,0.85) !important;
  text-shadow: 0 1px 3px rgba(0,0,0,0.55);
}
.profile-bio.contrast-on-dark,
.uprofile-bio.contrast-on-dark {
  color: rgba(255,255,255,0.88) !important;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.field-hint {
  font-size: 12px;
  color: var(--text3);
  margin-top: 6px;
  line-height: 1.35;
}
.profile-bio { font-size: 13px; opacity: 0.85; text-align: center; max-width: 260px; margin-bottom: 16px; }
.profile-stats {
  display: flex; gap: 24px;
  background: rgba(255,255,255,0.15);
  border-radius: 14px;
  padding: 12px 24px;
  backdrop-filter: blur(8px);
}
.profile-stat { text-align: center; }
.profile-stat-num { font-size: 20px; font-weight: 800; }
.profile-stat-label { font-size: 11px; opacity: 0.8; margin-top: 2px; }

.coins-banner {
  margin: 16px;
  background: linear-gradient(135deg, #FFD700, #FFA500);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer;
}
.coins-banner-left { display: flex; align-items: center; gap: 10px; }
.coins-icon { font-size: 28px; display: inline-flex; align-items: center; justify-content: center; }
.coins-icon .tl-ico { width: 28px; height: 28px; }
.coins-info { }
.coins-label { font-size: 12px; font-weight: 600; color: rgba(0,0,0,0.6); }
.coins-value { font-size: 22px; font-weight: 900; color: #333; }
.coins-buy-btn {
  background: rgba(0,0,0,0.15);
  color: #333;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px; font-weight: 700;
}

.settings-section {
  margin: 8px 16px;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.settings-section-title {
  font-size: 11px; font-weight: 700;
  color: var(--text3);
  text-transform: uppercase; letter-spacing: 0.8px;
  padding: 12px 16px 6px;
}
.setting-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: background var(--transition);
  border-top: 1px solid var(--border);
  position: relative;
}
.setting-item:first-child { border-top: none; }
.setting-item:active { background: var(--surface); }
.setting-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.setting-icon.red { background: var(--red-bg); }
.setting-icon.blue { background: #E8F4FF; }
.setting-icon.green { background: #E8FFF0; }
.setting-icon.orange { background: #FFF5E8; }
.setting-icon.purple { background: #F5E8FF; }
.setting-label { flex: 1; font-size: 15px; font-weight: 500; }
.setting-value { font-size: 13px; color: var(--text3); margin-right: 6px; }
.setting-chevron { color: var(--text3); }
.setting-chevron svg { width: 16px; height: 16px; }
.setting-item.danger .setting-label { color: var(--red); }
.setting-item.danger .setting-icon { background: var(--red-bg); }

.settings-group-label {
  font-size: 13px; font-weight: 600; color: var(--text3);
  margin: 4px 4px 8px; line-height: 1.3;
}

/* ── Language settings (Telegram-style) ── */
.lang-settings-body { padding-top: 4px; }
.lang-settings-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 8px;
}
.lang-check-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  width: 100%;
  background: none;
  border-left: none;
  border-right: none;
  border-bottom: none;
  color: inherit;
  font: inherit;
  text-align: left;
  box-sizing: border-box;
}
.lang-check-row:first-child { border-top: none; }
.lang-check-row:active { background: var(--surface); }
.lang-check-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.lang-check-box {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--text3);
  flex-shrink: 0;
  position: relative;
  background: transparent;
  transition: background .15s, border-color .15s;
}
.lang-check-row input:checked + .lang-check-box {
  background: var(--red);
  border-color: var(--red);
}
.lang-check-row input:checked + .lang-check-box::after {
  content: '';
  position: absolute;
  left: 6px; top: 2px;
  width: 5px; height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.lang-check-box.is-off {
  opacity: 0.45;
  background: transparent;
}
.lang-check-label {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}
.lang-check-row.is-locked {
  opacity: 0.55;
  cursor: default;
}
.lang-check-row.is-locked:active { background: none; }
.lang-lock {
  display: inline-flex;
  opacity: 0.7;
  flex-shrink: 0;
}
.lang-lock .tl-ico { width: 16px; height: 16px; }
.lang-settings-hint {
  font-size: 13px;
  color: var(--text3);
  line-height: 1.4;
  margin: 0 4px 18px;
  padding: 0 2px;
}
.lang-iface-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.lang-iface-native {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.lang-iface-en {
  font-size: 13px;
  color: var(--text3);
}
.lang-iface-group .settings-radio-row input:checked + .settings-radio-dot {
  border-color: var(--red);
}
.lang-iface-group .settings-radio-row input:checked + .settings-radio-dot::after {
  background: var(--red);
}
.settings-radio-group {
  display: flex; flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 8px;
}
.settings-radio-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  border-top: 1px solid var(--border);
  user-select: none;
}
.settings-radio-row:first-child { border-top: none; }
.settings-radio-row:active { background: var(--surface); }
.settings-radio-row input {
  position: absolute; opacity: 0; pointer-events: none;
}
.settings-radio-dot {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--text3);
  flex-shrink: 0;
  position: relative;
  transition: border-color .15s;
}
.settings-radio-row input:checked + .settings-radio-dot {
  border-color: var(--primary, #2AABEE);
}
.settings-radio-row input:checked + .settings-radio-dot::after {
  content: '';
  position: absolute; inset: 4px;
  border-radius: 50%;
  background: var(--primary, #2AABEE);
}
.settings-radio-label {
  flex: 1; font-size: 15px; font-weight: 500; color: var(--text);
}
.settings-radio-emoji {
  font-size: 18px; line-height: 1; flex-shrink: 0;
}
.chat-dbl-react-picker.hidden { display: none; }
.chat-dbl-react-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  padding: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: min(42vh, 320px);
  overflow-y: auto;
  scrollbar-width: thin;
}
.chat-dbl-react-pick {
  aspect-ratio: 1;
  border: none;
  border-radius: 12px;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s, transform .12s;
}
.chat-dbl-react-pick:active { transform: scale(1.15); }
.chat-dbl-react-pick.selected {
  background: rgba(42, 171, 238, .18);
  box-shadow: inset 0 0 0 1.5px var(--primary, #2AABEE);
}

/* Language switcher */
.lang-switcher { display: flex; gap: 4px; flex-shrink: 0; }
.lang-btn {
  padding: 4px 12px; border-radius: 20px; font-size: 13px; font-weight: 600;
  border: 1.5px solid var(--border); background: transparent;
  color: var(--text2); cursor: pointer; transition: all 0.18s;
}
.lang-btn.active {
  background: var(--primary); border-color: var(--primary);
  color: #fff;
}
.lang-btn:not(.active):active { background: var(--surface); }

/* Toggle switch */
.toggle-switch {
  position: relative; width: 48px; height: 26px; flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 13px;
  cursor: pointer;
  transition: 0.3s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.3s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.toggle-switch input:checked + .toggle-slider { background: var(--red); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(22px); }

/* ══════════════════════════════════════════════════════
   AVATAR
   ══════════════════════════════════════════════════════ */
/* ── Avatar Frames ───────────────────────────────────── */
.av-frame {
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.av-frame > * { position: relative; z-index: 1; }

.av-frame-red          { background: linear-gradient(135deg,#E8001D,#FF4D64); }
.av-frame-gold         { background: linear-gradient(135deg,#f9ca24,#f0932b,#c8860a); }
.av-frame-rainbow      { background: linear-gradient(135deg,#ff0000,#ff8800,#ffff00,#00cc66,#0088ff,#8800ff); }
.av-frame-fire         { background: linear-gradient(135deg,#ff4500,#ff8c00,#ffd700); }
.av-frame-ice          { background: linear-gradient(135deg,#74b9ff,#0984e3,#a8edff); }
.av-frame-neon         { background: linear-gradient(135deg,#00ff41,#00b894); }
.av-frame-purple       { background: linear-gradient(135deg,#6c5ce7,#a29bfe); }
.av-frame-rose         { background: linear-gradient(135deg,#fd79a8,#e84393); }
.av-frame-cosmic       { background: linear-gradient(135deg,#1a1a2e,#e94560); }

.av-frame-anim_rainbow::before,
.av-frame-anim_fire::before {
  content: ''; position: absolute; inset: -100%; z-index: 0;
  animation: av-spin 3s linear infinite;
}
.av-frame-anim_rainbow::before { background: conic-gradient(from 0deg,#ff0000,#ff8800,#ffff00,#00ff88,#0088ff,#8800ff,#ff0000); }
.av-frame-anim_fire::before    { background: conic-gradient(from 0deg,#ff4500,#ff8c00,#ffd700,#ff8c00,#ff4500); animation-duration: 2s; }
@keyframes av-spin { to { transform: rotate(360deg); } }

/* Пикер рамок */
.pd-modal-body { padding-bottom: 8px; }
.pd-section-label { font-size: 13px; font-weight: 600; color: var(--text2); margin-bottom: 10px; }
.pd-hint { font-size: 12px; color: var(--text3); margin-top: 6px; }

.avatar-frame-picker {
  display: flex; flex-wrap: wrap; gap: 10px; padding: 4px 0;
}
.af-pick-btn {
  background: none; border: 2.5px solid transparent;
  border-radius: 50%; padding: 2px; cursor: pointer;
  transition: border-color 0.15s;
}
.af-pick-btn:hover   { border-color: var(--text2); }
.af-pick-btn.af-selected { border-color: var(--red); }

.avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
  overflow: hidden;
}
.avatar-text {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 16px;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.22);
}
/* Крупный аватар на красном hero — белое кольцо, чтобы не сливался */
.profile-hero .avatar-text,
.uprofile-hero .avatar-text,
.profile-avatar-wrap .avatar-text {
  box-shadow:
    0 0 0 3px rgba(255,255,255,0.92),
    0 6px 18px rgba(0,0,0,0.28);
}

/* ══════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════ */
.btn {
  padding: 9px 20px;
  border-radius: 50px;
  font-size: 13px; font-weight: 700;
  transition: all var(--transition);
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.btn-sm { padding: 7px 14px; font-size: 12px; }
.btn-outline {
  border: 1.5px solid var(--border);
  color: var(--text);
}
.btn-outline:active { background: var(--surface); }
.btn-red { background: var(--red); color: #fff; box-shadow: 0 3px 10px rgba(var(--red-rgb), 0.3); }
.btn-red:active { transform: scale(0.96); }
.btn-following {
  border: 1.5px solid var(--red);
  color: var(--red);
}
.btn-following:active { background: var(--red-bg); }

/* ══════════════════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════════════════ */
#overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}
#modal {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  margin: 0 auto;
  width: 100%; max-width: 480px;
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  border-radius: 22px 22px 0 0;
  border: 1px solid rgba(255,255,255,0.7);
  z-index: 201;
  max-height: calc(var(--real-vh) * 85);
  overflow-y: auto;
  transform: translateY(0);
  animation: slideUp 0.38s cubic-bezier(0.22, 1, 0.36, 1);
  scrollbar-width: none;
  box-shadow: 0 -12px 40px rgba(0,0,0,0.12);
  isolation: isolate;
}
#modal > .modal-glass {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(20px) saturate(170%);
  -webkit-backdrop-filter: blur(20px) saturate(170%);
}
html.lg-svg-backdrop #modal > .modal-glass.lg-ready {
  backdrop-filter: var(--lg-filter, url(#liquidGlassModal)) saturate(160%);
  -webkit-backdrop-filter: var(--lg-filter, url(#liquidGlassModal)) saturate(160%);
}
#modal > *:not(.modal-glass) {
  position: relative;
  z-index: 1;
}
[data-theme="dark"] #modal {
  background: rgba(28,28,32,0.72);
  border-color: rgba(255,255,255,0.1);
}
[data-theme="dark"] #modal > .modal-glass {
  background: rgba(18, 20, 26, 0.28);
}
#modal::-webkit-scrollbar { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0.85; }
  to   { transform: translateY(0); opacity: 1; }
}
.modal-handle {
  width: 40px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 12px auto 0;
  /* Увеличиваем зону касания */
  position: relative;
}
.modal-handle::before {
  content: '';
  position: absolute;
  inset: -12px -40px;
}
.modal-title {
  font-size: 18px; font-weight: 800;
  padding: 16px 20px 0;
  text-align: center;
}
.modal-header-row {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 8px 48px 0;
  min-height: 44px;
}
.modal-header-row .modal-title {
  padding: 8px 0 0;
  flex: 1;
  text-align: center;
}
.modal-back-btn {
  width: 36px; height: 36px;
  border: none; background: transparent;
  color: var(--text);
  font-size: 28px; line-height: 1;
  cursor: pointer;
  border-radius: 10px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.modal-back-btn:active { background: rgba(127,127,127,.28); }
.modal-close-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(127,127,127,.18);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
}
.modal-close-btn:active { background: rgba(127,127,127,.28); }
.modal-body { padding: 16px 20px 24px; }
.modal-confirm-body {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}
.modal-confirm-text {
  margin: 0 0 6px;
  color: var(--text2);
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
}
.modal-confirm-body .btn {
  justify-content: center;
  text-align: center;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 15px;
}
.btn-danger-solid {
  background: var(--red) !important;
  color: #fff !important;
  border: none;
}

/* ── Donate modal ── */
.donate-header {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding-top: 20px;
}
.donate-icon {
  font-size: 40px;
  animation: donatePulse 2s ease-in-out infinite;
}
@keyframes donatePulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.15); }
}
.donate-desc {
  font-size: 14px; color: var(--text2); line-height: 1.6;
  text-align: center; margin: 0 0 16px;
}
.donate-block {
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.donate-block-header {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  margin-bottom: 12px;
}
.donate-method-icon {
  font-size: 22px;
  grid-row: 1 / 3;
  align-self: center;
}
.donate-method-name { font-size: 15px; font-weight: 700; }
.donate-method-sub  { font-size: 12px; color: var(--text3); }
.donate-wallet-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg3);
  border-radius: 10px;
  padding: 10px 12px;
}
.donate-wallet-addr {
  flex: 1; font-size: 12px; font-family: monospace;
  color: var(--text2); word-break: break-all;
  line-height: 1.4;
}
.donate-copy-btn {
  display: flex; align-items: center; gap: 5px;
  flex-shrink: 0;
  background: var(--red); color: #fff;
  border-radius: 8px; padding: 7px 10px;
  font-size: 12px; font-weight: 700;
  transition: opacity 0.15s;
}
.donate-copy-btn:active { opacity: 0.75; }
.donate-pally-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--accent-grad);
  color: #fff; border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px; font-weight: 700;
  text-decoration: none;
  transition: opacity 0.15s;
}
.donate-pally-btn:active { opacity: 0.8; }
.donate-thanks {
  text-align: center; font-size: 13px; color: var(--text3);
  margin: 16px 0 0;
}

/* Coins modal */
.coins-packages { display: flex; flex-direction: column; gap: 10px; }
.coin-pkg {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.coin-pkg:active { border-color: var(--red); background: var(--red-bg); }
.coin-pkg-icon { font-size: 32px; }
.coin-pkg-info { flex: 1; }
.coin-pkg-name { font-size: 15px; font-weight: 700; }
.coin-pkg-coins { font-size: 13px; color: var(--text2); }
.coin-pkg-bonus { font-size: 11px; color: #22C55E; font-weight: 600; margin-top: 2px; }
.coin-pkg-price {
  font-size: 16px; font-weight: 800;
  color: var(--red);
}

/* Create post modal */
.create-post-form { display: flex; flex-direction: column; gap: 14px; }
.create-post-form textarea {
  width: 100%;
  min-height: 120px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  font-size: 15px;
  color: var(--text);
  resize: none;
  transition: border-color var(--transition);
}
.create-post-form textarea:focus { border-color: var(--red); }
.create-post-form textarea::placeholder { color: var(--text3); }

/* Privacy policy modal */
.privacy-content {
  font-size: 14px; color: var(--text2); line-height: 1.7;
}
.privacy-content h3 { font-size: 16px; font-weight: 700; color: var(--text); margin: 16px 0 8px; }
.privacy-content h3:first-child { margin-top: 0; }
.privacy-content p { margin-bottom: 10px; }

/* Start stream modal */
.start-stream-form { display: flex; flex-direction: column; gap: 12px; }
.start-stream-form input,
.start-stream-form textarea {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  font-size: 15px;
  color: var(--text);
  transition: border-color var(--transition);
}
.start-stream-form input:focus,
.start-stream-form textarea:focus { border-color: var(--red); }
.start-stream-form input::placeholder,
.start-stream-form textarea::placeholder { color: var(--text3); }

/* ── Прогресс загрузки поста (фото/видео) ────────────── */
.post-upload-progress {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  width: calc(100% - 32px);
  max-width: 420px;
  z-index: 320;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(18, 18, 18, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.post-upload-progress.open {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.post-upload-progress.closing {
  opacity: 0;
  transform: translateX(-50%) translateY(-10px);
}
.post-upload-progress-label {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: 0.01em;
}
.post-upload-progress-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}
.post-upload-progress-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #FF5A6A, #E8001D);
  transition: width 0.12s linear;
}

/* ══════════════════════════════════════════════════════
   TOAST
   ══════════════════════════════════════════════════════ */
#toast-container {
  position: fixed; top: calc(var(--bar-h) + 8px); left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
  width: calc(100% - 32px); max-width: 440px;
}
.toast {
  background: var(--text);
  color: var(--bg);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s cubic-bezier(0.16,1,0.3,1), toastOut 0.3s ease 2.5s forwards;
  display: flex; align-items: center; gap: 8px;
}
.toast.success { background: #22C55E; color: #fff; }
.toast.error { background: var(--red); color: #fff; }
@keyframes toastIn { from { opacity:0; transform:translateY(-10px); } to { opacity:1; transform:translateY(0); } }
@keyframes toastOut { to { opacity:0; transform:translateY(-10px); } }

/* ── Undo Snackbar (удаление чата) ── */
#undo-snackbar {
  position: fixed;
  bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom, 0px));
  left: 50%; transform: translateX(-50%);
  width: calc(100% - 32px); max-width: 420px;
  background: #323232;
  color: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.28);
  z-index: 10000;
  animation: snackIn 0.3s cubic-bezier(0.16,1,0.3,1);
  overflow: hidden;
}
[data-theme="dark"] #undo-snackbar { background: #3a3a3a; }
#undo-snackbar .snack-text { flex: 1; font-size: 14px; font-weight: 500; }
#undo-snackbar .snack-undo {
  font-size: 14px; font-weight: 700;
  color: var(--red);
  background: none; border: none;
  padding: 4px 0; cursor: pointer;
  flex-shrink: 0;
}
#undo-snackbar .snack-timer {
  font-size: 13px; color: rgba(255,255,255,0.5);
  flex-shrink: 0; min-width: 18px; text-align: right;
}
#undo-snackbar .snack-progress {
  position: absolute;
  bottom: 0; left: 0; height: 3px;
  background: var(--red);
  border-radius: 0;
}
@keyframes snackIn {
  from { opacity:0; transform:translateX(-50%) translateY(20px); }
  to   { opacity:1; transform:translateX(-50%) translateY(0); }
}

/* ══════════════════════════════════════════════════════
   LOADING / EMPTY
   ══════════════════════════════════════════════════════ */
.loading-spinner {
  display: flex; align-items: center; justify-content: center;
  padding: 48px;
  flex-direction: column; gap: 12px;
  color: var(--text3);
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center; color: var(--text3);
  padding: 48px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.empty-state svg { width: 56px; height: 56px; opacity: 0.2; }
.empty-state h3 { font-size: 17px; font-weight: 700; color: var(--text2); }
.empty-state p { font-size: 14px; }

/* ══════════════════════════════════════════════════════
   SECTION HEADERS & COMMON
   ══════════════════════════════════════════════════════ */
.section-title {
  font-size: 18px; font-weight: 800;
  padding: 14px 16px 8px;
}
.divider { height: 1px; background: var(--border); margin: 4px 0; }

/* Scroll padding under floating nav is set on #screen-content above */

/* ── Profile Topbar & Avatar ─────────────────────────── */
.profile-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px 0;
}
.profile-settings-btn {
  display: flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 700; color: var(--text2);
  padding: 8px 12px;
  border-radius: 50px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  transition: color var(--transition), border-color var(--transition);
}
.profile-settings-btn svg { width: 18px; height: 18px; }
.profile-settings-btn:active { color: var(--red); border-color: var(--red); }
.profile-coins-chip {
  display: flex; align-items: center; gap: 6px;
  font-size: 15px; font-weight: 800;
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: #333;
  border-radius: 50px;
  padding: 8px 14px;
  cursor: pointer;
}

.profile-avatar-wrap {
  position: relative; display: inline-block; cursor: pointer;
}
/* Тап по аватарке открывает просмотр; смена фото — маленькая кнопка-камера в углу */
.profile-avatar-overlay {
  position: absolute; right: -2px; bottom: -2px;
  width: 30px; height: 30px;
  background: var(--red, #e8001d);
  border: 2px solid var(--bg, #fff);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; cursor: pointer;
  z-index: 2;
}
.profile-avatar-overlay svg { width: 14px; height: 14px; }
.avatar-view { display: inline-block; cursor: zoom-in; border-radius: 50%; }
.uprofile-hero .avatar-view { display: inline-flex; }
.profile-hero { align-items: center; }

/* ── In-App Notification (Telegram-style) ────────────── */
.tg-notif {
  position: fixed;
  top: max(10px, env(safe-area-inset-top, 0px));
  left: 12px; right: 12px;
  width: auto; max-width: 420px;
  margin: 0 auto;
  z-index: 520;
  color: #fff;
  pointer-events: auto;
  -webkit-user-select: none; user-select: none;
  touch-action: pan-y;
  opacity: 0;
  transform: translateY(calc(-100% - 16px));
  transition: transform .38s cubic-bezier(.22,1,.36,1), opacity .28s ease;
}
.tg-notif.show {
  opacity: 1;
  transform: translateY(0);
}
.tg-notif-card {
  background: rgba(44, 44, 46, 0.92);
  backdrop-filter: blur(28px) saturate(1.5);
  -webkit-backdrop-filter: blur(28px) saturate(1.5);
  border-radius: 22px;
  box-shadow: 0 10px 36px rgba(0,0,0,.38);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.06);
}
.tg-notif-main {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 10px 10px;
  cursor: pointer;
}
.tg-notif-av {
  flex-shrink: 0;
  width: 42px; height: 42px;
  border-radius: 50%;
  overflow: hidden;
}
.tg-notif-av .avatar,
.tg-notif-av .avatar-text,
.tg-notif-av .av-frame {
  width: 42px !important;
  height: 42px !important;
}
.tg-notif-av .avatar-text { font-size: 15px !important; }
.tg-notif-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.tg-notif-name {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tg-notif-body {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.3;
  opacity: .92;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tg-notif-app {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--red, #E8001D);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.tg-notif-reply {
  display: none;
  padding: 0 10px 10px;
  gap: 8px;
  align-items: center;
}
.tg-notif.expanded .tg-notif-reply {
  display: flex;
  animation: tgNotifReplyIn .22s ease;
}
@keyframes tgNotifReplyIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.tg-notif.expanded .tg-notif-body {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.tg-notif-reply-input {
  flex: 1;
  min-width: 0;
  height: 36px;
  border: none;
  outline: none;
  border-radius: 18px;
  padding: 0 14px;
  font-size: 14px;
  color: #fff;
  background: rgba(255,255,255,.12);
  -webkit-user-select: text; user-select: text;
}
.tg-notif-reply-input::placeholder { color: rgba(255,255,255,.45); }
.tg-notif-reply-send {
  flex-shrink: 0;
  width: 36px; height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--red, #E8001D);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.tg-notif-reply-send:disabled { opacity: .45; }
.tg-notif-reply-send svg { width: 18px; height: 18px; }
.tg-notif.pressing .tg-notif-card {
  transform: scale(.985);
  transition: transform .12s ease;
}
/* legacy alias */
.inapp-notif { display: none; }

/* ── Activity / Notifications panel ──────────────────── */
#modal.modal--flat,
#modal:has(.activity-panel) {
  background: var(--card, #1c1c1e);
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: 1px solid var(--border);
  box-shadow: 0 -10px 36px rgba(0, 0, 0, 0.35);
}
#modal.modal--flat > .modal-glass,
#modal:has(.activity-panel) > .modal-glass {
  display: none !important;
}
.activity-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: inherit;
  padding: 0 4px 8px;
}
.activity-panel .modal-handle {
  margin: 10px auto 2px;
  background: rgba(255, 255, 255, 0.22);
}
.activity-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.activity-head-main { min-width: 0; flex: 1; }
.activity-title {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--text);
}
.activity-clear {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  color: var(--text2);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 4px 8px 10px;
  white-space: nowrap;
  border-radius: 0 !important;
  flex-shrink: 0;
}
.activity-clear:hover,
.activity-clear:active { color: var(--text); background: transparent !important; }
.activity-clear.tl-liquid-btn,
.activity-clear.tl-liquid-btn::before {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.activity-clear.tl-liquid-btn::before {
  display: none !important;
  content: none !important;
}
.activity-body-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px;
  padding: 4px 0 8px;
}
.activity-list {
  display: flex;
  flex-direction: column;
}
.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.activity-item:active { background: rgba(255,255,255,.04); }
.activity-item.is-unread .activity-text { font-weight: 500; }
.activity-av { flex-shrink: 0; pointer-events: none; }
.activity-body {
  flex: 1;
  min-width: 0;
}
.activity-text {
  display: block;
  font-size: 14px;
  line-height: 1.35;
  color: var(--text);
  font-weight: 400;
  word-break: break-word;
}
.activity-name {
  font-weight: 700;
  color: var(--text);
}
.activity-time {
  color: var(--text2);
  font-weight: 400;
  white-space: nowrap;
}
.activity-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface);
}
.activity-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.activity-thumb--video,
.activity-thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
  background: var(--surface);
}
.activity-chevron {
  flex-shrink: 0;
  color: var(--text2);
  font-size: 22px;
  line-height: 1;
  opacity: .55;
  padding: 0 2px 2px;
}
.activity-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text2);
  font-size: 14px;
  line-height: 1.45;
}
/* legacy */
.notif-item { display: none; }

/* ── Post Detail Full Screen ─────────────────────────── */
#modal.post-detail-modal,
.post-detail-modal {
  top: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  border-radius: 0 !important;
  height: auto !important;
  max-height: none !important;
  width: 100% !important;
  margin: 0 !important;
  animation: none !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  overflow-y: hidden !important;
  scrollbar-width: none !important;
}
#modal.post-detail-modal::-webkit-scrollbar,
.post-detail-modal::-webkit-scrollbar { display: none !important; width: 0 !important; height: 0 !important; }
#modal.post-detail-modal > .post-detail {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  max-height: 100%;
}
.post-detail {
  display: flex; flex-direction: column;
  height: 100%;
  background: var(--bg);
  overflow-y: auto;
  scrollbar-width: none;
}
.post-detail::-webkit-scrollbar { display: none; }
.post-detail--with-comments {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
  max-height: 100%;
  min-height: 0;
}
.post-detail-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.post-detail-scroll::-webkit-scrollbar { display: none; width: 0; height: 0; }
.post-detail-feed-wrap--embed {
  position: relative;
  height: min(52vh, 420px);
  min-height: 280px;
  flex: none;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.post-detail-feed-wrap--embed.post-detail-feed-wrap--media {
  height: min(62vh, 560px);
  min-height: 320px;
  background: #000;
}
.post-detail-feed-wrap--embed .feed-card {
  height: 100%;
  min-height: 100%;
  border-radius: 0;
}
/* В профиле actions/ник чуть выше низа карточки (скруббер остаётся) */
.post-detail-feed-wrap--embed .feed-card-content,
.post-detail-feed-wrap--embed .feed-card-actions {
  bottom: calc(12px + 36px);
}
.post-detail-feed-wrap--embed .feed-card[data-has-video="true"] .feed-card-content,
.post-detail-feed-wrap--embed .feed-card[data-has-video="true"] .feed-card-actions {
  bottom: calc(12px + 44px);
}
.post-detail-feed-wrap--embed .video-scrubber,
.post-detail-feed-wrap--embed .audio-scrubber {
  top: auto;
  bottom: 8px;
  z-index: 30;
  pointer-events: auto;
  touch-action: none;
}
.post-detail-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: sticky; top: 0; z-index: 5;
}
.post-detail-del {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--red);
  transition: background var(--transition);
}
.post-detail-del:active { background: var(--red-bg); }

.post-detail-media-wrap {
  position: relative;
  width: 100%;
  background: #000;
  display: flex; align-items: center; justify-content: center;
  max-height: calc(var(--real-vh) * 62);
  overflow: hidden;
  flex-shrink: 0;
}
.post-detail-media {
  width: 100%;
  max-height: calc(var(--real-vh) * 62);
  object-fit: contain;
  display: block;
}
.post-detail-gradient {
  width: 100%; height: 300px;
}
.post-detail-info {
  padding: 16px;
  flex: 1;
}
.post-detail-user {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px;
  cursor: pointer;
}
.post-detail-text {
  font-size: 15px; line-height: 1.6;
  color: var(--text);
  margin-bottom: 16px;
}
.post-detail-stats {
  display: flex; align-items: center; gap: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.post-detail-like-btn {
  display: flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 700; color: var(--text2);
  padding: 8px 0;
  transition: color var(--transition);
}
.post-detail-like-btn svg { stroke: currentColor; fill: none; }
.post-detail-like-btn.liked { color: var(--red); }
.post-detail-like-btn.liked svg { fill: var(--red); stroke: var(--red); }
.post-detail-view-count {
  display: flex; align-items: center; gap: 6px;
  font-size: 15px; font-weight: 600; color: var(--text2);
}

/* ── Media Preview Fix (create post) ─────────────────── */
.media-preview-wrap {
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  max-height: calc(var(--real-vh) * 45);
  display: flex; align-items: center; justify-content: center;
}
.media-preview-img {
  width: 100%;
  max-height: calc(var(--real-vh) * 45);
  object-fit: contain;
  display: block;
}

/* ── Immersive feed: hide chrome, keep scrubber ─── */
html.feed-ui-hold #top-bar,
html.feed-ui-hold #bottom-nav,
html.feed-ui-hold .fab,
html.feed-ui-hold .feed-card-overlay,
html.feed-ui-hold .feed-card-content,
html.feed-ui-hold .feed-card-actions,
html.feed-ui-hold .feed-vol-wrap,
html.feed-ui-hold .feed-tap-icon {
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
html.feed-ui-hold #top-bar {
  transform: translateY(-100%);
  visibility: hidden;
}
/* Keep translateX(-50%) so the floating nav stays centered when shown again */
html.feed-ui-hold #bottom-nav {
  transform: translate(-50%, 110%);
  visibility: hidden;
}
/* Scroll down → tuck nav away; scroll up / pull → bring back (IG / TG) */
#bottom-nav.nav-collapsed:not(.hidden) {
  transform: translate(-50%, calc(100% + 28px));
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}
#top-bar,
#bottom-nav {
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.38s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.28s;
}
/* Скруббер остаётся; nav скрыт — чуть ниже, над safe-area */
html.feed-ui-hold .video-scrubber,
html.feed-ui-hold .audio-scrubber {
  opacity: 1 !important;
  pointer-events: auto !important;
  visibility: visible !important;
  top: auto;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
}

/* ── Feed Card Media ─────────────────────────────────── */
.feed-card-media-stage {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #0a0a0a;
}
/* Размытый фон за фото (свободные полосы при contain) */
.feed-card-media-blur {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  object-position: center center;
  filter: blur(28px) saturate(1.15) brightness(0.52);
  transform: scale(1.14);
  pointer-events: none;
}
.feed-card-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  object-position: center center;
  z-index: 1;
}
/* Фото всегда целиком, без обрезки (как в TikTok photo posts) */
.feed-card-media-stage .feed-card-media {
  z-index: 1;
  object-fit: contain;
  object-position: center center;
  background: transparent;
}
video.feed-card-media {
  background: #000;
  z-index: 0;
}
/* Видео: горизонталь — letterbox; остальное cover */
.feed-card-media.is-landscape,
video.feed-card-media.is-letterbox {
  object-fit: contain;
  object-position: center center;
  background: #000;
}

/* Фото-посты: ник/кнопки чуть выше плавающей навбар-капсулы */
.feed-card:not([data-has-video="true"]):not(.feed-card--text) .feed-card-content {
  bottom: calc(14px + var(--nav-h) + env(safe-area-inset-bottom, 0px));
}
.feed-card:not([data-has-video="true"]):not(.feed-card--text) .feed-card-actions {
  bottom: calc(14px + var(--nav-h) + env(safe-area-inset-bottom, 0px));
}

/* ── Create Post Media ───────────────────────────────── */
.create-post-user {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.post-media-btns {
  display: flex; gap: 8px;
}
.post-media-pick {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px; font-weight: 600; color: var(--text2);
  cursor: pointer; font-family: inherit;
  transition: border-color var(--transition), color var(--transition);
}
.post-media-pick:active { border-color: var(--red); color: var(--red); }
.post-media-pick svg { width: 16px; height: 16px; }
.post-media-clear { color: var(--red) !important; border-color: var(--red) !important; }
.media-preview-wrap {
  border-radius: var(--radius);
  overflow: hidden;
  max-height: calc(var(--real-vh) * 38);
  background: #000;
}
.media-preview-img {
  width: 100%;
  max-height: calc(var(--real-vh) * 38);
  object-fit: contain;
  display: block;
}

/* ── User Profile Screen ─────────────────────────────── */
.uprofile-container { overflow-y: auto; height: 100%; }

.uprofile-topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.uprofile-topbar-name {
  flex: 1;
  font-size: 16px; font-weight: 800;
  text-align: center;
}

.uprofile-hero {
  background: var(--profile-hero-bg, linear-gradient(160deg, var(--red) 0%, var(--red-light) 60%, var(--surface) 100%));
  padding: 24px 20px 20px;
  display: flex; flex-direction: column; align-items: center;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.uprofile-hero > *:not(.profile-stickers):not(.profile-stickers-overlay) { position: relative; z-index: 1; }
.uprofile-name {
  font-size: 20px; font-weight: 800;
  margin-top: 10px; margin-bottom: 4px;
}
.uprofile-bio {
  font-size: 13px; opacity: 0.85;
  text-align: center; max-width: 260px;
  margin-bottom: 14px;
  min-height: 18px;
}
.uprofile-stats {
  display: flex; gap: 20px;
  background: rgba(255,255,255,0.18);
  border-radius: 14px;
  padding: 10px 20px;
  backdrop-filter: blur(8px);
  margin-bottom: 14px;
}
.uprofile-stat { text-align: center; }
.uprofile-stat-num  { font-size: 18px; font-weight: 800; }
.uprofile-stat-label{ font-size: 10px; opacity: 0.8; margin-top: 2px; }
.uprofile-action-btns {
  display: flex; gap: 8px; width: 100%;
}

.uprofile-posts-title {
  display: flex; align-items: center; gap: 6px;
  font-size: 15px; font-weight: 800;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
}

/* ── Вкладки профиля ─────────────────────────────────── */
.uprofile-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}
.uprofile-tab {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 13px 8px;
  font-size: 14px; font-weight: 600; color: var(--text-secondary);
  background: none; border: none; cursor: pointer;
  border-bottom: 2.5px solid transparent;
  transition: color 0.18s, border-color 0.18s;
  touch-action: manipulation;
}
.uprofile-tab.active {
  color: var(--red);
  border-bottom-color: var(--red);
}
.uprofile-tab svg { stroke: currentColor; }
.uprofile-tab { font-size: 13px; gap: 4px; padding: 12px 4px; }

/* ── Книжная полка и достижения ──────────────────────── */
.books-tab { padding: 14px 14px 24px; }
.books-tab-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 14px;
}
.books-count { font-size: 15px; font-weight: 800; color: var(--text); }
.books-empty {
  text-align: center; padding: 28px 16px;
  color: var(--text2); display: flex; flex-direction: column;
  align-items: center; gap: 12px;
}
.books-shelf {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}
.book-cover {
  display: flex; flex-direction: column; gap: 6px;
  background: none; border: none; padding: 0;
  cursor: pointer; text-align: left;
  color: var(--text);
}
.book-cover-img, .book-cover-fallback {
  width: 100%; aspect-ratio: 2 / 3;
  object-fit: cover; border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
}
.book-cover-fallback {
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
}
.book-cover-title {
  font-size: 11px; font-weight: 600; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; color: var(--text2);
}
.achievements-block { margin-top: 8px; }
.achievements-title {
  font-size: 15px; font-weight: 800; margin-bottom: 12px; color: var(--text);
}
.achievements-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
}
.ach-badge {
  border-radius: 14px; padding: 14px 12px;
  background: var(--surface); border: 1px solid var(--border);
  text-align: center;
}
.ach-badge.unlocked {
  border-color: rgba(var(--red-rgb),.35);
  background: linear-gradient(160deg, rgba(var(--red-rgb),.08), var(--surface));
}
.ach-badge.locked { opacity: .55; }
.ach-badge-icon { font-size: 26px; margin-bottom: 6px; }
.ach-badge-name { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.ach-badge-progress { font-size: 11px; color: var(--text2); font-weight: 600; }

.books-search-modal { padding: 8px 16px 20px; }
.books-search-title { font-size: 18px; font-weight: 800; margin-bottom: 12px; }
.books-add-tabs {
  display: flex; gap: 6px; margin-bottom: 14px;
  background: var(--surface); border-radius: 12px; padding: 4px;
}
.books-add-tab {
  flex: 1; border: none; background: transparent; color: var(--text2);
  font-size: 13px; font-weight: 700; padding: 9px 10px; border-radius: 10px;
  cursor: pointer;
}
.books-add-tab.active {
  background: var(--card, #fff); color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.book-search-results {
  max-height: 52vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
}
.books-search-hint {
  text-align: center; color: var(--text2); font-size: 13px; padding: 28px 12px;
}
.book-search-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 8px; border: none; border-radius: 12px;
  background: var(--surface); cursor: pointer; text-align: left; color: var(--text);
}
.book-search-item:active { background: var(--border); }
.book-search-cover {
  width: 42px; height: 62px; object-fit: cover; border-radius: 6px; flex-shrink: 0;
  background: var(--card);
}
.book-search-cover.fallback {
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.book-search-meta { flex: 1; min-width: 0; }
.book-search-name {
  font-size: 14px; font-weight: 700; margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.book-search-author {
  font-size: 12px; color: var(--text2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.book-search-add {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--red); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; flex-shrink: 0;
}
.custom-book-form { display: flex; flex-direction: column; gap: 10px; }
.custom-book-cover-pick { display: flex; justify-content: center; margin-bottom: 4px; }
.custom-book-cover-btn {
  width: 110px; aspect-ratio: 2 / 3; border-radius: 10px;
  border: 2px dashed var(--border); background: var(--surface);
  cursor: pointer; padding: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  color: var(--text2);
}
.custom-book-cover-placeholder {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; padding: 8px;
}
.custom-book-cover-plus { font-size: 28px; line-height: 1; color: var(--red); }
.custom-book-cover-preview {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.custom-book-matches {
  margin-top: 8px; display: flex; flex-direction: column; gap: 6px;
  max-height: 220px; overflow-y: auto;
}
.custom-book-matches.hidden { display: none; }
.custom-book-matches-title {
  font-size: 12px; font-weight: 700; color: var(--text2); margin-bottom: 2px;
}
.book-manage-modal {
  padding: 16px 20px 24px;
  text-align: center;
}
.book-manage-cover-wrap { margin-bottom: 14px; }
.book-manage-cover {
  width: 120px; aspect-ratio: 2 / 3; object-fit: cover;
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.2);
  background: var(--surface); display: inline-block;
}
.book-manage-cover-empty {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 42px; color: var(--text2);
}
.book-manage-title {
  font-weight: 800; font-size: 17px; margin-bottom: 6px; color: var(--text);
}
.book-manage-meta {
  color: var(--text2); font-size: 14px; margin-bottom: 18px;
}
.book-manage-actions {
  display: flex; flex-direction: column; gap: 8px;
}
.book-manage-actions #book-manage-change-cover {
  background: var(--red);
  color: #fff;
  box-shadow: 0 3px 12px rgba(var(--red-rgb), 0.35);
  justify-content: center;
  font-size: 14px;
  padding: 12px 20px;
}
.book-manage-actions #book-manage-change-cover:disabled {
  opacity: 0.7;
}
.book-manage-cover-empty {
  border: 2px dashed rgba(255,255,255,.2);
}
.book-manage-close {
  background: rgba(255,255,255,.06) !important;
  color: var(--text) !important;
  border: 1px solid var(--border);
  justify-content: center;
}

/* ── Posts Grid ──────────────────────────────────────── */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
}
.post-thumb {
  aspect-ratio: 1;
  position: relative;
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
}
.post-thumb-media {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.post-thumb-gradient {
  width: 100%; height: 100%;
}
.post-thumb-video-icon {
  position: absolute; top: 6px; right: 6px;
  background: rgba(0,0,0,0.5);
  color: #fff; font-size: 10px;
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
/* Текстовый пост без фото/видео — иконка комментария поверх градиента */
.post-thumb-text-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  color: #fff;
  filter: drop-shadow(0 1px 4px rgba(0,0,0,.35));
}
.post-thumb-text-icon svg {
  width: 36%;
  height: 36%;
  max-width: 42px;
  max-height: 42px;
  opacity: 0.92;
}
.post-thumb-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.6), transparent 50%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  padding: 6px 6px 4px;
  opacity: 0;
  transition: opacity 0.2s;
}
.post-thumb:active .post-thumb-overlay { opacity: 1; }
.post-thumb-stats {
  display: flex; gap: 8px;
  font-size: 11px; font-weight: 600; color: #fff;
  flex: 1;
  align-items: flex-end;
}
.post-thumb-delete {
  position: absolute; top: 4px; right: 4px;
  width: 28px; height: 28px;
  background: rgba(var(--red-rgb),0.85);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  opacity: 0;
  transition: opacity 0.2s;
}
.post-thumb:active .post-thumb-delete { opacity: 1; }

/* ── Feed Create Bar ─────────────────────────────────── */
.feed-create-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: sticky; top: 0; z-index: 10;
}
.feed-create-input {
  flex: 1;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 50px;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text3);
  text-align: left;
  transition: border-color var(--transition);
}
.feed-create-input:active { border-color: var(--red); }
.feed-create-btn {
  width: 40px; height: 40px;
  background: var(--red);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(var(--red-rgb),0.35);
}
.feed-create-btn svg { width: 20px; height: 20px; stroke: #fff; }
.feed-create-avatar { flex-shrink: 0; }

/* ── Suggest chat (planet) ───────────────────────────── */
.btn-tinder {
  background: linear-gradient(135deg, #5b8def, #3d5afe);
  color: #fff;
  border: none;
  box-shadow: 0 2px 8px rgba(61, 90, 254, 0.35);
  font-size: 11px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  min-width: 44px;
}
.btn-tinder:active { transform: scale(0.96); }
.meet-planet-ico {
  width: 22px; height: 22px; object-fit: contain;
  display: block; pointer-events: none;
}
.meet-modal-body {
  padding: 24px 20px 32px;
  text-align: center;
}
.meet-planet-hero {
  display: flex; align-items: center; justify-content: center;
  animation: matchBounce 0.6s ease;
}
.meet-planet-hero img {
  width: 96px; height: 96px; object-fit: contain;
  filter: drop-shadow(0 8px 20px rgba(91, 141, 239, 0.35));
}
.meet-modal-title {
  font-size: 22px; font-weight: 900; margin: 12px 0 6px;
  background: linear-gradient(135deg, #5b8def, #7c4dff);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.meet-modal-hint {
  color: var(--text2); font-size: 14px; margin-bottom: 20px;
}
.meet-presets {
  display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px;
}
.meet-custom-wrap textarea {
  width: 100%; background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 12px; padding: 12px; font-size: 14px; color: var(--text);
  resize: none; min-height: 72px; font-family: inherit; box-sizing: border-box;
}
.meet-send-btn {
  margin-top: 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.meet-send-btn .meet-planet-ico { width: 20px; height: 20px; }
.match-notif-title .meet-planet-ico {
  width: 18px; height: 18px; display: inline-block; vertical-align: -3px; margin-right: 4px;
}

.meet-preset-btn {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text);
  text-align: left;
  transition: border-color var(--transition), background var(--transition);
  cursor: pointer;
  font-family: inherit;
}
.meet-preset-btn:active {
  border-color: #5b8def;
  background: rgba(91, 141, 239, 0.12);
}

@keyframes matchBounce {
  0%   { transform: scale(0.5) rotate(-15deg); opacity: 0; }
  60%  { transform: scale(1.2) rotate(10deg);  opacity: 1; }
  100% { transform: scale(1)   rotate(0deg);   opacity: 1; }
}

/* Post create button */
.fab {
  position: fixed;
  right: calc(50% - 240px + 12px);
  bottom: calc(var(--nav-h) + 12px);
  width: 52px; height: 52px;
  background: var(--red);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(var(--red-rgb),0.4);
  z-index: 90;
  transition: transform var(--transition);
}
.fab:active { transform: scale(0.93); }
.fab svg { width: 24px; height: 24px; stroke: #fff; }

@media (max-width: 480px) {
  .fab { right: 12px; }
}

/* ══════════════════════════════════════════════════════
   PROFILE HERO TOPBAR (кнопки внутри hero)
   ══════════════════════════════════════════════════════ */

/* Тёмный градиент сверху — только когда стоит фото/GIF фон */
.hero-bg-image::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 110px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.52) 0%, transparent 100%);
  z-index: 0;
  pointer-events: none;
}
/* Кнопки должны быть поверх оверлея */
.hero-bg-image .profile-hero-topbar {
  position: relative;
  z-index: 1;
}

.profile-hero-topbar {
  display: flex; align-items: center; justify-content: space-between;
  align-self: stretch;
  margin-bottom: 16px;
}
.profile-settings-btn-hero {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600;
  color: rgba(255,255,255,0.92);
  padding: 6px 12px;
  border-radius: 50px;
  background: rgba(255,255,255,0.18);
  border: 1.5px solid rgba(255,255,255,0.35);
  transition: background var(--transition);
}
.profile-settings-btn-hero:active { background: rgba(255,255,255,0.32); }
.profile-qr-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.18);
  border: 1.5px solid rgba(255,255,255,0.35);
  border-radius: 50%; color: #fff; cursor: pointer;
  transition: background var(--transition);
}
.profile-qr-btn:active { background: rgba(255,255,255,0.32); }

/* ── Comments ── */
.comments-sheet {
  display: flex; flex-direction: column;
  height: min(78vh, 640px);
  max-height: calc(var(--real-vh) * 85);
}
.comments-sheet-list {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 4px 16px 8px;
  scrollbar-width: none;
}
.comments-sheet-list::-webkit-scrollbar { display: none; }
.comments-sheet-compose {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  background: var(--card);
  flex-shrink: 0;
}
.post-detail-comments {
  margin-top: 4px;
  padding: 0 0 8px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.post-detail-comments-head {
  padding: 14px 16px 6px;
}
.post-detail-comments-title {
  font-size: 15px; font-weight: 700; color: var(--text);
}
.post-detail-comments-list {
  padding: 0 16px 8px;
  max-height: none;
}
.post-detail-comments-compose {
  flex: 0 0 auto;
  flex-shrink: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  background: var(--card);
  z-index: 6;
  width: 100%;
  box-sizing: border-box;
}
.post-detail-comments-compose .av-frame,
.post-detail-comments-compose .avatar,
.post-detail-comments-compose .avatar-text {
  flex-shrink: 0;
}
.post-detail-comments-btn {
  background: none; border: none; cursor: pointer;
  font: inherit; color: inherit;
  padding: 0;
}
.post-detail-comments-btn:active { opacity: .7; }
.comments-empty {
  text-align: center;
  padding: 28px 16px;
  color: var(--text2);
  font-size: 14px;
  line-height: 1.45;
}
.comments-loading {
  display: flex; justify-content: center;
  padding: 28px;
}
.comment-thread {
  padding: 6px 0 8px;
  border-bottom: 1px solid var(--border);
}
.comment-thread:last-child { border-bottom: none; }
.comment-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 6px 0;
}
.comment-item--reply { padding: 5px 0; }
.comment-replies {
  margin: 0 0 2px 46px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.comment-replies[hidden] { display: none !important; }
.comment-replies:empty { display: none; }
.comment-replies-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 4px 46px;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--text2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.comment-replies-toggle:hover { color: var(--text); }
.comment-replies-line {
  width: 22px;
  height: 1px;
  background: var(--text2);
  opacity: .55;
  flex-shrink: 0;
}
.comment-replies-toggle-label { line-height: 1.2; }
.comment-replies-chevron {
  font-size: 11px;
  opacity: .8;
  line-height: 1;
}
.comment-avatar { flex-shrink: 0; cursor: pointer; }
.comment-body { flex: 1; min-width: 0; }
.comment-meta {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 2px;
}
.comment-username {
  font-size: 13px; font-weight: 700; color: var(--text); cursor: pointer;
  min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.comment-text {
  font-size: 14px; color: var(--text); line-height: 1.4; word-break: break-word;
}
.comment-text .chat-mention { color: #6ea8ff; }
.comment-reply-mention {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  color: #6ea8ff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.comment-reply-mention:hover { text-decoration: underline; }
.comment-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}
.comment-time { font-size: 12px; color: var(--text2); }
.comment-reply-btn {
  padding: 0 !important;
  border: 0 !important;
  background: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  color: var(--text2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 0 !important;
}
.comment-reply-btn:hover { color: var(--text); background: none !important; }
.comment-reply-btn.tl-liquid-btn,
.comment-reply-btn.tl-liquid-btn::before {
  background: none !important;
  box-shadow: none !important;
  border: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.comment-reply-btn.tl-liquid-btn::before {
  display: none !important;
  content: none !important;
}
.comment-del-btn {
  margin-left: auto;
  background: none; border: none; color: var(--text2);
  cursor: pointer; padding: 2px; border-radius: 6px;
  opacity: 0.45; transition: opacity .15s;
  flex-shrink: 0;
}
.comment-del-btn:hover { opacity: 1; color: var(--red); }
.comment-reply-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px 8px;
  color: var(--text2);
  font-size: 13px;
}
.comment-reply-bar[hidden] { display: none !important; }
.comment-reply-bar-text { flex: 1; min-width: 0; }
.comment-reply-bar-label { opacity: .75; margin-right: 4px; }
.comment-reply-bar [data-reply-name] { font-weight: 700; color: var(--text); }
.comment-reply-bar-close {
  width: 28px; height: 28px; border: 0; border-radius: 50%;
  background: transparent; color: var(--text2); cursor: pointer;
  font-size: 14px; line-height: 1;
}
.comment-reply-bar-close:hover { background: var(--bg2, var(--surface)); color: var(--text); }
.comments-sheet-compose-wrap,
.post-detail-comments-compose-wrap {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--card);
}
.comments-sheet-compose-wrap .comments-sheet-compose,
.post-detail-comments-compose-wrap .post-detail-comments-compose {
  border-top: none;
}
.comments-sheet-compose-wrap .comment-reply-bar,
.post-detail-comments-compose-wrap .comment-reply-bar {
  padding: 8px 14px 0;
}
.comment-inp {
  flex: 1; padding: 10px 14px; border: 1.5px solid var(--border);
  border-radius: 22px; font-size: 14px; background: var(--bg2, var(--surface));
  color: var(--text); outline: none; transition: border .2s;
  min-width: 0;
}
.comment-inp:focus { border-color: var(--red); }
.comment-send-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--red); color: #fff; border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; transition: opacity .15s;
}
.comment-send-btn:disabled { opacity: .5; }
.profile-coins-chip-hero {
  display: flex; align-items: center; gap: 5px;
  font-size: 13px; font-weight: 800;
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: #333;
  border-radius: 50px;
  padding: 6px 12px;
  cursor: pointer;
}

/* ══════════════════════════════════════════════════════
   MATCH NOTIFICATION (bottom popup)
   ══════════════════════════════════════════════════════ */
.match-notif {
  position: fixed;
  bottom: calc(var(--nav-h) + 10px);
  left: 50%; transform: translateX(-50%) translateY(130px);
  width: calc(100% - 24px); max-width: 456px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  border: 1px solid var(--border);
  z-index: 290;
  transition: transform 0.4s cubic-bezier(0.16,1,0.3,1);
}
.match-notif.show {
  transform: translateX(-50%) translateY(0);
}
.match-notif-inner {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
}
.match-notif-left {
  display: flex; align-items: center; gap: 10px;
  flex: 1; min-width: 0;
}
.match-notif-title {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.match-notif-sub {
  font-size: 11px; color: var(--text3); margin-top: 2px;
}
.match-notif-btns {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.match-notif-accept {
  background: var(--red);
  color: #fff;
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 12px; font-weight: 700;
  border: none; cursor: pointer; font-family: inherit;
}
.match-notif-decline {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text3);
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  border: none; cursor: pointer;
}

/* ══════════════════════════════════════════════════════
   FOLLOWERS / FOLLOWING LIST (modal)
   ══════════════════════════════════════════════════════ */
.followers-list { display: flex; flex-direction: column; }
.followers-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
}
.followers-item:last-child { border-bottom: none; }
.followers-item:active { background: var(--surface); border-radius: var(--radius-sm); }
.followers-info { flex: 1; min-width: 0; }
.followers-name { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.followers-bio { font-size: 12px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ══════════════════════════════════════════════════════
   LIKED PROFILE BUTTON
   ══════════════════════════════════════════════════════ */
.btn-liked-profile {
  background: var(--red-bg);
  color: var(--red);
  border: 1.5px solid var(--red);
}
.btn-liked-profile:active { background: var(--red); color: #fff; }

/* ══════════════════════════════════════════════════════
   АДАПТИВНОСТЬ — ВСЕ УСТРОЙСТВА
   ══════════════════════════════════════════════════════ */

/* ── Маленькая ширина ≤ 360px (iPhone SE 1gen, бюджетные Android) ── */
@media (max-width: 360px) {
  :root { --nav-h: 58px; --bar-h: 44px; }

  #bottom-nav {
    width: calc(100% - 16px);
    border-radius: 22px;
    padding: 0 3px;
    height: var(--nav-h);
  }
  .nav-btn svg { width: 19px; height: 19px; }
  .nav-btn span { font-size: 8px; }
  .nav-create-icon { width: 48px; height: 48px; margin-top: -20px; }
  .nav-profile-avatar,
  .nav-profile-avatar .avatar,
  .nav-profile-avatar .avatar-text { width: 22px !important; height: 22px !important; }

  .auth-logo-text { font-size: 26px; }
  .auth-card { padding: 18px 14px; }
  .feed-action-btn svg { width: 25px; height: 25px; }
}

/* ── Маленькая высота ≤ 650px (iPhone SE 2/3, Galaxy A-series) ── */
@media (max-height: 650px) {
  :root { --nav-h: 54px; --bar-h: 44px; }

  #bottom-nav { bottom: calc(6px + env(safe-area-inset-bottom, 0px)); }
  #screen-content { bottom: 0; }

  .nav-btn span { font-size: 8px; }

  .auth-bg { padding: 16px 20px; }
  .auth-logo { margin-bottom: 16px; }
  .auth-logo-sub { display: none; }
  .auth-logo-text { font-size: 24px; }
  .auth-card { padding: 18px 16px; }

  .post-detail-media-wrap,
  .post-detail-media { max-height: calc(var(--real-vh) * 52); }
  .media-preview-wrap,
  .media-preview-img { max-height: calc(var(--real-vh) * 32); }
  .feed-card-actions { gap: 12px; }
  .feed-card:not([data-has-video="true"]):not(.feed-card--text) .feed-card-actions,
  .feed-card:not([data-has-video="true"]):not(.feed-card--text) .feed-card-content {
    bottom: calc(12px + var(--nav-h) + env(safe-area-inset-bottom, 0px));
  }
  .feed-card[data-has-video="true"] .feed-card-actions,
  .feed-card[data-has-video="true"] .feed-card-content {
    bottom: calc(12px + var(--nav-h) + env(safe-area-inset-bottom, 0px) + 26px);
  }
  .feed-action-btn svg { width: 26px; height: 26px; }
}

/* ── Средняя высота 651–750px ── */
@media (min-height: 651px) and (max-height: 750px) {
  .post-detail-media-wrap,
  .post-detail-media { max-height: calc(var(--real-vh) * 58); }
  .media-preview-wrap,
  .media-preview-img { max-height: calc(var(--real-vh) * 36); }
}

/* ── Ландшафт на телефоне (высота < 500px) ── */
@media (orientation: landscape) and (max-height: 500px) {
  :root { --nav-h: 52px; --bar-h: 40px; }

  #bottom-nav {
    bottom: calc(6px + env(safe-area-inset-bottom, 0px));
    width: calc(100% - 120px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
  }
  #screen-content { bottom: 0; }

  /* Прячем подписи под иконками — экономим вертикальное пространство */
  .nav-btn span { display: none; }
  .nav-btn { gap: 0; }

  /* Авторизация в ландшафте — горизонтальный макет */
  .auth-bg { flex-direction: row; gap: 32px; padding: 16px 32px; justify-content: center; }
  .auth-logo { margin-bottom: 0; flex-shrink: 0; width: 140px; }
  .auth-logo-sub { display: none; }
  .auth-logo-text { font-size: 20px; }
  .auth-logo-infinity { max-height: min(var(--auth-logo-h, 190px), 28vh); }
  .auth-card { max-height: calc(var(--real-vh) * 88); overflow-y: auto; }

  .feed-card-actions { gap: 10px; }
  .feed-card:not([data-has-video="true"]):not(.feed-card--text) .feed-card-actions,
  .feed-card:not([data-has-video="true"]):not(.feed-card--text) .feed-card-content {
    bottom: calc(10px + var(--nav-h) + env(safe-area-inset-bottom, 0px));
  }
  .feed-card[data-has-video="true"] .feed-card-actions,
  .feed-card[data-has-video="true"] .feed-card-content {
    bottom: calc(10px + var(--nav-h) + env(safe-area-inset-bottom, 0px) + 24px);
  }
}

/* ── Планшет 600–899px: мягкая телефонная рамка ── */
@media (min-width: 600px) and (max-width: 899px) {
  :root { --phone-r: 28px; }
  body {
    border-radius: var(--phone-r);
    overflow: hidden;
    clip-path: inset(0 round var(--phone-r));
    box-shadow: 0 0 0 1px rgba(0,0,0,0.06), 0 12px 48px rgba(0,0,0,0.14);
  }
  #app,
  #main-app,
  #auth-screen {
    border-radius: var(--phone-r);
    overflow: hidden;
  }
}

/* ── Десктоп: телефонная рамка по центру (клип со всех 4 сторон) ── */
@media (min-width: 900px) {
  :root { --phone-r: 36px; }
  html {
    background: #d8d8de;
    min-height: 100%;
  }
  html[data-theme="dark"] {
    background: #050505;
  }
  body {
    width: 390px;
    max-width: 390px;
    height: min(844px, calc(100vh - 48px));
    margin: 0;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: var(--phone-r);
    overflow: hidden;
    isolation: isolate;
    /* Надёжный клип: fixed-дети больше не вылезают за скругления */
    clip-path: inset(0 round var(--phone-r));
    -webkit-clip-path: inset(0 round var(--phone-r));
    box-shadow:
      0 0 0 1px rgba(255,255,255,0.10),
      0 0 0 10px #111114,
      0 28px 90px rgba(0,0,0,0.45);
  }
  #app {
    position: relative;
    height: 100%;
    width: 100%;
    border-radius: var(--phone-r);
    overflow: hidden;
    clip-path: inset(0 round var(--phone-r));
    -webkit-clip-path: inset(0 round var(--phone-r));
  }
  #main-app,
  #auth-screen {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: var(--phone-r);
    overflow: hidden;
  }
  /* fixed → absolute внутри рамки, иначе углы шапки/контента торчат */
  #top-bar {
    position: absolute;
    top: 0; left: 0; right: 0;
    transform: none;
    width: 100%;
    max-width: none;
    border-radius: var(--phone-r) var(--phone-r) 0 0;
  }
  #screen-content {
    position: absolute;
    left: 0; right: 0;
    transform: none;
    width: 100%;
    max-width: none;
  }
  #bottom-nav {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    max-width: calc(100% - 28px);
  }
  .chat-view {
    border-radius: var(--phone-r);
    overflow: hidden;
  }
  .chat-view-header {
    border-radius: var(--phone-r) var(--phone-r) 0 0;
  }
  #toast-container {
    left: 0; right: 0;
    width: 100%;
    max-width: none;
    transform: none;
  }
  #overlay {
    position: absolute;
    inset: 0;
    border-radius: var(--phone-r);
  }
  #modal {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    margin: 0;
    transform: translateY(0);
    width: 100%;
    max-width: none;
    border-radius: 22px 22px 0 0;
    animation: slideUp 0.32s cubic-bezier(0.16,1,0.3,1);
  }
}


/* ── Profile BG Image Upload ───────────────────────── */
.bg-preview-thumb {
  width: 100%; height: 80px;
  object-fit: cover;
  border-radius: 12px;
  margin-top: 8px;
}
.profile-bg-image-row {
  display: flex; gap: 8px; align-items: center;
}
.btn-upload-bg {
  flex: 1; padding: 10px 14px;
  border-radius: 12px; border: 1.5px dashed var(--border);
  background: var(--surface); color: var(--text);
  font-size: 14px; cursor: pointer;
}
.btn-remove-bg {
  padding: 10px 14px;
  border-radius: 12px; border: 1.5px solid var(--red);
  background: var(--red-bg); color: var(--red);
  font-size: 14px; cursor: pointer;
}

/* ── Report BG button ──────────────────────────────── */
.btn-report-bg {
  padding: 10px 13px;
  color: var(--text-secondary);
}
.btn-report-bg:active { color: var(--red); border-color: var(--red); }

/* ── Post pending review badge ─────────────────────── */
.post-thumb-pending { opacity: 0.75; }
.post-pending-badge {
  position: absolute; top: 6px; left: 6px; z-index: 2;
  background: rgba(0,0,0,0.65);
  color: #fff; font-size: 10px; font-weight: 700;
  padding: 3px 8px; border-radius: 20px;
  pointer-events: none;
}
.post-repost-badge {
  position: absolute; top: 6px; left: 6px; z-index: 2;
  background: rgba(var(--red-rgb),0.9);
  color: #fff; font-size: 12px; font-weight: 800;
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}

/* ── Chat header actions / menu / search ─────────────── */
.chat-header-actions {
  display: flex; align-items: center; gap: 2px; flex-shrink: 0;
}
.chat-hdr-btn {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text); touch-action: manipulation;
}
.chat-hdr-btn:active { background: var(--surface); }
.chat-hdr-btn svg { width: 20px; height: 20px; }
.chat-menu-sheet { padding: 8px 0 16px; }
.chat-menu-item {
  display: block; width: 100%;
  padding: 14px 20px; text-align: left;
  font-size: 15px; font-weight: 600; color: var(--text);
  background: none; border: none; cursor: pointer;
  border-radius: 0;
}
/* Flat sheet rows — no liquid glass */
.chat-menu-item.tl-liquid-btn,
.chat-menu-sheet .tl-liquid-btn {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  overflow: visible !important;
  isolation: auto !important;
  border-radius: 0 !important;
}
.chat-menu-item.tl-liquid-btn::before,
.chat-menu-sheet .tl-liquid-btn::before {
  display: none !important;
}
.chat-menu-item:active { background: var(--surface); }
.chat-menu-item.tl-liquid-btn:active { background: var(--surface) !important; }
.chat-menu-item.danger { color: var(--red); }
.chat-menu-item--two {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; line-height: 1.25;
}
.chat-menu-item--two span:last-child { font-size: 13px; font-weight: 500; color: var(--text2); }
.chat-menu-sep { height: 1px; background: var(--border); margin: 6px 0; }
.chat-search-bar {
  display: flex; gap: 4px; align-items: center;
  padding: 8px 10px; background: var(--card); border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-search-bar input {
  flex: 1; min-width: 0; background: var(--surface); border-radius: 12px;
  border: none; outline: none;
  padding: 10px 12px; color: var(--text); font-size: 14px;
}
.chat-search-count {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  padding: 0 4px;
  white-space: nowrap;
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-search-nav,
.chat-search-close {
  flex-shrink: 0;
  width: 34px; height: 34px;
  border: none; background: transparent;
  color: var(--text2); border-radius: 50%;
  font-size: 18px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.chat-search-nav:active,
.chat-search-close:active { background: var(--surface); }
.chat-bubble.search-hit {
  outline: 1px solid rgba(51, 144, 236, 0.45); outline-offset: 2px;
}

.chat-view.has-wallpaper {
  background-image:
    linear-gradient(rgba(0,0,0,var(--chat-wallpaper-dim, .28)), rgba(0,0,0,var(--chat-wallpaper-dim, .28))),
    var(--chat-wallpaper);
  background-size: cover; background-position: center;
}
.chat-view.has-wallpaper .chat-messages { background: transparent; }
.chat-view.has-wallpaper .chat-view-header,
.chat-view.has-wallpaper .chat-input-bar {
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(12px);
}
[data-theme="dark"] .chat-view.has-wallpaper .chat-view-header,
[data-theme="dark"] .chat-view.has-wallpaper .chat-input-bar {
  background: rgba(20,20,20,.82);
}

/* Call overlay — Telegram-style */
.call-overlay {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; flex-direction: column;
  color: #fff;
  overflow: hidden;
  background: #1a2a32;
}
.call-overlay.hidden { display: none !important; }
.call-bg {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(120% 80% at 100% 0%, #8ec8e8 0%, transparent 55%),
    radial-gradient(100% 90% at 0% 100%, #c9d36a 0%, #7eb89a 40%, transparent 70%),
    linear-gradient(165deg, #6eb5d4 0%, #8fc4a8 48%, #b8c86a 100%);
}
.call-overlay.is-video .call-bg { opacity: .35; }
.call-video-remote {
  position: absolute; inset: 0; z-index: 1;
  width: 100%; height: 100%; object-fit: cover; background: #111;
}
.call-video-remote.hidden { display: none; }
.call-top {
  position: relative; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 14px 8px;
  gap: 8px;
}
.call-top-right { display: flex; gap: 4px; }
.call-icon-btn {
  width: 40px; height: 40px; border: none; background: none;
  color: #fff; display: flex; align-items: center; justify-content: center;
  cursor: pointer; border-radius: 50%;
}
.call-icon-btn:active { background: rgba(255,255,255,.12); }
.call-icon-btn svg { width: 22px; height: 22px; }
.call-emojis {
  flex: 1; text-align: center;
  font-size: 18px; letter-spacing: 6px;
  background: rgba(255,255,255,.14);
  border-radius: 999px;
  padding: 6px 14px;
  backdrop-filter: blur(8px);
  max-width: 220px;
  margin: 0 auto;
}
.call-center {
  position: relative; z-index: 4;
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 12px 20px 20px;
  text-align: center;
  gap: 8px;
}
.call-center.has-remote-video .call-avatar-wrap { display: none; }
.call-avatar-wrap {
  width: 128px; height: 128px; border-radius: 50%;
  overflow: hidden; margin-bottom: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,.22);
  background: rgba(255,255,255,.2);
}
.call-avatar-wrap .avatar,
.call-avatar-wrap .avatar-text,
.call-avatar-wrap .av-frame {
  width: 128px !important; height: 128px !important;
  font-size: 44px !important;
}
.call-peer-name {
  font-size: 28px; font-weight: 700; letter-spacing: -.02em;
  text-shadow: 0 1px 8px rgba(0,0,0,.25);
}
.call-timer {
  font-size: 16px; font-weight: 500; opacity: .95;
  font-variant-numeric: tabular-nums;
}
.call-timer.hidden { display: none; }
.call-status {
  font-size: 15px; opacity: .85; min-height: 1.2em;
}
.call-mute-pill {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.22);
  backdrop-filter: blur(10px);
  font-size: 13px; font-weight: 500;
}
.call-mute-pill.hidden { display: none; }
.call-mute-pill-icon { display: flex; }
.call-mute-pill-icon svg { width: 16px; height: 16px; }
.call-video-local {
  position: absolute; z-index: 6;
  right: 16px; bottom: 140px;
  width: 100px; height: 140px;
  border-radius: 14px; object-fit: cover;
  background: #222; border: 2px solid rgba(255,255,255,.85);
  box-shadow: 0 6px 20px rgba(0,0,0,.3);
  transform: scaleX(-1);
}
.call-video-local.hidden { display: none; }
.call-controls {
  position: relative; z-index: 5;
  display: flex; justify-content: space-around; align-items: flex-start;
  gap: 6px;
  padding: 10px 16px calc(22px + env(safe-area-inset-bottom, 0px));
}
.call-ctrl {
  flex: 1; max-width: 88px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  cursor: pointer; background: none; border: none; color: #fff;
  -webkit-tap-highlight-color: transparent;
}
.call-ctrl > span {
  font-size: 12px; font-weight: 500; opacity: .95;
  text-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.call-round {
  width: 64px; height: 64px; border-radius: 50%; border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: transform .12s ease, background .15s ease;
  color: #fff;
}
.call-round:active { transform: scale(0.94); }
.call-round svg { width: 26px; height: 26px; pointer-events: none; }
.call-round.glass {
  background: rgba(255,255,255,.22);
  backdrop-filter: blur(12px);
}
.call-round.glass.on { background: rgba(255,255,255,.38); }
.call-round.solid {
  background: #fff; color: #111;
}
.call-round.solid svg { stroke: #111; color: #111; }
.call-round.end { background: #e53935; color: #fff; }
.call-round.accept { background: #2ecc71; color: #fff; }
.call-settings-sheet {
  position: absolute; inset: 0; z-index: 10;
  background: rgba(0,0,0,.35);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 16px;
}
.call-settings-card {
  width: min(360px, 100%);
  background: rgba(30,30,30,.92);
  backdrop-filter: blur(16px);
  border-radius: 18px;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.call-settings-card button {
  padding: 16px; border: none; background: none;
  color: #fff; font-size: 16px; font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,.08);
  cursor: pointer;
}
.call-settings-card button.ghost { color: rgba(255,255,255,.65); font-weight: 500; border-bottom: none; }
.call-mini {
  position: fixed; z-index: 1999;
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  background: #2a2a2e; color: #fff;
  padding: 8px 10px 8px 14px;
  border-radius: 999px;
  box-shadow: 0 8px 28px rgba(0,0,0,.35);
  max-width: calc(100% - 24px);
}
.call-mini-info {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; min-width: 0;
}
.call-mini-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #2ecc71; flex-shrink: 0;
}
.call-mini-name {
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 120px;
}
.call-mini-timer { font-size: 13px; opacity: .85; font-variant-numeric: tabular-nums; }
.call-mini-end {
  width: 36px; height: 36px; border-radius: 50%;
  background: #e53935; border: none; color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.call-mini-end svg { width: 18px; height: 18px; }

/* Mini-games overlay / boards */
.mg-overlay, .chess-overlay {
  position: fixed; inset: 0; z-index: 1900;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.mg-panel, .chess-panel {
  width: min(420px, 100%);
  background: var(--card);
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 16px 48px rgba(0,0,0,.28);
}
.mg-top, .chess-top { margin-bottom: 12px; text-align: center; }
.mg-title, .chess-title { font-weight: 800; font-size: 17px; }
.mg-info, .chess-info { font-size: 13px; color: var(--text2); margin-top: 4px; }
.mg-stake-badge {
  display: inline-block; margin-top: 6px;
  padding: 3px 10px; border-radius: 999px;
  background: rgba(var(--red-rgb),.12); color: var(--red);
  font-size: 12px; font-weight: 700;
}
.mg-board-host { margin-bottom: 12px; }
.chess-board, .checkers-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 4px;
  border: 1px solid var(--border);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
}
.chess-board--pro .chess-cell.light { background: #ebecd0; }
.chess-board--pro .chess-cell.dark { background: #779556; }
.chess-cell {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(18px, 5vw, 32px);
  border: none; padding: 0; cursor: pointer;
  aspect-ratio: 1;
}
.chess-cell.light { background: #f0d9b5; }
.chess-cell.dark { background: #b58863; }
.chess-cell.selected { box-shadow: inset 0 0 0 3px #f6f669; z-index: 1; }
.chess-cell.last-move { background-image: linear-gradient(rgba(255,255,0,.28), rgba(255,255,0,.28)); }
.chess-cell.hint .chess-dot {
  width: 28%; height: 28%; border-radius: 50%;
  background: rgba(0,0,0,.22); display: block;
  pointer-events: none;
}
.chess-cell.capture::after {
  content: '';
  position: absolute; inset: 12%;
  border: 3px solid rgba(0,0,0,.18);
  border-radius: 50%;
  pointer-events: none;
}
.chess-cell.capture { box-shadow: none; }
.chess-piece-wrap {
  width: 92%; height: 92%;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  will-change: transform;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.28));
}
.chess-piece-svg {
  width: 100%; height: 100%;
  display: block;
}
.chess-piece { line-height: 1; }
.chess-piece.w { color: #f8f8f8; }
.chess-piece.b { color: #222; }
.chk-piece {
  width: 68%; height: 68%; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.28), inset 0 2px 4px rgba(255,255,255,.25);
}
.chk-piece.red { background: radial-gradient(circle at 35% 30%, #ff6b6b, #e8001d 55%, #9a0012); }
.chk-piece.black { background: radial-gradient(circle at 35% 30%, #555, #1a1a1a 55%, #000); }
.chk-piece.king::after {
  content: '♛'; display: flex; align-items: center; justify-content: center;
  height: 100%; font-size: 14px; color: #ffd84d;
}

/* Mini-game bottom sheet */
.mg-sheet {
  position: fixed; inset: 0; z-index: 1850;
  pointer-events: none;
}
.mg-sheet.open { pointer-events: auto; }
.mg-sheet-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.45);
  opacity: 0; transition: opacity .28s ease;
}
.mg-sheet.open .mg-sheet-backdrop { opacity: 1; }
.mg-sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: min(55vh, 420px);
  max-height: 92vh;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  padding: 0 0 calc(10px + env(safe-area-inset-bottom, 0px));
  transform: translateY(110%);
  transition: transform .32s cubic-bezier(.16,1,.3,1), height .28s cubic-bezier(.16,1,.3,1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -8px 32px rgba(0,0,0,.2);
}
.mg-sheet.open .mg-sheet-panel { transform: translateY(0); }
.mg-sheet-panel.mg-sheet-expanded { height: min(92vh, 820px); }
.mg-sheet-handle {
  display: flex; justify-content: center; padding: 10px 0 8px; cursor: grab;
  flex-shrink: 0;
  touch-action: none;
}
.mg-sheet-handle span {
  width: 40px; height: 4px; border-radius: 4px; background: rgba(128,128,128,.35);
}
.mg-sheet-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 16px 8px;
  -webkit-overflow-scrolling: touch;
}
.mg-sheet-title { font-size: 18px; font-weight: 800; margin-bottom: 4px; }
.mg-sheet-sub { font-size: 12px; color: var(--text2); margin-bottom: 12px; }
.mg-stake-row {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px;
}
.mg-stake-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px; font-weight: 700;
  font-family: inherit; cursor: pointer;
}
.mg-stake-chip.active {
  background: var(--red); color: #fff; border-color: var(--red);
}
.mg-game-list { display: flex; flex-direction: column; gap: 8px; }
.mg-game-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit; cursor: pointer;
}
.mg-game-item:active { transform: scale(.99); }
.mg-game-ico { font-size: 26px; width: 36px; text-align: center; flex-shrink: 0; }
.mg-game-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mg-game-name { font-weight: 800; font-size: 15px; }
.mg-game-desc { font-size: 12px; color: var(--text2); }

/* Invite notification (top) */
.mg-invite-notif {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top, 0px));
  left: 50%; transform: translateX(-50%) translateY(-120%);
  width: calc(100% - 24px); max-width: 456px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 10px 36px rgba(0,0,0,.22);
  border: 1px solid var(--border);
  z-index: 1950;
  transition: transform .35s cubic-bezier(.16,1,.3,1);
}
.mg-invite-notif.show { transform: translateX(-50%) translateY(0); }
.mg-invite-inner {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 12px 12px 14px;
}
.mg-invite-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.mg-invite-title {
  font-size: 13px; font-weight: 600; color: var(--text);
  line-height: 1.3;
}
.mg-invite-sub { font-size: 11px; color: var(--text3); margin-top: 2px; }
.mg-invite-btns { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.mg-invite-yes, .mg-invite-no {
  width: 36px; height: 36px; border-radius: 50%;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800; color: #fff;
}
.mg-invite-yes { background: #22c55e; }
.mg-invite-no { background: #ef4444; }

/* RPS */
.mg-rps-choices {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.mg-rps-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 16px 8px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 32px; font-family: inherit; color: var(--text); cursor: pointer;
}
.mg-rps-btn span { font-size: 12px; font-weight: 700; }
.mg-rps-btn.picked, .mg-rps-btn:active {
  border-color: var(--red); background: rgba(var(--red-rgb),.08);
}
.mg-rps-reveal {
  display: flex; align-items: center; justify-content: space-around;
  padding: 20px 8px; text-align: center; font-size: 12px; color: var(--text2);
}
.mg-rps-big { font-size: 48px; margin-bottom: 6px; }
.mg-rps-vs { font-weight: 900; color: var(--red); font-size: 16px; }

/* In-app camera for "Сделать фото" */
.chat-camera-overlay {
  position: fixed; inset: 0; z-index: 9800;
  background: #000;
  display: flex; align-items: stretch; justify-content: center;
}
.chat-camera-frame {
  position: relative;
  width: 100%; max-width: 520px;
  background: #000;
}
.chat-camera-video {
  width: 100%; height: 100%;
  object-fit: cover;
  background: #000;
}
.chat-camera-top {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 14px 12px;
  background: linear-gradient(to bottom, rgba(0,0,0,.55), transparent);
}
.chat-camera-bottom {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: center;
  padding: 18px 14px calc(22px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, rgba(0,0,0,.55), transparent);
}
.chat-camera-icon-btn {
  width: 44px; height: 44px; border-radius: 50%;
  border: none; background: rgba(30,30,32,.72);
  color: #fff; display: flex; align-items: center; justify-content: center;
  cursor: pointer; backdrop-filter: blur(8px);
}
.chat-camera-shutter {
  width: 72px; height: 72px; border-radius: 50%;
  border: 4px solid #fff; background: rgba(255,255,255,.92);
  cursor: pointer; box-shadow: 0 4px 20px rgba(0,0,0,.35);
}
.chat-camera-shutter:active { transform: scale(.94); background: #efe; }

/* ══════════════════════════════════════════════════════════
   PHOTO EDITOR (avatar / wallpaper) — public/js/photo-editor.js
   ══════════════════════════════════════════════════════════ */
#photo-editor, #photo-editor * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
#photo-editor {
  position: fixed; inset: 0; z-index: 9500;
  background: #0b0b0d; color: #fff;
  font-family: inherit; user-select: none; -webkit-user-select: none;
  opacity: 0; transition: opacity .22s ease; overflow: hidden;
}
#photo-editor.pe-open { opacity: 1; }
#photo-editor.pe-closing { opacity: 0; pointer-events: none; }
#photo-editor button { font-family: inherit; }
.pe-stage {
  position: absolute; left: 0; right: 0; top: calc(64px + env(safe-area-inset-top, 0px));
  bottom: calc(130px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; justify-content: center;
}
.pe-crop, .pe-draw { touch-action: none; display: block; }
.pe-crop { position: absolute; left: 0; top: 0; cursor: grab; }
.pe-crop:active { cursor: grabbing; }
.pe-drawwrap {
  position: relative; display: none; overflow: hidden; border-radius: 4px;
  background: #000; box-shadow: 0 8px 40px rgba(0,0,0,.6);
}
.pe-draw { width: 100%; height: 100%; cursor: crosshair; }
.pe-circle-guide {
  position: absolute; inset: 0; border-radius: 50%; pointer-events: none; display: none;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.45);
}
.pe-avatar[data-mode="draw"] .pe-circle-guide { display: block; }
#photo-editor[data-mode="draw"] .pe-drawwrap { display: block; }
#photo-editor[data-mode="draw"] .pe-crop { display: none; }
.pe-spinner {
  position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border: 3px solid rgba(255,255,255,.2); border-top-color: #fff; border-radius: 50%;
  animation: pe-spin .8s linear infinite; display: none;
}
.pe-loading .pe-spinner { display: block; }
.pe-spinner.pe-sm { position: static; display: block; margin: 20px auto; width: 24px; height: 24px; }
@keyframes pe-spin { to { transform: rotate(360deg); } }

/* glass pills */
.pe-glass {
  background: rgba(38,38,42,.62);
  -webkit-backdrop-filter: blur(22px) saturate(1.6); backdrop-filter: blur(22px) saturate(1.6);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 8px 28px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.1);
  border-radius: 999px;
}
.pe-bottom {
  position: absolute; left: 0; right: 0; bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  display: flex; justify-content: center; padding: 0 8px; pointer-events: none;
}
.pe-pill {
  display: none; align-items: center; gap: 2px; padding: 6px; max-width: 100%; pointer-events: auto;
  animation: pe-up .34s cubic-bezier(.2,.9,.3,1.08) both;
}
#photo-editor[data-mode="crop"] .pe-pill-crop, #photo-editor[data-mode="draw"] .pe-pill-draw { display: flex; }
.pe-story .pe-pill { display: none !important; }
#photo-editor.pe-story { z-index: 13000; }
.pe-story .pe-stage {
  top: calc(56px + env(safe-area-inset-top, 0px));
  bottom: calc(168px + env(safe-area-inset-bottom, 0px));
}
.pe-story .pe-bottom {
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  padding: 0 14px;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}
.pe-story-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  pointer-events: auto;
  animation: pe-up .34s cubic-bezier(.2,.9,.3,1.08) both;
}
.pe-story-caption-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pe-story-caption {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 22px;
  background: rgba(48, 48, 52, .92);
  color: #fff;
  font-size: 15px;
  outline: none;
}
.pe-story-caption::placeholder { color: rgba(255,255,255,.45); }
.pe-story-ttl {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1.5px dashed rgba(255,255,255,.55);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  background: rgba(0,0,0,.25);
}
.pe-story-tools-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pe-story-back {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  background: rgba(38,38,42,.72);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.pe-story-back:active { transform: scale(.94); }
.pe-story-tools {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  gap: 2px;
  padding: 5px 8px;
}
.pe-story-next {
  height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 22px;
  background: #3390ec;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .02em;
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
}
.pe-story-next:hover { background: #4aa0f5; }
.pe-story-next:active { transform: scale(.96); }
.pe-story .pe-row {
  bottom: calc(148px + env(safe-area-inset-bottom, 0px));
}
.pe-story .pe-story-xformrow {
  display: flex;
  gap: 4px;
  width: min(380px, calc(100% - 24px));
}
.pe-story .pe-story-xformrow .pe-xform-hint {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  line-height: 1.2;
  opacity: .65;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-left: 4px;
}
.pe-story[data-mode="draw"][data-brush="1"] .pe-sizerow {
  bottom: calc(196px + env(safe-area-inset-bottom, 0px));
}
.pe-story .pe-crop { cursor: grab; }
.pe-story .pe-crop:active { cursor: grabbing; }
.pe-story[data-mode="draw"] .pe-draw { cursor: grab; }
.pe-story[data-mode="draw"][data-brush="1"] .pe-draw { cursor: crosshair; }
.story-caption-sheet {
  position: fixed;
  inset: 0;
  z-index: 12500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.story-caption-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
}
.story-caption-sheet-card {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  padding: 18px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  border-radius: 18px 18px 0 0;
  background: var(--bg-elevated, #1c1c1e);
  color: var(--text, #fff);
  box-shadow: 0 -8px 32px rgba(0,0,0,.35);
}
.story-caption-sheet-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
}
.story-caption-sheet-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border, rgba(255,255,255,.12));
  background: var(--bg, #111);
  color: inherit;
  font-size: 15px;
  outline: none;
  box-sizing: border-box;
}
.story-caption-sheet-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}
@keyframes pe-up { from { transform: translateY(70px); opacity: 0; } to { transform: none; opacity: 1; } }
.pe-btn {
  width: 40px; height: 40px; flex: 0 0 auto; border: 0; border-radius: 50%; padding: 0;
  background: transparent; color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, transform .12s, opacity .15s;
}
.pe-btn svg { width: 22px; height: 22px; }
.pe-btn:hover { background: rgba(255,255,255,.12); }
.pe-btn:active { transform: scale(.9); }
.pe-btn.on { background: rgba(255,255,255,.22); color: #5ab2ff; }
.pe-btn:disabled { opacity: .3; pointer-events: none; }
.pe-tbtn {
  height: 40px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent;
  color: #fff; font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto;
  transition: background .15s, transform .14s cubic-bezier(.2,.9,.3,1.2), box-shadow .15s, filter .15s;
}
.pe-tbtn:hover { background: rgba(255,255,255,.12); }
.pe-tbtn:active,
.pe-tbtn.pe-tap { transform: scale(.88); }
.pe-tbtn.pe-primary { background: #3390ec; font-weight: 600; margin-left: 4px; }
.pe-tbtn.pe-primary:hover { background: #4aa0f5; }
.pe-tbtn.pe-primary:active,
.pe-tbtn.pe-primary.pe-tap {
  transform: scale(.88);
  filter: brightness(1.12);
  box-shadow: 0 0 0 4px rgba(51,144,236,.35);
}

/* top toolbar (draw mode) */
.pe-top {
  position: absolute; left: 0; right: 0; top: calc(12px + env(safe-area-inset-top, 0px));
  display: none; justify-content: center; padding: 0 8px; pointer-events: none; z-index: 2;
}
#photo-editor[data-mode="draw"] .pe-top { display: flex; }
.pe-top-pill { display: flex; align-items: center; gap: 2px; padding: 5px; pointer-events: auto; animation: pe-down .3s cubic-bezier(.2,.9,.3,1.08) both; }
@keyframes pe-down { from { transform: translateY(-40px); opacity: 0; } to { transform: none; opacity: 1; } }
.pe-tools { display: none; align-items: center; gap: 2px; }
#photo-editor[data-brush="1"] .pe-tools { display: inline-flex; animation: pe-fade .22s ease both; }
@keyframes pe-fade { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
.pe-sep { width: 1px; height: 22px; background: rgba(255,255,255,.2); margin: 0 4px; }
.pe-colorbtn i {
  width: 24px; height: 24px; border-radius: 50%; display: block;
  border: 3px solid transparent; background-clip: padding-box;
  box-shadow: 0 0 0 2px transparent;
  outline: 0;
}
.pe-colorbtn { background: conic-gradient(#f33, #fa0, #ee0, #3c3, #3cf, #36f, #c3f, #f3a, #f33); border-radius: 50%; width: 30px; height: 30px; margin: 5px; }
.pe-colorbtn:hover { background: conic-gradient(#f33, #fa0, #ee0, #3c3, #3cf, #36f, #c3f, #f3a, #f33); filter: brightness(1.15); }
.pe-colorbtn i { width: 30px; height: 30px; border: 0; background-clip: border-box; transform: scale(.52); border: 2px solid rgba(255,255,255,.9); }

/* slider rows */
.pe-row {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(86px + env(safe-area-inset-bottom, 0px));
  width: min(340px, calc(100% - 24px)); height: 38px; padding: 0 14px;
  display: none; align-items: center; gap: 10px; font-size: 13px;
  background: rgba(38,38,42,.62); border: 1px solid rgba(255,255,255,.12); border-radius: 999px;
  -webkit-backdrop-filter: blur(22px) saturate(1.6); backdrop-filter: blur(22px) saturate(1.6);
  animation: pe-rowup .3s ease both;
}
@keyframes pe-rowup { from { transform: translate(-50%, 40px); opacity: 0; } to { transform: translateX(-50%); opacity: 1; } }
.pe-row input[type=range] { flex: 1; min-width: 0; accent-color: #3390ec; }
.pe-row .pe-ico svg,
.pe-row .pe-ico img { width: 18px; height: 18px; display: block; object-fit: contain; }
.pe-row b { min-width: 34px; text-align: right; font-weight: 600; }
.pe-wallpaper[data-mode="crop"] .pe-darkrow,
.pe-photo[data-mode="crop"] .pe-darkrow { display: flex; }
#photo-editor[data-mode="draw"][data-brush="1"] .pe-sizerow { display: flex; }
#photo-editor[data-mode="draw"][data-mosaic="1"] .pe-mosaicrow {
  display: flex;
  bottom: calc(130px + env(safe-area-inset-bottom, 0px));
}
#photo-editor[data-mode="draw"][data-mosaic="1"] .pe-sizerow {
  bottom: calc(86px + env(safe-area-inset-bottom, 0px));
}
.pe-story[data-mode="draw"][data-mosaic="1"] .pe-mosaicrow {
  bottom: calc(244px + env(safe-area-inset-bottom, 0px));
}
.pe-story[data-mode="draw"][data-mosaic="1"] .pe-sizerow {
  bottom: calc(196px + env(safe-area-inset-bottom, 0px));
}
/* popovers */
.pe-pop {
  position: absolute; z-index: 5; display: none; flex-direction: column;
  background: rgba(34,34,38,.82);
  -webkit-backdrop-filter: blur(26px) saturate(1.7); backdrop-filter: blur(26px) saturate(1.7);
  border: 1px solid rgba(255,255,255,.12); border-radius: 18px;
  box-shadow: 0 14px 44px rgba(0,0,0,.55);
  opacity: 0; transform: scale(.55); pointer-events: none;
  transition: transform .22s cubic-bezier(.2,.9,.3,1.15), opacity .18s ease;
}
.pe-pop.pe-in { opacity: 1; transform: scale(1); pointer-events: auto; }
.pe-colorpop { flex-direction: row; flex-wrap: wrap; gap: 8px; padding: 12px; width: 232px; }
.pe-sw {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35);
  cursor: pointer; padding: 0; position: relative; transition: transform .12s;
}
.pe-sw:hover { transform: scale(1.12); }
.pe-swcustom { background: conic-gradient(#f33, #fa0, #ee0, #3c3, #3cf, #36f, #c3f, #f3a, #f33); overflow: hidden; }
.pe-swcustom input { position: absolute; inset: -6px; opacity: 0; cursor: pointer; width: 44px; height: 44px; }
.pe-shapepop {
  padding: 6px;
  width: max-content;
  min-width: 220px;
  max-width: min(320px, calc(100vw - 24px));
  box-sizing: border-box;
  overflow: visible;
}
.pe-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 0; border-radius: 12px;
  background: transparent; color: #fff; font-size: 15px; font-weight: 500; cursor: pointer;
  text-align: left; width: auto; min-width: 100%; box-sizing: border-box;
  white-space: nowrap;
}
.pe-item:hover { background: rgba(255,255,255,.1); }
.pe-item svg,
.pe-item .pe-ico,
.pe-item img {
  width: 22px !important; height: 22px !important; flex: 0 0 auto; display: block; object-fit: contain;
}
.pe-item span { flex: 0 0 auto; white-space: nowrap; }
.pe-fill { justify-content: space-between; gap: 16px; border-top: 1px solid rgba(255,255,255,.1); border-radius: 0 0 12px 12px; margin-top: 4px; padding-top: 12px; }
.pe-fill span { flex: 1 1 auto; }
.pe-fill input { position: absolute; opacity: 0; pointer-events: none; }
.pe-switch { width: 42px; height: 24px; border-radius: 12px; background: rgba(255,255,255,.22); position: relative; transition: background .2s; }
.pe-switch::after { content: ''; position: absolute; left: 2px; top: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; }
.pe-fill input:checked + .pe-switch { background: #34c759; }
.pe-fill input:checked + .pe-switch::after { transform: translateX(18px); }

/* stickers panel */
.pe-stickerpop { width: min(340px, calc(100% - 16px)); height: min(430px, calc(100% - 200px)); overflow: hidden; }
.pe-tabs {
  position: relative;
  display: flex;
  margin: 10px 10px 6px;
  padding: 3px;
  background: rgba(255,255,255,.1);
  border-radius: 12px;
}
.pe-tabs-pill {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc((100% - 6px) / 2);
  height: calc(100% - 6px);
  border-radius: 9px;
  background: rgba(255,255,255,.22);
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  pointer-events: none;
  z-index: 0;
  transition: transform .3s cubic-bezier(.2,.9,.25,1.15);
  will-change: transform;
}
.pe-tabs[data-tab="emoji"] .pe-tabs-pill {
  transform: translateX(100%);
}
.pe-tabs button {
  position: relative;
  z-index: 1;
  flex: 1;
  height: 30px;
  border: 0;
  border-radius: 9px;
  background: transparent !important;
  color: rgba(255,255,255,.65);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: color .22s ease;
}
.pe-tabs button.on { color: #fff; }
.pe-grid.pe-grid-swap { opacity: 0; transform: translateY(6px); }
.pe-grid.pe-grid-in {
  animation: pe-grid-in .26s cubic-bezier(.2,.9,.3,1.05) both;
}
@keyframes pe-grid-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.pe-search { padding: 4px 10px 8px; }
.pe-search input {
  width: 100%; height: 34px; border: 0; border-radius: 10px; padding: 0 12px; outline: none;
  background: rgba(255,255,255,.1); color: #fff; font-size: 14px; user-select: text; -webkit-user-select: text;
}
.pe-search input::placeholder { color: rgba(255,255,255,.5); }
.pe-grid {
  flex: 1; min-height: 0; overflow-y: auto; padding: 4px 8px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 4px; align-content: start;
}
.pe-cell {
  aspect-ratio: 1; border: 0; border-radius: 10px; background: transparent; padding: 4px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: background .15s, transform .12s;
}
.pe-cell:hover { background: rgba(255,255,255,.1); }
.pe-cell:active { transform: scale(.92); }
.pe-cell img { max-width: 100%; max-height: 100%; object-fit: contain; pointer-events: none; }
.pe-emo { font-size: 34px; line-height: 1; padding: 0; }
.pe-empty { grid-column: 1 / -1; text-align: center; color: rgba(255,255,255,.55); font-size: 14px; padding: 36px 16px; }
.pe-packrow {
  display: flex; gap: 4px; padding: 6px 8px; overflow-x: auto; border-top: 1px solid rgba(255,255,255,.1); flex: 0 0 auto;
  scrollbar-width: none;
}
.pe-packrow::-webkit-scrollbar { display: none; }
.pe-pk {
  flex: 0 0 auto; width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: #fff;
  cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 22px; overflow: hidden; padding: 4px;
}
.pe-pk svg { width: 22px; height: 22px; }
.pe-pk img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.pe-pk:hover { background: rgba(255,255,255,.1); }
.pe-pk.on { background: rgba(255,255,255,.22); }

/* text input */
.pe-textbox {
  position: absolute; inset: 0; z-index: 8; display: none; align-items: center; justify-content: center;
  background: rgba(0,0,0,.55); padding: 16px; opacity: 0; transition: opacity .22s ease, background .22s ease;
}
.pe-textbox.pe-in { display: flex; opacity: 1; }
.pe-textbox.pe-out { opacity: 0; background: rgba(0,0,0,0); pointer-events: none; }
.pe-textbox.pe-out .pe-textcard {
  animation: pe-text-out .22s cubic-bezier(.4,0,.2,1) both;
}
.pe-textcard {
  width: min(420px, 100%); padding: 14px; border-radius: 20px;
  background: rgba(38,38,42,.9); border: 1px solid rgba(255,255,255,.12);
  animation: pe-up .28s cubic-bezier(.2,.9,.3,1.08) both;
}
@keyframes pe-text-out {
  from { transform: scale(1) translateY(0); opacity: 1; }
  to   { transform: scale(.88) translateY(18px); opacity: 0; }
}
.pe-textcard textarea {
  width: 100%; resize: none; border: 0; outline: none; background: transparent;
  font-family: inherit; font-weight: 700; font-size: 26px; line-height: 1.25; text-align: center; min-height: 90px; user-select: text; -webkit-user-select: text;
}
.pe-textcard textarea::placeholder { color: rgba(255,255,255,.4); }
.pe-textbtns { display: flex; justify-content: space-between; margin-top: 8px; gap: 8px; }
.pe-textbtns .pe-tbtn { min-width: 88px; }

@media (max-width: 420px) {
  .pe-tbtn { padding: 0 9px; font-size: 13px; }
  .pe-btn { width: 36px; height: 36px; }
  .pe-tbtn { height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  #photo-editor *, #photo-editor { animation-duration: .01s !important; transition-duration: .01s !important; }
}

/* Settings page enter (bottom → up) */
.settings-enter {
  animation: settingsSlideUp .34s cubic-bezier(.16,1,.3,1);
}
@keyframes settingsSlideUp {
  from { transform: translateY(28px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* Media forward sheet */
.media-forward-sheet {
  position: fixed; inset: 0; z-index: 10050;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.media-forward-sheet.open { pointer-events: auto; }
.media-forward-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.55);
  opacity: 0; transition: opacity .25s ease;
}
.media-forward-sheet.open .media-forward-backdrop { opacity: 1; }
.media-forward-panel {
  position: relative; z-index: 1;
  width: min(92vw, 380px);
  max-height: min(78vh, 560px);
  display: flex; flex-direction: column;
  background: var(--card, #1c1c1e);
  border-radius: 18px;
  box-shadow: 0 16px 48px rgba(0,0,0,.4);
  overflow: hidden;
  transform: translateY(40px) scale(.96);
  opacity: 0;
  transition: transform .32s cubic-bezier(.16,1,.3,1), opacity .28s ease;
}
.media-forward-sheet.open .media-forward-panel {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.media-forward-search {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--border, rgba(255,255,255,.08));
}
.media-forward-search svg { color: var(--text3); flex-shrink: 0; }
.media-forward-search input {
  flex: 1; background: transparent; color: var(--text);
  font-size: 15px; min-width: 0;
}
.media-forward-list {
  flex: 1; overflow: auto; min-height: 160px;
  padding: 6px 0;
}
.media-forward-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; cursor: pointer;
}
.media-forward-row:hover { background: rgba(127,127,127,.1); }
.media-forward-row input { width: 18px; height: 18px; accent-color: var(--red, #e8001d); }
.media-forward-name {
  font-size: 15px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.media-forward-footer {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border, rgba(255,255,255,.08));
  background: var(--surface, rgba(255,255,255,.04));
}
.media-forward-msg-wrap {
  flex: 1; min-width: 0; position: relative;
  height: 40px; border-radius: 12px;
  background: var(--bg, #111);
  border: 1px solid var(--border, rgba(255,255,255,.08));
  overflow: hidden;
}
.media-forward-msg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  padding: 0 12px;
  background: transparent; color: var(--text);
  font-size: 14px; z-index: 1;
}
.media-forward-msg-label {
  position: absolute; inset: 0;
  display: flex; align-items: center;
  padding: 0 12px;
  pointer-events: none;
  color: var(--text3);
  font-size: 13px;
  overflow: hidden;
  z-index: 0;
}
.media-forward-msg-label.hidden-label { opacity: 0; }
.media-forward-marquee {
  display: inline-flex; white-space: nowrap; gap: 32px;
}
.media-forward-msg-label.is-marquee .media-forward-marquee {
  animation: mediaFwdMarquee 8s linear infinite;
}
.media-forward-msg-label:not(.is-marquee) .media-forward-marquee span:last-child {
  display: none;
}
@keyframes mediaFwdMarquee {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.media-forward-send {
  flex-shrink: 0;
  padding: 10px 16px;
  border-radius: 12px;
  border: none;
  background: var(--red, #e8001d);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.media-forward-send:active { transform: scale(.97); }

/* ── Индикатор «печатает…» в шапке чата ─────────────── */
.chat-view-status.typing { color: var(--red, #e8001d); background: rgba(var(--red-rgb),.1); }
.typing-status { display: inline-flex; align-items: baseline; }
.typing-word {
  display: inline-block; overflow: hidden; white-space: nowrap;
  max-width: 0; opacity: 0; margin-left: 0;
  transition: max-width .35s ease, opacity .3s ease, margin-left .3s ease;
}
.typing-phase-word .typing-word { max-width: 120px; opacity: 1; margin-left: 5px; }
.typing-dots { display: inline-flex; align-items: center; gap: 3px; height: 10px; }
.typing-dots i {
  width: 4px; height: 4px; border-radius: 50%;
  background: currentColor; display: block;
  animation: typingDot 1.1s ease-in-out infinite;
}
.typing-dots i:nth-child(2) { animation-delay: .16s; }
.typing-dots i:nth-child(3) { animation-delay: .32s; }
.typing-phase-dots .typing-dots i { width: 5px; height: 5px; }
@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30%           { transform: translateY(-3px); opacity: 1; }
}

/* ── Контекстное меню фото (как в Telegram) ─────────── */
.media-ctx-menu {
  position: fixed; z-index: 10060;
  min-width: 210px; padding: 6px;
  background: rgba(40, 40, 42, .96);
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(0,0,0,.45);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: mediaCtxIn .16s ease;
}
@keyframes mediaCtxIn {
  from { opacity: 0; transform: scale(.9); }
  to   { opacity: 1; transform: scale(1); }
}
.media-ctx-item {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border: none; border-radius: 10px;
  background: transparent;
  color: rgba(245,245,247,.95);
  font-size: 15px; font-weight: 500; text-align: left;
  cursor: pointer;
}
.media-ctx-item:hover, .media-ctx-item:active { background: rgba(70,70,74,.9); }
.media-ctx-item svg { flex-shrink: 0; opacity: .9; }
.media-ctx-item.danger { color: #ff5a67; }

.media-del-sheet {
  position: fixed; inset: 0; z-index: 10070;
  display: flex; align-items: flex-end; justify-content: center;
  pointer-events: none;
}
.media-del-sheet.open { pointer-events: auto; }
.media-del-backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,.5);
  opacity: 0; transition: opacity .2s ease;
}
.media-del-sheet.open .media-del-backdrop { opacity: 1; }
.media-del-panel {
  position: relative; width: min(100%, 420px);
  margin: 0 8px calc(8px + env(safe-area-inset-bottom, 0px));
  padding: 8px;
  background: var(--card, #1c1c1e);
  border-radius: 16px;
  transform: translateY(40px); opacity: 0;
  transition: transform .25s cubic-bezier(.16,1,.3,1), opacity .2s ease;
}
.media-del-sheet.open .media-del-panel { transform: translateY(0); opacity: 1; }
.media-del-title { text-align: center; font-size: 13px; color: var(--text3); padding: 8px 0 6px; }
.media-del-btn {
  width: 100%; padding: 14px; border: none; border-radius: 12px;
  background: transparent; color: var(--text);
  font-size: 16px; font-weight: 600; cursor: pointer;
}
.media-del-btn:active { background: rgba(127,127,127,.15); }
.media-del-btn.danger { color: var(--red, #e8001d); }
.media-del-btn.cancel { margin-top: 4px; background: rgba(127,127,127,.12); }

/* ── Все фотографии чата ───────────────────────────── */
.media-all-photos {
  position: fixed; inset: 0; z-index: 9990;
  display: flex; flex-direction: column;
  background: var(--bg, #0f0f10);
  opacity: 0; transition: opacity .2s ease;
}
.media-all-photos.open { opacity: 1; }
.media-all-photos-head {
  display: flex; align-items: center; gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 12px 10px;
}
.media-all-photos-head .media-viewer-close { background: rgba(127,127,127,.2); color: var(--text); }
.media-all-photos-title { font-size: 17px; font-weight: 700; color: var(--text); }
.media-all-photos-grid {
  flex: 1; overflow: auto;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px;
  align-content: start;
}
.media-all-photos-cell {
  position: relative; padding: 0; border: none; background: #000;
  aspect-ratio: 1; cursor: pointer; overflow: hidden;
}
.media-all-photos-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-all-photos-grid .empty-state, .media-all-photos-grid .loading-spinner { grid-column: 1 / -1; }
.bubble-media-wrap[data-action="open-media-viewer"] .bubble-media { cursor: zoom-in; }

/* ══════════════════════════════════════════════════════
   FEED: текстовые посты (центр + ряд действий + диск справа)
   ══════════════════════════════════════════════════════ */
.feed-card--text {
  align-items: center; justify-content: center;
}
.feed-card--text .feed-card-overlay {
  background: linear-gradient(to bottom, rgba(0,0,0,0.12) 0%, transparent 30%, transparent 70%, rgba(0,0,0,0.18) 100%);
}
.feed-text-stack {
  position: relative; z-index: 3;
  width: 100%; max-width: 520px;
  padding: 0 16px;
  display: flex; flex-direction: column; align-items: center;
  gap: 14px;
  color: #fff;
  margin-top: -4%;
}
.feed-text-author {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  text-align: center; cursor: pointer;
}
.feed-text-author .feed-card-username {
  font-size: 16px; font-weight: 800; color: #fff;
  text-shadow: 0 1px 6px rgba(0,0,0,.45);
}
.feed-follow-btn {
  margin-top: 2px;
  min-width: 120px;
  padding: 7px 18px;
  border-radius: 8px;
  border: 1.5px solid rgba(255,255,255,.85);
  background: transparent;
  color: #fff;
  font-size: 13px; font-weight: 700;
  cursor: pointer;
}
.feed-follow-btn.is-following {
  background: rgba(255,255,255,.12);
}
.feed-follow-btn:active { transform: scale(0.96); }
.feed-card--text .feed-card-user { margin-bottom: 0; justify-content: center; text-align: center; }
.feed-card--text .feed-card-user > div { display: flex; flex-direction: column; align-items: center; }
.feed-text-body {
  width: 100%;
  text-align: center;
  font-size: 22px; line-height: 1.35; font-weight: 700;
  word-break: break-word; overflow-wrap: anywhere;
  white-space: pre-wrap;
  text-shadow: 0 2px 8px rgba(0,0,0,0.45);
  max-height: calc(var(--feed-h, 70vh) * 0.5);
  overflow-y: auto; scrollbar-width: none;
  padding: 6px 4px;
}
.post-detail--feed {
  background: #000; padding: 0; height: 100%;
  display: flex; flex-direction: column;
}
.post-detail-topbar--overlay {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20;
  background: linear-gradient(to bottom, rgba(0,0,0,.55), transparent);
  color: #fff;
}
.post-detail-feed-wrap {
  flex: 1; min-height: 0;
  position: relative;
}
.post-detail-feed-wrap .feed-card {
  height: 100%; min-height: 100%;
  border-radius: 0;
}
.post-detail-text { white-space: pre-wrap; word-break: break-word; }
.post-detail-music {
  position: absolute; left: 12px; right: 12px; bottom: 12px;
  z-index: 3;
  display: flex; align-items: center; gap: 10px;
  background: rgba(0,0,0,.55); backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 14px; padding: 8px 12px; color: #fff;
  box-sizing: border-box;
  max-width: calc(100% - 24px);
  pointer-events: auto;
}
.post-detail-music .music-disc-wrap { flex-shrink: 0; margin: 0; }
.post-detail-music .music-disc { width: 40px; height: 40px; }
.post-detail-music-meta { flex: 1; min-width: 0; }
.post-detail-music-title {
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: #fff;
}
/* В блоке инфо поста (если музыка не на медиа) — в потоке, целиком видна */
.post-detail-info .post-detail-music {
  position: static;
  left: auto; right: auto; bottom: auto;
  max-width: none;
  width: 100%;
  margin-top: 14px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.post-detail-info .post-detail-music-title { color: var(--text); }
.feed-text-body::-webkit-scrollbar { display: none; }
.feed-card-actions.feed-card-actions--row {
  position: static;
  width: 100%;
  flex-direction: row; align-items: center; justify-content: center;
  gap: 0;
  right: auto; bottom: auto;
}
.feed-card--text .feed-card-actions--row .feed-action-btn { padding: 6px 7px; gap: 2px; min-width: 0; }
.feed-card--text .feed-card-actions--row .feed-action-btn svg { width: 28px; height: 28px; }
.feed-card--text .feed-card-actions--row .feed-action-profile .avatar,
.feed-card--text .feed-card-actions--row .feed-action-profile .avatar-text,
.feed-card--text .feed-card-actions--row .feed-action-profile .av-frame {
  width: 40px !important; height: 40px !important;
}
.feed-card--text .feed-card-actions--row .music-disc-wrap { margin: 0 0 0 6px; }
.feed-card--text .feed-card-actions--row .music-disc { width: 40px; height: 40px; }
.feed-card--text .feed-text-track {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
  max-width: 90%;
}
.feed-card--text .feed-text-track .music-disc-wrap { margin: 0; flex-shrink: 0; }
.feed-card--text .feed-text-track .music-disc { width: 40px; height: 40px; }
.feed-card--text .feed-text-track .feed-music-strip {
  justify-content: flex-start;
  margin-top: 0;
  max-width: 100%;
  text-align: left;
}
.feed-card--text .feed-music-strip { justify-content: center; margin-top: 0; max-width: 90%; }
.feed-card--text .feed-music-text { animation: none; }

/* ── Выбранный трек в «Новая публикация»: обложка = play/pause ── */
.post-music-cover {
  position: relative; flex-shrink: 0;
  width: 44px; height: 44px; border-radius: 10px;
  padding: 0; border: none; background: transparent; cursor: pointer;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.post-music-cover .post-music-preview-img { width: 44px; height: 44px; display: block; border-radius: 10px; object-fit: cover; }
.post-music-cover .post-music-noimg { background: var(--border); }
.post-music-cover .mp-icon {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; background: rgba(0,0,0,0.38);
  transition: background .15s, opacity .15s;
}
.post-music-cover.is-playing .mp-icon { background: rgba(0,0,0,0.5); }
.post-music-cover:active { transform: scale(0.94); }
.post-music-cover.is-disabled { cursor: default; opacity: .7; }

/* ── Громкость в выборе музыки ── */
.music-vol-row {
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px 10px; color: var(--text2);
}
.music-vol-slider {
  -webkit-appearance: none; appearance: none;
  flex: 1; height: 4px; border-radius: 999px; outline: none; cursor: pointer;
  background: linear-gradient(to right, var(--red) var(--vol, 100%), var(--border) var(--vol, 100%));
}
.music-vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 5px rgba(0,0,0,0.35); cursor: pointer;
}
.music-vol-slider::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%; background: #fff; border: none;
  box-shadow: 0 1px 5px rgba(0,0,0,0.35); cursor: pointer;
}
.music-vol-val { font-size: 12px; font-weight: 700; min-width: 38px; text-align: right; color: var(--text); }
.music-track-preview svg { display: block; }
.music-track-preview.is-playing { background: var(--text); color: var(--card); }

/* ══════════════════════════════════════════════════════
   Telegram-like меню сообщения (долгое нажатие)
   ══════════════════════════════════════════════════════ */
.chat-bubble { -webkit-touch-callout: none; }
.chat-bubble.msg-focus-src { visibility: hidden; }

.msg-focus { position: fixed; inset: 0; z-index: 10040; }
.msg-focus-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.34);
  -webkit-backdrop-filter: blur(18px) saturate(1.1);
  backdrop-filter: blur(18px) saturate(1.1);
  opacity: 0; transition: opacity .22s ease;
}
.msg-focus.in .msg-focus-backdrop { opacity: 1; }
.msg-focus.out .msg-focus-backdrop { opacity: 0; transition-duration: .16s; }
.msg-focus-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.msg-focus-clone {
  position: absolute; margin: 0 !important; max-width: none !important;
  pointer-events: none; z-index: 1;
  transition: transform .3s cubic-bezier(.2,.9,.25,1.05), opacity .15s ease;
  box-shadow: 0 10px 40px rgba(0,0,0,.35);
}
.msg-focus.out .msg-focus-clone { opacity: 0; }

.msg-react-bar, .msg-menu {
  position: absolute; z-index: 2; pointer-events: auto;
  background: rgba(36,36,40,.94); color: #f5f5f7;
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  box-shadow: 0 10px 34px rgba(0,0,0,.45);
  opacity: 0; transform: scale(.7);
  transition: transform .26s cubic-bezier(.2,.9,.25,1.15), opacity .18s ease;
}
.msg-focus.in .msg-react-bar, .msg-focus.in .msg-menu { opacity: 1; transform: scale(1); }
.msg-focus.in .msg-menu { transition-delay: .03s; }
.msg-focus.out .msg-react-bar, .msg-focus.out .msg-menu { opacity: 0; transform: scale(.85); }
.msg-focus.pin-choice .msg-react-bar { display: none; }

.msg-react-bar { border-radius: 30px; padding: 5px 7px; max-width: calc(100% - 16px); }
.msg-react-row { display: flex; align-items: center; gap: 1px; }
.msg-react-pick {
  width: 38px; height: 40px; flex-shrink: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 25px; line-height: 1; color: inherit;
  transition: transform .14s ease, background .14s ease;
}
.msg-react-pick:active { transform: scale(1.3); }
.msg-react-pick.selected { background: rgba(255,255,255,.2); }
.msg-react-expand {
  width: 28px; height: 28px; margin-left: 4px; flex-shrink: 0; border-radius: 50%;
  background: rgba(255,255,255,.22); color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: transform .2s ease;
}
.msg-react-expand svg { width: 18px; height: 18px; }
.msg-focus.expanded .msg-react-expand { transform: rotate(180deg); }
.msg-react-grid { display: none; grid-template-columns: repeat(7, 1fr); gap: 1px; padding: 6px 0 3px; max-height: 210px; overflow-y: auto; scrollbar-width: none; }
.msg-react-grid::-webkit-scrollbar { display: none; }
.msg-react-grid .msg-react-pick { width: 100%; }
.msg-focus.expanded .msg-react-grid { display: grid; }
.msg-focus.expanded .msg-menu,
.msg-focus.expanded .msg-focus-clone { opacity: 0 !important; pointer-events: none; }

.msg-menu {
  border-radius: 20px;
  padding: 6px;
  width: max-content;
  min-width: 232px;
  max-width: calc(100% - 20px);
  box-sizing: border-box;
  overflow: hidden;
}
.msg-menu-item {
  width: auto;
  min-width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px 12px 14px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.25;
  text-align: left;
  color: #f5f5f7;
  white-space: nowrap;
  transition: background .12s ease;
}
.msg-menu-item .tl-ico,
.msg-menu-item svg {
  width: 22px !important;
  height: 22px !important;
  flex-shrink: 0;
  display: block;
  object-fit: contain;
  opacity: .92;
}
.msg-menu-item span {
  flex: 0 1 auto;
  min-width: 0;
  white-space: nowrap;
}
.msg-menu-item:active { background: rgba(255,255,255,.14); }
.msg-menu-item.danger { color: #ff5a67; }
.msg-menu-item.tr-active { color: #c6b4ff; }
.msg-menu-item.has-sub { padding-right: 10px; }
.msg-menu-chevron {
  margin-left: auto;
  opacity: 0.45;
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}
.msg-menu-item.is-picked { background: rgba(168, 139, 255, 0.18); }
.msg-menu-check {
  margin-left: auto;
  color: #c6b4ff;
  font-weight: 700;
  flex-shrink: 0;
}
.msg-menu-sep { height: 1px; margin: 5px 8px; background: rgba(255,255,255,.14); }
.msg-menu-sub {
  max-height: min(360px, 52vh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.msg-menu-lang { min-width: 220px; }
.chat-bubble.is-translating .bubble-text { opacity: 0.55; }
.chat-bubble.is-translated .bubble-text { box-shadow: inset 0 -2px 0 rgba(168, 139, 255, 0.45); }
.msg-menu-pin {
  width: max-content;
  min-width: 232px;
  max-width: min(360px, calc(100vw - 24px));
  overflow: visible;
}
.msg-menu-pin .msg-menu-item {
  padding: 14px 16px;
  white-space: normal;
  align-items: flex-start;
}
.msg-menu-pin .msg-menu-item span {
  flex: 1 1 auto;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Закреплённое сообщение под шапкой */
.chat-pinned-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 6px 14px; flex-shrink: 0;
  background: var(--card); border-bottom: 1px solid var(--border);
}
.chat-pinned-bar.hidden { display: none; }
.pinned-segs { display: flex; flex-direction: column; gap: 2px; width: 3px; height: 32px; flex-shrink: 0; }
.pinned-segs i { flex: 1; border-radius: 2px; background: var(--border); display: block; }
.pinned-segs i.on { background: var(--red); }
.pinned-main { flex: 1; min-width: 0; cursor: pointer; }
.pinned-title { font-size: 12px; font-weight: 700; color: var(--red); line-height: 1.3; }
.pinned-text { font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.pinned-unpin { width: 34px; height: 34px; border-radius: 50%; color: var(--text2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pinned-unpin:active { background: var(--surface); }
.chat-view.has-wallpaper .chat-pinned-bar { background: rgba(255,255,255,.82); backdrop-filter: blur(12px); }
[data-theme="dark"] .chat-view.has-wallpaper .chat-pinned-bar { background: rgba(20,20,20,.82); }

/* Реакции на пузырях */
.msg-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; clear: both; }
.msg-reactions[hidden] { display: none; }
.msg-react-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 13px; font-size: 14px; line-height: 1.4;
  background: rgba(127,127,127,.18); color: inherit;
  transition: transform .12s ease, background .12s ease;
}
.msg-react-chip:active { transform: scale(.92); }
.msg-react-count { font-size: 12px; font-weight: 700; }
.chat-bubble.mine .msg-react-chip { background: rgba(255,255,255,.22); }
.chat-bubble.mine .msg-react-chip.own { background: #fff; color: var(--red); }
.chat-bubble.theirs .msg-react-chip.own { background: var(--red); color: #fff; }
.chat-bubble.bubble-media-only .msg-reactions { padding: 0 2px; }

/* Шапка «Переслано от …» — как в Telegram: полоска только у шапки, фото без рамки */
.bubble-fwd {
  display: flex;
  margin: 0 0 6px;
  color: rgba(255, 255, 255, .92);
}
.chat-bubble.theirs .bubble-fwd { color: var(--primary, var(--red)); }
.bubble-fwd-inner {
  flex: 1;
  min-width: 0;
  border-left: 2px solid currentColor;
  padding-left: 8px;
  line-height: 1.25;
}
.bubble-fwd-label {
  font-size: 12px;
  font-weight: 500;
  opacity: .9;
}
.bubble-fwd-user {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 2px;
  font-size: 13px; font-weight: 700; cursor: pointer; max-width: 100%;
  color: inherit;
}
.bubble-fwd-user .avatar, .bubble-fwd-user .avatar-text {
  width: 18px !important; height: 18px !important; font-size: 8px !important;
  border-radius: 50%; flex-shrink: 0;
}
.bubble-fwd-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Пересланное медиа: компактно сверху, без обводки всей фотки */
.chat-bubble.bubble-has-fwd .bubble-media-wrap {
  display: block;
  width: fit-content;
  max-width: min(100%, 220px);
  margin: 0 0 6px;
  border-radius: 10px;
  overflow: hidden;
  border: none;
  box-shadow: none;
  outline: none;
}
.chat-bubble.bubble-has-fwd .bubble-media,
.chat-bubble.bubble-has-fwd .bubble-media-wrap .bubble-media {
  width: auto;
  max-width: min(100%, 220px);
  max-height: 140px;
  height: auto;
  object-fit: cover;
  object-position: center top;
  border-radius: 10px;
  margin: 0;
  border: none;
  box-shadow: none;
}
.chat-bubble.bubble-has-fwd .bubble-media-wrap--video .bubble-media {
  object-fit: contain;
  background: rgba(0, 0, 0, .2);
  max-height: 160px;
}
/* Цитата ответа */
.bubble-reply {
  border-left: 3px solid var(--red); border-radius: 4px 8px 8px 4px;
  padding: 3px 8px; margin-bottom: 6px; cursor: pointer;
  background: rgba(127,127,127,.14);
}
.bubble-reply-name { font-size: 12px; font-weight: 700; color: var(--red); line-height: 1.3; }
.bubble-reply-text { font-size: 13px; line-height: 1.3; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-bubble.mine .bubble-reply { border-left-color: #fff; background: rgba(255,255,255,.2); }
.chat-bubble.mine .bubble-reply-name { color: #fff; }

/* Панель ответа над вводом */
.chat-reply-bar {
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
  padding: 7px 8px 7px 14px;
  background: var(--card); border-top: 1px solid var(--border);
  animation: replyBarIn .18s ease;
}
.chat-reply-bar.hidden { display: none; }
@keyframes replyBarIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.reply-bar-ico { color: var(--red); display: flex; flex-shrink: 0; }
.reply-bar-body { flex: 1; min-width: 0; border-left: 2px solid var(--red); padding-left: 8px; }
.reply-bar-name { font-size: 13px; font-weight: 700; color: var(--red); line-height: 1.3; }
.reply-bar-text { font-size: 13px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.reply-bar-close { width: 34px; height: 34px; border-radius: 50%; color: var(--text2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.reply-bar-close:active { background: var(--surface); }

/* Режим выбора сообщений */
.chat-select-bar {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
  padding: 8px 10px; background: var(--card); border-top: 1px solid var(--border);
  padding-bottom: max(8px, env(safe-area-inset-bottom));
}
.chat-select-bar.hidden { display: none; }
.select-bar-count { flex: 1; font-weight: 700; font-size: 16px; padding-left: 4px; }
.select-bar-btn { width: 42px; height: 42px; border-radius: 50%; color: var(--text); display: flex; align-items: center; justify-content: center; }
.select-bar-btn:active { background: var(--surface); }
.select-bar-btn.danger { color: var(--red); }
.select-bar-btn:disabled { opacity: .35; pointer-events: none; }
.chat-view.selecting .chat-input-bar,
.chat-view.selecting .chat-reply-bar,
.chat-view.selecting .chat-media-preview,
.chat-view.selecting #chat-emoji-panel { display: none !important; }
.chat-bubble.select-mode { cursor: pointer; user-select: none; -webkit-user-select: none; }
.chat-bubble.select-mode * { pointer-events: none; }
.chat-bubble.selected { outline: 2px solid var(--red); outline-offset: 2px; }
.chat-bubble.selected::after {
  content: '✓'; position: absolute; top: -8px; right: -8px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--red); color: #fff; font-size: 13px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.chat-bubble.msg-flash { animation: msgFlash 1.6s ease; }
@keyframes msgFlash {
  0%   { box-shadow: 0 0 0 0 rgba(var(--red-rgb),.6); }
  25%  { box-shadow: 0 0 0 7px rgba(var(--red-rgb),.35); }
  100% { box-shadow: 0 0 0 0 rgba(var(--red-rgb),0); }
}

/* Шторка перевода */
.msg-tr-sheet { position: fixed; inset: 0; z-index: 10080; display: flex; align-items: flex-end; justify-content: center; pointer-events: none; }
.msg-tr-sheet.open { pointer-events: auto; }
.msg-tr-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.5); opacity: 0; transition: opacity .22s ease; }
.msg-tr-sheet.open .msg-tr-backdrop { opacity: 1; }
.msg-tr-panel {
  position: relative; width: min(100%, 440px); max-height: 88%; overflow-y: auto;
  margin: 0 8px calc(8px + env(safe-area-inset-bottom, 0px)); padding: 14px;
  background: var(--card); color: var(--text); border-radius: 26px;
  box-shadow: 0 -8px 40px rgba(0,0,0,.35);
  transform: translateY(40px); opacity: 0;
  transition: transform .3s cubic-bezier(.16,1,.3,1), opacity .2s ease;
}
.msg-tr-sheet.open .msg-tr-panel { transform: none; opacity: 1; }
.msg-tr-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.msg-tr-title { font-weight: 800; font-size: 17px; }
.msg-tr-x { width: 38px; height: 38px; border-radius: 50%; background: var(--surface); color: var(--text); display: flex; align-items: center; justify-content: center; }
.msg-tr-x-spacer { width: 38px; }
.msg-tr-card { background: var(--surface); border-radius: 18px; padding: 14px; }
.msg-tr-label { font-size: 13px; font-weight: 600; color: var(--text2); display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.msg-tr-label2 { margin-top: 14px; }
.msg-tr-lang { color: #3390ec; }
.msg-tr-select {
  background: transparent; border: none; color: #3390ec; font-weight: 700; font-size: 13px;
  padding: 2px 0; max-width: 55%; cursor: pointer;
}
.msg-tr-select option { color: #111; }
.msg-tr-text { font-size: 17px; line-height: 1.4; word-break: break-word; white-space: pre-wrap; }
.msg-tr-text.err { color: var(--red); font-size: 14px; }
.msg-tr-row { width: 100%; display: flex; align-items: center; gap: 14px; padding: 14px 6px; margin-top: 6px; color: #3390ec; font-size: 16px; font-weight: 500; text-align: left; }
.msg-tr-close-btn { width: 100%; height: 50px; margin-top: 6px; border-radius: 16px; background: #3390ec; color: #fff; font-size: 17px; font-weight: 700; }
.msg-tr-close-btn:active { filter: brightness(.9); }

/* Подпись при пересылке: поле перекрывает подсказку, когда есть текст */
.media-forward-msg:not(:placeholder-shown) { background: var(--bg, #111); }

/* ══════════════════════════════════════════════════════
   ONBOARDING (first-run after registration)
   ══════════════════════════════════════════════════════ */
#onboarding-screen.ob-screen {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(246,46,142,0.35), transparent 55%),
    radial-gradient(90% 60% at 100% 100%, rgba(255,90,106,0.22), transparent 50%),
    #0c0a12;
  color: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
#onboarding-screen.ob-screen.hidden { display: none !important; }
html.tl-onboarding #main-app.ob-blur-hide {
  visibility: hidden;
  pointer-events: none;
}
.ob-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  opacity: 1;
  transform: none;
}
.ob-stage.ob-enter {
  opacity: 0.92;
  transform: translateY(10px);
  transition: none;
}
.ob-stage.ob-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.22s ease, transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}
.ob-chip,
.ob-card {
  -webkit-tap-highlight-color: transparent;
}

/* Welcome */
.ob-welcome { align-items: center; justify-content: center; text-align: center; position: relative; }
.ob-welcome-orb {
  position: absolute;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(246,46,142,0.45), transparent 70%);
  filter: blur(8px);
  animation: obOrb 4.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes obOrb {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.15); opacity: 1; }
}
.ob-welcome-logo {
  width: auto; height: auto;
  max-height: 100px;
  border-radius: 0;
  background: none;
  box-shadow: none;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 24px;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 0 18px rgba(255, 45, 120, 0.45));
  animation: obLogoIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.ob-welcome-infinity {
  width: auto; height: auto;
  max-height: 88px; max-width: 220px;
  object-fit: contain;
  display: block;
}
@keyframes obLogoIn {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.ob-welcome-title {
  font-size: 28px; font-weight: 800; line-height: 1.25;
  letter-spacing: -0.4px; margin: 0 12px 10px; position: relative; z-index: 1;
}
.ob-welcome-sub {
  font-size: 15px; color: rgba(255,255,255,0.62); margin: 0 20px 36px;
  line-height: 1.4; position: relative; z-index: 1;
}

/* Progress */
.ob-top {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 0 12px; flex-shrink: 0;
}
.ob-back {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.ob-back:active { transform: scale(0.94); }
.ob-progress {
  flex: 1; height: 6px; border-radius: 99px;
  background: rgba(255,255,255,0.12); overflow: hidden;
}
.ob-progress-fill {
  height: 100%; border-radius: inherit;
  background: var(--accent-grad-h);
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 0 12px rgba(var(--red-rgb), 0.5);
}
.ob-step-num {
  font-size: 12px; font-weight: 700; color: rgba(255,255,255,0.5);
  min-width: 36px; text-align: right;
}

.ob-q-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 12px; }
.ob-q-title {
  font-size: 26px; font-weight: 800; letter-spacing: -0.3px;
  margin: 8px 0 6px; line-height: 1.2;
}
.ob-q-hint { font-size: 14px; color: rgba(255,255,255,0.55); margin: 0 0 18px; }
.ob-footer { flex-shrink: 0; padding-top: 8px; }

.ob-btn-primary {
  width: 100%;
  padding: 16px;
  border: none; border-radius: 16px;
  background: var(--accent-grad-h);
  color: #fff; font-size: 16px; font-weight: 750;
  box-shadow: 0 10px 28px rgba(var(--red-rgb), 0.4);
  transition: transform 0.15s, filter 0.15s, opacity 0.15s;
}
.ob-btn-primary:active { transform: scale(0.98); }
.ob-btn-primary:disabled {
  opacity: 0.4; box-shadow: none; cursor: not-allowed;
}
.ob-btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 20px; border-radius: 14px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.16);
  color: #fff; font-weight: 650; font-size: 14px; cursor: pointer;
}
.ob-skip {
  background: none; border: none; color: rgba(255,255,255,0.5);
  font-size: 14px; margin-top: 14px; text-decoration: underline;
  text-underline-offset: 3px; cursor: pointer;
}

.ob-input-wrap { margin-top: 8px; }
.ob-input {
  width: 100%; box-sizing: border-box;
  padding: 16px 18px; border-radius: 16px;
  border: 1.5px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.07);
  color: #fff; font-size: 18px; font-weight: 600;
  outline: none;
}
.ob-input:focus {
  border-color: rgba(246,46,142,0.65);
  box-shadow: 0 0 0 4px rgba(246,46,142,0.18);
}
.ob-input::placeholder { color: rgba(255,255,255,0.35); font-weight: 500; }

.ob-chips {
  display: flex; flex-wrap: wrap; gap: 10px;
}
.ob-chips-sm { gap: 8px; }
.ob-flag {
  width: 28px; height: 20px;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
  flex-shrink: 0;
  display: block;
}
.ob-chip-inner {
  display: inline-flex; align-items: center; gap: 8px;
}
.ob-chip-txt { line-height: 1.2; }
.ob-level-title {
  display: flex; align-items: center; gap: 10px;
}
.ob-chip {
  padding: 10px 14px; border-radius: 999px;
  border: 1.5px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.88);
  font-size: 14px; font-weight: 650;
  transition: transform 0.15s, background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.ob-chip-lang { padding: 8px 14px 8px 10px; }
.ob-chip.selected {
  background: linear-gradient(100deg, rgba(255,90,106,0.95), rgba(246,46,142,0.95));
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(246,46,142,0.35);
  color: #fff;
}
.ob-chip.ob-pop { animation: obPop 0.28s ease; }
@keyframes obPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.ob-cards {
  display: flex; flex-direction: column; gap: 10px;
}
.ob-cards-2 {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.ob-cards-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.ob-card {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 14px; border-radius: 18px;
  border: 1.5px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: #fff; text-align: left;
  font-size: 15px; font-weight: 650;
  transition: transform 0.18s cubic-bezier(0.22,1,0.36,1), background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.ob-cards-grid .ob-card {
  flex-direction: column; align-items: flex-start;
  min-height: 88px; justify-content: center;
}
.ob-card:active { transform: scale(0.97); }
.ob-card.selected {
  background: linear-gradient(145deg, rgba(255,90,106,0.28), rgba(246,46,142,0.22));
  border-color: rgba(246,46,142,0.75);
  box-shadow: 0 8px 24px rgba(246,46,142,0.22), inset 0 0 0 1px rgba(255,255,255,0.08);
  transform: scale(1.02);
}
.ob-card-ico { font-size: 22px; line-height: 1; }
.ob-card-label { line-height: 1.25; }

.ob-levels { display: flex; flex-direction: column; gap: 16px; }
.ob-level-block {
  padding: 14px; border-radius: 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
}
.ob-level-title { font-weight: 700; margin-bottom: 10px; font-size: 15px; }

.ob-photo { display: flex; flex-direction: column; align-items: center; padding-top: 12px; }
.ob-photo-preview {
  width: 140px; height: 140px; border-radius: 50%;
  overflow: hidden; margin-bottom: 20px;
  background: var(--accent-grad);
  box-shadow: 0 14px 36px rgba(var(--red-rgb), 0.35);
  display: flex; align-items: center; justify-content: center;
  border: 3px solid rgba(255,255,255,0.2);
}
.ob-photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.ob-photo-placeholder {
  font-size: 42px; font-weight: 800; color: #fff;
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,0.35);
}
.ob-photo-btn { cursor: pointer; }

/* Finish */
.ob-finish {
  align-items: center; justify-content: center; text-align: center; position: relative;
}
.ob-finish-burst {
  position: absolute; width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, rgba(246,46,142,0.5), transparent 68%);
  animation: obBurst 1.2s ease-out both;
  pointer-events: none;
}
@keyframes obBurst {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1.2); opacity: 1; }
}
.ob-finish-check {
  width: 84px; height: 84px; border-radius: 50%;
  background: var(--accent-grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; font-weight: 800;
  box-shadow: 0 16px 40px rgba(var(--red-rgb), 0.45);
  margin-bottom: 24px; position: relative; z-index: 1;
  animation: obCheck 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both;
}
@keyframes obCheck {
  from { transform: scale(0); }
  to { transform: scale(1); }
}
.ob-finish-title {
  font-size: 26px; font-weight: 800; margin: 0 16px 10px;
  position: relative; z-index: 1;
  animation: obFadeUp 0.5s ease 0.25s both;
}
.ob-finish-sub {
  font-size: 15px; color: rgba(255,255,255,0.6); margin: 0;
  position: relative; z-index: 1;
  animation: obFadeUp 0.5s ease 0.4s both;
}
@keyframes obFadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-height: 640px) {
  .ob-welcome-logo { width: 110px; height: 55px; margin-bottom: 18px; }
  .ob-welcome-infinity { width: 110px; height: 55px; }
  .ob-welcome-title { font-size: 24px; }
  .ob-q-title { font-size: 22px; }
}

/* ======================================================
   LIQUID GLASS PROFILE (iOS-style)
   ====================================================== */
.lg-profile {
  min-height: 100%;
  background: linear-gradient(180deg, #fff5f7 0%, #f7f7fa 40%, #f3f3f6 100%);
  padding-bottom: calc(var(--nav-h) + 28px + env(safe-area-inset-bottom, 0px));
}
[data-theme="dark"] .lg-profile {
  background: linear-gradient(180deg, #1a0a10 0%, #0f0f12 45%, #0c0c0e 100%);
}

.lg-hero {
  position: relative;
  overflow: visible;
  padding: 14px 18px 22px;
  color: #fff;
  background: var(--profile-hero-bg, linear-gradient(160deg, var(--red-light) 0%, var(--red) 42%, var(--red-dark) 78%, color-mix(in srgb, var(--red-dark) 75%, #000) 100%));
  border-radius: 0 0 28px 28px;
  align-items: center;
}
.lg-hero .profile-stickers,
.lg-hero .profile-stickers-overlay,
.lg-hero .lg-hero-glow {
  overflow: hidden;
  border-radius: inherit;
}
.lg-hero-glow {
  position: absolute;
  inset: -20% -10% auto;
  height: 70%;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(255,255,255,0.35), transparent 50%),
    radial-gradient(ellipse at 90% 10%, rgba(255,180,200,0.35), transparent 45%);
  pointer-events: none;
  z-index: 0;
}
.lg-hero > *:not(.lg-hero-glow):not(.profile-stickers):not(.profile-stickers-overlay) {
  position: relative;
  z-index: 1;
}

.lg-topbar {
  margin-bottom: 18px;
  align-self: stretch;
}
.lg-glass-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 0 0 auto;
  color: #fff;
  background: rgba(255,255,255,0.22);
  border: 1px solid rgba(255,255,255,0.42);
  /* без backdrop-filter — он клипает содержимое при flex-shrink */
  box-shadow:
    0 4px 16px rgba(0,0,0,0.12),
    inset 0 1px 0 rgba(255,255,255,0.45);
  transition: transform 0.22s cubic-bezier(0.34,1.45,0.64,1), background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.lg-glass-btn:active { transform: scale(0.94); background: rgba(255,255,255,0.32); }
.lg-settings-btn {
  padding: 8px 18px 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 650;
  width: max-content;
  min-width: max-content;
  max-width: none;
  flex: 0 0 auto;
  white-space: nowrap;
  box-sizing: border-box;
  overflow: visible;
}
.lg-settings-btn span {
  display: inline-block;
  white-space: nowrap;
  line-height: 1.25;
  flex-shrink: 0;
}
.lg-settings-btn .tl-ico {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.lg-topbar.profile-hero-topbar,
.profile-hero-topbar.lg-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0;
  box-sizing: border-box;
  overflow: visible;
}
.lg-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  margin-left: auto;
}
.lg-qr-btn,
.lg-edit-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  padding: 0;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.lg-avatar-wrap {
  margin: 4px auto 14px;
}
.lg-avatar-wrap .avatar,
.lg-avatar-wrap .avatar-text,
.lg-avatar-wrap .av-frame {
  box-shadow:
    0 0 0 3px rgba(255,255,255,0.92),
    0 10px 28px rgba(0,0,0,0.22) !important;
}
.lg-cam-btn {
  background: var(--accent-grad) !important;
  border: 2px solid rgba(255,255,255,0.95) !important;
  width: 32px !important;
  height: 32px !important;
  box-shadow: 0 4px 14px rgba(var(--red-rgb), 0.45);
  transition: transform 0.22s cubic-bezier(0.34,1.45,0.64,1);
}
.lg-cam-btn:active { transform: scale(0.9); }

.lg-name-row {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0 16px;
  min-height: 36px;
  margin-bottom: 4px;
  box-sizing: border-box;
}
.lg-name-row .profile-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lg-hero .profile-name {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.3px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.2);
  margin: 0;
  text-align: center;
}
.lg-hero .profile-username {
  opacity: 0.88;
  font-size: 14px;
  margin-bottom: 10px;
}
.lg-hero .profile-bio {
  max-width: 320px;
  text-align: center;
  font-size: 13px;
  opacity: 0.9;
  margin-bottom: 12px;
}
.lg-edit-btn .tl-ico,
.lg-edit-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.lg-edit-btn svg {
  stroke: #fff;
  stroke-width: 2.2;
}
.lg-edit-btn:active { transform: scale(0.94); }

.lg-stats {
  display: flex;
  align-items: stretch;
  gap: 6px;
  width: 100%;
  max-width: 360px;
  padding: 10px 12px;
  border-radius: 18px;
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.32);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  box-shadow:
    0 8px 24px rgba(0,0,0,0.12),
    inset 0 1px 0 rgba(255,255,255,0.35);
}
.lg-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 6px 4px;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  border-radius: 12px;
  transition: background 0.15s, transform 0.2s cubic-bezier(0.34,1.45,0.64,1);
}
.lg-stat:active { background: rgba(255,255,255,0.12); transform: scale(0.96); }
.lg-stat .tl-ico {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  opacity: 0.95;
}
.lg-stat-text { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.lg-stat-num { font-size: 16px; font-weight: 800; line-height: 1.1; }
.lg-stat-label { font-size: 10px; font-weight: 600; opacity: 0.85; text-align: center; }

.lg-body {
  padding: 14px 14px 0;
}
.lg-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: none !important;
  margin-bottom: 14px;
  overflow: visible;
}
.lg-tabs::-webkit-scrollbar { display: none; }
.lg-tab.uprofile-tab {
  flex: 1 1 calc(50% - 8px) !important;
  width: auto;
  min-width: 0;
  max-width: none;
  border-bottom: none !important;
  border-radius: 999px;
  padding: 10px 18px !important;
  gap: 6px !important;
  font-size: 13px !important;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  box-sizing: border-box;
  overflow: visible;
  color: var(--text) !important;
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(255,255,255,0.7);
  box-shadow: none;
  transition: transform 0.22s cubic-bezier(0.34,1.45,0.64,1), background 0.2s, color 0.2s;
}
.lg-tab.uprofile-tab .tl-ico {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
[data-theme="dark"] .lg-tab.uprofile-tab {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.12);
  color: var(--text) !important;
}
.lg-tab.uprofile-tab:active { transform: scale(0.95); }
.lg-tab.uprofile-tab.active {
  color: #fff !important;
  background: var(--accent-grad-h) !important;
  border-color: transparent !important;
  box-shadow: none;
}
.lg-tab.uprofile-tab.active svg,
.lg-tab.uprofile-tab.active .tl-ico { stroke: #fff; }

.lg-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 36px 22px;
  margin: 4px 2px 12px;
  border-radius: 24px;
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(255,255,255,0.85);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  box-shadow:
    0 12px 36px rgba(var(--red-rgb),0.08),
    inset 0 1px 0 rgba(255,255,255,0.9);
}
[data-theme="dark"] .lg-empty {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.1);
}
.lg-empty-art {
  margin-bottom: 14px;
  line-height: 0;
}
.lg-empty-art svg {
  width: 112px !important;
  height: 90px !important;
  display: block;
}
.lg-empty-title {
  font-size: 16px;
  font-weight: 750;
  color: var(--text);
  margin: 0 0 16px;
}
.lg-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border-radius: 999px;
  border: none;
  color: #fff;
  font-size: 15px;
  font-weight: 750;
  background: var(--accent-grad-h);
  box-shadow: 0 12px 28px rgba(var(--red-rgb), 0.4);
  transition: transform 0.24s cubic-bezier(0.34,1.45,0.64,1), box-shadow 0.2s;
}
.lg-cta-btn:active {
  transform: scale(0.95);
  box-shadow: 0 6px 16px rgba(var(--red-rgb), 0.3);
}

.lg-anim {
  animation: lgRise 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: var(--lg-delay, 0ms);
}
@keyframes lgRise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.lg-tab-panel.lg-panel-in {
  animation: lgPanelIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes lgPanelIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .lg-anim,
  .lg-tab-panel.lg-panel-in,
  .lg-glass-btn,
  .lg-tab.uprofile-tab,
  .lg-cta-btn,
  .nav-create-icon { animation: none !important; transition: none !important; }
}


/* ── Privacy settings screen (ported) ── */
.privacy-screen { padding-bottom: 28px; min-height: 100%; }
.privacy-card {
  margin: 14px 16px;
  padding: 14px 0 6px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.privacy-card-title {
  padding: 2px 18px 12px;
  font-size: 14px; font-weight: 800;
  color: #5eb3f6;
  letter-spacing: .01em;
}
.privacy-row {
  display: block; width: 100%;
  text-align: left;
  padding: 12px 18px;
  background: transparent; border: none; color: inherit;
  cursor: pointer;
  transition: background .12s;
}
.privacy-row:active { background: rgba(127,127,127,.12); }
.privacy-row-q {
  font-size: 15px; font-weight: 600; line-height: 1.35;
  color: var(--text); margin-bottom: 4px;
}
.privacy-row-a {
  font-size: 13px; font-weight: 600;
  color: #8aa0b4;
}
.privacy-hint {
  margin: 10px 22px 0;
  font-size: 12px; line-height: 1.4;
  color: var(--text3);
}
.privacy-pick-list { display: flex; flex-direction: column; gap: 2px; }
.privacy-pick-item {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 14px 12px; border-radius: 12px;
  background: transparent; border: none; color: var(--text);
  font-size: 16px; font-weight: 600; cursor: pointer; text-align: left;
}
.privacy-pick-item:active { background: rgba(127,127,127,.12); }
.privacy-pick-item.active { color: #5eb3f6; }
.privacy-pick-check { color: #5eb3f6; font-weight: 800; }
.privacy-ex-block {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border, rgba(127,127,127,.2));
}
.privacy-ex-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 6px;
}
.privacy-ex-title { font-size: 15px; font-weight: 700; color: var(--text); }
.privacy-ex-add {
  border: none; background: transparent; color: #5eb3f6;
  font-size: 14px; font-weight: 700; cursor: pointer; padding: 4px 2px;
}
.privacy-ex-hint {
  font-size: 12px; color: var(--text3); margin: 0 0 10px; line-height: 1.35;
}
.privacy-ex-list, .privacy-ex-pick-list {
  display: flex; flex-direction: column; gap: 2px; max-height: 42vh; overflow: auto;
}
.privacy-ex-row, .privacy-ex-pick {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 8px 4px; border: none; background: transparent;
  color: inherit; text-align: left; cursor: pointer; border-radius: 10px;
}
.privacy-ex-pick:active { background: rgba(127,127,127,.12); }
.privacy-ex-pick.is-on { opacity: 0.55; cursor: default; }
.privacy-ex-meta, .privacy-ex-pick-meta {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px;
}
.privacy-ex-name, .privacy-ex-pick-name {
  font-size: 14px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.privacy-ex-sub, .privacy-ex-pick-sub {
  font-size: 12px; color: var(--text3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.privacy-ex-remove {
  border: none; background: rgba(127,127,127,.12); color: var(--text2);
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 14px;
}
.privacy-ex-pick-mark { color: #5eb3f6; font-weight: 800; font-size: 18px; }
.privacy-ex-empty {
  padding: 14px 6px; font-size: 13px; color: var(--text3); text-align: center;
}
.privacy-ex-search {
  width: 100%; box-sizing: border-box; margin-bottom: 10px;
  border: 1px solid var(--border, rgba(127,127,127,.25));
  background: var(--bg2, rgba(127,127,127,.08));
  color: var(--text); border-radius: 12px; padding: 10px 12px; font-size: 14px;
  outline: none;
}
.privacy-pick-hint {
  margin: 12px 4px 4px;
  font-size: 12px; line-height: 1.4; color: var(--text3);
}
.bubble-fwd-hidden { opacity: .75; font-style: italic; cursor: default; }



/* ── Channel composer / settings (ported) ── */
.channel-composer-extras { width: 100%; flex: 0 0 100%; }
.chat-view-channel .chat-input-bar { flex-wrap: wrap; align-items: center; }
.channel-silent-banner {
  width: 100%; text-align: center; font-size: 12px; color: var(--text2);
  padding: 4px 8px 0; line-height: 1.3;
}
.chat-compose-field {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--surface);
  border-radius: 24px;
  border: 1.5px solid var(--border);
  transition: border-color var(--transition);
}
.chat-compose-field:focus-within { border-color: var(--red); }
.chat-compose-field .chat-input {
  flex: 1;
  min-width: 0;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 24px;
  padding: 11px 8px 11px 16px;
}
.chat-compose-field .chat-input:focus { border: none !important; }
.chat-compose-field .chat-emoji-btn {
  flex-shrink: 0;
  margin-right: 2px;
}
/* Downloads: tools live inside existing .chat-compose bubble */
.chat-view-channel .chat-compose {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
}
.chat-view-channel .chat-compose .chat-sticker-draft {
  flex: 0 0 100%;
}
.chat-view-channel .chat-compose .chat-input {
  flex: 1;
  min-width: 0;
}
.channel-composer-tools {
  display: flex; align-items: center; gap: 0;
  flex-shrink: 0; width: auto; padding: 0 2px;
}
.channel-composer-tools.is-typing-hidden { display: none; }
.channel-tool-btn {
  width: 32px; height: 32px; border-radius: 50%; color: var(--text2);
  display: inline-flex; align-items: center; justify-content: center; position: relative;
  border: none; background: transparent; padding: 0; cursor: pointer;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.channel-tool-btn:active { background: rgba(51, 144, 236, 0.12); }
.channel-tool-btn.is-on { color: #3390ec; }
.channel-tool-btn.tl-liquid-btn,
.channel-tool-btn.tl-liquid-btn::before {
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.channel-tool-btn.tl-liquid-btn::before {
  display: none !important;
  content: none !important;
}
.channel-tool-ttl {
  position: absolute; right: 1px; bottom: 1px; font-size: 7px; font-weight: 800; color: #3390ec;
}
.chat-input-bar.channel-readonly {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0));
  background: transparent !important; border-top: none;
  backdrop-filter: none !important;
}
.chat-view.has-wallpaper .chat-input-bar.channel-readonly {
  background: transparent !important;
}
.chat-input-bar.channel-readonly > :not(.channel-sub-bar) { display: none !important; }
.channel-sub-bar {
  display: flex; align-items: center; gap: 10px; width: 100%;
}
.channel-sub-mute {
  flex: 1; min-width: 0; height: 48px; border: none; border-radius: 999px;
  background: rgba(40, 44, 52, 0.92);
  color: #fff; font-size: 16px; font-weight: 700; letter-spacing: 0.01em;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.channel-sub-mute:active { filter: brightness(1.12); }
.channel-sub-search {
  flex: 0 0 48px; width: 48px; height: 48px; border: none; border-radius: 50%;
  background: rgba(40, 44, 52, 0.92);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.channel-sub-search:active { filter: brightness(1.12); }
[data-theme="light"] .channel-sub-mute,
[data-theme="light"] .channel-sub-search {
  background: rgba(230, 232, 236, 0.96); color: #111;
}

.ginfo-admin-badge {
  font-size: 11px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #3390ec, #2a7fd4);
  padding: 2px 8px; border-radius: 999px;
}
.ginfo-role-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2); font-size: 12px; font-weight: 700;
  padding: 6px 10px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.ginfo-role-btn.accent { color: #3390ec; border-color: color-mix(in srgb, #3390ec 35%, var(--border)); }
.ginfo-role-btn:hover { background: color-mix(in srgb, #3390ec 14%, transparent); }
.ginfo-page .tl-liquid-btn,
.ginfo-page .tl-liquid-btn::before {
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.ginfo-page .tl-liquid-btn::before {
  display: none !important;
  content: none !important;
}
.ginfo-page .ginfo-action.tl-liquid-btn,
.ginfo-page .ginfo-tab.tl-liquid-btn,
.ginfo-page .ginfo-role-btn.tl-liquid-btn,
.ginfo-page .ginfo-add-row.tl-liquid-btn {
  background: var(--surface) !important;
}
.ginfo-page .ginfo-add-row.tl-liquid-btn {
  background: transparent !important;
}
.ginfo-page .ginfo-icon-btn.tl-liquid-btn,
.ginfo-page .ginfo-edit-btn.tl-liquid-btn,
.ginfo-page .ginfo-kick-btn.tl-liquid-btn {
  background: transparent !important;
}

/* ── Chat search panel (TG-style) ────────────────────── */
.chat-search-panel {
  position: absolute; inset: 0; z-index: 40;
  background: var(--bg, #0e1216); display: flex; flex-direction: column;
}
.chat-search-panel--list {
  position: fixed; inset: 0; z-index: 120;
  padding-top: env(safe-area-inset-top, 0);
}
.chat-search-panel-bar, .chat-search-panel-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.chat-search-panel-bar input, .chat-search-panel-head input {
  flex: 1; height: 38px; border: none; border-radius: 10px;
  background: var(--surface); color: var(--text); padding: 0 12px; font-size: 15px; outline: none;
}
.chat-search-clear-q, .chat-search-close, .chat-search-panel-bar [data-action="chat-search-close"] {
  width: 36px; height: 36px; border-radius: 50%; color: var(--text2); font-size: 16px;
}
.chat-search-scope {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px; font-size: 13px; color: var(--text2);
}
.chat-search-scope-btn, .chat-search-scope-chip {
  background: var(--surface); color: var(--text); border-radius: 10px;
  padding: 8px 12px; font-weight: 600; font-size: 13px;
}
.chat-search-summary { padding: 4px 14px 8px; font-size: 13px; color: var(--text2); }
.chat-search-results { flex: 1; overflow-y: auto; padding: 0 6px 16px; }
.chat-search-result, .chat-search-hit {
  display: flex; gap: 10px; align-items: flex-start; width: 100%;
  padding: 10px 8px; border-radius: 12px; text-align: left; color: var(--text);
}
.chat-search-result:active, .chat-search-hit:active { background: var(--surface); }
.chat-search-result-body, .chat-search-hit-body { flex: 1; min-width: 0; }
.chat-search-result-head, .chat-search-hit-top {
  display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 2px;
}
.chat-search-result-head span, .chat-search-hit-top span { color: var(--text2); flex-shrink: 0; }
.chat-search-result-text, .chat-search-hit-text {
  font-size: 14px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block;
}
.chat-search-mark { background: transparent; color: #5ec8ff; font-weight: 700; padding: 0; }
.chat-search-empty { text-align: center; color: var(--text2); padding: 28px 12px; font-size: 14px; }
.chat-bubble.search-hit { outline: 1px solid rgba(94,200,255,.55); }
.chat-search-scope-sheet {
  position: fixed; inset: 0; z-index: 2147483600;
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.chat-search-scope-sheet.open { opacity: 1; pointer-events: auto; }
.chat-search-scope-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.chat-search-scope-panel {
  position: relative; width: min(100%, 480px); max-height: 70vh;
  background: var(--card, #1a1d24); border-radius: 18px 18px 0 0;
  padding: 12px 14px calc(14px + env(safe-area-inset-bottom, 0px));
  transform: translateY(24px); transition: transform .22s ease; overflow: hidden;
  display: flex; flex-direction: column;
}
.chat-search-scope-sheet.open .chat-search-scope-panel { transform: none; }
.chat-search-scope-list { overflow-y: auto; flex: 1; min-height: 0; }
.channel-username-hint { font-size: 12px; color: var(--text2); margin-top: 4px; }
.search-section-label {
  font-size: 12px; font-weight: 800; color: var(--text2);
  text-transform: uppercase; letter-spacing: .04em; margin: 8px 4px 10px;
}

/* ── Channel settings (TG «Изменить») ───────────────── */

.cset-page {
  display: flex; flex-direction: column; min-height: 100%;
  background: var(--bg);
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}
.cset-page.cset-animating {
  overflow: hidden;
}
.cset-body.animate__animated {
  animation-fill-mode: both;
}
.cset-topbar, .cset-subhead {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 8px 4px;
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
}
.cset-title {
  flex: 1; text-align: center; font-size: 17px; font-weight: 700;
}
.cset-body {
  padding: 8px 0 24px;
  --animate-duration: 0.34s;
}
.cset-section {
  margin: 10px 16px;
  background: var(--card);
  border-radius: 14px;
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.cset-row {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  background: transparent; border: none; border-top: 1px solid var(--border);
  color: var(--text); text-align: left; cursor: pointer;
  font: inherit; -webkit-tap-highlight-color: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-radius: 0;
}
.cset-row:first-child { border-top: none; }
.cset-row:active { background: color-mix(in srgb, var(--surface) 80%, transparent); }
.cset-page .tl-liquid-btn,
.cset-page .tl-liquid-btn::before,
.cset-row.tl-liquid-btn,
.cset-row.tl-liquid-btn::before,
.cset-text-btn.tl-liquid-btn,
.cset-text-btn.tl-liquid-btn::before {
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.cset-page .tl-liquid-btn::before,
.cset-row.tl-liquid-btn::before,
.cset-text-btn.tl-liquid-btn::before {
  display: none !important;
  content: none !important;
}
.cset-section.tl-liquid-btn,
.cset-page .cset-section {
  background: var(--card) !important;
}
.cset-row-label { flex: 1; font-size: 15px; font-weight: 500; min-width: 0; }
.cset-row-hint { font-size: 13px; color: var(--text3); text-align: right; }
.cset-row-toggle { cursor: default; }
.cset-row-toggle:active { background: transparent; }
.cset-row-danger .cset-row-label { color: var(--red); font-weight: 600; }
.cset-row-ico { color: var(--red); display: inline-flex; }
.cset-hint {
  margin: 8px 20px 0; font-size: 13px; color: var(--text3); line-height: 1.35;
}
.cset-empty {
  padding: 18px 16px; font-size: 14px; color: var(--text3); text-align: center;
}
.cset-edit-name { padding: 8px 16px 0; text-align: center; }
.cset-text-btn {
  background: none; border: none; color: #3390ec;
  font-size: 15px; font-weight: 600; cursor: pointer; padding: 10px;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.cset-topbar .ginfo-icon-btn,
.cset-subhead .ginfo-icon-btn {
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.cset-invite-box {
  background: var(--surface); border-radius: 12px; padding: 12px 14px;
}
.cset-invite-label { font-size: 12px; color: var(--text3); margin-bottom: 6px; }
.cset-invite-url {
  font-size: 14px; word-break: break-all; color: var(--text); line-height: 1.35;
}
.cset-log-row, .cset-ban-row {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.cset-log-row:first-child, .cset-ban-row:first-child { border-top: none; }
.cset-log-main { font-size: 14px; font-weight: 600; }
.cset-log-meta { font-size: 12px; color: var(--text3); margin-top: 3px; }
.cset-ban-row {
  display: flex; align-items: center; gap: 10px;
}
.cset-ban-info { flex: 1; min-width: 0; }
.cset-ban-name { font-size: 15px; font-weight: 600; }
.cset-ban-reason { font-size: 12px; color: var(--text3); margin-top: 2px; }
.cset-people-row {
  border-top: 1px solid var(--border);
}
.cset-people-row:first-child { border-top: none; }
.cset-section .ginfo-member {
  padding-left: 14px;
  padding-right: 12px;
}
/* Канал: Author  0👁  23:07 — справа от текста */
.bubble-channel-meta {
  float: right;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 4px 0 -2px 10px;
  font-size: 11px;
  line-height: 14px;
  color: var(--text3);
  opacity: 0.78;
  white-space: nowrap;
  max-width: 78%;
  user-select: none;
}
.bubble-views {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.bubble-views-n {
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.bubble-views-ico {
  width: 13px;
  height: 13px;
  opacity: 0.9;
  flex-shrink: 0;
}
.bubble-channel-sign {
  font-size: 11px;
  font-style: italic;
  font-weight: 600;
  color: inherit;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
  flex-shrink: 1;
  min-width: 0;
}
.bubble-channel-meta .bubble-time {
  float: none;
  margin: 0;
  opacity: 0.9;
  font-size: 11px;
  flex-shrink: 0;
}
.chat-bubble.mine .bubble-channel-meta {
  color: rgba(255, 255, 255, 0.78);
}
.chat-bubble.mine .bubble-channel-meta .bubble-time {
  opacity: 0.85;
}
.bubble-main.has-channel-meta::after {
  content: '';
  display: table;
  clear: both;
}
.bubble-text {
  white-space: pre-wrap;
  word-break: break-word;
}
/* Telegram-style channel translation bar (под шапкой, на все посты) */
.channel-tr-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  margin: 8px 12px 4px;
  padding: 0 2px 0 12px;
  min-height: 40px;
  border-radius: 12px;
  background: rgba(40, 40, 44, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  z-index: 3;
}
.channel-tr-bar.hidden,
.channel-tr-bar[hidden] {
  display: none !important;
}
[data-theme="day"] .channel-tr-bar,
.theme-day .channel-tr-bar {
  background: rgba(45, 45, 48, 0.94);
}
.channel-tr-bar-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  background: none;
  color: inherit;
  padding: 10px 4px;
  cursor: pointer;
  text-align: left;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
}
.channel-tr-bar-ico {
  display: inline-flex;
  flex-shrink: 0;
}
.channel-tr-bar-ico .tl-ico,
.channel-tr-bar-more .tl-ico {
  filter: brightness(0) invert(1);
}
.channel-tr-bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.channel-tr-bar-more {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  color: inherit;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.9;
}
.channel-tr-bar-more:active {
  background: rgba(255, 255, 255, 0.1);
}
.chat-menu-item.is-active {
  color: var(--red, #3390ec);
  font-weight: 700;
}
.tr-lang-sheet {
  max-height: min(60vh, 420px);
  overflow-y: auto;
}
.chat-bubble.is-translating .bubble-text {
  opacity: 0.55;
}
.chat-bubble.search-hit-active {
  outline: 2px solid var(--red, #3390ec);
  outline-offset: 2px;
}

/* ══════════════════════════════════════════════════════
   LIQUID GLASS — all buttons (kube.io refraction + fallback)
   ══════════════════════════════════════════════════════ */
.tl-liquid-btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.38) !important;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.42) 0%, rgba(255, 255, 255, 0.08) 42%, rgba(255, 255, 255, 0.04) 100%),
    rgba(255, 255, 255, 0.14) !important;
  backdrop-filter: blur(14px) saturate(170%);
  -webkit-backdrop-filter: blur(14px) saturate(170%);
  box-shadow:
    0 6px 18px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 rgba(255, 255, 255, 0.08) !important;
  color: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease, background 0.18s ease;
}
.tl-liquid-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
  background: linear-gradient(
    125deg,
    rgba(255, 255, 255, 0.5) 0%,
    rgba(255, 255, 255, 0.08) 28%,
    transparent 55%,
    rgba(255, 255, 255, 0.06) 100%
  );
  opacity: 0.85;
}
.tl-liquid-btn > * {
  position: relative;
  z-index: 1;
}
[data-theme="dark"] .tl-liquid-btn {
  border-color: rgba(255, 255, 255, 0.2) !important;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.03) 40%, rgba(0, 0, 0, 0.12) 100%),
    rgba(22, 24, 30, 0.42) !important;
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -1px 0 rgba(0, 0, 0, 0.25) !important;
  color: var(--text);
}
[data-theme="dark"] .tl-liquid-btn::before {
  background: linear-gradient(
    125deg,
    rgba(255, 255, 255, 0.22) 0%,
    rgba(255, 255, 255, 0.04) 30%,
    transparent 58%,
    rgba(255, 255, 255, 0.03) 100%
  );
}

/* Chromium: shared SVG refraction maps */
html.lg-svg-backdrop .tl-liquid-btn {
  backdrop-filter: url(#liquidGlassBtnPill) saturate(165%);
  -webkit-backdrop-filter: url(#liquidGlassBtnPill) saturate(165%);
}
html.lg-svg-backdrop .tl-liquid-btn.tl-liquid-btn--round {
  backdrop-filter: url(#liquidGlassBtnRound) saturate(165%);
  -webkit-backdrop-filter: url(#liquidGlassBtnRound) saturate(165%);
}
html.lg-svg-backdrop .tl-liquid-btn.tl-liquid-btn--wide {
  backdrop-filter: url(#liquidGlassBtnWide) saturate(165%);
  -webkit-backdrop-filter: url(#liquidGlassBtnWide) saturate(165%);
}

/* Accent CTAs keep lavender wash, still glass */
.tl-liquid-btn.btn-primary,
.tl-liquid-btn.btn-red,
.tl-liquid-btn.welcome-btn-primary,
.tl-liquid-btn.lg-cta-btn,
.tl-liquid-btn.nav-create-icon,
.tl-liquid-btn.fab,
.tl-liquid-btn.btn-tinder {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.35) 0%, rgba(198, 180, 255, 0.35) 35%, rgba(123, 98, 232, 0.55) 100%),
    rgba(var(--red-rgb), 0.55) !important;
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.45) !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}
[data-theme="dark"] .tl-liquid-btn.btn-primary,
[data-theme="dark"] .tl-liquid-btn.btn-red,
[data-theme="dark"] .tl-liquid-btn.welcome-btn-primary,
[data-theme="dark"] .tl-liquid-btn.lg-cta-btn,
[data-theme="dark"] .tl-liquid-btn.nav-create-icon,
[data-theme="dark"] .tl-liquid-btn.fab,
[data-theme="dark"] .tl-liquid-btn.btn-tinder {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.22) 0%, rgba(168, 139, 255, 0.4) 40%, rgba(90, 70, 180, 0.65) 100%),
    rgba(var(--red-rgb), 0.5) !important;
}

.tl-liquid-btn.btn-outline,
.tl-liquid-btn.btn-following,
.tl-liquid-btn.btn-liked-profile {
  color: var(--text) !important;
}
.tl-liquid-btn.btn-following {
  border-color: rgba(var(--red-rgb), 0.45) !important;
  color: var(--red) !important;
}

.tl-liquid-btn.icon-btn,
.tl-liquid-btn.eye-btn {
  background: rgba(255, 255, 255, 0.12) !important;
}
[data-theme="dark"] .tl-liquid-btn.icon-btn,
[data-theme="dark"] .tl-liquid-btn.eye-btn {
  background: rgba(255, 255, 255, 0.08) !important;
}

.tl-liquid-btn:active {
  transform: scale(0.97);
  filter: brightness(1.04);
}

/* Profile stats: one glass plate, not 3 separate liquid buttons */
.lg-stats .lg-stat.tl-liquid-btn,
.lg-stats button.lg-stat {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.lg-stats .lg-stat.tl-liquid-btn::before {
  display: none !important;
}

/* Feed + top bar icons: never liquid glass */
#top-bar .icon-btn,
#top-bar .streams-top-btn,
#top-bar #top-search-btn,
#top-bar button.tl-liquid-btn,
.feed-card-actions .tl-liquid-btn,
.feed-card-actions button,
.feed-card-actions .feed-action-btn,
.feed-card-actions .pub-icon-btn,
.pub-actions-row button,
.feed-follow-btn.tl-liquid-btn {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  overflow: visible !important;
}
#top-bar .icon-btn::before,
#top-bar button.tl-liquid-btn::before,
.feed-card-actions .tl-liquid-btn::before,
.feed-card-actions button::before,
.feed-follow-btn.tl-liquid-btn::before {
  display: none !important;
}

/* Chat attach menu: flat items, no liquid glass */
.chat-attach-menu .chat-attach-item,
.chat-attach-menu button,
.chat-attach-item.tl-liquid-btn,
.chat-media-btn.tl-liquid-btn,
#chat-attach-btn.tl-liquid-btn {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  overflow: visible !important;
}
.chat-attach-menu .chat-attach-item::before,
.chat-attach-item.tl-liquid-btn::before,
.chat-media-btn.tl-liquid-btn::before,
#chat-attach-btn.tl-liquid-btn::before {
  display: none !important;
}
.chat-attach-menu .chat-attach-item:hover,
.chat-attach-menu .chat-attach-item:active {
  background: var(--surface) !important;
}

/* Create post screen: flat controls, no liquid glass */
.create-fs .tl-liquid-btn,
.create-media-tile,
.create-meta-btn,
.create-fs-clear {
  background: var(--surface) !important;
  border-color: var(--border) !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.create-fs .tl-liquid-btn::before,
.create-media-tile.tl-liquid-btn::before,
.create-meta-btn.tl-liquid-btn::before,
.create-fs-clear.tl-liquid-btn::before {
  display: none !important;
  content: none !important;
}

