/* ==========================================================================
   WseGa — стили сайта
   Тёплая тёмная тема по умолчанию, светлая — по системной настройке или
   переключателю. Токены в :root, переопределение в [data-theme="light"].

   Решение владельца: марка-шеврон сохраняется, уникальность делает подача.
   Чем она делается здесь:
     1. тёплый акцент (янтарь) вместо холодного синего — сайт про анимацию,
        игры и фотографии, и холодная палитра читалась бы как служебная;
     2. редакционная типографика: заголовки с засечками, текст без них;
        сайт пишет истории и заметки, и газетный набор им к лицу;
     3. крупные заголовки, много воздуха, асимметрия на главной;
     4. свой акцентный цвет ровно в одном месте на страницу.
   Всё оформление — переменные: смена темы не трогает разметку.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* Фон и поверхности: тёплый почти-чёрный, не сине-серый. */
  --bg: #14110e;
  --bg-elev: #1c1917;
  --bg-elev-2: #262220;
  --bg-inset: #0f0d0b;
  --border: #332d29;
  --border-strong: #4a413b;

  --text: #f2ede7;
  --text-dim: #b3a89d;
  --text-faint: #7d736a;

  /* Акцент — янтарь. Одно место на страницу, как и задумано. */
  --accent: #f0a63c;
  --accent-hover: #ffbb5c;
  --accent-contrast: #1a1512;
  --accent-soft: rgba(240, 166, 60, 0.13);

  /* Плашка марки: светлая с контуром, как на games.wsega.ru. */
  /* Размер кнопок. Раньше у четырёх классов было четыре разных паддинга
     (11/20, 10/16, 9/16, 4/8), и в одной строке таблицы кнопки были разной
     высоты — ряд выглядел разъехавшимся. Различие теперь только в цвете и
     начертании, а размер общий. */
  --btn-pad-y: 9px;
  --btn-pad-x: 14px;
  --btn-font: 14px;

  --logo-chip-bg: #f5f1eb;
  /* Нативные пикеры даты, выпадающие списки и полосы прокрутки берут цвета
     отсюда. Тема по умолчанию тёмная — значит и схема тёмная; без этого
     пикер остаётся светлым посреди тёмной страницы. */
  --scheme: dark;
  --picker-invert: 1;
  --logo-chip-border: #7a6f66;
  --logo-chip-ink: #14110e;

  --ok: #6fbf8b;
  --ok-soft: rgba(111, 191, 139, 0.14);
  --warn: #e8c15c;
  --warn-soft: rgba(232, 193, 92, 0.14);
  --danger: #e2735f;
  --danger-soft: rgba(226, 115, 95, 0.14);

  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 22px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);

  /* Заголовки с засечками — редакционный характер. */
  --font-display: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --wrap: 1080px;
  --gap: 22px;
  --header-h: 68px;
}

[data-theme="light"] {
  color-scheme: light;

  --bg: #faf7f2;
  --bg-elev: #ffffff;
  --bg-elev-2: #f3eee6;
  --bg-inset: #f0ebe2;
  --border: #e3dbd0;
  --border-strong: #c9bfb1;

  --text: #221c16;
  --text-dim: #5f554a;
  --text-faint: #8b8177;

  /* На светлом акцент темнее, иначе жёлтый на белом нечитаем. */
  --accent: #a9650a;
  --accent-hover: #8a5207;
  --accent-contrast: #ffffff;
  --accent-soft: rgba(169, 101, 10, 0.1);

  --logo-chip-bg: #ffffff;
  --scheme: light;
  --picker-invert: 0;
  --logo-chip-border: #b6aa9c;
  --logo-chip-ink: #221c16;

  --ok: #2f7a4d;
  --ok-soft: rgba(47, 122, 77, 0.1);
  --warn: #8a6a10;
  --warn-soft: rgba(138, 106, 16, 0.1);
  --danger: #b23a24;
  --danger-soft: rgba(178, 58, 36, 0.1);

  --shadow: 0 8px 24px rgba(60, 45, 30, 0.12);
}

/* ── Сброс ───────────────────────────────────────────────────────────────── */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

img, svg, video { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
}

h1 { font-size: clamp(30px, 5vw, 46px); }
h2 { font-size: clamp(24px, 3.4vw, 32px); }
h3 { font-size: clamp(20px, 2.4vw, 24px); }

p { margin: 0 0 1em; }

code, pre { font-family: var(--mono); font-size: 0.92em; }

hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

/* Ссылка «к содержанию» — видна только с клавиатуры. */
.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 10px 16px;
  z-index: 100;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip:focus { left: 0; }

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

.site-head {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.head-inner {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 18px;
}

/* Марка-шеврон. Плашка светлая в обеих темах — так она читается и на
   тёмном фоне. Переменные --logo-chip-* были объявлены, но нигде не
   использовались, а у <path> в logo.js нет ни fill, ни stroke: SVG
   рисовал его чёрным, и в тёмной теме логотип пропадал (поймал владелец
   2026-09-27). */
.logo-mark {
  display: block;
  background: var(--logo-chip-bg);
  border: 1px solid var(--logo-chip-border);
  border-radius: var(--radius-sm);
  flex: none;
}
.logo-mark path { fill: var(--logo-chip-ink); }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}
.brand:hover { text-decoration: none; color: var(--text); }

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }

.brand-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand-tag {
  font-size: 11.5px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.site-nav { margin-left: auto; }
.site-nav ul {
  list-style: none;
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0;
}

.nav-link {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 15px;
}
.nav-link:hover { background: var(--bg-elev-2); color: var(--text); text-decoration: none; }

/* Активный пункт — единственное место, где цвет появляется в меню. */
.nav-link.is-active { color: var(--accent); background: var(--accent-soft); }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--border-strong); color: var(--text); }

.theme-toggle-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  background: linear-gradient(90deg, var(--text) 50%, transparent 50%);
}

/* ── Основное ────────────────────────────────────────────────────────────── */

.site-main { flex: 1; padding: 40px 20px 72px; }

.section { margin-bottom: 56px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.section-head h2 { margin: 0; }
.section-more { font-size: 14px; color: var(--text-faint); white-space: nowrap; }
.section-more:hover { color: var(--accent); }

.lead {
  font-size: clamp(18px, 2.2vw, 21px);
  color: var(--text-dim);
  max-width: 62ch;
}

.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); font-size: 14px; }

/* ── Типы публикаций ─────────────────────────────────────────────────────── */

/* Метка типа. Цвет — приглушённый, акцент остаётся для действий. */
.type-badge {
  display: inline-block;
  padding: 3px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 11.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-faint);
  white-space: nowrap;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text-faint);
  margin-bottom: 12px;
}

/* ── Карточки ────────────────────────────────────────────────────────────── */

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

.card {
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.card:hover { border-color: var(--border-strong); transform: translateY(-2px); }

.card-cover {
  aspect-ratio: 16 / 10;
  background: var(--bg-inset);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.card-cover img { width: 100%; height: 100%; object-fit: cover; }

.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; flex: 1; }
.card-title { font-size: 20px; margin: 8px 0 6px; }
.card-title a { color: var(--text); }
.card-title a:hover { color: var(--accent); text-decoration: none; }
.card-excerpt { color: var(--text-dim); font-size: 15px; margin: 0; flex: 1; }
.card-tags { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }

/* ── Избранное на главной: широкие плитки, асимметрия ───────────────────── */

.featured { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.feature-card {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 220px;
  padding: 22px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(160deg, var(--bg-elev-2), var(--bg-elev));
  overflow: hidden;
}
.feature-card h3 { margin: 6px 0 4px; color: var(--text); }
.feature-card h3 a { color: var(--text); }
.feature-card h3 a:hover { color: var(--accent); text-decoration: none; }
.feature-card .faint { color: var(--text-faint); }

/* ── Страница публикации ─────────────────────────────────────────────────── */

.post-header { margin-bottom: 28px; }
.post-title { margin: 10px 0 12px; }

.post-cover {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 28px;
  background: var(--bg-inset);
}

.prose { max-width: 68ch; }
.prose p { margin: 0 0 1.1em; }
.prose h2 { margin-top: 1.8em; }
.prose h3 { margin-top: 1.5em; }
.prose ul { padding-left: 1.3em; margin: 0 0 1.1em; }
.prose li { margin-bottom: 0.4em; }
.prose img { border-radius: var(--radius); margin: 1.2em 0; }

/* Видео */
.video-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
  margin-bottom: 24px;
}
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Свой видеофайл. `object-fit: contain` обязателен: с `cover` ролик
   обрезался бы по краям, а чёрные полосы слева и справа — это нормально
   и не портит вёрстку. */
.video-frame-own video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: contain;
  background: #000;
}
/* Строка «свой файл, 12,4 МБ: открыть» под плеером площадки. Файл после
   выкладки не удаляется сам, и видеть его размер полезно. */
.video-file-note { margin: -12px 0 24px; font-size: 0.9em; }

/* Строка файла видео в админке */
.file-row {
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
  margin: 0 0 6px;
}
.file-row a { word-break: break-all; }
/* Строка «площадка: выложено / в очереди / ошибка» */
.line { margin: 0 0 8px; }

/* Кросспостинг: подготовленный текст под площадку. */
.prepared { margin: 12px 0; }
.prepared .field { margin-bottom: 10px; }
/* Текст только для чтения и копирования: серый фон отличает его от полей,
   которые можно править. */
.prepared textarea {
  background: var(--bg-inset);
  color: var(--text-dim);
  font-family: var(--mono, monospace);
  font-size: 0.9em;
  resize: vertical;
}
.prepared-tags {
  margin: 0;
  padding: 6px 10px;
  background: var(--bg-inset);
  border-radius: var(--radius-sm, 4px);
  font-family: var(--mono, monospace);
  font-size: 0.9em;
  word-break: break-word;
}

/* Галерея */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin: 1.4em 0;
}
.gallery figure { margin: 0; }
.gallery img { border-radius: var(--radius-sm); width: 100%; }
.gallery figcaption { font-size: 13.5px; color: var(--text-faint); margin-top: 6px; }

/* Кнопка-действие */
.action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: var(--btn-pad-y) var(--btn-pad-x);
  font-size: var(--btn-font);
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
  border: 1px solid transparent;
}
.action:hover { background: var(--accent-hover); color: var(--accent-contrast); text-decoration: none; }

.action-quiet {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: var(--btn-pad-y) var(--btn-pad-x);
  font-size: var(--btn-font);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.action-quiet:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ── Фильтры ─────────────────────────────────────────────────────────────── */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 26px;
  padding: 14px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.filter {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 14px;
}
.filter:hover { border-color: var(--border-strong); color: var(--text); text-decoration: none; }
.filter.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }

/* ── Пагинация ───────────────────────────────────────────────────────────── */

.pager {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin-top: 40px;
  font-size: 15px;
}

/* ── Формы ───────────────────────────────────────────────────────────────── */

/* Обязательное правило, а не украшение: без него атрибут `hidden`
   не прячет ничего, у чего в CSS задан `display`. UA-правило
   `[hidden] { display: none }` слабее по специфичности, чем `.field-inline
   { display: flex }`, поэтому переключение типа публикации в админке
   не работало: поля всех типов висели одновременно. */
[hidden] { display: none !important; }

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 14px; color: var(--text-dim); margin-bottom: 6px; }

/* Раньше типы перечислялись списком, и `datetime-local`, `date`, `file` в
   него не попадали: такие поля рисовались браузером — с тонкими рамками и
   мимо общей стилистики (пожаловался владелец 2026-09-27). Поэтому перечисляем
   не типы, а ИСКЛЮЧЕНИЯ: всё остальное получает единый вид. */
.field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.field textarea,
.field select {
  width: 100%;
  padding: 11px 13px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  /* Нативные пикеры даты, времени и выпадающие списки берут цвета из
     `color-scheme`. Без него они остаются светлыми в тёмной теме. */
  color-scheme: var(--scheme);
}
/* Файл: кнопка выбора в браузере своя, красим под общий стиль. */
.field input[type="file"] {
  width: 100%;
  padding: 9px 11px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font: inherit;
  font-size: 14px;
}
.field input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-elev-2);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.field input[type="file"]::file-selector-button:hover { border-color: var(--accent); color: var(--accent); }
/* Значок календаря в тёмной теме почти чёрный — на тёмном фоне не виден. */
.field input[type="date"]::-webkit-calendar-picker-indicator,
.field input[type="datetime-local"]::-webkit-calendar-picker-indicator,
.field input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(var(--picker-invert, 1));
  opacity: 0.7;
  cursor: pointer;
}
[data-theme="light"] .field input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="light"] .field input[type="datetime-local"]::-webkit-calendar-picker-indicator,
[data-theme="light"] .field input[type="time"]::-webkit-calendar-picker-indicator {
  --picker-invert: 0;
}
.field textarea { min-height: 140px; resize: vertical; line-height: 1.6; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); }
.field .hint { font-size: 13px; color: var(--text-faint); margin-top: 6px; }

/* `flex-start`, а не `center`: если у одного поля есть подсказка снизу, а у
   соседнего нет, при `center` инпуты съезжают по вертикали. Выравниваем
   верхи — подсказкиhang вниз и не трогают линию полей. */
.field-inline { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.field-inline .field { flex: 1; min-width: 180px; margin-bottom: 0; }

.checkbox { display: flex; align-items: center; gap: 9px; font-size: 15px; cursor: pointer; }
.checkbox input { width: 17px; height: 17px; accent-color: var(--accent); }

.form-foot { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 22px; }

.alert {
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  font-size: 15px;
}
.alert-ok { border-color: var(--ok); background: var(--ok-soft); color: var(--text); }
.alert-bad { border-color: var(--danger); background: var(--danger-soft); color: var(--text); }

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

.comments { margin-top: 56px; padding-top: 36px; border-top: 1px solid var(--border); }
.comment-list { list-style: none; margin: 0 0 34px; padding: 0; }
.comment { padding: 16px 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: 0; }
.comment-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 6px; }
.comment-author { font-weight: 600; }
.comment-date { font-size: 13px; color: var(--text-faint); }
.comment-body { margin: 0; color: var(--text-dim); }
.comment-replies { list-style: none; margin: 14px 0 0; padding-left: 20px; border-left: 2px solid var(--border); }
.comment-replies .comment { padding-bottom: 0; border-bottom: 0; }
.comment-form { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }

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

.site-foot {
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
  padding: 40px 0 24px;
  margin-top: auto;
}

.foot-inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 32px;
  padding-bottom: 28px;
}

.foot-brand { margin-bottom: 10px; }
.foot-title { font-size: 15px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-faint); font-family: var(--font); font-weight: 600; margin-bottom: 12px; }
.foot-note { color: var(--text-dim); font-size: 14.5px; max-width: 40ch; }
.foot-col ul { list-style: none; margin: 0; padding: 0; }
.foot-col li { margin-bottom: 8px; }
.foot-col a { color: var(--text-dim); font-size: 14.5px; }
.foot-col a:hover { color: var(--accent); }

.foot-legal { padding-top: 20px; border-top: 1px solid var(--border); color: var(--text-faint); font-size: 13.5px; }

/* ── Админка ────────────────────────────────────────────────────────────── */

.admin { background: var(--bg-inset); }

.admin-head {
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
  position: sticky;
  top: 0;
  z-index: 20;
}
.admin-head-inner { display: flex; align-items: center; gap: 18px; min-height: 58px; flex-wrap: wrap; }
.admin-head .brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.admin-head .brand-name { font-size: 18px; }

.admin-nav ul { list-style: none; display: flex; gap: 3px; margin: 0; padding: 0; flex-wrap: wrap; }
.admin-nav-link {
  display: block;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 14px;
}
.admin-nav-link:hover { background: var(--bg-elev-2); color: var(--text); text-decoration: none; }
.admin-nav-link.is-active { background: var(--accent-soft); color: var(--accent); }

.admin-logout { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.admin-main { padding: 32px 20px 64px; }

/* Таблицы в админке */
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th, .table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table th { color: var(--text-faint); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; }
.table tr:last-child td { border-bottom: 0; }
/* Действия в строке таблицы.
   Раньше это был `text-align: right` с inline-block формами, и зазор между
   кнопками зависел от пробелов в HTML: правил лишние отступы не было, и
   «одобрить / отклонить / удалить» стояли друг к другу (пожаловался
   владелец 2026-09-27). Flex с `gap` даёт ровный зазор независимо от
   разметки, а `flex-wrap` не даёт строке разъехаться на узком экране. */
.table td.actions {
  white-space: nowrap;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 6px 8px;
}
.table td.actions form { display: inline-flex; margin: 0; }

/* Панель над таблицей в админке. Правила не было: кнопки и ссылки стояли
   встык, без отступа друг от друга. */
.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin: 0 0 16px;
}
.admin-toolbar .filters { margin: 0; }
.admin-toolbar .action { margin: 0; }

/* Иллюстрация внутри текста: ![подпись](адрес). */
.prose-figure { margin: 26px 0; }
.prose-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}
.prose-figure figcaption {
  margin-top: 8px;
  font-size: 13.5px;
  color: var(--text-faint);
  text-align: center;
}
/* Картинка внутри абзаца: ограничиваем шириной, чтобы не ломала строку. */
.prose-img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  vertical-align: middle;
}

.panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}

.cards-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 28px; }
.stat {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.stat-n { font-family: var(--font-display); font-size: 30px; line-height: 1.1; }
.stat-label { font-size: 13px; color: var(--text-faint); margin-top: 4px; }
.stat-alert { border-color: var(--accent); }
.stat-alert .stat-n { color: var(--accent); }

/* Форма входа */
.auth { max-width: 380px; margin: 60px auto; }
.auth h1 { margin-bottom: 24px; }

/* Шапка админки: заголовок и кнопка в одну строку */
.admin-head-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.admin-head-row h1 { margin: 0; }

/* Загрузка файлов */
.upload-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.upload-preview { width: 120px; height: 80px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.upload-list, .upload-new { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 12px; }
.upload-list li, .upload-new li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}
.upload-list img, .upload-new img { width: 76px; height: 56px; object-fit: cover; border-radius: 6px; }
.upload-list input[type="text"], .upload-new input[type="text"] { flex: 1; min-width: 180px; padding: 8px 10px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font: inherit; }

/* Секреты */
.secret-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.secret-row input { flex: 1; min-width: 240px; padding: 9px 12px; background: var(--bg-inset); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font: inherit; }
.secret-state { font-size: 13px; min-width: 190px; color: var(--text-faint); }
.secret-state.is-set { color: var(--ok); }

/* Флажки списком */
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }

/* Telegram-раздел */
.channel { padding: 18px 0; border-top: 1px solid var(--border); }
.channel:first-of-type { border-top: 0; }
.steps { margin: 0 0 12px; padding-left: 1.4em; color: var(--text-dim); }
.steps li { margin-bottom: 6px; }
.steps code { background: var(--bg-inset); padding: 1px 5px; border-radius: 4px; }

/* Кнопки и формы рядом */
/* Формы-однокнопочные стоят в ряд внутри панелей и ячеек таблиц. Раньше
   было `display: inline`, и кнопки примыкали друг к другу: зазор зависел от
   пробелов в HTML. В таблице зазор даёт `gap` контейнера, поэтому там отступ
   обнуляем. */
.inline-form { display: inline-flex; vertical-align: middle; margin: 2px 6px 2px 0; }
.table td.actions .inline-form { margin: 0; }
.danger, .danger-link {
  display: inline-flex;
  align-items: center;
  padding: var(--btn-pad-y) var(--btn-pad-x);
  font-family: inherit;
  font-size: var(--btn-font);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--text);
  cursor: pointer;
}
.danger:hover, .danger-link:hover { background: var(--danger); color: #fff; text-decoration: none; }

@media (max-width: 760px) {
  .admin-nav { order: 3; width: 100%; }
  .table { font-size: 14px; }
  .secret-state { min-width: 0; }
}

/* ── Страница ошибки ─────────────────────────────────────────────────────── */

.error-page { text-align: center; padding: 80px 20px; }
.error-page .code { font-family: var(--font-display); font-size: clamp(64px, 14vw, 128px); color: var(--accent); line-height: 1; margin-bottom: 8px; }

/* ── Планшет и телефон ───────────────────────────────────────────────────── */

@media (max-width: 760px) {
  :root { --gap: 16px; }

  .site-head { position: static; }
  .head-inner { flex-wrap: wrap; padding: 12px 20px; gap: 12px; }
  .brand-tag { display: none; }
  .site-nav { order: 3; width: 100%; margin-left: 0; overflow-x: visible; }
  /* Меню переносится на две строки, а не прокручивается вбок: пять пунктов
     в одну строку не влезали, а горизонтальная прокрутка без подсказки
     выглядит как «сломанная вёрстка». */
  .site-nav ul { gap: 2px 4px; flex-wrap: wrap; }
  .nav-link { padding: 7px 10px; font-size: 14.5px; }
  .theme-toggle { margin-left: auto; }

  .site-main { padding: 26px 20px 52px; }
  .foot-inner { grid-template-columns: 1fr; gap: 24px; }
  .prose { max-width: none; }
  .comment-replies { padding-left: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
