/* ═══════════════════════════════════════════════════════════════════════════
   Klipy — дизайн-система.

   Принципы, от которых не отступаем:
   · один акцент (вермильон) и только для смысла: эфир, активный раздел,
     главное действие. Никаких градиентов, свечений и стекла;
   · цвет в интерфейс приносит контент — превью. Хром монохромный;
   · плотная сетка и типографика вместо рамок и теней: карточка не «плитка»,
     а строка каталога;
   · радиус 2px, границы в 1px, движение только opacity/transform 120мс.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --ink-900: #0B0B0C;   /* фон страницы */
  --ink-800: #101012;   /* приподнятая поверхность */
  --ink-700: #17171A;   /* заглушка превью */
  --ink-600: #1D1D21;
  --line:    #232326;   /* волосяная линия */
  --line-strong: #34343A;

  --fg-000: #F2F1EE;    /* тёплый белый, не #FFF */
  --fg-100: #A5A29C;
  --fg-200: #6C6A66;
  --fg-300: #474643;

  --accent: #E8442A;
  --accent-dim: #B8351F;
  --focus: #7B9CFF;

  --sans: "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --r: 2px;
  --topbar-h: 56px;
  --gutter: clamp(16px, 3vw, 40px);
  --max: 1680px;
  --ease: cubic-bezier(.2, .6, .3, 1);
}

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

/* Любое авторское правило с display перебивает браузерное [hidden]{display:none},
   поэтому атрибут hidden закрепляем явно — на нём держатся все скрытые панели. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ink-900);
  color: var(--fg-000);
  font: 400 14px/1.45 var(--sans);
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.is-locked { overflow: hidden; }

img { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

::selection { background: var(--accent); color: var(--ink-900); }

.icon { flex: none; }

/* Числа везде табличные: колонки метаданных не должны «дышать». */
.mono, .badge, .card__meta, .filters__count, .rail__count,
.related__meta, .eyebrow {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-200);
}

/* ─── Шапка ───────────────────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--ink-900);
  border-bottom: 1px solid var(--line);
}

.topbar__inner {
  display: flex;
  align-items: center;
  gap: 28px;
  height: var(--topbar-h);
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.brand { display: flex; align-items: center; gap: 10px; flex: none; }

.brand__mark {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  background: var(--accent);
  color: var(--ink-900);
  font: 700 14px/1 var(--mono);
}

.brand__word {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
}

.tabs { display: flex; gap: 22px; height: 100%; }

.tab {
  position: relative;
  display: flex;
  align-items: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-100);
  transition: color 120ms var(--ease);
}
.tab:hover { color: var(--fg-000); }
.tab.is-active { color: var(--fg-000); }
.tab.is-active::after {
  content: "";
  position: absolute;
  inset: auto 0 -1px;
  height: 2px;
  background: var(--accent);
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  max-width: 320px;
  margin-left: auto;
  padding: 0 10px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--fg-200);
  transition: border-color 120ms var(--ease);
}
.search:focus-within { border-color: var(--line-strong); color: var(--fg-100); }

.search__input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: none;
  font-size: 13px;
  color: var(--fg-000);
}
.search__input::placeholder { color: var(--fg-300); }
.search__input::-webkit-search-cancel-button { filter: invert(1) opacity(.4); }

.account { display: flex; align-items: center; gap: 6px; flex: none; }

.iconbtn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r);
  color: var(--fg-200);
  transition: color 120ms var(--ease), background 120ms var(--ease);
}
.iconbtn:hover { color: var(--fg-000); background: var(--ink-700); }
.iconbtn.is-on { color: var(--accent); }

.avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.avatar--fallback {
  display: grid;
  place-items: center;
  background: var(--ink-600);
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-100);
}

.pro-tag {
  font: 500 9px/1 var(--mono);
  letter-spacing: 0.1em;
  padding: 3px 4px;
  color: var(--ink-900);
  background: var(--accent);
}

.menu { position: relative; }
.menu__trigger { display: flex; align-items: center; gap: 6px; padding: 3px; }

.menu__list {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 50;
  display: none;
  min-width: 216px;
  padding: 6px 0;
  background: var(--ink-800);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.menu.is-open .menu__list { display: block; }

.menu__name { margin: 6px 14px 0; font-size: 13px; font-weight: 600; }
.menu__sub { margin: 2px 14px 8px; font-size: 11px; color: var(--fg-200); }

.menu__item {
  display: block;
  width: 100%;
  padding: 8px 14px;
  text-align: left;
  font-size: 13px;
  color: var(--fg-100);
  transition: background 120ms var(--ease), color 120ms var(--ease);
}
.menu__item:hover { background: var(--ink-700); color: var(--fg-000); }
.menu__item--accent { color: var(--accent); }

/* ─── Кнопки ──────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-000);
  transition: background 120ms var(--ease), border-color 120ms var(--ease), color 120ms var(--ease);
}
.btn:hover { background: var(--ink-700); }
.btn:disabled { opacity: .5; cursor: default; }

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink-900);
  font-weight: 600;
}
.btn--primary:hover { background: var(--accent-dim); border-color: var(--accent-dim); }

.btn--ghost { border-color: var(--line); color: var(--fg-100); }
.btn--ghost:hover { color: var(--fg-000); border-color: var(--line-strong); }
.btn--ghost.is-on { color: var(--accent); border-color: var(--accent); }

.btn--sm { height: 32px; padding: 0 14px; font-size: 13px; }
.btn--wide { width: 100%; }

/* ─── Полоса фильтров ─────────────────────────────────────────────────────── */

.page { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

.filters:not(:empty) {
  position: sticky;
  top: var(--topbar-h);
  z-index: 30;
  background: var(--ink-900);
  border-bottom: 1px solid var(--line);
  margin: 0 calc(var(--gutter) * -1);
  padding: 0 var(--gutter);
}

.filters__row {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 46px;
}

.filters__spacer { flex: 1; }

.filters__count { font-size: 11px; color: var(--fg-200); white-space: nowrap; }

.seg { display: flex; align-items: center; }
.seg__item {
  padding: 4px 10px;
  font-size: 13px;
  color: var(--fg-200);
  transition: color 120ms var(--ease);
}
.seg__item + .seg__item { border-left: 1px solid var(--line); }
.seg__item:hover { color: var(--fg-100); }
.seg__item.is-active { color: var(--fg-000); font-weight: 500; }

.filters__chips {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.filters__chips::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.02em;
  color: var(--fg-100);
  white-space: nowrap;
  transition: border-color 120ms var(--ease), color 120ms var(--ease), background 120ms var(--ease);
}
.chip:hover { border-color: var(--line-strong); color: var(--fg-000); }
.chip.is-active {
  background: var(--fg-000);
  border-color: var(--fg-000);
  color: var(--ink-900);
}

.chip__divider { flex: none; width: 1px; height: 18px; background: var(--line); margin: 0 4px; }

/* ─── Сетка и карточка ────────────────────────────────────────────────────── */

.content { padding: 28px 0 80px; min-height: 60vh; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 30px 22px;
}

/* Карточка без фона и рамки: единственный блок — превью, остальное держит
   типографика. Так каталог читается как разворот, а не как набор плиток. */
.card { position: relative; display: flex; flex-direction: column; gap: 10px; min-width: 0; }

.card__thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: var(--ink-700);
  border-radius: var(--r);
  overflow: hidden;
}
.card__thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgb(255 255 255 / 8%);
  border-radius: inherit;
  pointer-events: none;
}

.card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 160ms var(--ease);
}
.card:hover .card__img { opacity: .82; }

.badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px;
  border-radius: var(--r);
  background: rgb(11 11 12 / 82%);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--fg-000);
}
.badge--time { left: auto; right: 8px; letter-spacing: 0.02em; }
.badge--live { background: var(--accent); color: var(--ink-900); font-weight: 600; }
.badge__dot { width: 5px; height: 5px; background: currentColor; }

.card__source {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 5px;
  border-radius: var(--r);
  background: rgb(11 11 12 / 72%);
  font: 500 9px/1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-100);
  opacity: 0;
  transition: opacity 120ms var(--ease);
}
.card:hover .card__source { opacity: 1; }

.card__save {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r);
  background: rgb(11 11 12 / 72%);
  color: var(--fg-100);
  opacity: 0;
  transition: opacity 120ms var(--ease), color 120ms var(--ease);
}
.card:hover .card__save,
.card__save:focus-visible,
.card__save[aria-pressed="true"] { opacity: 1; }
.card__save:hover { color: var(--fg-000); }
.card__save[aria-pressed="true"] { color: var(--accent); }

.card__body { display: flex; flex-direction: column; gap: 5px; min-width: 0; }

.card__title {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.012em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__channel {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--fg-100);
  min-width: 0;
}
.card__channel:hover { color: var(--fg-000); }
.card__channel span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card__avatar { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; flex: none; }

.card__meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-size: 11px;
  color: var(--fg-200);
}
.sep { width: 2px; height: 2px; background: currentColor; opacity: .6; flex: none; }

/* ─── Полка «в эфире сейчас» ──────────────────────────────────────────────── */

.rail { margin-bottom: 34px; }

.rail__head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.rail__title { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: 0.02em; }
.rail__count { font-size: 11px; color: var(--fg-200); }

.rail__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(268px, 1fr);
  gap: 22px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding-bottom: 4px;
  scrollbar-width: thin;
}
.card--rail { scroll-snap-align: start; }

/* ─── Заглушки и пустые состояния ─────────────────────────────────────────── */

.card--skeleton { pointer-events: none; }
.card--skeleton .card__thumb { background: var(--ink-700); }
.sk { height: 10px; border-radius: var(--r); background: var(--ink-700); }
.sk--title { height: 14px; width: 88%; }
.sk--line { width: 56%; }
.sk--short { width: 34%; }
.card--skeleton .card__thumb, .sk { animation: pulse 1.4s ease-in-out infinite; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

.sentinel { height: 1px; }

.feed__end {
  margin: 56px 0 0;
  text-align: center;
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-300);
}

.empty { padding: 100px 0; text-align: center; }
.empty__title { margin: 0 0 8px; font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.empty__lead { margin: 0 auto 20px; max-width: 42ch; font-size: 14px; color: var(--fg-100); }

.page-head { padding: 8px 0 30px; border-bottom: 1px solid var(--line); margin-bottom: 30px; }
.page-title { margin: 0 0 6px; font-size: 26px; font-weight: 600; letter-spacing: -0.03em; }
.page-lead { margin: 0; max-width: 60ch; font-size: 14px; color: var(--fg-100); }
.side-title {
  margin: 0 0 14px;
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-200);
}

/* ─── Подвал ──────────────────────────────────────────────────────────────── */

.footer {
  border-top: 1px solid var(--line);
  margin-top: 40px;
}
.footer__note {
  max-width: var(--max);
  margin: 0 auto;
  padding: 26px var(--gutter) 40px;
  max-width: 78ch;
  font-size: 12px;
  line-height: 1.6;
  color: var(--fg-300);
}

@media (max-width: 860px) {
  .topbar__inner { gap: 14px; }
  /* Раньше на узких экранах слово пряталось и от кнопки «на главную» оставался
     безымянный квадрат — его переставали замечать. Уменьшаем, но не скрываем. */
  .brand__word { font-size: 14px; }
  .search { max-width: none; }
  .tabs { gap: 16px; order: 3; width: 100%; }
}

/* ─── Оверлеи и листы ─── */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgb(6 6 7 / 78%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gutter);
  overflow-y: auto;
  animation: fadeIn 140ms var(--ease);
}

.sheet {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--ink-800);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 32px;
  align-self: center;
  box-shadow: 0 24px 60px rgb(0 0 0 / 55%);
}

.sheet--auth { max-width: 420px; }
.sheet--plans { max-width: 460px; }

.sheet__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: var(--fg-200);
  transition: color 120ms var(--ease);
}
.sheet__close:hover { color: var(--fg-000); }

.sheet__title {
  margin: 0 0 10px;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.sheet__lead {
  margin: 0 0 22px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--fg-100);
}

.auth__link {
  margin-bottom: 14px;
}

.auth__status {
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--fg-200);
  min-height: 16px;
}

.auth__perks {
  list-style: none;
  margin: 24px 0 0;
  padding: 20px 0 0;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  font-size: 13px;
  color: var(--fg-100);
}

.auth__perks li {
  position: relative;
  padding-left: 16px;
}

.auth__perks li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .55em;
  width: 4px;
  height: 4px;
  background: var(--fg-300);
}

/* ─── Тарифы ─── */

.plans__perks {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: grid;
  gap: 10px;
  font-size: 13px;
  color: var(--fg-100);
}

.plans__perks li {
  position: relative;
  padding-left: 16px;
}

.plans__perks li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .55em;
  width: 4px;
  height: 4px;
  background: var(--fg-300);
}

.plans {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.plan {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: var(--ink-800);
}

.plan__title {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
}

.plan__days {
  margin: 2px 0 0;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-200);
}

.plan__buy {
  height: 32px;
  padding: 0 14px;
  white-space: nowrap;
}

.plans__fine {
  margin: 18px 0 0;
  font-size: 11px;
  line-height: 1.5;
  color: var(--fg-300);
}

.paywall {
  padding: 90px 0;
  text-align: center;
}

.paywall__title {
  margin: 0 0 10px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.paywall__lead {
  max-width: 46ch;
  margin: 0 auto 24px;
  color: var(--fg-100);
}

/* ─── Рекомендации ─── */

.related {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.related__btn {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 10px;
  width: 100%;
  text-align: left;
  align-items: start;
}

.related__thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--ink-700);
  border-radius: var(--r);
  overflow: hidden;
}

.related__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.related__live {
  position: absolute;
  left: 6px;
  bottom: 6px;
  width: 6px;
  height: 6px;
  background: var(--accent);
}

.related__body {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.related__title {
  margin: 0;
  font-size: 13px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related__meta {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--fg-200);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.related__btn:hover .related__title {
  text-decoration: underline;
}

/* ─── Мультиэкран ─── */

.mv {
  display: grid;
  gap: 22px;
  grid-template-rows: 1fr auto;
  min-height: 70vh;
}

.mv__stage {
  display: grid;
  gap: 8px;
  background: var(--ink-700);
  border: 1px solid var(--line);
  border-radius: var(--r);
  min-height: 46vh;
  padding: 8px;
  place-items: stretch;
}

.mv__stage[data-count="0"],
.mv__stage[data-count="1"] {
  grid-template-columns: 1fr;
}

.mv__stage[data-count="2"] {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: 1fr;
}

.mv__stage[data-count="3"],
.mv__stage[data-count="4"] {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.mv__cell {
  position: relative;
  background: #000;
  border-radius: var(--r);
  overflow: hidden;
  min-height: 200px;
}

.mv__frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.mv__bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  background: rgb(11 11 12 / 78%);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-100);
  opacity: 0;
  transition: opacity 120ms var(--ease);
}

.mv__cell:hover .mv__bar {
  opacity: 1;
}

.mv__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mv__drop {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: var(--fg-100);
  transition: color 120ms var(--ease);
}
.mv__drop:hover {
  color: var(--fg-000);
}

.mv__empty {
  place-self: center;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-200);
}

.mv__pickwrap {
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.mv__picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mv__chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 240px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-size: 12px;
  color: var(--fg-100);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: border-color 120ms var(--ease), color 120ms var(--ease), background 120ms var(--ease);
}
.mv__chip:hover {
  border-color: var(--line-strong);
  color: var(--fg-000);
}
.mv__chip.is-on {
  background: var(--fg-000);
  border-color: var(--fg-000);
  color: var(--ink-900);
}

.mv__dot {
  width: 5px;
  height: 5px;
  background: var(--accent);
  flex: none;
}
.mv__chip.is-on .mv__dot {
  background: var(--accent);
}

/* ─── Список каналов ─── */

.channels {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1px;
  background: var(--line);
  border-block: 1px solid var(--line);
}

.channel {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 4px;
  background: var(--ink-900);
}

.channel__avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  background: var(--ink-700);
}

.channel__body {
  flex: 1;
  min-width: 0;
}

.channel__name {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel__meta {
  margin: 2px 0 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-200);
}

.channel.is-live .channel__meta {
  color: var(--accent);
}

/* ─── Тосты ─── */

.toasts {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 24px;
  z-index: 200;
  display: grid;
  gap: 8px;
  justify-items: center;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: var(--ink-800);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  font-size: 13px;
  max-width: min(92vw, 480px);
  animation: toastIn 160ms var(--ease);
}

.toast--error {
  border-color: var(--accent-dim);
}

.toast--upgrade {
  border-color: var(--accent);
}

.toast__action {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  white-space: nowrap;
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 300ms var(--ease), transform 300ms var(--ease);
}

/* ─── Анимации ─── */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ─── Адаптив ─── */

@media (max-width: 860px) {
  .mv__stage[data-count="3"],
  .mv__stage[data-count="4"],
  .mv__stage[data-count="2"] {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-auto-rows: minmax(200px, 1fr);
  }
  .related__btn {
    grid-template-columns: 92px 1fr;
  }
  .sheet {
    padding: 24px;
  }
}

@media (max-width: 860px) {
  .topbar__inner {
    flex-wrap: wrap;
    height: auto;
    padding-top: 10px;
    row-gap: 0;
  }
  /* Переменную переопределяем на :root, а не на .topbar: от неё зависят липкая
     полоса фильтров, боковая колонка и высота ленты клипов — все вне шапки. */
  :root {
    --topbar-h: 84px;
  }
  .tabs {
    height: 40px;
    border-top: 1px solid var(--line);
    margin: 0 calc(var(--gutter) * -1);
    padding: 0 var(--gutter);
  }
}

/* ─── Страница просмотра ─── */

.watch {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 372px;
  gap: 32px;
  align-items: start;
  padding-top: 4px;
}

.watch__main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.watch__side {
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: calc(var(--topbar-h) + 20px);
}

.stage {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}

.stage__frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.stage--loading {
  display: grid;
  place-items: center;
}

.stage__hint {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-200);
  margin: 0;
}

.stage-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stage__note {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--fg-300);
}

.stage__note a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--fg-100);
}

.stage__note a:hover,
.stage__reload:hover {
  color: var(--fg-000);
}

.stage__reload {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-200);
  transition: color 120ms var(--ease);
}

.watch__title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.badge--inline {
  position: static;
  left: auto;
  right: auto;
  bottom: auto;
  flex: none;
}

.watch__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.watch__channel {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.watch__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  background: var(--ink-700);
  display: block;
}

.watch__channel-name {
  display: block;
  font-size: 15px;
  font-weight: 500;
}

.watch__channel-name:hover {
  text-decoration: underline;
}

.watch__channel-meta {
  margin: 2px 0 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-200);
}

.follow {
  height: 34px;
  padding: 0 16px;
  margin-left: 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-000);
  white-space: nowrap;
  transition: background 120ms var(--ease), border-color 120ms var(--ease), color 120ms var(--ease);
}

.follow:hover {
  background: var(--ink-700);
}

.follow.is-on {
  border-color: var(--accent);
  color: var(--accent);
}

.watch__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.react {
  display: flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  height: 34px;
  overflow: hidden;
}

.react__half {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 100%;
  padding: 0 13px;
  font-size: 13px;
  color: var(--fg-100);
  transition: color 120ms var(--ease), background 120ms var(--ease);
}

.react__half:hover {
  background: var(--ink-700);
  color: var(--fg-000);
}

.react__half[aria-pressed="true"] {
  color: var(--accent);
}

.react__half--down .icon {
  transform: rotate(180deg);
}

.react__count {
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.react__split {
  width: 1px;
  height: 18px;
  background: var(--line-strong);
  flex: none;
}

.act {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  font-size: 13px;
  color: var(--fg-100);
  white-space: nowrap;
  transition: background 120ms var(--ease), border-color 120ms var(--ease), color 120ms var(--ease);
}

.act:hover {
  background: var(--ink-700);
  color: var(--fg-000);
}

.act.is-on {
  color: var(--accent);
  border-color: var(--accent);
}

.act__label {
  white-space: nowrap;
}

.desc {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px;
  background: var(--ink-800);
  font-size: 14px;
  line-height: 1.55;
}

.desc__facts {
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--fg-100);
}

.desc__body {
  display: grid;
  gap: 10px;
  max-height: 78px;
  overflow: hidden;
  color: var(--fg-100);
  position: relative;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.desc__body p {
  margin: 0;
}

.desc.is-open .desc__body {
  max-height: none;
}

.desc__empty {
  color: var(--fg-300);
}

.desc__more {
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-000);
}

.side-block {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.side-block--chat {
  min-height: 420px;
}

.chat__frame {
  width: 100%;
  height: 460px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--ink-800);
  display: block;
}

.reels-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  font-size: 12px;
  color: var(--fg-000);
  white-space: nowrap;
  transition: background 120ms var(--ease), border-color 120ms var(--ease), color 120ms var(--ease);
}

.reels-link:hover {
  background: var(--ink-700);
}

/* ─── Комментарии ─── */

.comments {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-top: 10px;
}

.comments__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.comments__title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.comments__sort {
  display: flex;
  align-items: center;
}

.comments__sort-btn {
  padding: 4px 10px;
  font-size: 13px;
  color: var(--fg-200);
  transition: color 120ms var(--ease);
}

.comments__sort-btn + .comments__sort-btn {
  border-left: 1px solid var(--line);
}

.comments__sort-btn:hover {
  color: var(--fg-100);
}

.comments__sort-btn.is-active {
  color: var(--fg-000);
  font-weight: 500;
}

.cform {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: start;
}

.cform--inline {
  margin-top: 12px;
  grid-template-columns: 28px 1fr;
  gap: 10px;
}

.cform__guest {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--ink-800);
  font-size: 13px;
  color: var(--fg-100);
}

.cform__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--ink-600);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-100);
  flex: none;
}

.cform--inline .cform__avatar {
  width: 28px;
  height: 28px;
  font-size: 12px;
}

.cform__input {
  grid-column: 2;
  width: 100%;
  min-height: 34px;
  max-height: 320px;
  padding: 6px 0;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--fg-000);
  font: 14px/1.5 var(--sans);
  resize: none;
  outline: none;
  overflow: hidden;
}

.cform__input:focus {
  border-bottom-color: var(--fg-200);
}

.cform__input::placeholder {
  color: var(--fg-300);
}

.cform__actions {
  grid-column: 2;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.clist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.clist__loading,
.clist__empty {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-200);
  padding: 8px 0;
}

.comment {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: start;
}

.comment--reply {
  grid-template-columns: 28px 1fr;
  gap: 10px;
}

.comment__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--ink-600);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-100);
  flex: none;
}

.comment--reply .comment__avatar {
  width: 28px;
  height: 28px;
  font-size: 12px;
}

.comment__body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.comment__head {
  margin: 0;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.comment__author {
  font-size: 13px;
  font-weight: 600;
}

.comment__pro {
  font: 500 9px/1 var(--mono);
  letter-spacing: 0.1em;
  padding: 3px 4px;
  color: var(--ink-900);
  background: var(--accent);
}

.comment__time {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--fg-200);
}

.comment__text {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comment__text--gone {
  color: var(--fg-300);
  font-style: italic;
}

.comment__actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 2px;
}

.comment__like {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--fg-200);
  transition: color 120ms var(--ease);
}

.comment__like:hover {
  color: var(--fg-000);
}

.comment__like[aria-pressed="true"] {
  color: var(--accent);
}

.comment__likes {
  font-family: var(--mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  min-width: 10px;
}

.comment__reply,
.comment__del {
  font-size: 12px;
  color: var(--fg-200);
  transition: color 120ms var(--ease);
}

.comment__reply:hover,
.comment__del:hover {
  color: var(--fg-000);
}

.comment__del {
  display: inline-flex;
  align-items: center;
}

.comment__replies {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 12px;
}

.comment__expand {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-100);
  transition: color 120ms var(--ease);
}

.comment__expand:hover {
  color: var(--fg-000);
}

.comment__expand .icon {
  transform: rotate(90deg);
}

.comment__expand[data-expanded="true"] .icon {
  transform: rotate(-90deg);
}

.comments__more {
  align-self: flex-start;
  padding: 8px 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-100);
  transition: color 120ms var(--ease);
}

.comments__more:hover {
  color: var(--fg-000);
}

.comments__more:disabled {
  color: var(--fg-300);
}

/* ─── Лента клипов ─── */

body.is-immersive .footer,
body.is-immersive .filters {
  display: none;
}

body.is-immersive .content {
  padding: 0;
}

.reels {
  position: relative;
  height: calc(100vh - var(--topbar-h));
  background: #000;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}

.reels__loading {
  display: grid;
  place-items: center;
  height: 60vh;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-200);
}

.reels__track {
  height: 100%;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
}

.reels__track::-webkit-scrollbar {
  display: none;
}

.reel {
  position: relative;
  height: 100%;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px 0;
  background: #000;
}

.reel__frame-wrap {
  position: relative;
  width: min(100%, 460px);
  aspect-ratio: 9 / 16;
  max-height: 100%;
  background: var(--ink-900);
  /* Хайрлайн отделяет вертикальный кадр от чёрного поля вокруг — иначе колонка
     сливается с фоном и лента выглядит поломанной. */
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}

.reel__poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.reel__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.reel__play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgb(11 11 12 / 62%);
  color: var(--fg-000);
  border: 1px solid rgb(255 255 255 / 14%);
}

.reel__info {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 14px;
  display: grid;
  gap: 3px;
  z-index: 2;
  pointer-events: none;
  text-shadow: 0 1px 4px rgb(0 0 0 / 90%);
}

.reel__channel {
  margin: 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-100);
}

.reel__title {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.reel__meta {
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-100);
}

/* Столбец действий стоит вплотную к кадру, а не у края экрана — так он читается
   как часть клипа, ровно как в Shorts на десктопе. */
.reel__rail {
  align-self: flex-end;
  margin-bottom: 18px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
  flex: none;
}

.reel__act {
  display: grid;
  justify-items: center;
  gap: 4px;
  color: var(--fg-000);
  font-family: var(--mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  transition: color 120ms var(--ease), transform 120ms var(--ease);
}

.reel__act:hover {
  transform: translateY(-1px);
}

.reel__act[aria-pressed="true"] {
  color: var(--accent);
}

.reels__sentinel {
  height: 1px;
}

.reels__nav {
  position: absolute;
  right: 20px;
  z-index: 4;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: var(--r);
  background: rgb(11 11 12 / 62%);
  color: var(--fg-000);
  transition: background 120ms var(--ease);
}

.reels__nav:hover {
  background: var(--ink-700);
}

.reels__nav--up {
  top: calc(50% - 44px);
}

.reels__nav--up .icon {
  transform: rotate(-90deg);
}

.reels__nav--down {
  top: calc(50% + 10px);
}

.reels__nav--down .icon {
  transform: rotate(90deg);
}

.reels__exit {
  position: absolute;
  top: 16px;
  right: 20px;
  z-index: 4;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--r);
  background: rgb(11 11 12 / 62%);
  color: var(--fg-000);
  transition: background 120ms var(--ease);
}

.reels__exit:hover {
  background: var(--ink-700);
}

.reels__comments {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  width: min(420px, 92vw);
  display: flex;
  flex-direction: column;
  background: var(--ink-900);
  border-left: 1px solid var(--line);
}

.reels__comments-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.reels__comments-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.reels__comments-close {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: var(--fg-200);
  transition: color 120ms var(--ease);
}

.reels__comments-close:hover {
  color: var(--fg-000);
}

.reels__comments-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
}

/* ─── Адаптив ─── */

@media (max-width: 1180px) {
  .watch {
    grid-template-columns: 1fr;
    gap: 26px;
  }
  .watch__side {
    position: static;
  }
  .chat__frame {
    height: 380px;
  }
}

@media (max-width: 720px) {
  .watch__bar {
    align-items: flex-start;
    flex-direction: column;
  }
  .watch__actions {
    width: 100%;
  }
  .reel__info {
    left: 12px;
    right: 12px;
  }
  .reel__rail {
    gap: 14px;
    margin-bottom: 12px;
  }
  .reel { gap: 8px; }
  .reels {
    border: 0;
    border-radius: 0;
  }
  .comment__replies {
    margin-left: -10px;
  }
}

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