/* =========================================================================
 * Clipzy — дизайн-система сайта.
 * Раскладка в духе YouTube: шапка с поиском, сайдбар слева (на телефоне —
 * нижний таббар), ровная сетка карточек. Стиль — как в промо-ролике:
 * всё мягко скруглено (крупные радиусы, пилюли), воздушные отступы,
 * пастельный mesh-фон (голубой → мятный → светло-зелёный), плавные анимации.
 * Монохромный акцент: белый на тёмном, чёрный на светлом. Красный — только
 * «лайкнуто» и опасные действия, жёлтый — «сохранено». Градиент — только фон
 * страницы, у кнопок и акцентов его нет, свечения нет.
 * Тема — атрибут data-theme на <html> ("dark" | "light"), ключ clz-theme.
 * ========================================================================= */

:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0f0e;
  --mesh:
    radial-gradient(60% 50% at 8% 0%, rgba(64, 120, 190, 0.20), transparent 70%),
    radial-gradient(55% 55% at 92% 18%, rgba(40, 170, 140, 0.16), transparent 70%),
    radial-gradient(70% 60% at 50% 105%, rgba(110, 190, 90, 0.12), transparent 70%);
  --bg-elevated: #171c1b;
  --surface: #141a18;
  --surface-solid: #141a18;
  --glass: rgba(16, 21, 20, 0.66);
  --input-bg: rgba(255, 255, 255, 0.06);
  --btn: rgba(255, 255, 255, 0.08);
  --btn-hover: rgba(255, 255, 255, 0.14);
  /* Активный пункт (сайдбар, вкладки) — светлая пилюля; выбранный фильтр — белая */
  --active-bg: rgba(255, 255, 255, 0.13);
  --active-ink: #ffffff;
  --sel-bg: #f2f5f4;
  --sel-ink: #0b0f0e;
  --chip: rgba(255, 255, 255, 0.08);
  --chip-hover: rgba(255, 255, 255, 0.14);
  --hover: rgba(255, 255, 255, 0.07);
  --press: rgba(255, 255, 255, 0.12);
  --text: #f2f5f4;
  --text-2: #a4adaa;
  --text-3: #6f7875;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  /* Монохромный акцент: белый на тёмном, чёрный на светлом. Цвет — только у логотипа */
  --accent: #f2f5f4;
  --on-accent: #0b0f0e;
  --brand: var(--accent);
  --link: #6cc4ff;
  --liked: #ff3b55;
  --saved: #ffcc00;
  --danger: #ff5a52;
  --success: #2fbf71;
  --overlay: rgba(4, 8, 7, 0.55);
  --skeleton: rgba(255, 255, 255, 0.07);
  --media-bg: #000;
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -14px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  --shadow-pop: 0 18px 50px -12px rgba(0, 0, 0, 0.7), 0 2px 8px rgba(0, 0, 0, 0.3);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f9f8;
  /* Как в тёмной теме: небольшие светящиеся пятна по углам на почти белом фоне */
  --mesh:
    radial-gradient(40% 34% at 6% 0%, rgba(110, 165, 255, 0.36), rgba(110, 165, 255, 0) 70%),
    radial-gradient(34% 36% at 96% 14%, rgba(30, 200, 150, 0.28), rgba(30, 200, 150, 0) 70%),
    radial-gradient(42% 36% at 55% 106%, rgba(135, 215, 80, 0.28), rgba(135, 215, 80, 0) 70%);
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-solid: #ffffff;
  --glass: rgba(250, 253, 252, 0.72);
  --input-bg: #ffffff;
  --btn: rgba(18, 52, 40, 0.06);
  --btn-hover: rgba(18, 52, 40, 0.10);
  --active-bg: rgba(16, 24, 21, 0.08);
  --active-ink: #101815;
  --sel-bg: #101815;
  --sel-ink: #ffffff;
  --chip: rgba(18, 52, 40, 0.06);
  --chip-hover: rgba(18, 52, 40, 0.10);
  --hover: rgba(18, 52, 40, 0.05);
  --press: rgba(18, 52, 40, 0.09);
  --text: #101815;
  --text-2: #56625d;
  --text-3: #8b9792;
  --border: rgba(18, 52, 40, 0.09);
  --border-strong: rgba(18, 52, 40, 0.16);
  /* Монохромный акцент: белый на тёмном, чёрный на светлом. Цвет — только у логотипа */
  --accent: #101815;
  --on-accent: #ffffff;
  --brand: var(--accent);
  --link: #0b63ce;
  --liked: #e8132b;
  --saved: #e0a800;
  --danger: #d1242f;
  --success: #188a4a;
  --overlay: rgba(22, 40, 34, 0.32);
  --skeleton: rgba(18, 52, 40, 0.07);
  --media-bg: #000;
  --shadow-soft: 0 1px 2px rgba(20, 50, 40, 0.05);
  --shadow-card: 0 1px 2px rgba(16, 48, 36, 0.04), 0 10px 30px -12px rgba(16, 48, 36, 0.14);
  --shadow-pop: 0 22px 60px -18px rgba(20, 60, 45, 0.28), 0 2px 8px rgba(20, 60, 45, 0.06);
}

:root {
  /* Montserrat — как в промо-ролике сайта */
  --font: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --r-xs: 10px; --r-sm: 14px; --r-thumb: 22px; --r-card: 28px; --r-pill: 999px;
  --header-h: 64px;
  --sidebar-w: 248px;
  --rail-w: 80px;
  --tabbar-h: 60px;
  --content-max: 2200px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  /* Мягкая «пружина» без отскока — для появления и наведения */
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 0.28s;
  --dur-nav: 0.45s;
  /* Кривая для панелей (сайдбар, выезжающее меню): ровный разгон и мягкая остановка */
  --ease-nav: cubic-bezier(0.32, 0.72, 0, 1);
  --blur: saturate(1.6) blur(22px);
}

/* ---------- База ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  background: transparent;
  color: var(--text);
  font: 500 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
/* Пастельный mesh-фон: отдельный фиксированный слой (background-attachment: fixed
   дёргается на iOS) */
body::before { content: ""; position: fixed; inset: 0; z-index: -1; background: var(--mesh), var(--bg); pointer-events: none; }
a { color: inherit; text-decoration: none; }
img, video { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; opacity: 0.5; }
h1, h2, h3, h4, p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent); color: var(--on-accent); }
.bi { line-height: 1; display: inline-block; }
.bi::before { vertical-align: 0 !important; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* Смена темы — цвета перетекают, а не щёлкают (класс ставит setTheme на полсекунды) */
html.theme-anim, html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after {
  transition: background-color 0.4s var(--ease-soft), color 0.4s var(--ease-soft), border-color 0.4s var(--ease-soft), box-shadow 0.4s var(--ease-soft), fill 0.4s var(--ease-soft) !important;
}

/* Переход между страницами сайта — мягкое растворение (View Transitions; где не
   поддерживается, страница просто открывается). Шапка, сайдбар и таббар стоят на месте. */
@view-transition { navigation: auto; }
.app-header { view-transition-name: clz-header; }
.app-sidebar { view-transition-name: clz-sidebar; }
.app-rail { view-transition-name: clz-rail; }
.app-tabbar { view-transition-name: clz-tabbar; }
::view-transition-old(root) { animation: 0.18s var(--ease-soft) both vt-out; }
::view-transition-new(root) { animation: 0.32s var(--ease-soft) both vt-in; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; transition-duration: 0.01ms !important; }
}

/* Типографика */
.t-display { font-size: 28px; line-height: 36px; font-weight: 700; letter-spacing: -0.01em; }
.t-title { font-size: 20px; line-height: 28px; font-weight: 700; }
.t-headline { font-size: 16px; line-height: 22px; font-weight: 600; }
.t-body { font-size: 14px; line-height: 20px; }
.t-caption { font-size: 12px; line-height: 18px; color: var(--text-2); }
.t-muted { color: var(--text-2); }
.t-num { font-variant-numeric: tabular-nums; }
.clamp-1, .clamp-2, .clamp-3 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-1 { -webkit-line-clamp: 1; }
.clamp-2 { -webkit-line-clamp: 2; }
.clamp-3 { -webkit-line-clamp: 3; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* =========================================================================
 * Каркас: шапка, сайдбар, контент, таббар.
 * Шапка и панели — полупрозрачные поверх mesh-фона, без рамок.
 * ========================================================================= */
.app-header {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  padding: 0 var(--s5) 0 var(--s4);
  background: transparent;
  transition: background-color var(--dur) var(--ease-soft), box-shadow var(--dur) var(--ease-soft);
}
.app-header.scrolled { background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: 0 1px 0 var(--border); }
.header-start, .header-end { display: flex; align-items: center; gap: var(--s2); flex-shrink: 0; }
.header-start { min-width: 216px; }
.header-end { justify-content: flex-end; min-width: 216px; }
.logo { display: flex; align-items: center; gap: 7px; height: 44px; padding: 0 var(--s2); font-weight: 700; font-size: 20px; letter-spacing: -0.02em; }
.logo img { width: 25px; height: 25px; }

.header-search { flex: 0 1 640px; display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.search-box {
  flex: 1; display: flex; align-items: center; height: 46px; min-width: 0; padding: 0 5px 0 0;
  border: 1px solid transparent; border-radius: var(--r-pill);
  background: var(--surface-solid); box-shadow: var(--shadow-card);
  transition: border-color var(--dur) var(--ease-soft), box-shadow var(--dur) var(--ease-soft);
}
.search-box:focus-within { border-color: var(--accent); }
.search-box input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent;
  padding: 0 var(--s3) 0 22px; font-size: 15px; font-weight: 500;
}
.search-box input::placeholder { color: var(--text-3); }
.search-box button {
  width: 36px; height: 36px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%;
  font-size: 17px; color: var(--text-2);
  transition: background-color var(--dur) var(--ease-soft), color var(--dur) var(--ease-soft);
}
.search-box button:hover { background: var(--active-bg); color: var(--active-ink); }

.icon-btn {
  position: relative; width: 44px; height: 44px; flex-shrink: 0;
  display: inline-grid; place-items: center; border-radius: 50%;
  font-size: 20px; color: var(--text);
  transition: background-color var(--dur) var(--ease-soft), transform 0.18s var(--ease-soft);
}
.icon-btn:hover { background: var(--hover); }
.icon-btn:active { background: var(--press); transform: scale(0.94); }
.icon-btn.sm { width: 34px; height: 34px; font-size: 16px; }
.badge-dot {
  position: absolute; top: 4px; left: 23px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: var(--r-pill); background: var(--liked); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
  border: 2px solid var(--bg); box-sizing: content-box;
}
.header-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--chip); }

/* Сайдбар */
.app-sidebar {
  position: fixed; top: var(--header-h); bottom: 0; left: 0; z-index: 90;
  width: var(--sidebar-w); overflow-y: auto; overscroll-behavior: contain;
  padding: var(--s2) var(--s3) var(--s5) var(--s4);
  background: transparent;
  scrollbar-width: thin; scrollbar-color: transparent transparent;
  /* Сворачивание и выезд — сдвигом и прозрачностью (display:none не анимируется);
     visibility гаснет в конце, чтобы скрытое меню не ловило Tab и клики */
  transition: transform var(--dur-nav) var(--ease-nav), opacity var(--dur-nav) var(--ease-nav), visibility 0s linear 0s;
  will-change: transform;
}
.app-sidebar:hover { scrollbar-color: var(--border-strong) transparent; }
.nav-item {
  display: flex; align-items: center; gap: var(--s4);
  height: 44px; padding: 0 var(--s4); border-radius: var(--r-pill);
  font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden;
  transition: background-color var(--dur) var(--ease-soft), transform 0.18s var(--ease-soft);
}
.nav-item:hover { background: var(--hover); }
.nav-item:active { transform: scale(0.98); }
.nav-item.active { background: var(--active-bg); color: var(--active-ink); font-weight: 600; }
.nav-item .bi { font-size: 19px; width: 24px; text-align: center; flex-shrink: 0; }
.nav-item .nav-count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: var(--r-pill); background: var(--chip); font-size: 12px; font-weight: 600; line-height: 22px; text-align: center; color: var(--text-2); }
.nav-item .nav-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.nav-sep { height: 1px; background: var(--border); margin: var(--s3) var(--s4); }
.nav-title { padding: var(--s2) var(--s4) var(--s1); font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: var(--s2); }
.nav-hint { padding: 0 var(--s4); color: var(--text-2); font-size: 14px; }
.nav-foot { padding: var(--s4) var(--s4) 0; font-size: 12px; color: var(--text-3); display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); }
.nav-foot a:hover { color: var(--text); }

/* Узкая «рейка» сайдбара */
.app-rail {
  position: fixed; top: var(--header-h); bottom: 0; left: 0; z-index: 90;
  width: var(--rail-w); padding: var(--s2); display: flex; flex-direction: column; gap: 4px;
  background: transparent;
  opacity: 0; visibility: hidden; transform: translateX(-12px); pointer-events: none;
  transition: transform var(--dur-nav) var(--ease-nav), opacity var(--dur-nav) var(--ease-nav), visibility 0s linear var(--dur-nav);
}
.rail-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 0 12px; border-radius: var(--r-thumb); font-size: 10px; font-weight: 600; line-height: 14px;
  transition: background-color var(--dur) var(--ease-soft);
}
.rail-item .bi { font-size: 21px; }
.rail-item:hover { background: var(--hover); }
.rail-item.active { color: var(--active-ink); }
.rail-item.active .bi { width: 56px; height: 32px; display: grid; place-items: center; border-radius: var(--r-pill); background: var(--active-bg); }
.rail-item .bi { width: 56px; height: 32px; display: grid; place-items: center; }
.rail-item { gap: 4px; padding: 10px 0; }

.app-main {
  padding-top: var(--header-h);
  margin-left: var(--sidebar-w);
  min-height: 100vh;
}
.page { padding: var(--s4) var(--s6) var(--s7); max-width: var(--content-max); margin: 0 auto; animation: rise 0.5s var(--ease-soft) both; }
.page-narrow { max-width: 1120px; }
.page-form { max-width: 720px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s5); flex-wrap: wrap; }
.page-head h1 { font-size: 28px; line-height: 36px; font-weight: 700; letter-spacing: -0.015em; }
.page-head .t-caption { margin-top: 2px; }

/* Сворачивание сайдбара кнопкой меню (десктоп): сайдбар плавно уезжает влево,
   контент сдвигается за ним, рейка проявляется с небольшой задержкой */
@media (min-width: 1313px) {
  body.nav-mini .app-sidebar {
    transform: translateX(-100%); visibility: hidden; pointer-events: none;
    transition: transform var(--dur-nav) var(--ease-nav), visibility 0s linear var(--dur-nav);
  }
  body.nav-mini .app-rail {
    opacity: 1; visibility: visible; transform: none; pointer-events: auto;
    transition: transform var(--dur-nav) var(--ease-nav) 0.08s, opacity var(--dur-nav) var(--ease-nav) 0.08s, visibility 0s;
  }
  body.nav-mini .app-main { margin-left: var(--rail-w); }
}
/* Восстановление свёрнутого состояния при загрузке страницы — без анимации */
body.nav-instant .app-sidebar, body.nav-instant .app-rail, body.nav-instant .app-main { transition: none !important; }

/* Выдвижное меню (средние экраны и телефон) */
.drawer-scrim {
  position: fixed; inset: 0; z-index: 140; background: var(--overlay);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity var(--dur-nav) var(--ease-nav), visibility 0s linear var(--dur-nav);
}
body.drawer-open .drawer-scrim { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity var(--dur-nav) var(--ease-nav), visibility 0s; }

/* Нижний таббар — парящая пилюля из стекла */
.app-tabbar {
  position: fixed; left: var(--s3); right: var(--s3); bottom: calc(var(--s2) + env(safe-area-inset-bottom)); z-index: 100;
  height: var(--tabbar-h);
  display: none; align-items: stretch; justify-content: space-around; padding: 0 var(--s1);
  border-radius: var(--r-pill);
  background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: var(--shadow-pop), inset 0 0 0 1px var(--border);
}
.tab-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 10px; font-weight: 600; line-height: 12px; color: var(--text-2);
  position: relative; transition: color var(--dur) var(--ease-soft), transform 0.18s var(--ease-soft);
}
.tab-item:active { transform: scale(0.92); }
.tab-item.active { color: var(--active-ink); }
.tab-item.active .bi { background: var(--active-bg); border-radius: var(--r-pill); }
.tab-item .bi { width: 52px; height: 30px; display: grid; place-items: center; transition: background-color var(--dur) var(--ease-soft); }
.tab-item .bi { font-size: 21px; }
.tab-item .badge-dot { top: 6px; left: calc(50% + 4px); }
.tab-create { flex: 0 0 64px; }
.tab-create span.plus {
  width: 46px; height: 36px; border-radius: var(--r-pill); display: grid; place-items: center;
  background: var(--accent); color: var(--on-accent); font-size: 21px;
}
.tab-item img.tab-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; box-sizing: border-box; }
.tab-item.active img.tab-avatar { border: 2px solid var(--accent); }

@media (max-width: 1312px) {
  /* Сайдбар становится выезжающей панелью: и открывается, и закрывается плавно */
  .app-sidebar {
    z-index: 150; top: var(--s2); bottom: var(--s2); left: var(--s2); padding-top: 0;
    border-radius: var(--r-card); background: var(--bg-elevated); box-shadow: var(--shadow-pop);
    transform: translateX(calc(-100% - var(--s4))); visibility: hidden;
    transition: transform var(--dur-nav) var(--ease-nav), visibility 0s linear var(--dur-nav);
  }
  body.drawer-open .app-sidebar { transform: none; visibility: visible; transition: transform var(--dur-nav) var(--ease-nav), visibility 0s; }
  .app-rail { opacity: 1; visibility: visible; transform: none; pointer-events: auto; }
  .app-main { margin-left: var(--rail-w); }
  .drawer-head { display: flex !important; }
}
.drawer-head { display: none; align-items: center; gap: var(--s2); height: var(--header-h); margin: 0 calc(-1 * var(--s3)) var(--s2) calc(-1 * var(--s4)); padding: 0 var(--s4); }

/* Страница видео как на YouTube: сайдбар не занимает места, видео шире,
   кнопка меню выдвигает его поверх страницы с затемнением на любой ширине */
body.nav-overlay .app-rail { display: none !important; }
body.nav-overlay .app-main { margin-left: 0 !important; }
body.nav-overlay .drawer-head { display: flex !important; }
@media (min-width: 1313px) {
  body.nav-overlay .app-sidebar {
    z-index: 150; top: var(--s2); bottom: var(--s2); left: var(--s2); padding-top: 0;
    border-radius: var(--r-card); background: var(--bg-elevated); box-shadow: var(--shadow-pop);
    transform: translateX(calc(-100% - var(--s4))); visibility: hidden; pointer-events: none;
    transition: transform var(--dur-nav) var(--ease-nav), visibility 0s linear var(--dur-nav);
  }
  body.nav-overlay.drawer-open .app-sidebar { transform: none; visibility: visible; pointer-events: auto; transition: transform var(--dur-nav) var(--ease-nav), visibility 0s; }
}

@media (max-width: 1000px) {
  .header-start { min-width: 0; }
  .header-end { min-width: 0; }
}

@media (max-width: 767px) {
  :root { --header-h: 56px; --tabbar-h: 62px; }
  .app-rail { display: none !important; }
  .app-main { margin-left: 0 !important; padding-bottom: calc(var(--tabbar-h) + var(--s4) + env(safe-area-inset-bottom)); }
  .app-tabbar { display: flex; }
  .app-header { padding: 0 var(--s2) 0 var(--s3); gap: var(--s1); }
  .header-search { display: none; }
  .header-end .hide-mobile { display: none; }
  .logo { font-size: 19px; padding: 0 var(--s1); }
  .logo img { width: 22px; height: 22px; }
  .page { padding: var(--s3) var(--s4) var(--s6); }
  .page-head h1 { font-size: 24px; line-height: 30px; }
  body.drawer-open .app-sidebar { width: 296px; }
}
@media (min-width: 768px) {
  .show-mobile { display: none !important; }
}

/* Мобильный поиск поверх шапки — проявляется и гаснет */
.mobile-search {
  position: fixed; inset: 0 0 auto 0; z-index: 120; height: var(--header-h);
  display: none; align-items: center; gap: var(--s2); padding: 0 var(--s3) 0 var(--s2);
  background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity var(--dur) var(--ease-soft), transform var(--dur) var(--ease-soft), visibility 0s linear var(--dur);
}
@media (max-width: 767px) { .mobile-search { display: flex; } }
body.msearch-open .mobile-search { opacity: 1; visibility: visible; transform: none; transition: opacity var(--dur) var(--ease-soft), transform var(--dur) var(--ease-soft), visibility 0s; }
.mobile-search .search-box { height: 42px; }

/* =========================================================================
 * Кнопки, поля, чипы — всё пилюлями
 * ========================================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 20px; border-radius: var(--r-pill);
  font-size: 14px; font-weight: 600; white-space: nowrap; line-height: 1;
  background: var(--btn); color: var(--text);
  transition: background-color var(--dur) var(--ease-soft), opacity var(--dur) var(--ease-soft), transform 0.18s var(--ease-soft), box-shadow var(--dur) var(--ease-soft);
  user-select: none;
}
.btn:hover { background: var(--btn-hover); }
.btn:active { transform: scale(0.97); }
.btn .bi { font-size: 17px; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.btn-primary:hover { background: var(--accent); opacity: 0.88; }
.btn-ghost { background: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--hover); }
.btn-outline { background: transparent; box-shadow: inset 0 0 0 1px var(--border-strong); }
.btn-outline:hover { background: var(--hover); }
.btn-danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1px var(--border-strong); }
.btn-danger:hover { background: var(--hover); }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; }
.btn-sm .bi { font-size: 15px; }
.btn-lg { height: 50px; padding: 0 28px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; padding: 0; }
.btn-sm.btn-icon { width: 34px; }
.btn.is-on { background: var(--active-bg); color: var(--active-ink); box-shadow: none; }
.btn.liked .bi { color: var(--liked); }
.btn.saved .bi { color: var(--saved); }

/* Сегмент «лайк | дизлайк»-подобная группа */
.btn-group { display: inline-flex; border-radius: var(--r-pill); overflow: hidden; background: var(--btn); }
.btn-group .btn { border-radius: 0; box-shadow: none; background: transparent; }
.btn-group .btn + .btn { border-left: 1px solid var(--border-strong); }

.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: var(--s5); }
.field > label, .field-label { font-size: 13px; font-weight: 600; color: var(--text); padding-left: 4px; }
.field-hint { font-size: 12px; color: var(--text-2); padding-left: 4px; }
.field-error { font-size: 12px; color: var(--danger); padding-left: 4px; }
.input, .textarea, .select {
  width: 100%; min-height: 46px; padding: 12px 18px;
  border: 1px solid var(--border-strong); border-radius: var(--r-pill);
  background: var(--input-bg); color: var(--text); outline: 0;
  font-size: 15px; line-height: 20px;
  transition: border-color var(--dur) var(--ease-soft), background-color var(--dur) var(--ease-soft);
}
.input:hover, .textarea:hover, .select:hover { border-color: var(--border-strong); }
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.textarea { resize: vertical; min-height: 110px; border-radius: 24px; }
.select { appearance: none; padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='%23888'%3E%3Cpath d='M1.6 4.6a.75.75 0 0 1 1.06 0L8 9.94l5.34-5.34a.75.75 0 1 1 1.06 1.06l-5.87 5.87a.75.75 0 0 1-1.06 0L1.6 5.66a.75.75 0 0 1 0-1.06z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; }
.input-underline { border: 0; border-bottom: 1px solid var(--border-strong); border-radius: 0; padding: 6px 0; min-height: 32px; background: transparent; }
.input-underline:focus { border-bottom: 2px solid var(--accent); padding-bottom: 5px; }

/* Переключатель */
.switch { position: relative; width: 46px; height: 28px; flex-shrink: 0; display: inline-block; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: var(--r-pill); background: var(--chip-hover); transition: background-color var(--dur) var(--ease-soft); }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform 0.36s var(--ease-soft); box-shadow: 0 1px 3px rgba(0,0,0,0.22); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); background: var(--on-accent); }

/* Чипы */
.chips { display: flex; gap: var(--s2); overflow-x: auto; scrollbar-width: none; padding: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; height: 38px; padding: 0 18px; border-radius: var(--r-pill);
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--btn); font-size: 14px; font-weight: 600; white-space: nowrap;
  transition: background-color var(--dur) var(--ease-soft), color var(--dur) var(--ease-soft), transform 0.18s var(--ease-soft);
}
.chip:hover { background: var(--btn-hover); }
.chip:active { transform: scale(0.96); }
.chip.active { background: var(--sel-bg); color: var(--sel-ink); }
.chips-bar { position: sticky; top: var(--header-h); z-index: 20; padding: var(--s3) 0; margin: calc(-1 * var(--s4)) 0 var(--s4); }
@media (max-width: 767px) { .chips-bar { margin-top: calc(-1 * var(--s3)); } }

/* Вкладки (канал, поиск, студия) — пилюли, как в промо */
.tabs { display: flex; gap: var(--s2); overflow-x: auto; scrollbar-width: none; padding: 2px; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; flex-shrink: 0; height: 40px; padding: 0 20px; border-radius: var(--r-pill);
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 600; color: var(--text-2);
  transition: background-color var(--dur) var(--ease-soft), color var(--dur) var(--ease-soft), transform 0.18s var(--ease-soft);
}
.tab:hover { color: var(--text); background: var(--hover); }
.tab:active { transform: scale(0.96); }
.tab.active { color: var(--active-ink); background: var(--active-bg); }
.tab .tab-count { font-size: 12px; font-weight: 500; color: inherit; opacity: 0.7; }

/* =========================================================================
 * Карточки. Ролик на сайте — всегда клип 9:16, как в сетках приложения;
 * .grid остался только для плейлистов.
 * ========================================================================= */
.grid { display: grid; gap: var(--s6) var(--s5); grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.grid-clips { display: grid; gap: var(--s5) var(--s4); grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
@media (max-width: 767px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4) var(--s3); }
  .grid-clips { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
  /* Профиль и звук — плотная сетка в три колонки, как в приложении, но со скруглением */
  .grid-clips.grid-3m { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .grid-3m .ccard { gap: 0; }
  .grid-3m .thumb { border-radius: var(--r-sm); }
  .grid-3m .ccard-title, .grid-3m .ccard-meta, .grid-3m .vcard-menu { display: none; }
}

.thumb {
  position: relative; display: block; width: 100%; aspect-ratio: 9 / 16;
  border-radius: var(--r-thumb); overflow: hidden; background: var(--skeleton);
  isolation: isolate; transform: translateZ(0);
}
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease-soft); }
a.thumb:hover img, .ccard:hover .thumb img, .pl-card:hover .thumb img { transform: scale(1.04); }
/* Горизонтальный ролик — целиком, поля сверху и снизу */
.thumb.landscape { background: var(--media-bg); }
.thumb.landscape img, .thumb.landscape video { object-fit: contain; }
.thumb video.preview { position: absolute; inset: 0; opacity: 0; transition: opacity var(--dur) var(--ease-soft); }
.thumb.previewing video.preview { opacity: 1; }
.thumb-ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); font-size: 32px; }
.thumb-badge {
  position: absolute; right: 10px; bottom: 10px; padding: 3px 9px; border-radius: var(--r-pill);
  background: rgba(0, 0, 0, 0.55); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  color: #fff; font-size: 12px; font-weight: 600; line-height: 16px;
  display: inline-flex; align-items: center; gap: 4px;
}
.thumb-badge.left { left: 10px; right: auto; }
.vcard-title { font-size: 16px; line-height: 22px; font-weight: 600; }
.vcard-meta { margin-top: 4px; font-size: 14px; line-height: 20px; color: var(--text-2); }
.vcard-menu { opacity: 0; transition: opacity var(--dur) var(--ease-soft); }
.ccard:hover .vcard-menu, .vcard-menu:focus-visible, .vcard-menu[aria-expanded="true"] { opacity: 1; }
@media (hover: none) { .vcard-menu { opacity: 1; } }

.ccard { display: flex; flex-direction: column; gap: 10px; min-width: 0; position: relative; animation: rise 0.5s var(--ease-soft) both; }
.ccard:nth-child(2) { animation-delay: 0.03s; } .ccard:nth-child(3) { animation-delay: 0.06s; }
.ccard:nth-child(4) { animation-delay: 0.09s; } .ccard:nth-child(5) { animation-delay: 0.12s; }
.ccard:nth-child(n+6) { animation-delay: 0.15s; }
.ccard-title { font-size: 15px; line-height: 21px; font-weight: 600; padding: 0 4px; }
.ccard-meta { font-size: 13px; color: var(--text-2); padding: 0 4px; }
.ccard .vcard-menu { position: absolute; top: 8px; right: 8px; margin: 0; color: #fff; background: rgba(0,0,0,0.28); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.ccard .vcard-menu:hover { background: rgba(0,0,0,0.45); }

/* Полка (секция с заголовком) */
.shelf { margin-bottom: var(--s7); }
.shelf-head { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s4); }
.shelf-head h2 { font-size: 22px; line-height: 28px; font-weight: 700; letter-spacing: -0.01em; display: flex; align-items: center; gap: var(--s2); }
.shelf-head .spacer { flex: 1; }
.shelf-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(180px, 210px); gap: var(--s4); overflow-x: auto; scrollbar-width: none; padding: 4px 2px 8px; margin: -4px -2px 0; }
.shelf-row::-webkit-scrollbar { display: none; }
@media (max-width: 767px) { .shelf-row { grid-auto-columns: 42%; gap: var(--s3); } }

/* Скелеты */
.sk { background: var(--skeleton); border-radius: var(--r-xs); animation: sk 1.6s ease-in-out infinite; }
@keyframes sk { 50% { opacity: 0.5; } }
.sk-line { height: 14px; margin-top: 8px; border-radius: var(--r-pill); }
.sk-line.w60 { width: 60%; }
.sk-line.w40 { width: 40%; }

/* Пустые состояния */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  gap: var(--s3); padding: 72px var(--s4); color: var(--text-2); animation: rise 0.5s var(--ease-soft) both;
}
.empty .bi { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; font-size: 40px; color: var(--active-ink); background: var(--active-bg); margin-bottom: var(--s2); }
.empty h3 { font-size: 20px; line-height: 26px; color: var(--text); font-weight: 700; }
.empty p { max-width: 420px; }
.empty .btn { margin-top: var(--s2); }
.empty .btn .bi { width: auto; height: auto; font-size: 17px; background: none; box-shadow: none; margin: 0; color: inherit; }

/* Аватары, бейджи */
.avatar { border-radius: 50%; object-fit: cover; background: var(--chip); flex-shrink: 0; }
.av-24 { width: 24px; height: 24px; } .av-32 { width: 32px; height: 32px; } .av-40 { width: 40px; height: 40px; }
.av-48 { width: 48px; height: 48px; } .av-56 { width: 56px; height: 56px; } .av-80 { width: 80px; height: 80px; }
.av-120 { width: 120px; height: 120px; } .av-160 { width: 160px; height: 160px; }
.verified { color: var(--text-2); font-size: 0.86em; margin-left: 3px; vertical-align: 0; }
.role-tag { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: var(--r-pill); background: var(--chip); color: var(--text-2); font-size: 11px; font-weight: 600; margin-left: 6px; vertical-align: 1px; }

/* =========================================================================
 * Всплывающие меню, модалки, тосты
 * ========================================================================= */
.menu {
  position: fixed; z-index: 300; min-width: 232px; max-width: min(320px, calc(100vw - 16px));
  padding: var(--s2); border-radius: 22px;
  background: var(--bg-elevated); box-shadow: var(--shadow-pop), inset 0 0 0 1px var(--border);
  max-height: calc(100vh - 16px); overflow-y: auto;
  animation: menu 0.26s var(--ease-soft);
}
@keyframes menu { from { opacity: 0; transform: translateY(-6px) scale(0.97); } }
.menu.closing { opacity: 0; transform: translateY(-4px) scale(0.98); transition: opacity 0.16s var(--ease-soft), transform 0.16s var(--ease-soft); pointer-events: none; }
.menu-item {
  width: 100%; display: flex; align-items: center; gap: var(--s3);
  min-height: 44px; padding: 0 var(--s3); border-radius: var(--r-sm); text-align: left; font-size: 14px; font-weight: 500;
  transition: background-color 0.18s var(--ease-soft);
}
.menu-item:hover { background: var(--hover); }
.menu-item.active, .menu-item[aria-checked="true"] { background: var(--chip); }
.menu-item .bi { font-size: 19px; width: 24px; text-align: center; flex-shrink: 0; }
.menu-item.danger { color: var(--danger); }
.menu-sep { height: 1px; background: var(--border); margin: var(--s2) var(--s3); }
.menu-head { display: flex; gap: var(--s3); padding: var(--s2) var(--s3) var(--s3); align-items: flex-start; }
.menu-head .t-headline { word-break: break-word; }
.menu-head a { color: var(--link); font-size: 14px; }

.modal-root { position: fixed; inset: 0; z-index: 400; display: flex; align-items: center; justify-content: center; padding: var(--s4); }
.modal-scrim { position: absolute; inset: 0; background: var(--overlay); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade 0.24s var(--ease-soft); }
.modal {
  position: relative; width: 100%; max-width: 480px; max-height: calc(100vh - 32px);
  display: flex; flex-direction: column;
  border-radius: 32px; background: var(--bg-elevated);
  box-shadow: var(--shadow-pop), inset 0 0 0 1px var(--border); animation: pop 0.34s var(--ease-soft);
}
.modal.wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; gap: var(--s2); padding: var(--s5) var(--s4) var(--s2) var(--s6); }
.modal-head h2 { flex: 1; font-size: 20px; line-height: 26px; font-weight: 700; letter-spacing: -0.02em; }
.modal-body { padding: var(--s2) var(--s6) var(--s4); overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: var(--s2); padding: var(--s3) var(--s6) var(--s6); flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
.modal-root.closing { pointer-events: none; }
.modal-root.closing .modal-scrim { opacity: 0; transition: opacity 0.22s var(--ease-soft); }
.modal-root.closing .modal { opacity: 0; transform: translateY(8px) scale(0.98); transition: opacity 0.22s var(--ease-soft), transform 0.22s var(--ease-soft); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.97); } }
@media (max-width: 767px) {
  .modal-root { align-items: flex-end; padding: 0 var(--s2) var(--s2); }
  .modal { max-width: none !important; border-radius: 32px; max-height: 88vh; padding-bottom: env(safe-area-inset-bottom); animation: sheet 0.42s var(--ease-soft); }
  .modal::before { content: ""; position: absolute; top: 8px; left: 50%; width: 40px; height: 5px; margin-left: -20px; border-radius: 3px; background: var(--border-strong); }
  .modal-head { padding-left: var(--s5); }
  .modal-body { padding-left: var(--s5); padding-right: var(--s5); }
  .modal-foot { padding: var(--s3) var(--s5) var(--s5); }
  @keyframes sheet { from { transform: translateY(60px); opacity: 0; } }
  .modal-root.closing .modal { transform: translateY(60px); }
}

.toasts { position: fixed; left: var(--s5); bottom: var(--s5); z-index: 500; display: flex; flex-direction: column; gap: var(--s2); pointer-events: none; }
.toast {
  max-width: 420px; padding: 14px 22px; border-radius: 24px;
  background: var(--text); color: var(--bg); font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-pop); animation: toast 0.42s var(--ease-soft); pointer-events: auto;
  display: flex; align-items: center; gap: var(--s3);
}
@keyframes toast { from { opacity: 0; transform: translateY(16px) scale(0.96); } }
.toast.leaving { opacity: 0; transform: translateY(8px) scale(0.97); transition: opacity 0.26s var(--ease-soft), transform 0.26s var(--ease-soft); }
.toast.error { background: var(--danger); color: #fff; }
.toast a, .toast button { font-weight: 700; color: inherit; text-decoration: underline; }
@media (max-width: 767px) { .toasts { left: var(--s3); right: var(--s3); bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + var(--s5)); } .toast { max-width: none; } }

/* Флеш-сообщения сервера */
.flashes { display: flex; flex-direction: column; gap: var(--s2); margin-bottom: var(--s4); }
.flash { padding: 14px 20px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-card); font-size: 14px; display: flex; gap: var(--s3); align-items: flex-start; animation: rise 0.4s var(--ease-soft) both; }
.flash .bi { font-size: 18px; margin-top: 1px; }
.flash.danger, .flash.error { color: var(--danger); }
.flash.success { color: var(--success); }

/* Списки-строки (настройки, уведомления, пользователи) */
.list { display: flex; flex-direction: column; gap: 2px; }
.row {
  display: flex; align-items: center; gap: var(--s4); min-height: 60px; padding: var(--s3) var(--s4);
  border-radius: 20px; text-align: left; width: 100%;
  transition: background-color 0.2s var(--ease-soft);
}
a.row:hover, button.row:hover, .row.clickable:hover { background: var(--hover); }
.row-icon { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--chip); font-size: 18px; flex-shrink: 0; }
.row-text { flex: 1; min-width: 0; }
.row-title { font-size: 15px; line-height: 20px; font-weight: 600; }
.row-sub { font-size: 13px; line-height: 18px; color: var(--text-2); margin-top: 2px; }
.row-end { display: flex; align-items: center; gap: var(--s2); flex-shrink: 0; color: var(--text-2); }
.row .chev { color: var(--text-3); font-size: 16px; }
.row.unread { background: var(--hover); }
.row.unread .row-title { font-weight: 700; }

.card { background: var(--surface); box-shadow: var(--shadow-card); border-radius: var(--r-card); }
.card-pad { padding: var(--s5) var(--s6); }
@media (max-width: 767px) { .card-pad { padding: var(--s5); } }
.section { margin-bottom: var(--s7); }
.section-title { font-size: 18px; line-height: 24px; font-weight: 700; margin-bottom: var(--s3); padding-left: 4px; }
.section-sub { color: var(--text-2); font-size: 13px; margin: -8px 0 var(--s3); padding-left: 4px; }
.settings-group { border-radius: var(--r-card); overflow: hidden; background: var(--surface); box-shadow: var(--shadow-card); padding: 6px; }
.settings-group .row { border-radius: 22px; }
.settings-group .row + .row { border-top: 0; }

/* Статистика */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--s4); }
.stat { padding: var(--s5); border-radius: var(--r-card); background: var(--surface); box-shadow: var(--shadow-card); }
.stat-label { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 26px; line-height: 34px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-delta { font-size: 12px; color: var(--text-2); }

/* Таблица */
.table-wrap { overflow-x: auto; border-radius: var(--r-card); background: var(--surface); box-shadow: var(--shadow-card); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; font-size: 12px; color: var(--text-2); padding: 14px 20px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 20px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--hover); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Подвал (страницы с контентом) */
.app-footer { padding: var(--s5) var(--s5) var(--s6); color: var(--text-3); font-size: 12px; display: flex; gap: var(--s4); flex-wrap: wrap; justify-content: center; }
.app-footer a:hover { color: var(--text); }

/* Ссылка-превью ролика (чаты, посты) */
.link-card { display: flex; gap: var(--s3); align-items: center; padding: var(--s2); border-radius: 20px; background: var(--chip); max-width: 340px; }
.link-card img { width: 64px; height: 64px; object-fit: cover; border-radius: 14px; background: var(--skeleton); flex-shrink: 0; }
.link-card.clip img { width: 48px; height: 80px; }
.link-card .lc-text { min-width: 0; }
.link-card .lc-title { font-weight: 600; font-size: 14px; line-height: 19px; }
.link-card .lc-meta { font-size: 12px; color: var(--text-2); margin-top: 2px; display: flex; align-items: center; gap: 4px; }

.text-link { color: var(--link); }
.text-link:hover { text-decoration: underline; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--chip-hover); border-top-color: var(--accent); animation: spin 0.8s linear infinite; margin: var(--s6) auto; }
.spinner.sm { width: 18px; height: 18px; border-width: 2px; margin: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Блокировка (экранное время / бан) */
.lock-screen {
  position: fixed; inset: 0; z-index: 1000; background: var(--mesh), var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s4);
  padding: var(--s5); text-align: center;
}
.lock-screen .bi-lg { font-size: 56px; color: var(--text-2); }
.lock-screen h1 { font-size: 24px; line-height: 32px; font-weight: 700; }
.lock-screen p { color: var(--text-2); max-width: 420px; }
.pin-dots { display: flex; gap: var(--s3); margin: var(--s2) 0; }
.pin-dots span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--text-2); }
.pin-dots span.on { background: var(--text); border-color: var(--text); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 72px); gap: var(--s3); }
.pin-pad button { height: 72px; border-radius: 50%; background: var(--surface-solid); box-shadow: var(--shadow-card); font-size: 26px; font-weight: 500; transition: background-color 0.2s var(--ease-soft), transform 0.15s var(--ease-soft); }
.pin-pad button:active { transform: scale(0.94); }
.pin-pad button:hover { background: var(--surface-solid); }
.pin-pad button.blank { visibility: hidden; }
.shake { animation: shake 0.35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

/* Полоски-графики (студия, аналитика) */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 160px; padding-top: var(--s2); }
.bars .bar { flex: 1; min-width: 4px; background: var(--accent); border-radius: 8px 8px 3px 3px; opacity: 0.85; position: relative; }
.bars .bar:hover { opacity: 1; }
.bars-x { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); margin-top: 6px; }
.meter { height: 8px; border-radius: var(--r-pill); background: var(--chip); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: var(--r-pill); transition: width 0.4s var(--ease-soft); }

/* =========================================================================
 * Комментарии
 * ========================================================================= */
.cmts-head { display: flex; align-items: center; gap: var(--s4); margin-bottom: var(--s5); }
.cmts-title { font-size: 20px; line-height: 28px; font-weight: 700; }
.cmt-form { display: flex; gap: var(--s4); margin-bottom: var(--s6); align-items: flex-start; }
.cmt-form-main { flex: 1; min-width: 0; }
.cmt-input { width: 100%; resize: none; font-size: 14px; line-height: 20px; overflow: hidden; outline: 0; color: var(--text); }
.cmt-form-actions { display: flex; align-items: center; gap: var(--s2); margin-top: var(--s2); }
.cmt-replying { display: flex; align-items: center; gap: var(--s2); font-size: 13px; color: var(--text-2); margin-bottom: 2px; }
.cmt-image { position: relative; display: inline-block; margin-top: var(--s2); }
.cmt-image img { max-height: 120px; border-radius: 16px; }
.cmt-image .icon-btn { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,0.6); color: #fff; }
.cmt-signin { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s5); border-radius: var(--r-pill); background: var(--btn); margin-bottom: var(--s5); font-weight: 500; }
.cmt-signin .bi { font-size: 22px; }
.cmt-list { display: flex; flex-direction: column; gap: var(--s4); }
.cmt { display: flex; gap: var(--s4); }
.cmt[data-depth]:not([data-depth="0"]) { gap: var(--s3); }
.cmt-main { flex: 1; min-width: 0; }
.cmt-meta { display: flex; align-items: center; gap: 6px; font-size: 13px; line-height: 18px; flex-wrap: wrap; }
.cmt-author { font-weight: 600; }
.cmt-author.is-author { background: var(--chip-hover); padding: 0 8px; border-radius: var(--r-pill); }
.cmt-time { color: var(--text-2); font-size: 12px; }
.cmt-text { font-size: 14px; line-height: 20px; margin-top: 2px; word-wrap: break-word; overflow-wrap: anywhere; }
.cmt-readmore { color: var(--text-2); font-weight: 600; font-size: 13px; margin-top: 2px; }
.cmt-img { max-width: min(280px, 100%); max-height: 280px; border-radius: 18px; margin-top: var(--s2); }
.cmt-actions { display: flex; align-items: center; gap: 2px; margin: 2px 0 0 -8px; }
.cmt-actions .btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.cmt-like.liked { color: var(--liked); }
.cmt-likes { font-size: 12px; color: var(--text-2); min-width: 6px; margin-right: 4px; }
.cmt-poll { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 4px; max-width: 420px; }
.cmt-poll-opt { position: relative; display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: var(--r-pill); border: 1px solid var(--border); background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; overflow: hidden; }
.cmt-poll-opt:hover { background: var(--hover); }
.cmt-poll-opt.voted { border-color: transparent; background: var(--chip); }
.cmt-poll-bar { position: absolute; inset: 0 auto 0 0; background: var(--chip-active, rgba(127,127,127,.28)); transition: width .5s var(--ease-soft); }
.cmt-poll-opt.mine { font-weight: 600; }
.cmt-poll-text { position: relative; flex: 1; }
.cmt-poll-opt .bi, .cmt-poll-pct { position: relative; }
.cmt-poll-total { color: var(--text-2); }
.cmt-poll-edit { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.cmt-poll-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--text-2); }
.cmt-poll-fields { display: flex; flex-direction: column; gap: 6px; }
.cmt-pinned { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 2px; }
.cmt-pinned .bi { font-size: 12px; }
.cmt-hearted { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-2); margin: 0 6px; }
.cmt-hearted .bi { color: var(--liked); font-size: 12px; }
.cmt-more { margin-left: auto; opacity: 0; }
.cmt:hover > .cmt-main > .cmt-actions .cmt-more, .cmt-more[aria-expanded="true"] { opacity: 1; }
@media (hover: none) { .cmt-more { opacity: 1; } }
.cmt-toggle { color: var(--link); margin-left: -10px; }
.cmt-toggle:hover { background: color-mix(in srgb, var(--link) 12%, transparent); }
.cmt-replies { display: flex; flex-direction: column; gap: var(--s3); margin-top: var(--s2); }

/* «Поделиться» */
.share-targets { display: flex; gap: var(--s2); overflow-x: auto; scrollbar-width: none; }
.share-target { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 76px; flex-shrink: 0; font-size: 12px; color: var(--text-2); padding: 6px 0; border-radius: 18px; }
.share-target .row-icon { width: 56px; height: 56px; font-size: 22px; color: var(--text); transition: background-color 0.2s var(--ease-soft), transform 0.2s var(--ease-soft); }
.share-target:active .row-icon { transform: scale(0.94); }
.share-target:hover .row-icon { background: var(--chip-hover); }
@media (max-width: 767px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stat-value { font-size: 22px; line-height: 30px; } }
