*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg) url(../img/bg.webp) top center / 100% auto repeat-y;
  color: var(--ink);
  font: 400 15px/1.5 var(--sans);
  overflow-x: clip;
}
a { color: var(--gold-light); }
a:hover { color: var(--ink); }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* Колонка страницы */
.page { position: relative; max-width: var(--page); margin: 0 auto; padding-bottom: 110px; overflow: hidden; }
.section { position: relative; padding: 28px 16px 0; }
.deco { position: absolute; pointer-events: none; user-select: none; }

/* Шапка */
.topbar { position: relative; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 0; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--gold); background: rgba(45, 16, 25, 0.8); display: inline-flex; align-items: center; justify-content: center; color: var(--gold-light); padding: 0; cursor: pointer; }
.brand { font: 600 18px/1.1 var(--serif); letter-spacing: 0.03em; color: var(--gold-light); text-decoration: none; text-align: center; }
.plaque { background: url(../img/plaque.webp) center / 100% 100% no-repeat; display: flex; align-items: center; justify-content: center; padding: 12px 22px 0; min-height: 66px; }
.lang { display: inline-flex; border: 1px solid var(--gold); border-radius: var(--r-pill); padding: 2px; background: rgba(45, 16, 25, 0.8); }
.lang button { border: 0; border-radius: var(--r-pill); background: transparent; color: var(--muted); font-weight: 600; font-size: 12px; padding: 6px 11px; min-height: 32px; cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--accent); color: var(--ink); }

/* Заголовки */
.h1 { margin: 0; font: italic 600 clamp(36px, 11vw, 44px)/1.02 var(--serif); color: var(--gold-light); text-wrap: balance; }
.h2 { margin: 0; font: 600 30px/1.1 var(--serif); color: var(--gold-light); text-align: center; }
.h2-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 14px; }
.h2-wrap img { width: 280px; }
.name { font: italic 600 23px/1.05 var(--serif); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* Кнопки */
.btn-primary, .btn-outline { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: var(--r-pill); border: 1px solid var(--gold); text-decoration: none; font-weight: 600; font-size: 15px; cursor: pointer; }
.btn-primary { background: var(--accent); color: var(--ink); box-shadow: inset 0 1px 0 rgba(255, 244, 229, 0.18); }
.btn-primary:hover { color: var(--ink); filter: brightness(1.08); }
.btn-outline { background: transparent; color: var(--gold-light); }
.btn-primary[disabled], .btn-outline[disabled], .btn-primary[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; filter: none; }
.btn-big { min-height: 58px; font: 600 27px/1 var(--serif); }
.btn-block { display: flex; width: 100%; }

/* Поля */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 14px; font-weight: 600; }
.input, .textarea, .select { width: 100%; min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--field-bg); color: var(--ink); font-size: 16px; padding: 0 12px; }
.textarea { padding: 12px; resize: vertical; min-height: 96px; line-height: 1.45; }
.input::placeholder, .textarea::placeholder { color: var(--placeholder); }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--gold-light); box-shadow: 0 0 0 3px rgba(242, 209, 139, 0.18); }
.field.invalid .input, .field.invalid .textarea { border-color: var(--accent-2); }
.err { color: #FFB3C8; font-size: 13px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.4; cursor: pointer; }
.check input { width: 22px; height: 22px; flex: none; accent-color: var(--accent); margin: 0; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: var(--r-pill); border: 1px solid var(--line); color: var(--ink); font-size: 14px; cursor: pointer; }
.seg input:checked + span { background: var(--gold-light); border-color: var(--gold-light); color: var(--bg); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--gold-light); outline-offset: 2px; }

/* Карточки и рамки */
.card { border: 1px solid var(--gold); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.frame { position: relative; border: 1px solid var(--gold); border-radius: var(--r-lg); background: rgba(45, 16, 25, 0.92); padding: 22px 16px 18px; }
.frame::before { content: ''; position: absolute; left: 50%; top: -15px; width: 180px; height: 29px; transform: translateX(-50%); background: url(../img/ornament.webp) center / contain no-repeat; pointer-events: none; }
.frame > .corner { position: absolute; width: 42px; pointer-events: none; }
.corner.tl { left: -6px; top: -6px; }
.corner.tr { right: -6px; top: -6px; transform: scaleX(-1); }
.corner.bl { left: -6px; bottom: -6px; transform: scaleY(-1); }
.corner.br { right: -6px; bottom: -6px; transform: scale(-1); }
.panel { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--line); border-radius: var(--r-md); background: rgba(45, 16, 25, 0.85); padding: 14px; }
.label-caps { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--powder); }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: rgba(217, 160, 181, 0.12); font-size: 13px; line-height: 1.45; }

/* Чипы и шкала */
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--gold); border-radius: var(--r-pill); padding: 4px 11px; font-size: 12px; font-weight: 600; }
.chip.live { border-color: var(--accent); background: rgba(165, 16, 64, 0.25); }
.chip.live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #FF4D7A; }
.filter { border: 1px solid var(--gold); border-radius: var(--r-pill); background: transparent; color: var(--ink); font-weight: 600; font-size: 13px; padding: 8px 16px; min-height: 40px; cursor: pointer; }
.filter[aria-pressed="true"] { background: var(--gold-light); border-color: var(--gold-light); color: var(--bg); }
.bar { height: 6px; border-radius: 3px; background: rgba(255, 244, 229, 0.12); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(to right, var(--accent), var(--accent-2)); }
.steps { display: flex; gap: 6px; }
.steps i { flex: 1; height: 5px; border-radius: 3px; background: rgba(255, 244, 229, 0.15); }
.steps i.done { background: var(--accent); }
.steps i.now { background: var(--gold-light); }

/* Карточка героя */
.heroes-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.hero-card { display: flex; flex-direction: column; }
.hero-card .photo { position: relative; height: 176px; background: var(--surface); }
.hero-card .photo img { width: 100%; height: 100%; object-fit: cover; }
.hero-card .photo::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(45, 16, 25, 0) 45%, var(--surface) 98%); }
.hero-card .photo .name { position: absolute; left: 12px; right: 8px; bottom: 6px; z-index: 1; }
.hero-card .body { padding: 4px 12px 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.hero-card .quote { font-size: 13px; line-height: 1.4; flex: 1; }
.place { display: flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 500; color: var(--muted); }

/* Нижнее меню */
.bottom-nav { position: fixed; z-index: 20; left: 50%; bottom: max(10px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(410px, calc(100% - 20px)); display: flex; padding: 8px; border: 1px solid var(--line); border-radius: 22px; background: rgba(45, 16, 25, 0.96); }
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 0; border-radius: 14px; color: var(--ink); text-decoration: none; font-size: 11.5px; font-weight: 500; min-height: 44px; }
.bottom-nav a[aria-current="page"] { background: var(--accent); }
.bottom-nav svg { width: 22px; height: 22px; }

/* Сообщения */
.toast { position: fixed; z-index: 30; left: 50%; top: 16px; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 12px 16px; border-radius: var(--r-md); border: 1px solid var(--gold); background: var(--surface); font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
.banner { margin: 16px; padding: 14px; border: 1px dashed var(--gold); border-radius: var(--r-md); text-align: center; color: var(--muted); }

@media (prefers-reduced-motion: no-preference) {
  .btn-primary, .filter, .seg span { transition: filter 0.15s, background-color 0.15s; }
}

/* Тексты на двух языках в одной странице */
html[lang="uk"] [data-l="ru"], html[lang="ru"] [data-l="uk"] { display: none; }
.doc { line-height: 1.6; }
.doc h2 { font: 600 24px/1.2 var(--serif); color: var(--gold-light); margin: 26px 0 8px; }
.doc ul { padding-left: 20px; margin: 0; }
.doc li { margin-bottom: 6px; }
