/* Хайп-радар — мини-апп.
   Тёмная поверхность, один акцент, иконки одной толщины. Никаких эмодзи в
   интерфейсе: они разные на разных системах и не подчиняются теме.
   Цвета тянутся из темы Телеграма, свои — только там, где у неё нет аналога. */

:root {
  --bg: var(--tg-theme-bg-color, #0e1116);
  --card: var(--tg-theme-secondary-bg-color, #171b22);
  --text: var(--tg-theme-text-color, #eef1f6);
  --dim: var(--tg-theme-hint-color, #8e97a8);
  --accent: var(--tg-theme-button-color, #3b82f6);
  --accent-text: var(--tg-theme-button-text-color, #fff);

  --hot: #ff6a3d;
  --warm: #f0a92c;
  --ok: #34c77b;

  --line: color-mix(in srgb, var(--text) 10%, transparent);
  --raised: color-mix(in srgb, var(--text) 6%, transparent);
  --glass: color-mix(in srgb, var(--card) 78%, transparent);
  --sheen: color-mix(in srgb, #fff 12%, transparent);

  /* Шаг сетки 4px, радиусы — три размера, не больше. */
  --r-l: 18px;
  --r-m: 12px;
  --r-s: 9px;

  --fast: 160ms cubic-bezier(0.2, 0, 0, 1);
  --slow: 280ms cubic-bezier(0.2, 0, 0, 1);
  --spring: 420ms cubic-bezier(0.32, 1.34, 0.5, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Своё display сильнее встроенного [hidden] — без этого спрятать нельзя. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.ic-sm { width: 15px; height: 15px; }
.ic-xl { width: 44px; height: 44px; stroke-width: 1.4; }
.ic-dim { color: var(--dim); }

/* ---------- заглушка ---------- */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.gate-box { text-align: center; max-width: 330px; }
.gate-mark {
  width: 84px; height: 84px; margin: 0 auto; display: grid; place-items: center;
  border-radius: 24px; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
}
.gate h1 { font-size: 23px; margin: 18px 0 8px; letter-spacing: -0.02em; }
.gate p { color: var(--dim); margin: 0; font-size: 14px; line-height: 1.5; }

/* ---------- шапка ---------- */
header {
  position: sticky; top: 0; z-index: 20;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--line);
}
.head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.head-titles { min-width: 0; }
header h1 { font-size: 24px; margin: 0; font-weight: 700; letter-spacing: -0.03em; }
.sub {
  color: var(--dim); font-size: 13px; margin: 2px 0 0;
  font-variant-numeric: tabular-nums;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.head-tools { display: flex; gap: 8px; flex: 0 0 auto; }

/* Кнопка-иконка: визуально 38, область нажатия 44 — правило касания. */
.icon-btn {
  position: relative; width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--raised); color: var(--text);
  display: grid; place-items: center; cursor: pointer;
  transition: background var(--fast), transform var(--fast);
}
.icon-btn::after { content: ''; position: absolute; inset: -3px; }
.icon-btn:active { transform: scale(0.9); background: color-mix(in srgb, var(--text) 12%, transparent); }
.icon-btn.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.icon-btn.spin svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- фильтры ---------- */
.filters { padding: 12px 16px 0; display: grid; gap: 8px; animation: drop var(--slow) both; }
@keyframes drop { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* Сегменты вместо россыпи кнопок: видно, что выбор один из нескольких. */
.seg {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--raised); border: 1px solid var(--line);
  border-radius: var(--r-m); padding: 3px; gap: 3px;
}
.seg-item {
  min-height: 34px; border: none; background: none; color: var(--dim); cursor: pointer;
  border-radius: 9px; font-size: 13px; font-weight: 500; padding: 0 6px;
  transition: color var(--fast), background var(--fast);
}
.seg-item.on { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.seg-item:active { transform: scale(0.97); }
/* Область нажатия добирается только по высоте: вширь она задела бы соседа. */
.seg-item { position: relative; }
.seg-item::after { content: ''; position: absolute; inset: -5px 0; }

.field {
  display: flex; align-items: center; gap: 9px;
  border: 1px solid var(--line); background: var(--raised);
  border-radius: var(--r-m); padding: 0 12px; min-height: 44px;
  transition: border-color var(--fast), box-shadow var(--fast);
}
.field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.field input {
  flex: 1; min-width: 0; border: none; background: none; color: var(--text);
  font-size: 15px; outline: none; padding: 10px 0;
}
.field input::placeholder { color: var(--dim); }

/* ---------- список ---------- */
main { padding: 12px 16px 20px; display: grid; gap: 10px; }

.card {
  display: grid; grid-template-columns: 108px 1fr; gap: 12px;
  border: 1px solid var(--line); border-radius: var(--r-l); padding: 10px;
  background: var(--card);
  animation: rise var(--spring) both;
  transition: opacity var(--slow), transform var(--slow);
}
.card:nth-child(1) { animation-delay: 0ms; }
.card:nth-child(2) { animation-delay: 40ms; }
.card:nth-child(3) { animation-delay: 80ms; }
.card:nth-child(4) { animation-delay: 120ms; }
.card:nth-child(n+5) { animation-delay: 160ms; }
.card.leaving { opacity: 0; transform: translateX(24px) scale(0.96); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Левая колонка: превью, под ним две главные цифры — кратность и просмотры.
   Обе набраны крупно и светлым: именно по ним решают, брать тему или нет. */
.left { display: grid; gap: 6px; align-content: start; }
.nums {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 5px 7px;
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
}
.views {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--text); font-size: 13px; font-weight: 600;
}

.thumb {
  position: relative; display: block; border-radius: var(--r-m); overflow: hidden;
  aspect-ratio: 16 / 10; background: var(--raised);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Кратность — самая важная цифра карточки: в плашке и по цвету силы выброса. */
.heat {
  padding: 3px 9px; border-radius: 999px;
  font-size: 13px; font-weight: 800; line-height: 1.3;
  color: var(--text);
  background: color-mix(in srgb, var(--text) 12%, transparent);
  border: 1px solid transparent;
}
.heat.hot {
  color: var(--hot);
  background: color-mix(in srgb, var(--hot) 16%, transparent);
  border-color: color-mix(in srgb, var(--hot) 34%, transparent);
}
.heat.warm {
  color: var(--warm);
  background: color-mix(in srgb, var(--warm) 15%, transparent);
  border-color: color-mix(in srgb, var(--warm) 30%, transparent);
}

.body { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.title {
  margin: 0; font-size: 14.5px; line-height: 1.32; font-weight: 600; letter-spacing: -0.01em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px;
  color: var(--dim); font-size: 12.5px; font-variant-numeric: tabular-nums;
}
.meta span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.chan { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.tag {
  font-size: 10.5px; padding: 2px 7px; border-radius: 999px;
  background: var(--raised); color: var(--dim); border: 1px solid var(--line);
}

/* Действия: главное — словом, остальное — иконками, все по 44 в высоту. */
.acts { display: flex; gap: 6px; margin-top: auto; padding-top: 2px; }
.act {
  position: relative;
  min-height: 36px; min-width: 40px; padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); border-radius: var(--r-s);
  background: var(--raised); color: var(--text); cursor: pointer;
  font-size: 13px; font-weight: 500;
  transition: transform var(--fast), background var(--fast), border-color var(--fast);
}
/* Выглядит на 36, нажимается как 44 — правило минимальной цели касания. */
.act::after { content: ''; position: absolute; inset: -4px; }
.act:active { transform: scale(0.94); }
.act.primary {
  flex: 1; background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600;
}
.act.ghost { color: var(--dim); }
.act.danger:active { border-color: var(--hot); color: var(--hot); }

/* ---------- строки ---------- */
.row {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: var(--r-m);
  background: var(--card); padding: 10px 11px;
  animation: rise var(--spring) both;
}
/* Список длинный — лесенку показываем только у первых, дальше сразу. */
.row:nth-child(-n+8) { animation-delay: calc((var(--i, 0)) * 0ms); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { color: var(--dim); font-size: 12.5px; font-variant-numeric: tabular-nums; margin-top: 1px; }

/* Состояние словом, а не значком: «колокольчик» никто не обязан разгадывать. */
.pill {
  position: relative; flex: 0 0 auto;
  min-height: 32px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--raised); color: var(--dim);
  font-size: 12.5px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
  transition: transform var(--fast), background var(--fast), color var(--fast);
}
.pill::after { content: ''; position: absolute; inset: -6px; }
.pill:active { transform: scale(0.94); }
.pill.on { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: color-mix(in srgb, var(--ok) 12%, transparent); }
/* Теневой — рабочее состояние, но не такое же заметное, как основная слежка. */
.pill.soft { color: var(--dim); border-style: dashed; }

.icon-btn.sm { width: 32px; height: 32px; }
/* Маленькой кнопке нужна прибавка побольше, чтобы дотянуть до 44. */
.icon-btn.sm::after { inset: -6px; }

/* ---------- настройки ---------- */
.group { display: grid; gap: 8px; }
.group h2 {
  margin: 14px 0 2px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--dim);
}
.hint { color: var(--dim); font-size: 12.5px; margin: 0; }
.words { display: flex; flex-wrap: wrap; gap: 7px; }
.word {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--card);
  border-radius: 999px; padding: 7px 8px 7px 13px; font-size: 13px;
}
.word button {
  width: 22px; height: 22px; border: none; border-radius: 50%; cursor: pointer;
  background: var(--raised); color: var(--dim); display: grid; place-items: center;
}
.add-row { display: flex; gap: 8px; }
.add-row .field { flex: 1; }
.btn {
  min-height: 44px; padding: 0 18px; border: none; border-radius: var(--r-m); cursor: pointer;
  background: var(--accent); color: var(--accent-text); font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform var(--fast), opacity var(--fast);
}
.btn:active { transform: scale(0.97); }
.btn.quiet { background: var(--raised); color: var(--text); border: 1px solid var(--line); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

/* ---------- пусто и загрузка ---------- */
.empty { text-align: center; padding: 52px 24px; animation: rise var(--slow) both; }
.empty svg { color: var(--dim); opacity: 0.5; margin-bottom: 12px; }
.empty b { display: block; font-size: 16px; margin-bottom: 6px; letter-spacing: -0.02em; }
.empty span { color: var(--dim); font-size: 13.5px; line-height: 1.5; }

.skeleton {
  height: 96px; border-radius: var(--r-l); border: 1px solid var(--line);
  background:
    linear-gradient(100deg, transparent 20%, var(--raised) 50%, transparent 80%) var(--card);
  background-size: 220% 100%;
  animation: sweep 1.4s ease-in-out infinite;
}
@keyframes sweep { from { background-position: 130% 0; } to { background-position: -30% 0; } }

/* ---------- нижние вкладки ---------- */
nav {
  position: fixed; z-index: 30; left: 10px; right: 10px;
  bottom: calc(8px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 5px; border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  box-shadow: inset 0 1px 0 var(--sheen), 0 12px 30px -12px rgba(0, 0, 0, 0.8);
}
/* Подсветка одна на все вкладки — переезжает, а не перекрашивается. */
nav::after {
  content: ''; position: absolute; z-index: 0;
  top: 5px; bottom: 5px; width: calc((100% - 10px) / 5);
  left: calc(5px + var(--tab, 0) * (100% - 10px) / 5);
  border-radius: 17px; background: var(--raised);
  transition: left var(--spring);
}
.tab {
  position: relative; z-index: 1; min-height: 52px;
  border: none; background: none; color: var(--dim); cursor: pointer;
  display: grid; justify-items: center; align-content: center; gap: 3px;
  font-size: 10px; font-weight: 600; letter-spacing: -0.01em;
  transition: color var(--fast);
}
.tab svg { transition: transform var(--spring); }
.tab.on { color: var(--text); }
.tab.on svg { color: var(--accent); transform: translateY(-1px); }

/* ---------- уведомление ---------- */
.toast {
  position: fixed; z-index: 40; left: 50%; transform: translateX(-50%);
  bottom: calc(88px + env(safe-area-inset-bottom));
  max-width: calc(100% - 32px);
  padding: 11px 16px; border-radius: 999px;
  background: color-mix(in srgb, var(--text) 92%, transparent); color: var(--bg);
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  animation: toast var(--spring) both;
}
@keyframes toast { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }

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

/* Оригинал под переводом — мелко и приглушённо: он нужен для сверки,
   а читают всё-таки русский. */
.orig {
  margin: -2px 0 0; color: var(--dim); font-size: 11.5px; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
/* Буквенная кнопка в шапке — та же форма, что у иконочных. */
#toggle-ru { font-size: 12px; font-weight: 800; letter-spacing: 0.02em; }

/* ---------- волна: раскрывается списком роликов ---------- */
.wave {
  border: 1px solid var(--line); border-radius: var(--r-m);
  background: var(--card); overflow: hidden;
  animation: rise var(--spring) both;
}
.wave-head {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border: none; background: none; color: var(--text);
  cursor: pointer; text-align: left;
}
.wave-head .chev { color: var(--dim); transition: transform var(--slow); }
.wave.open .chev { transform: rotate(180deg); }
.wave.open { border-color: color-mix(in srgb, var(--accent) 34%, transparent); }

.inner { padding: 0 8px 8px; display: grid; gap: 6px; }
.mini {
  display: grid; grid-template-columns: 72px 1fr; gap: 9px; align-items: center;
  padding: 6px; border-radius: var(--r-s); background: var(--raised);
  color: inherit; text-decoration: none;
}
.mini img { width: 72px; aspect-ratio: 16/10; object-fit: cover; border-radius: 7px; display: block; }
.mini-body { min-width: 0; }
.mini-title {
  font-size: 12.5px; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.mini-sub { color: var(--dim); font-size: 11.5px; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* Норма канала — тот самый ориентир, относительно которого считается кратность. */
.norm { text-align: center; color: var(--dim); font-size: 11.5px; font-variant-numeric: tabular-nums; }
