:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --text: #e8eaed;
  --muted: #9aa0ab;
  --line: #2a2f3a;
  --yes: #22c55e;
  --no: #ef4444;
  --accent: #6ea8fe;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; text-decoration: none; }

/* ---------- Гейт (пин-код) ---------- */
.gate {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(9, 11, 15, .96);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.gate-box {
  width: 100%; max-width: 340px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px 24px; text-align: center;
  display: flex; flex-direction: column; gap: 14px;
}
.gate-box h1 { margin: 0; font-size: 20px; }
.gate-box p { margin: 0; color: var(--muted); font-size: 14px; }
.gate-input {
  width: 100%; box-sizing: border-box;
  font-size: 28px; letter-spacing: 10px; text-align: center;
  padding: 14px 12px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
}
.gate-input:focus { outline: none; border-color: var(--accent); }
.gate-btn { border: 0; cursor: pointer; font-size: 15px; }
.gate-error { color: var(--no); font-size: 13px; }

/* ---------- Шапка ---------- */
.topbar {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.topbar h1 { margin: 0; font-size: 20px; letter-spacing: .2px; }
.topbar .subtitle { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

.topbar.sticky {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  backdrop-filter: blur(8px);
  background: rgba(23, 26, 33, .92);
}
.topbar.sticky h1 { font-size: 18px; flex: 1; }
.back {
  color: var(--accent); font-weight: 600; font-size: 14px;
  white-space: nowrap;
}
.count-badge {
  color: var(--muted); font-size: 13px;
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px;
}

/* ---------- Контент ---------- */
.wrap { max-width: 1200px; margin: 0 auto; padding: 20px; }

/* ---------- Главная: категории ---------- */
.cat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.cat-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; transition: border-color .15s, transform .05s;
}
.cat-card:active { transform: scale(.995); }
.cat-card:hover { border-color: var(--accent); }
.cat-name { font-size: 18px; font-weight: 700; }
.cat-meta { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.pill { border-radius: 999px; padding: 2px 9px; font-weight: 700; font-size: 12px; }
.pill.yes { background: rgba(34,197,94,.15); color: var(--yes); }
.pill.no  { background: rgba(239,68,68,.15); color: var(--no); }

.export-row { margin-top: 24px; display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  display: inline-block; background: var(--accent); color: #0b1220; font-weight: 700;
  padding: 11px 16px; border-radius: 10px; font-size: 14px;
}
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }

/* ---------- Подзаголовок подкатегории ---------- */
.sub-title {
  margin: 30px 0 14px; font-size: 17px; display: flex; align-items: baseline; gap: 10px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.sub-count { color: var(--muted); font-size: 13px; font-weight: 500; }

/* ---------- Грид медиа ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.card {
  margin: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
}
.card.is-off { opacity: .55; }

.media {
  position: relative;
  background: #000; aspect-ratio: 4 / 3;
  overflow: hidden;
}
/* Картинка вне потока → бокс всегда одинаковой высоты, картинка вписывается contain по центру. */
.media img, .media video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain; display: block;
}

/* Кнопка-лупа в правом верхнем углу (только на фото). */
.zoom {
  position: absolute; top: 8px; right: 8px;
  width: 38px; height: 38px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 10px; cursor: pointer;
  color: #fff; background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(2px);
  transition: background .12s, transform .05s;
}
.zoom:hover { background: rgba(0, 0, 0, .8); }
.zoom:active { transform: scale(.94); }

.cap {
  padding: 10px 12px; font-size: 13px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- Переключатель YES/NO ---------- */
.toggle {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
  border-top: 1px solid var(--line);
}
.opt {
  border: 0; background: transparent; color: var(--muted);
  font-weight: 800; font-size: 16px; letter-spacing: .5px;
  padding: 16px 0; cursor: pointer; transition: background .12s, color .12s;
}
.opt:active { transform: none; }
.opt-yes { border-right: 1px solid var(--line); }

.toggle.is-yes .opt-yes { background: var(--yes); color: #06210f; }
.toggle.is-no  .opt-no  { background: var(--no);  color: #2a0808; }

/* ---------- Тост ---------- */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: #111; color: #fff; border: 1px solid var(--line);
  padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 50;
  opacity: 0; transition: opacity .2s; pointer-events: none;
}
.toast.show { opacity: 1; }

/* ---------- Лайтбокс ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, .9);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.lightbox[hidden] { display: none; }
.lb-inner { margin: 0; max-width: 100%; max-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.lb-img {
  max-width: 96vw; max-height: 86vh;
  object-fit: contain;                 /* пропорции сохранены, дальше зумит сам человек */
  border-radius: 8px; background: #000;
}
.lb-cap { color: #cfd3da; font-size: 14px; text-align: center; }
.lb-close {
  position: fixed; top: 14px; right: 16px;
  width: 46px; height: 46px; padding: 0; line-height: 1;
  font-size: 30px; color: #fff; cursor: pointer;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 12px;
}
.lb-close:hover { background: rgba(255, 255, 255, .2); }

/* ---------- Мобильный: один ряд, широкие картинки, отступ 20px по бокам ---------- */
@media (max-width: 640px) {
  .wrap { padding: 20px; }
  .grid { grid-template-columns: 1fr; gap: 22px; }
  .media { aspect-ratio: 4 / 3; }
  .opt { padding: 18px 0; font-size: 18px; }  /* крупные кнопки под палец */
  .cat-name { font-size: 17px; }
}
