@import url('https://fonts.googleapis.com/css2?family=Forum&family=Lato:wght@400;700&family=Open+Sans:wght@400;600&display=swap');

/* ============================================================
   FT Online Wiki — design tokens
   Источник бренда: ftptr.nempire-project.ru (см. brand-spec.md).
   Тёмная тема — основная, как на сайте; светлая производна от тех
   же тонов для длинного чтения.
   ============================================================ */

:root {
  --bg:      oklch(10.3% 0.037 322);  /* #08010a */
  --surface: oklch(17.4% 0.066 313);  /* #1a0524 */
  --fg:      oklch(93.6% 0.036 76);   /* #f8e7d0 */
  --muted:   oklch(72% 0.022 76);
  --border:  oklch(30% 0.055 310);
  --accent:  oklch(75.9% 0.177 61);   /* #ff9100 */

  /* Forum вместо Cinzel: та же римская антиква, но с кириллицей — иначе
     русские и латинские слова в одном заголовке рендерятся разными шрифтами */
  --font-display: 'Forum', Georgia, 'Times New Roman', serif;
  --font-body:    'Lato', 'Open Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono:    ui-monospace, SFMono-Regular, 'JetBrains Mono', Menlo, monospace;

  /* второй фирменный сигнал: золото несёт заголовки, границы и ссылки */
  --gold:      oklch(88.7% 0.182 95); /* #ffd700 */
  --gold-line: color-mix(in oklab, var(--gold) 26%, transparent);
  --gold-soft: color-mix(in oklab, var(--gold) 12%, transparent);

  --surface-2:  oklch(20.5% 0.075 312);
  --surface-3:  oklch(25.7% 0.123 300); /* #2e0854 */
  --hover:      oklch(27% 0.095 306);
  --accent-fg:  oklch(15% 0.05 313);
  --accent-soft: color-mix(in oklab, var(--accent) 16%, transparent);
  --accent-line: color-mix(in oklab, var(--accent) 42%, transparent);
  --accent-ink: oklch(80% 0.155 62);

  --ok:    oklch(72% 0.16 145);       /* #3ad13a, приглушён */
  --warn:  oklch(72.7% 0.127 87);     /* #c9a13a */
  --danger: oklch(66.4% 0.223 26);    /* #ff4444 */
  --stub:  var(--muted);

  --shadow-card: 0 10px 25px oklch(0% 0 0 / .45);

  --shell-max: 1560px;
  --nav-w: 268px;
  --toc-w: 232px;
  --topbar-h: 60px;
  --radius: 6px;
  --radius-sm: 4px;
  --ease: cubic-bezier(.2, .7, .3, 1);
  color-scheme: dark;
}

[data-theme='light'] {
  --bg:      oklch(97% 0.012 75);
  --surface: oklch(99.5% 0.005 75);
  --fg:      oklch(17.4% 0.066 313);
  --muted:   oklch(45% 0.03 310);
  --border:  oklch(88% 0.02 75);
  --accent:  oklch(52% 0.16 45);

  /* на светлом фоне золото затемнено: 11px лейблы должны держать 4.5:1,
     а рамка при 32 % была неразличима — отсюда более плотная линия */
  --gold:      oklch(51% 0.115 85);
  --gold-line: color-mix(in oklab, var(--gold) 52%, transparent);
  --gold-soft: color-mix(in oklab, var(--gold) 10%, transparent);

  --surface-2:  oklch(95.5% 0.014 75);
  --surface-3:  oklch(92% 0.02 75);
  --hover:      oklch(93% 0.024 70);
  --accent-fg:  oklch(99% 0.005 75);
  --accent-soft: color-mix(in oklab, var(--accent) 12%, transparent);
  --accent-line: color-mix(in oklab, var(--accent) 38%, transparent);
  --accent-ink: oklch(47% 0.15 45);

  --ok:    oklch(46% 0.14 145);
  --warn:  oklch(48% 0.1 82);
  --danger: oklch(50% 0.2 27);
  --stub:  var(--muted);

  --shadow-card: 0 8px 20px oklch(30% 0.06 310 / .1);
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* фирменное свечение вместо фонового JPEG: то же радиальное фиолетовое
   пятно и диагональный градиент, что и на ftptr.nempire-project.ru */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(120% 85% at 50% -6%, color-mix(in oklab, var(--surface-3) 92%, transparent), transparent 58%),
    linear-gradient(135deg, color-mix(in oklab, var(--surface) 60%, transparent), color-mix(in oklab, oklch(32% 0.12 24) 40%, transparent));
}
[data-theme='light'] body::before {
  background: radial-gradient(115% 75% at 50% -8%, var(--gold-soft), transparent 62%);
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.18; }
h1 {
  font-size: clamp(30px, 3.4vw, 42px); letter-spacing: -.01em; color: var(--gold);
  text-shadow: 0 0 22px color-mix(in oklab, var(--accent) 30%, transparent);
}
[data-theme='light'] h1 { text-shadow: none; }
h2 { font-size: 25px; letter-spacing: -.008em; }
h3 { font-size: 19px; letter-spacing: 0; }
p { max-width: 68ch; }
a { color: inherit; }

::selection { background: var(--accent-soft); }

/* focus */
:where(a, button, input, select, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: fixed; top: 8px; left: 8px; z-index: 200;
  background: var(--accent); color: var(--accent-fg);
  padding: 10px 16px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; text-decoration: none;
  transform: translateY(-160%); transition: transform .16s var(--ease);
}
.skip-link:focus-visible { transform: none; }

/* ============================ topbar ============================ */

.topbar {
  position: sticky; top: 0; z-index: 60;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 18px;
  padding: 0 20px;
  background: color-mix(in oklab, var(--bg) 84%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--gold-line);
  box-shadow: 0 1px 18px color-mix(in oklab, var(--accent) 10%, transparent);
}

.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; flex-shrink: 0;
}
.brand__mark {
  width: 28px; height: 28px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  background: var(--surface-3); color: var(--gold);
  border: 1px solid var(--gold-line);
}
.brand__mark svg { width: 17px; height: 17px; }
.brand__name {
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--gold);
  white-space: nowrap;
}
.brand__tag {
  font-size: 11px; color: var(--muted); letter-spacing: .07em;
  text-transform: uppercase; padding-left: 9px; margin-left: 2px;
  border-left: 1px solid var(--border); white-space: nowrap;
}

.topnav { display: flex; gap: 2px; margin-left: 6px; flex: 1; min-width: 0; }
.topnav a {
  font-size: 14px; color: var(--muted); text-decoration: none;
  padding: 7px 11px; border-radius: var(--radius-sm);
  transition: background .14s var(--ease), color .14s var(--ease);
  white-space: nowrap;
}
.topnav a:hover { background: var(--hover); color: var(--fg); }
.topnav a[aria-current='page'] { color: var(--accent-ink); background: var(--surface-3); font-weight: 700; }
/* звёздочка перед пунктом — деталь навигации с ftptr.nempire-project.ru */
.topnav a::before {
  content: '✦'; margin-right: 6px; font-size: 10px; color: var(--gold);
  opacity: 0; transition: opacity .25s var(--ease);
}
.topnav a:hover::before, .topnav a[aria-current='page']::before { opacity: 1; }

.searchtrigger {
  display: flex; align-items: center; gap: 9px;
  min-width: 292px; height: 36px; padding: 0 8px 0 11px;
  background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font: inherit; font-size: 14px; cursor: pointer;
  transition: background .14s var(--ease), border-color .14s var(--ease), color .14s var(--ease);
}
.searchtrigger:hover { background: var(--surface-3); border-color: var(--gold-line); color: var(--fg); }
.searchtrigger svg { width: 15px; height: 15px; flex-shrink: 0; }
.searchtrigger span { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

kbd {
  font-family: var(--font-mono); font-size: 11px; line-height: 1;
  padding: 4px 6px; border-radius: 5px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--muted); box-shadow: none;
}

.iconbtn {
  width: 36px; height: 36px; flex-shrink: 0;
  display: grid; place-items: center;
  background: transparent; color: var(--muted);
  border: 1px solid transparent; border-radius: var(--radius-sm);
  cursor: pointer; transition: background .14s var(--ease), color .14s var(--ease);
}
.iconbtn:hover { background: var(--hover); color: var(--fg); }
.iconbtn:active { transform: translateY(1px); }
.iconbtn svg { width: 18px; height: 18px; }
.iconbtn--menu { display: none; }

/* показываем ту тему, на которую переключимся */
.theme-sun { display: none; }
.theme-moon { display: block; }
[data-theme='dark'] .theme-sun { display: block; }
[data-theme='dark'] .theme-moon { display: none; }

/* ============================ shell ============================ */

.shell {
  max-width: var(--shell-max); margin: 0 auto;
  display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr) var(--toc-w);
  gap: 40px; padding: 0 24px;
  align-items: start;
}
.shell--wide { grid-template-columns: var(--nav-w) minmax(0, 1fr); }
.shell--flat { display: block; max-width: var(--shell-max); }

/* ---- sidebar ---- */

.sidenav {
  position: sticky; top: var(--topbar-h);
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto; overscroll-behavior: contain;
  padding: 26px 0 60px;
  scrollbar-width: thin;
}
.sidenav__label {
  font-family: var(--font-display); font-size: 11.5px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: var(--gold);
  padding: 0 10px; margin-bottom: 8px;
}
.sidenav__group { margin-bottom: 22px; }

.navitem {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: var(--radius-sm);
  font-size: 14px; color: var(--muted); text-decoration: none;
  transition: background .13s var(--ease), color .13s var(--ease);
}
.navitem:hover { background: var(--hover); color: var(--fg); }
.navitem[aria-current] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 550; }
.navitem svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .85; }
.navitem__count {
  margin-left: auto; font-family: var(--font-mono); font-size: 11px;
  font-variant-numeric: tabular-nums; color: var(--muted);
}
.navitem[aria-current] .navitem__count { color: inherit; }

.navtree { list-style: none; }
.navtree .navitem { padding-left: 35px; font-size: 13.5px; }
.navtree .navitem[aria-current]::before { content: '✦'; margin-left: -14px; margin-right: 4px; font-size: 10px; color: var(--gold); }

details.navgroup > summary {
  display: flex; align-items: center; gap: 9px; cursor: pointer;
  padding: 7px 10px; border-radius: var(--radius-sm);
  font-size: 14px; color: var(--muted); list-style: none;
  transition: background .13s var(--ease), color .13s var(--ease);
}
details.navgroup > summary::-webkit-details-marker { display: none; }
details.navgroup > summary:hover { background: var(--hover); color: var(--fg); }
details.navgroup > summary svg.i { width: 16px; height: 16px; opacity: .85; }
.chev { margin-left: auto; width: 14px !important; height: 14px !important; transition: transform .16s var(--ease); }
details[open] > summary .chev { transform: rotate(90deg); }

/* ---- content ---- */

.content { padding: 34px 0 96px; min-width: 0; }

.breadcrumbs {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  font-size: 13px; color: var(--muted); margin-bottom: 16px;
}
.breadcrumbs a { text-decoration: none; border-bottom: 1px solid transparent; }
.breadcrumbs a:hover { color: var(--fg); border-bottom-color: var(--border); }
.breadcrumbs svg { width: 13px; height: 13px; opacity: .55; }

.pagehead { margin-bottom: 26px; }
.pagehead__meta {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 14px; font-size: 13px; color: var(--muted);
}
.lede {
  font-size: 18.5px; line-height: 1.55; color: var(--muted);
  max-width: 62ch; margin-top: 14px;
}

/* ---- toc ---- */

.toc {
  position: sticky; top: calc(var(--topbar-h) + 34px);
  max-height: calc(100vh - var(--topbar-h) - 60px);
  overflow-y: auto; padding-bottom: 20px;
  font-size: 13.5px;
}
.toc__label {
  font-family: var(--font-display); font-size: 11.5px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: var(--gold); margin-bottom: 12px;
}
.toc ul { list-style: none; border-left: 1px solid var(--border); }
.toc a {
  display: block; padding: 5px 0 5px 14px; margin-left: -1px;
  color: var(--muted); text-decoration: none;
  border-left: 2px solid transparent;
  transition: color .13s var(--ease), border-color .13s var(--ease);
}
.toc a:hover { color: var(--fg); }
.toc a.is-active { color: var(--accent-ink); border-left-color: var(--accent); font-weight: 550; }
.toc li.lvl3 a { padding-left: 26px; font-size: 13px; }

.toc__aside { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--border); }

/* ============================ components ============================ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; min-width: 44px;
  font: inherit; font-size: 14px; font-weight: 550; letter-spacing: .01em;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--fg);
  text-decoration: none; cursor: pointer;
  transition: background .14s var(--ease), border-color .14s var(--ease), transform .1s var(--ease);
}
.btn:hover { background: var(--hover); border-color: var(--gold); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }

.btn--primary { background: var(--accent); color: var(--accent-fg); border-color: transparent; font-weight: 600; }
/* смешивание с --fg двигает L в нужную сторону в обеих темах:
   светлая — акцент темнеет, тёмная — светлеет. Текст остаётся --accent-fg,
   контраст в обоих случаях только растёт. */
.btn--primary:hover { background: color-mix(in oklab, var(--accent) 84%, var(--fg)); color: var(--accent-fg); border-color: transparent; }

.btn--ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn--ghost:hover { background: var(--hover); color: var(--fg); }
.btn--sm { height: 34px; padding: 0 13px; font-size: 13px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; white-space: nowrap;
  background: var(--surface-3); color: var(--muted);
  border: 1px solid var(--border);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--ok   { color: var(--ok);   border-color: color-mix(in oklab, var(--ok) 34%, transparent);   background: color-mix(in oklab, var(--ok) 10%, transparent); }
.badge--warn { color: var(--warn); border-color: color-mix(in oklab, var(--warn) 38%, transparent); background: color-mix(in oklab, var(--warn) 11%, transparent); }
.badge--stub { color: var(--stub); }

.chiprow { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 13px; border-radius: 999px;
  font: inherit; font-size: 13.5px; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; white-space: nowrap;
  transition: background .13s var(--ease), color .13s var(--ease), border-color .13s var(--ease);
}
.chip:hover { background: var(--hover); color: var(--fg); }
.chip[aria-pressed='true'] {
  background: var(--fg); color: var(--bg); border-color: var(--fg); font-weight: 550;
}
.chip[aria-pressed='true']:hover { background: color-mix(in oklab, var(--fg) 78%, var(--accent)); color: var(--bg); border-color: transparent; }
.chip__n { font-family: var(--font-mono); font-size: 11px; font-variant-numeric: tabular-nums; opacity: .75; }

.card {
  display: block; padding: 18px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--gold-line);
  border-radius: var(--radius); box-shadow: var(--shadow-card);
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .18s var(--ease);
}
/* подъём карточки при наведении — как .info-card:hover на сайте */
a.card:hover { background: var(--surface-2); border-color: var(--gold); transform: translateY(-4px); }
.card__icon {
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: var(--radius-sm); background: var(--surface-3); color: var(--gold);
  border: 1px solid var(--gold-line); margin-bottom: 13px;
}
a.card:hover .card__icon { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent-line); }
.card__icon svg { width: 18px; height: 18px; }
.card__title { font-family: var(--font-display); font-size: 16.5px; font-weight: 700; letter-spacing: 0; color: var(--accent-ink); }
.card__desc { font-size: 13.5px; color: var(--muted); line-height: 1.5; margin-top: 5px; }
.card__foot {
  display: flex; align-items: center; gap: 8px; margin-top: 13px;
  font-family: var(--font-mono); font-size: 11.5px;
  font-variant-numeric: tabular-nums; color: var(--muted);
}
.card__hint {
  display: flex; gap: 7px; margin-top: 8px; padding-top: 8px;
  border-top: 1px solid var(--gold-line);
  font-size: 12.5px; color: var(--gold);
}
.card__hint::before { content: '✦'; font-size: 10px; line-height: 1.55; }

.grid { display: grid; gap: 14px; }
.grid--3 { grid-template-columns: repeat(auto-fill, minmax(252px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); }

/* list rows (category listing) */
.rows { border: 1px solid var(--gold-line); box-shadow: var(--shadow-card); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.row {
  display: grid; grid-template-columns: minmax(0, 1fr) 148px 122px 108px;
  align-items: center; gap: 16px;
  padding: 13px 16px; text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: background .12s var(--ease);
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-2); }
.rows__head {
  display: grid; grid-template-columns: minmax(0, 1fr) 148px 122px 108px;
  gap: 16px; padding: 10px 16px;
  background: var(--surface-2); border-bottom: 1px solid var(--gold-line);
  font-family: var(--font-display); font-size: 11px; font-weight: 700;
  letter-spacing: .11em; text-transform: uppercase; color: var(--gold);
}
.rows__head button {
  display: inline-flex; align-items: center; gap: 5px;
  background: none; border: 0; font: inherit; color: inherit;
  letter-spacing: inherit; text-transform: inherit; cursor: pointer; padding: 2px 0;
}
.rows__head button:hover { color: var(--fg); }
.rows__head button svg { width: 12px; height: 12px; opacity: .5; transition: transform .15s var(--ease), opacity .15s var(--ease); }
.rows__head button[data-dir='asc'] svg { opacity: 1; }
.rows__head button[data-dir='desc'] svg { opacity: 1; transform: rotate(180deg); }

.row__title { font-weight: 550; font-size: 15px; letter-spacing: -.005em; }
.row__sub { font-size: 13px; color: var(--muted); margin-top: 2px; line-height: 1.45; }
.row__cell { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* infobox */
.infobox {
  float: right; width: 296px; margin: 0 0 22px 28px;
  background: var(--surface); border: 1px solid var(--gold-line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-card);
}
.infobox__media {
  aspect-ratio: 4 / 3; background: var(--surface-3); position: relative;
  display: grid; place-items: center;
}
.infobox__media .slot { display: grid; place-items: center; gap: 7px; color: var(--muted); padding-bottom: 26px; }
.infobox__media .slot svg { width: 26px; height: 26px; opacity: .8; }
.infobox__media .slot span { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; }
.infobox__cap {
  position: absolute; left: 10px; right: 10px; bottom: 10px;
  background: color-mix(in oklab, var(--surface) 88%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 7px 10px; font-size: 11.5px; color: var(--muted);
  box-shadow: 0 4px 14px oklch(0% 0 0 / .12);
}
.infobox__title {
  padding: 13px 15px; font-family: var(--font-display); font-weight: 700;
  font-size: 15.5px; letter-spacing: .01em; color: var(--gold);
  border-bottom: 1px solid var(--gold-line);
}
.infobox dl { display: grid; grid-template-columns: 108px minmax(0, 1fr); }
.infobox dt, .infobox dd {
  padding: 9px 15px; font-size: 13px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
}
.infobox dt { color: var(--muted); background: var(--surface-2); }
.infobox dd { font-variant-numeric: tabular-nums; }
.infobox dl > :nth-last-child(-n+2) { border-bottom: 0; }
.needs {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--warn); text-decoration: none;
  border-bottom: 1px dashed color-mix(in oklab, var(--warn) 50%, transparent);
}
.needs:hover { color: color-mix(in oklab, var(--warn) 78%, var(--fg)); border-bottom-color: currentColor; }
.needs svg { width: 12px; height: 12px; }

/* prose */
/* золотая линия под заголовком раздела — как .panel-header на сайте */
.prose h2 {
  margin: 42px 0 16px; padding-bottom: 9px;
  border-bottom: 1px solid var(--gold-line);
  scroll-margin-top: calc(var(--topbar-h) + 24px);
}
.prose h3 { margin: 28px 0 10px; scroll-margin-top: calc(var(--topbar-h) + 24px); }
.prose p { margin-bottom: 15px; }
.prose ul, .prose ol { margin: 0 0 16px 20px; max-width: 66ch; }
.prose li { margin-bottom: 7px; }
.prose li::marker { color: var(--muted); }
/* ссылки золотые при наведении — как .info-card a на сайте */
.prose a:not(.btn):not(.needs) {
  color: var(--fg); text-decoration: none;
  border-bottom: 1px solid var(--gold-line);
  transition: background .13s var(--ease), border-color .13s var(--ease), color .13s var(--ease);
}
.prose a:not(.btn):not(.needs):hover { color: var(--gold); background: var(--gold-soft); border-bottom-color: var(--gold); }
.prose strong { font-weight: 600; }
.prose code {
  font-family: var(--font-mono); font-size: .875em;
  background: var(--surface-3); padding: 2px 6px; border-radius: 5px;
}
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 34px 0; }

.note {
  display: flex; gap: 12px; padding: 14px 16px; margin: 20px 0;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); max-width: 68ch;
}
.note svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 2px; color: var(--muted); }
.note--warn { background: color-mix(in oklab, var(--warn) 8%, var(--surface)); border-color: color-mix(in oklab, var(--warn) 30%, transparent); }
.note--warn svg { color: var(--warn); }
.note p { font-size: 14px; margin: 0; }
.note strong { display: block; margin-bottom: 3px; font-size: 14px; }

table.data {
  width: 100%; border-collapse: collapse; margin: 18px 0;
  font-size: 14px; font-variant-numeric: tabular-nums;
  border: 1px solid var(--gold-line); border-radius: var(--radius);
  overflow: hidden; display: table;
}
table.data th, table.data td {
  padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.data th {
  background: var(--surface-2); font-size: 11px; font-weight: 700;
  font-family: var(--font-display); letter-spacing: .1em;
  text-transform: uppercase; color: var(--gold);
  border-bottom-color: var(--gold-line);
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data td.dash { color: var(--muted); }
.tablenote { font-size: 13px; color: var(--muted); margin: -6px 0 18px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tablewrap { overflow-x: auto; margin: 18px 0; clear: right; }
.tablewrap table.data { margin: 0; min-width: 520px; }
.prose .grid { clear: right; }

/* empty state */
.empty {
  display: grid; place-items: center; gap: 13px; text-align: center;
  padding: 54px 24px; background: var(--surface-2);
  border: 1px dashed var(--border); border-radius: var(--radius);
}
.empty svg { width: 26px; height: 26px; color: var(--muted); }
.empty h3 { font-size: 17px; }
.empty p { font-size: 14px; color: var(--muted); max-width: 46ch; }

/* stat strip */
.stats { display: flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--gold-line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.stat { flex: 1 1 150px; padding: 15px 18px; border-right: 1px solid var(--border); }
.stat:last-child { border-right: 0; }
.stat__n { font-family: var(--font-display); font-size: 25px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat__l { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ============================ command palette ============================ */

.palette[hidden] { display: none; }
.palette {
  position: fixed; inset: 0; z-index: 120;
  background: color-mix(in oklab, var(--fg) 34%, transparent);
  backdrop-filter: blur(3px);
  display: grid; place-items: start center;
  padding: 12vh 16px 16px;
  animation: fade .12s var(--ease);
}
@keyframes fade { from { opacity: 0 } }
.palette__panel {
  width: min(640px, 100%); max-height: 68vh;
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--gold-line);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 22px 60px oklch(0% 0 0 / .5);
  animation: pop .16s var(--ease);
}
@keyframes pop { from { transform: translateY(-8px); opacity: .6 } }
.palette__field { display: flex; align-items: center; gap: 11px; padding: 15px 17px; border-bottom: 1px solid var(--border); }
.palette__field svg { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
.palette__field input {
  flex: 1; min-width: 0; border: 0; background: none; outline: none;
  font: inherit; font-size: 16px; color: var(--fg);
}
.palette__field input::placeholder { color: var(--muted); }
.palette__list { overflow-y: auto; padding: 7px; }
.palette__section {
  font-family: var(--font-display); font-size: 11px; font-weight: 700;
  letter-spacing: .11em; text-transform: uppercase;
  color: var(--gold); padding: 10px 11px 6px;
}
.presult {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 9px 11px; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--fg); text-align: left;
  border: 0; background: none; font: inherit; cursor: pointer;
}
.presult[data-sel='true'] { background: var(--accent-soft); }
.presult__ic { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; background: var(--surface-3); flex-shrink: 0; }
.presult[data-sel='true'] .presult__ic { background: var(--surface); }
.presult__ic svg { width: 14px; height: 14px; }
.presult__t { font-size: 14.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.presult__s { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.presult mark { background: color-mix(in oklab, var(--accent) 24%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.presult__go { margin-left: auto; font-size: 11px; color: var(--muted); opacity: 0; flex-shrink: 0; }
.presult[data-sel='true'] .presult__go { opacity: 1; }
.palette__foot {
  display: flex; align-items: center; gap: 16px; padding: 10px 16px;
  border-top: 1px solid var(--border); background: var(--surface-2);
  font-size: 12px; color: var(--muted);
}
.palette__foot span { display: inline-flex; align-items: center; gap: 6px; }
.palette__none { padding: 34px 16px; text-align: center; color: var(--muted); font-size: 14px; }

/* image placeholder that still reads as art, never a grey wireframe box */
.ph-img {
  background:
    radial-gradient(120% 120% at 22% 12%, color-mix(in oklab, var(--accent) 32%, transparent), transparent 58%),
    radial-gradient(90% 90% at 82% 88%, color-mix(in oklab, var(--accent) 18%, transparent), transparent 60%),
    repeating-linear-gradient(115deg, color-mix(in oklab, var(--fg) 5%, transparent) 0 2px, transparent 2px 9px),
    var(--surface-3);
}

/* ============================ footer ============================ */

.foot {
  border-top: 1px solid var(--gold-line); margin-top: 40px;
  background: var(--surface-2);
}
.foot__in {
  max-width: var(--shell-max); margin: 0 auto; padding: 26px 24px;
  display: flex; flex-wrap: wrap; gap: 18px; align-items: center;
  font-size: 13px; color: var(--muted);
}
.foot a { text-decoration: none; }
.foot a:hover { color: var(--fg); }
.foot__sep { margin-left: auto; }

/* ============================ responsive ============================ */

@media (max-width: 1180px) {
  .shell { grid-template-columns: var(--nav-w) minmax(0, 1fr); }
  .toc { display: none; }
  .brand__tag { display: none; }
}

@media (max-width: 900px) {
  .topnav { display: none; }
  .searchtrigger { min-width: 0; flex: 1; }
  .iconbtn--menu { display: grid; }
  .shell { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .sidenav {
    position: fixed; top: var(--topbar-h); left: 0; bottom: 0; z-index: 70;
    width: 292px; padding: 20px 14px 60px;
    background: var(--surface); border-right: 1px solid var(--border);
    transform: translateX(-102%); transition: transform .2s var(--ease);
    max-height: none;
  }
  body[data-nav='open'] .sidenav { transform: none; box-shadow: 0 0 40px oklch(0% 0 0 / .2); }
  .navscrim { position: fixed; inset: var(--topbar-h) 0 0; z-index: 65; background: color-mix(in oklab, var(--fg) 32%, transparent); }
  .navscrim[hidden] { display: none; }
  .infobox { float: none; width: 100%; margin: 0 0 22px; }
  /* на планшете оставляем «страница + статус»: теги и дата уходят */
  .row, .rows__head { grid-template-columns: minmax(0, 1fr) 118px; }
  .row > .tagline, .row > :nth-child(4),
  .rows__head > :nth-child(2), .rows__head > :nth-child(4) { display: none; }
  .content { padding: 22px 0 70px; }
  h1 { font-size: 28px; }
}

@media (max-width: 560px) {
  .brand__name { display: none; }
  .stat { flex: 1 1 50%; border-bottom: 1px solid var(--border); }
  .row, .rows__head { grid-template-columns: minmax(0, 1fr); }
  .row > :not(:first-child), .rows__head > :not(:first-child) { display: none; }
  .palette { padding-top: 6vh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

/* ============================ проектные дополнения ============================
   Обе кнопки «Уточнить» — в топбаре («Уточнить данные») и в блоке состояния
   статьи — вели в Discord и приглашали игроков дослать недостающие цифры.
   Скрыты, а не вырезаны: разметка и вся логика на месте, вернуть = снять это
   правило. Инлайн-пометка «нужны данные» внутри текста остаётся — она говорит
   о самой статье, а не зовёт куда-то писать. */
.topbar__ask,
.statusbox .btn { display: none; }

/* Подсказку клавиш у поиска на узких экранах прячем — там уже нет места. */
@media (max-width: 900px) {
  .searchtrigger kbd { display: none; }
}

/* Счётчик страниц в дереве разделов вставал посередине между названием и
   стрелкой и ездил вместе с длиной названия: в summary auto-марджин стоял и у
   счётчика, и у шеврона, а несколько auto делят свободное место поровну.
   Свободное место отдаём одному счётчику — он уходит вправо и встаёт вплотную
   к стрелке. У ссылок вне summary (.navitem) правило не трогаем: там шеврона
   нет и одиночный auto работает как задумано. */
details.navgroup > summary .chev { margin-left: 0; }
details.navgroup > summary .navitem__count { margin-left: auto; }

/* ============================ справочник заданий ============================
   Страницы глав (quests-*) — это списки на сотню заданий, поэтому карточка
   свёрнута в <details>: заголовок держит уровень, название и тип, а разбор
   «как пройти» раскрывается по клику. Панель фильтра рисует article.html
   в контейнер [data-quest-filter] — в самой статье лежит только разметка. */

.qfilter {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin: 0 0 18px; padding: 12px 14px;
  border: 1px solid var(--gold-line); border-radius: var(--radius);
  background: var(--surface-2);
}
.qfilter__btn {
  font: inherit; font-size: 13px; cursor: pointer;
  padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  transition: color .14s var(--ease), border-color .14s var(--ease), background .14s var(--ease);
}
.qfilter__btn:hover { color: var(--fg); border-color: var(--gold-line); }
.qfilter__btn[aria-pressed='true'] {
  color: var(--gold); border-color: var(--gold); background: var(--gold-soft);
}
.qfilter__search {
  font: inherit; font-size: 13px; flex: 1 1 190px; min-width: 0;
  padding: 6px 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg); color: var(--fg);
}
.qfilter__search:focus { outline: 2px solid var(--gold-line); outline-offset: 1px; }
.qfilter__count { font-size: 12.5px; color: var(--muted); margin-left: auto; }

.quest {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); margin-bottom: 8px;
}
.quest[open] { border-color: var(--gold-line); background: var(--surface-2); }
.quest[hidden] { display: none; }
.quest > summary {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; cursor: pointer; list-style: none;
  font-size: 14.5px;
}
.quest > summary::-webkit-details-marker { display: none; }
.quest > summary:hover { background: var(--hover); border-radius: var(--radius); }
.quest > summary:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.quest__lv {
  flex-shrink: 0; min-width: 34px; text-align: center;
  font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted);
  padding: 2px 6px; border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.quest__name { font-weight: 550; }
.quest__tag {
  font-size: 11.5px; letter-spacing: .03em; padding: 2px 8px;
  border-radius: 999px; border: 1px solid currentColor; margin-left: auto;
}
.quest__tag--trunk { color: var(--accent-ink); }
.quest__tag--branch { color: var(--muted); }
.quest__tag--rank { color: var(--gold); }
.quest__tag--offer { color: var(--ok); }
.quest__job {
  font-size: 11.5px; padding: 2px 8px; border-radius: 999px;
  color: var(--warn); border: 1px solid currentColor;
}

.quest__body { padding: 2px 14px 14px; border-top: 1px solid var(--border); }
.quest__howto { margin: 12px 0 14px; max-width: 68ch; font-size: 14.5px; }
.quest__facts { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 0; }
.quest__facts dt, .quest__facts dd {
  padding: 7px 0; font-size: 13.5px; border-bottom: 1px solid var(--border);
}
.quest__facts dt { color: var(--muted); }
.quest__facts dd { padding-left: 12px; }
.quest__facts > :nth-last-child(-n+2) { border-bottom: 0; }
.quest__facts ul { margin: 0 0 0 17px; }
.quest__facts li { margin-bottom: 3px; }
.quest__id { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }

.qempty { padding: 22px 14px; text-align: center; color: var(--muted); font-size: 14px; }
.qempty[hidden] { display: none; }

@media (max-width: 560px) {
  .quest__tag { margin-left: 0; }
  .quest__facts { grid-template-columns: minmax(0, 1fr); }
  .quest__facts dt { padding-bottom: 0; border-bottom: 0; }
  .quest__facts dd { padding-left: 0; }
}
