/*
 * BRB.INK — публичная часть.
 * Повторяет привычный вид старого сайта (см. docs/DESIGN-REFERENCE.md):
 * тёмный фон, шапка 42px, белая карточка контента ~990px, Tahoma/Verdana.
 */
:root {
  --page-bg: #1c222c;
  --header-bg: #303a4a;
  --header-link: #ccd5e3;
  --header-active: #232a33;
  --card-bg: #fff;
  --text: #333;
  --muted: #888;
  --link: #0d5096;
  --link-poster: #526f91;
  --title: #0d5096;
  --tag-bg: #e6e6e6;
  --tag-border: #d0d0d0;
  --panel: #f4f5f7;
  --panel-blue: #eef3f8;
  --yellow: #ffaf0d;
  --gray-btn: #707c8c;
  --blue-btn: #43668c;
  --green: #3c9a3f;
  --red: #db494d;
  --line: #e2e5ea;
  --radius: 4px;
  --width: 990px;
  font-family: Tahoma, Verdana, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--page-bg); }
body { margin: 0; background: var(--page-bg); color: var(--text); font-size: 13px; line-height: 1.4; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

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

/* ---------- Шапка ---------- */
.header {
  display: flex; align-items: center; gap: 4px;
  height: 42px; padding: 0 6px 0 8px;
  background: var(--header-bg); border-radius: 0 0 var(--radius) var(--radius);
}
.header__logo { flex: none; display: flex; align-items: center; margin-right: 6px; }
.header__logo img { height: 34px; width: auto; }
.header__menu { display: flex; height: 42px; overflow-x: auto; scrollbar-width: none; }
.header__menu-link {
  display: block; padding: 0 10px; height: 42px; line-height: 42px;
  font-size: 14px; color: var(--header-link); white-space: nowrap;
}
.header__menu-link:hover, .header__menu-link.is-active { color: #fff; background: var(--header-active); text-decoration: none; }
.header__search { position: relative; flex: 1 1 200px; max-width: 350px; margin-left: auto; }
.header__search-input {
  width: 100%; height: 30px; padding: 0 8px 0 28px; border: 0; border-radius: var(--radius);
  font: inherit; font-size: 13px; background: #fff; color: var(--text);
}
.header__search-icon { position: absolute; left: 8px; top: 8px; width: 14px; height: 14px; fill: #8a95a5; pointer-events: none; }
.header__user { display: flex; gap: 4px; margin-left: 4px; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-block; padding: 0 12px; height: 26px; line-height: 26px;
  border-radius: var(--radius); font-size: 12px; color: #fff; text-align: center;
  white-space: nowrap; cursor: pointer; border: 0;
}
.btn:hover { text-decoration: none; filter: brightness(1.07); }
.btn[aria-disabled="true"] { cursor: default; opacity: .85; }
/* Вход/Регистрация в шапке — плоские; остальные — с вертикальным градиентом, как в оригинале */
.btn--gray { background: var(--gray-btn); }
.btn--yellow { background: var(--yellow); color: #222; }
.btn--blue, .btn--watch {
  background: linear-gradient(#597da6, #2b4d70);
  border: 1px solid #284766; box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 1px 2px rgba(0,0,0,.25);
  text-shadow: 0 -1px 0 rgba(0,0,0,.35);
}
.btn--green {
  background: linear-gradient(#6bca79, #338f41);
  border: 1px solid #2c7d39; box-shadow: inset 0 1px 0 rgba(255,255,255,.25); text-shadow: 0 -1px 0 rgba(0,0,0,.25);
}
.btn--red {
  background: linear-gradient(#d45b5f, #a83337);
  border: 1px solid #962c30; box-shadow: inset 0 1px 0 rgba(255,255,255,.2); text-shadow: 0 -1px 0 rgba(0,0,0,.25);
}
.btn--light {
  background: linear-gradient(#e3e3e3, #cccccc); color: #4a4a4a;
  border: 1px solid #b9b9b9; box-shadow: inset 0 1px 0 #fff;
}
.btn--block { display: block; margin-top: 6px; }
.btn--watch { height: 30px; line-height: 28px; padding: 0 14px; font-size: 14px; }

.flag { display: inline-block; width: 16px; height: 11px; vertical-align: -1px; margin-right: 3px; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.flag--text { width: auto; height: auto; padding: 0 3px; font-size: 9px; line-height: 12px; background: #ddd; color: #555; border-radius: 2px; box-shadow: none; }

/* ---------- Контент ---------- */
.content {
  margin: 10px 0; padding: 12px 14px 18px; background: var(--card-bg);
  border-radius: var(--radius); box-shadow: 0 2px 8px rgba(0,0,0,.35); min-height: 400px;
}
.footer { display: flex; justify-content: space-between; gap: 12px; padding: 8px 4px 24px; color: #7d8796; font-size: 11px; flex-wrap: wrap; }
.flash { padding: 8px 12px; margin-bottom: 10px; border-radius: var(--radius); background: #eef6ee; }
.empty { color: var(--muted); padding: 20px 0; }

.block { margin: 6px 0 18px; }
.block--gray, .block--blue { padding: 8px 10px 10px; border-radius: var(--radius); }
.block--gray { background: var(--panel); }
.block--blue { background: var(--panel-blue); }
.block__title { margin: 6px 0 12px; font: 20px/1.2 Verdana, Tahoma, sans-serif; color: #333; }
.block__title--small { font-size: 14px; font-weight: bold; color: #3d4a5c; }

/* ---------- Постеры ---------- */
.strip { display: grid; grid-template-columns: repeat(9, 1fr); gap: 10px; }
.strip--6 { grid-template-columns: repeat(6, 1fr); }
.grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 18px 14px; }
.poster { display: block; min-width: 0; }
.poster:hover { text-decoration: none; }
.poster__img {
  display: block; aspect-ratio: 2 / 3; overflow: hidden; background: #e8eaed;
  border: 1px solid #d6d9de; box-shadow: 2px 2px 3px rgba(0,0,0,.25);
}
.poster__img img { width: 100%; height: 100%; object-fit: cover; }
.poster__title { display: block; margin-top: 8px; font-size: 12px; line-height: 14px; color: var(--link-poster); overflow-wrap: anywhere; }
.poster:hover .poster__title { text-decoration: underline; }
.poster__stub {
  display: flex; align-items: center; justify-content: center; height: 100%; padding: 6px;
  background: linear-gradient(160deg, #e9ecf0, #d5dae2); color: #8a95a5;
  font-size: 11px; text-align: center; line-height: 1.2;
}

/* ---------- Плитки разделов ---------- */
.tiles {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px;
  padding: 16px 18px; margin: 0 0 18px; border-radius: var(--radius);
  background: repeating-linear-gradient(45deg, #eceef0 0 2px, #f3f4f6 2px 6px);
}
.tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  height: 84px; background: #fff; border-bottom: 3px solid #5b8fc4; color: #5b8fc4; font-size: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.tile:hover { text-decoration: none; background: #f7fbff; }
.tile__icon { width: 26px; height: 26px; fill: #3f6f9f; }

/* ---------- Карточки «Новое на сайте» ---------- */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.card { display: flex; flex-direction: column; border: 1px solid #dfe2e6; border-radius: 3px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.card__body { display: flex; gap: 14px; padding: 10px 12px; flex: 1; }
.card__poster { flex: none; width: 80px; aspect-ratio: 2/3; border: 1px solid #d6d9de; overflow: hidden; box-shadow: 1px 1px 2px rgba(0,0,0,.2); }
.card__poster img { width: 100%; height: 100%; object-fit: cover; }
.card__info { min-width: 0; }
.card__title { margin: 2px 0 6px; font-size: 14px; font-weight: normal; }
.card__meta { margin: 0 0 8px; font-size: 11px; color: #555; }
.card__text { margin: 0; font-size: 12px; line-height: 1.45; color: #333; }
.card__footer { display: flex; justify-content: space-between; padding: 4px 10px; background: #e8e9e3; font-size: 11px; color: #777; }
.badge { display: inline-block; padding: 0 4px; margin-right: 4px; background: #d8d8d8; color: #666; border-radius: 2px; font-size: 11px; vertical-align: 1px; }

/* ---------- Фильтры раздела ---------- */
.filters {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px 14px;
  padding: 6px 4px 14px; border-bottom: 1px solid var(--line); margin-bottom: 4px;
}
.filters__title { margin: 4px 0 6px; font-size: 13px; font-weight: bold; color: #3d4a5c; white-space: nowrap; }
.filters__icon { display: inline-block; width: 18px; color: #4f80b3; }
.filters__select, .chip {
  display: block; width: 100%; margin-bottom: 6px; padding: 3px 6px;
  border: 1px solid var(--line); border-radius: 2px; background: #fff;
  font: inherit; font-size: 11px; color: var(--link);
}
.chip:hover { background: #f3f8ff; text-decoration: none; }
.chip.is-active { background: #ffffe4; border-color: #e6d98a; color: #333; font-weight: bold; }

.list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 0 14px; }
.list-head__title { margin: 0; font-size: 14px; font-weight: bold; color: var(--title); }
.list-head__title small { font-weight: normal; color: var(--muted); }
.list-head .filters__select { width: auto; min-width: 140px; margin: 0; }
.list-head__count { color: var(--muted); }

.pager { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 26px; position: relative; }
.pager__page, .pager__next {
  min-width: 26px; height: 26px; line-height: 24px; padding: 0 6px; text-align: center;
  border: 1px solid #cfd5dd; border-radius: 3px; background: #fff; box-shadow: 0 1px 1px rgba(0,0,0,.1);
}
.pager__page.is-active { background: #dbece8; border-color: #a8cbe0; }
.pager__next { position: absolute; right: 0; font-size: 16px; }

/* ---------- Страница тайтла ---------- */
/* Как в оригинале: голубой градиент шапки — на всю ширину карточки, содержимое — в левой колонке ~660px */
.item__head {
  margin: -12px -14px 0; padding: 12px 14px 0;
  background: linear-gradient(#d2e4ed, #fff 140px);
}
.item__head-inner { display: flex; gap: 12px; max-width: 660px; }
.item > :not(.item__head) { max-width: 660px; }
.item__aside { flex: none; width: 136px; }
.item__poster { aspect-ratio: 2/3; border: 1px solid #b5c0cc; overflow: hidden; background: #e8eaed; }
.item__poster img { width: 100%; height: 100%; object-fit: cover; }
.item__main { flex: 1; min-width: 0; }
.item__title { margin: 0; font: 18px/1.25 Verdana, Tahoma, sans-serif; color: var(--title); }
.item__original { color: #8aa0b8; font-size: 12px; margin-bottom: 10px; }
.item__info { display: grid; grid-template-columns: 84px 1fr; gap: 8px 8px; margin: 10px 0 14px; font-size: 11px; }
.item__info dt { color: #333; }
.item__info dd { margin: 0; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.tag {
  display: inline-block; padding: 1px 5px; background: var(--tag-bg); border: 1px solid var(--tag-border);
  border-radius: 2px; color: #333; font-size: 11px; cursor: default;
}
a.tag { cursor: pointer; }
a.tag:hover { background: #dcdcdc; text-decoration: none; }
.more { display: contents; }
.more summary { list-style: none; cursor: pointer; color: var(--link); }
.more summary::-webkit-details-marker { display: none; }
.more[open] summary { display: none; }

.rating {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 3px; background: #fff;
}
.rating__label { width: 100%; font-size: 11px; color: var(--muted); }
.rating__bar { width: 100px; height: 5px; background: var(--red); border-radius: 2px; overflow: hidden; }
.rating__bar span { display: block; height: 100%; background: #4caf50; }
.rating__likes { color: #4caf50; font-size: 15px; }
.rating__dislikes { color: var(--red); font-size: 15px; margin-right: auto; }

.item__description { margin: 12px 0; padding-top: 10px; border-top: 1px solid #c9d6e3; font-size: 11px; line-height: 1.5; }
.item__tabs { display: flex; align-items: center; gap: 50px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 3px; }
.item__tab--files { font-size: 15px; text-decoration: underline; padding-left: 30px; position: relative; }
.item__tab--files::before { content: ''; position: absolute; left: 0; top: 0; width: 24px; height: 18px; background: #f7b733; border-radius: 2px 6px 2px 2px; }

/* ---------- Дерево «Файлы и папки» ---------- */
.files { margin: 0 0 16px; padding: 10px 12px; background: linear-gradient(#f2f3f5, #fff 40px); border-radius: 0 0 4px 4px; }
.files__folder { margin: 6px 0; }
.files__folder > summary {
  display: grid; grid-template-columns: 30px 1fr; align-items: center; column-gap: 8px;
  list-style: none; cursor: pointer; padding: 3px 0;
}
.files__folder > summary::-webkit-details-marker { display: none; }
.files__folder--lang, .files__folder--release { margin-left: 24px; }
.files__icon { grid-row: span 2; position: relative; width: 28px; height: 20px; background: #f7b733; border-radius: 2px 7px 2px 2px; }
.files__icon .q { position: absolute; left: 6px; bottom: -6px; }
.files__name { font-weight: bold; text-decoration: underline; color: #222; }
.files__folder--lang .files__name, .files__folder--release .files__name { text-decoration: none; }
.files__meta { font-size: 11px; color: var(--muted); display: flex; gap: 16px; }
.files__muted { color: var(--muted); font-weight: normal; }
.files__list { list-style: none; margin: 4px 0 0 30px; padding: 0; }
.files__file {
  display: grid; grid-template-columns: 42px 18px 1fr auto; align-items: center; gap: 6px;
  padding: 6px 0; border-bottom: 1px solid #e6e8eb; font-size: 12px;
}
.files__play { display: inline-flex; width: 18px; height: 18px; border-radius: 50%; background: #3d78c4; color: #fff; font-size: 8px; align-items: center; justify-content: center; }
.files__file-name b { font-size: 13px; margin-right: 4px; }
.files__size { color: #333; font-size: 12px; }
.files__note { margin: 6px 0 0 30px; font-size: 11px; color: var(--muted); }
.q { display: inline-block; padding: 0 4px; border-radius: 2px; background: #b8b86a; color: #fff; font: bold 9px/14px Tahoma, sans-serif; font-style: normal; }
.q--hd { background: #3d78c4; }
.q--badge { background: #777; margin-left: 4px; vertical-align: 1px; }

.crumbs { display: flex; gap: 20px; padding: 6px 10px; margin-top: 10px; background: var(--panel); font-size: 11px; color: var(--muted); }

/* ---------- Узкие экраны (улучшение: старый сайт был только 980px) ---------- */
@media (max-width: 1000px) {
  .page { padding: 0 6px; }
  .strip { grid-template-columns: repeat(6, 1fr); }
  .filters { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 760px) {
  .header { flex-wrap: wrap; height: auto; padding: 4px 6px; row-gap: 4px; }
  .header__menu { order: 3; width: 100%; height: 34px; }
  .header__menu-link { height: 34px; line-height: 34px; font-size: 13px; padding: 0 8px; }
  .header__search { order: 2; }
  .header__user { display: none; }
  .content { padding: 10px 10px 14px; }
  .strip, .strip--6 { grid-template-columns: repeat(4, 1fr); }
  .grid { grid-template-columns: repeat(3, 1fr); gap: 14px 10px; }
  .tiles { grid-template-columns: repeat(3, 1fr); padding: 10px; gap: 10px; }
  .cards { grid-template-columns: 1fr; }
  .filters { grid-template-columns: repeat(2, 1fr); }
  .item__head-inner { flex-direction: column; }
  .item__aside { width: 160px; }
  .item__tabs { gap: 16px; flex-wrap: wrap; }
}
@media (max-width: 420px) {
  .strip, .strip--6 { grid-template-columns: repeat(3, 1fr); }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .files__folder--lang, .files__folder--release { margin-left: 10px; }
  .files__list { margin-left: 0; }
}

/* ---------- Автодополнение поиска ---------- */
.suggest {
  position: absolute; z-index: 50; top: 34px; left: 0; right: 0;
  max-height: 70vh; overflow-y: auto; background: #fff; border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(0,0,0,.35);
}
.suggest__item { display: flex; gap: 8px; align-items: center; padding: 6px 8px; color: var(--text); border-bottom: 1px solid #eef0f3; }
.suggest__item:hover, .suggest__item.is-active { background: #eef5fc; text-decoration: none; }
.suggest__poster { flex: none; width: 30px; height: 45px; background: linear-gradient(160deg, #e9ecf0, #d5dae2); overflow: hidden; }
.suggest__poster img { width: 100%; height: 100%; object-fit: cover; }
.suggest__text { display: flex; flex-direction: column; min-width: 0; }
.suggest__text b { font-weight: normal; color: var(--link); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest__text small { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest__empty { padding: 10px; color: var(--muted); }
.suggest__all { display: block; padding: 6px 8px; text-align: right; font-size: 12px; }
.suggest__all.is-active { background: #eef5fc; }

/* ---------- Просмотр ---------- */
.files__resume { display: inline-block; margin: 0 0 8px; }
.files__file-name { color: #222; }
.files__file-name:hover { text-decoration: none; }
.files__file-name:hover b { text-decoration: underline; color: var(--link); }
a.files__play:hover { text-decoration: none; background: #2a5fa5; }
.files__file.is-watched .files__file-name b::after { content: ' ✓'; color: #3c9a3f; }
.files__file.is-watched { opacity: .75; }

.chip--inline { display: inline-block; width: auto; margin: 0 4px 6px 0; padding: 3px 8px; font-size: 12px; }
/* ---------- Учётная запись ---------- */
.header__user { align-items: center; }
.header__user-link { color: var(--header-link); font-size: 12px; padding: 0 6px; white-space: nowrap; }
.header__user-link:hover { color: #fff; }
.header__user-name { display: flex; align-items: center; gap: 6px; color: #fff; font-size: 13px; padding: 0 4px; max-width: 160px; }
.header__user-name:hover { text-decoration: none; }
.header__user-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header__avatar {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px;
  border-radius: 50%; background: var(--yellow); color: #222; font-weight: bold; font-size: 13px;
}

.account { max-width: 420px; margin: 10px auto 20px; }
.account__alt { margin-top: 16px; color: #555; }
.account__info { display: grid; grid-template-columns: 110px 1fr; gap: 8px; margin: 0 0 18px; }
.account__info dt { color: var(--muted); }
.account__info dd { margin: 0; }
.form { display: grid; gap: 12px; margin-bottom: 18px; }
.form > div:not(.hp), .form__row { display: grid; gap: 4px; }
.form label { font-size: 12px; color: #444; }
.form input[type=email], .form input[type=password], .form input[type=text] {
  height: 32px; padding: 0 8px; border: 1px solid #c9d0d9; border-radius: var(--radius); font: inherit; font-size: 14px;
}
.form input:focus { outline: 2px solid #9cc3ea; border-color: #5b8fc4; }
.form__row--inline { display: flex !important; justify-content: space-between; align-items: center; }
.form__row--inline label { display: flex; gap: 6px; align-items: center; }
.form ul { margin: 0; padding: 0; list-style: none; color: var(--red); font-size: 12px; }
.form .help-text, .form [id$="_help"] { color: var(--muted); font-size: 11px; }
.btn--big { height: 34px; line-height: 34px; font-size: 14px; }
.hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.flash--success { background: #eef6ee; border: 1px solid #c4e2c6; }
.flash--error { background: #fdeeee; border: 1px solid #f0c4c5; color: #8c2a2d; }
.badge--ok { background: #d9efda; color: #2f6d33; }
.badge--warn { background: #fbe9c8; color: #8a5a00; }
.inline { display: inline; }
.linklike { background: none; border: 0; padding: 0; color: var(--link); font: inherit; cursor: pointer; text-decoration: underline; }
@media (max-width: 760px) {
  .header__user { display: flex; }
  .header__user .btn { padding: 0 8px; }
  .header__user-text { display: none; }
}
