/* Тёмная тема: ролики смотрят вечером, светлый фон бьёт по глазам. */
:root,
[data-theme="dark"] {
  --bg: #0f1116;
  --panel: #171a21;
  --text: #e8eaee;
  --muted: #98a0ae;
  --accent: #4da3ff;
  --line: #242833;
  --link: #7cc0ff;
  --link-visited: #9fb8d4;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

/* Светлая тема: те же переменные, другие значения. */
[data-theme="light"] {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1a1d23;
  --muted: #5d6673;
  --accent: #1b6fd6;
  --line: #dfe3e9;
  --link: #1b6fd6;
  --link-visited: #6b4fa8;
  --shadow: 0 10px 30px rgba(15, 20, 30, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 -apple-system, "Segoe UI", Roboto, sans-serif;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
}

.logo { font-weight: 700; font-size: 20px; color: var(--text); text-decoration: none; }
nav { display: flex; gap: 16px; align-items: center; }
nav a { color: var(--muted); text-decoration: none; }
nav a:hover { color: var(--text); }
.who { color: var(--muted); }

main { max-width: 1040px; margin: 0 auto; padding: 28px 24px 60px; }
h1 { font-size: 28px; margin: 0 0 12px; }
h2 { font-size: 20px; margin: 32px 0 12px; }

.button {
  display: inline-block;
  padding: 9px 18px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #06121f;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.button.big { padding: 13px 26px; font-size: 17px; }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card {
  display: block;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
}
.card img { width: 100%; border-radius: 8px; display: block; margin-bottom: 10px; }
.card h3 { margin: 0 0 6px; font-size: 16px; }
.lock { font-size: 13px; color: var(--accent); }
.tier .price { font-size: 22px; font-weight: 700; margin: 6px 0; }

video { width: 100%; border-radius: 12px; background: #000; }
.paywall {
  padding: 40px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.form { display: flex; flex-direction: column; gap: 10px; max-width: 520px; }
.form input, .form textarea {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #11141a;
  color: var(--text);
}

table { width: 100%; border-collapse: collapse; margin-top: 12px; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
.cut { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty, .note, .soon { color: var(--muted); font-size: 14px; }
.login-options { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; margin: 20px 0; }

footer {
  border-top: 1px solid var(--line);
  padding: 20px 24px;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 14px;
}
footer a { color: var(--muted); }
.requisites { width: 100%; margin: 0; }

/* Фильтры, линейки, реакции, комментарии */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0; }
.chip {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}
.chip.on { border-color: var(--accent); color: var(--accent); }
.chip.small { padding: 3px 9px; font-size: 12px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.meta { color: var(--muted); font-size: 13px; margin: 4px 0 0; }

.episodes { padding-left: 20px; }
.episodes li { margin: 8px 0; }
.episodes a { color: var(--text); }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; margin-left: 8px; }
.badge.free { background: #17331f; color: #6ee7a0; }
.badge.lock { background: #2a2233; color: #c39bff; }
.crumbs a { color: var(--muted); font-size: 14px; }

.reactions { display: flex; gap: 8px; margin: 18px 0; }
.reaction {
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
}
.reaction.on { border-color: var(--accent); }
.reaction span { font-size: 13px; color: var(--muted); margin-left: 4px; }

.comments { margin-top: 28px; }
.comment { border-top: 1px solid var(--line); padding: 12px 0; }
.comment time { color: var(--muted); font-size: 12px; margin-left: 8px; }
.comment p { margin: 6px 0 0; }

/* Возврат и сброс фильтров */
.back {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}
.back:hover { color: var(--accent); }
.chip.reset { border-color: #4a3a3a; color: #ff9b9b; }
.chip.reset:hover { border-color: #ff9b9b; }

/* Ссылки. Браузерные цвета по умолчанию на тёмном фоне читаются плохо,
   поэтому задаём свои: спокойный голубой, посещённые чуть приглушённее. */
a {
  color: var(--link);
  text-decoration: none;
}
a:visited { color: var(--link-visited); }
a:hover, a:focus { color: var(--accent); text-decoration: underline; }

/* В тексте документов ссылки подчёркнуты сразу — так они заметнее. */
main p a, main li a, .comment a { text-decoration: underline; }

/* Служебные ссылки остаются приглушёнными. */
nav a, footer a, .back, .card, .card:visited, .episodes a { color: var(--muted); }
nav a:hover, footer a:hover, .back:hover { color: var(--text); }
.card, .card:visited { color: var(--text); }
.card:hover { border-color: var(--accent); }
.chip, .chip:visited { color: var(--muted); }
.chip.on, .chip.on:visited { color: var(--accent); }
.chip.reset, .chip.reset:visited { color: #ff9b9b; }
.button, .button:visited { color: #06121f; }

/* Пояснения на странице подписки */
.howto { margin-top: 30px; }
.howto h2 { font-size: 18px; }
.howto ol, .howto ul { padding-left: 22px; }
.howto li { margin: 6px 0; }

/* Постраничная подгрузка каталога */
.more { text-align: center; margin: 28px 0 8px; }
.more .note { margin-top: 10px; }
.counter { font-size: 14px; font-weight: 400; color: var(--muted); }
.button.busy { opacity: 0.6; pointer-events: none; }

/* Профиль */
.profile-card { max-width: 520px; }
.sub-active { border-color: #2d5c3a; }
.profile-card p, .sub-active p { margin: 4px 0; }

/* Выпадающее окно входа */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  min-width: 250px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
  z-index: 20;
}
.dropdown-title { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  margin-bottom: 8px;
}
.dropdown-item:hover { border-color: var(--accent); text-decoration: none; }
.dropdown-item.tg { padding: 6px; justify-content: center; }
.dropdown-item .ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--panel);
  font-weight: 700;
  font-size: 13px;
}
.dropdown-note { margin: 6px 0 0; font-size: 12px; color: var(--muted); }

/* Переключатель темы */
.theme-toggle {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--accent); }

/* Светлая тема: детали, которым мало смены переменных */
[data-theme="light"] .form input,
[data-theme="light"] .form textarea { background: #fff; }
[data-theme="light"] .button { color: #fff; }
[data-theme="light"] .badge.free { background: #e4f7ea; color: #1d7a3d; }
[data-theme="light"] .badge.lock { background: #f0e9fb; color: #6a3fb5; }
[data-theme="light"] video { background: #000; }
