/**
 * Классический «фолиант»: EB Garamond + Cinzel, рамки, правила, без стеклянных карточек.
 */

:root {
  --paper: #ebe4d6;
  --paper-raised: #f3ede3;
  --paper-shadow: #d4cbb8;
  --ink: #1a1410;
  --ink-muted: #4a4238;
  --rule: #8b7a66;
  --rule-light: rgba(74, 66, 56, 0.22);
  --wine: #5c2430;
  --wine-soft: rgba(92, 36, 48, 0.12);
  --forest: #2f3d32;
  --gold-ink: #6b5420;
  --danger: #8b1c10;
  --success: #1e4d32;
  --font-caps: "Cinzel", "Palatino Linotype", Palatino, serif;
  --font-body: "EB Garamond", "Palatino Linotype", Georgia, serif;
  --font-ui: var(--font-body);
  --radius: 0;
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --t: 0.22s var(--ease);
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 1.2rem;
  line-height: 1.55;
  font-weight: 400;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

/* ——— Фон: бумага ——— */
.app-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.app-bg__paper {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 70% at 0% 40%, rgba(92, 36, 48, 0.04) 0%, transparent 45%),
    radial-gradient(ellipse 70% 60% at 100% 60%, rgba(107, 84, 32, 0.05) 0%, transparent 42%),
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(255, 255, 255, 0.48) 0%, transparent 55%),
    linear-gradient(180deg, #efe8dc 0%, var(--paper) 35%, #e2d9c8 100%);
}

.app-bg__fibers {
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.spb-shell {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 100vh;
}

.menu-page .spb-shell {
  padding: clamp(1.25rem, 4vw, 2.75rem) clamp(0.75rem, 3vw, 1.5rem) 2.5rem;
}

/* Разворот: поле набора + страница */
.folio-spread {
  display: grid;
  gap: 0 1.5rem;
  align-items: start;
  max-width: 52rem;
  margin: 0 auto;
}

@media (min-width: 860px) {
  .folio-spread {
    grid-template-columns: minmax(0, 2.75rem) minmax(0, 1fr);
  }
}

.folio-margin {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  padding-top: 2.5rem;
  border-right: 1px solid var(--rule-light);
  min-height: 12rem;
}

@media (min-width: 860px) {
  .folio-margin {
    display: flex;
  }
}

.folio-margin__rot {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: var(--font-caps);
  font-size: 0.58rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-muted);
  opacity: 0.85;
  max-height: 14rem;
}

.folio-margin__block {
  font-family: var(--font-caps);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--gold-ink);
  opacity: 0.75;
}

h1,
h2,
h3,
.admin-title,
.modal-title,
.section-heading {
  font-family: var(--font-caps);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.06em;
}

h2,
.quiz-prompt,
.section-heading {
  font-size: clamp(1.15rem, 2.2vw, 1.45rem);
  line-height: 1.35;
  margin: 0 0 0.85rem;
}

h3,
.modal-title {
  font-size: 1.35rem;
  margin: 0 0 0.6rem;
}

p {
  margin: 0 0 1rem;
}

[data-reveal] {
  opacity: 0;
  transform: translate3d(0, 20px, 0);
  transition:
    opacity 0.85s var(--ease),
    transform 0.85s var(--ease);
}

[data-reveal].is-inview {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* ——— Главная: фолиант ——— */
.folio {
  max-width: 42rem;
  margin: 0;
  min-width: 0;
}

@media (max-width: 859px) {
  .folio {
    margin: 0 auto;
  }
}

.folio-frame {
  position: relative;
  border: 3px double var(--rule);
  padding: 2px;
  background: var(--paper-raised);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.65) inset,
    0 12px 40px rgba(26, 20, 16, 0.08);
  animation: folio-settle 1.1s var(--ease) both;
}

@keyframes folio-settle {
  from {
    opacity: 0;
    transform: translateY(10px) rotate(-0.35deg);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .folio-frame {
    animation: none;
  }
}

.folio-frame__inner {
  position: relative;
  border: 1px solid var(--rule-light);
  padding: clamp(1.5rem, 4vw, 2.5rem) clamp(1.25rem, 3vw, 2rem);
}

/* Уголки «верстки» */
.folio-frame__inner::before,
.folio-frame__inner::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: var(--gold-ink);
  border-style: solid;
  opacity: 0.35;
  pointer-events: none;
}

.folio-frame__inner::before {
  top: 0.65rem;
  left: 0.65rem;
  border-width: 1px 0 0 1px;
}

.folio-frame__inner::after {
  right: 0.65rem;
  bottom: 0.65rem;
  border-width: 0 1px 1px 0;
}

.folio-masthead {
  text-align: center;
  margin-bottom: 1.75rem;
}

.folio-masthead__epoch {
  margin: 0 0 0.5rem;
  font-family: var(--font-caps);
  font-size: clamp(0.58rem, 1.8vw, 0.72rem);
  letter-spacing: clamp(0.18em, 1.2vw, 0.38em);
  text-transform: uppercase;
  color: var(--ink-muted);
  max-width: 22rem;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.45;
}

.folio-masthead__rule {
  width: 4rem;
  height: 1px;
  margin: 0 auto 1rem;
  background: var(--rule);
  opacity: 0.65;
}

.folio-masthead__city {
  margin: 0 0 0.35rem;
  font-family: var(--font-caps);
  font-size: clamp(1.65rem, 4.5vw, 2.35rem);
  font-weight: 700;
  letter-spacing: 0.18em;
  line-height: 1.2;
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.folio-masthead__tag {
  margin: 0;
  font-size: 0.95rem;
  font-style: italic;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
}

.folio-masthead__printer {
  margin-top: 1.1rem;
  font-family: var(--font-caps);
  font-size: 0.62rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--wine);
  opacity: 0.55;
}

.folio-fleuron {
  margin: 0.25rem 0 1.25rem;
  text-align: center;
  font-family: var(--font-body);
  font-size: 1.15rem;
  color: var(--gold-ink);
  letter-spacing: 0.35em;
  opacity: 0.55;
}

.folio-fleuron span {
  display: inline-block;
  padding: 0 0.25rem;
}

.folio-fleuron--arch span {
  font-family: var(--font-caps);
  font-size: 1.35rem;
  line-height: 1;
  color: var(--wine);
  opacity: 0.35;
}

.folio-fleuron--small {
  margin: 1.5rem 0 1.25rem;
  font-size: 0.95rem;
  letter-spacing: 0.5em;
  opacity: 0.45;
}

.folio-lead {
  margin-bottom: 1rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--rule-light);
}

.folio-lead__title {
  margin: 0 0 0.75rem;
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--forest);
}

.folio-lead__text {
  margin: 0;
  text-align: justify;
  hyphens: auto;
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.65;
}

.folio-lead__text::first-letter {
  float: left;
  margin: 0.16em 0.28rem 0 0;
  padding: 0.08rem 0.35rem 0.14rem;
  font-family: var(--font-caps);
  font-size: 3.1rem;
  line-height: 0.78;
  font-weight: 700;
  color: var(--paper-raised);
  background: linear-gradient(165deg, var(--wine) 0%, #3f1820 100%);
  border: 1px solid rgba(26, 20, 16, 0.2);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset;
}

.folio-toc {
  margin: 0;
  padding: 0;
}

.folio-toc__heading {
  margin: 0 0 0.5rem;
  padding: 0 0 0.35rem;
  font-size: 0.98rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--wine);
  border-bottom: 2px solid var(--wine-soft);
}

.folio-toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.folio-toc__list li {
  margin: 0;
  border-bottom: 1px solid var(--rule-light);
}

.folio-toc__list li:last-child {
  border-bottom: none;
}

.folio-toc__link {
  position: relative;
  display: grid;
  grid-template-columns: 3.25rem 1fr auto;
  gap: 0.75rem 1rem;
  align-items: center;
  padding: 1.05rem 0.35rem 1.05rem 0.5rem;
  text-decoration: none;
  color: inherit;
  transition: background var(--t), padding-left 0.28s var(--ease);
}

.folio-toc__link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.65rem;
  bottom: 0.65rem;
  width: 3px;
  background: var(--wine);
  opacity: 0;
  transform: scaleY(0.4);
  transform-origin: center top;
  transition: opacity 0.25s var(--ease), transform 0.28s var(--ease);
}

.folio-toc__link:hover {
  background: linear-gradient(90deg, rgba(92, 36, 48, 0.07) 0%, rgba(92, 36, 48, 0.02) 38%, transparent 100%);
  padding-left: 0.75rem;
}

.folio-toc__link:hover::before {
  opacity: 0.85;
  transform: scaleY(1);
}

.folio-toc__link:focus-visible {
  outline: 2px solid var(--wine);
  outline-offset: 2px;
}

.folio-toc__num-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  border: 3px double var(--rule-light);
  background: rgba(255, 255, 255, 0.35);
}

.folio-toc__num {
  font-family: var(--font-caps);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gold-ink);
  line-height: 1;
}

.folio-toc__link:hover .folio-toc__num-wrap {
  border-color: rgba(92, 36, 48, 0.25);
  background: rgba(255, 255, 255, 0.55);
}

.folio-toc__body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.folio-toc__name {
  font-family: var(--font-caps);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  transition: color 0.22s var(--ease), letter-spacing 0.28s var(--ease);
}

.folio-toc__link:hover .folio-toc__name {
  color: var(--wine);
  letter-spacing: 0.1em;
}

.folio-toc__hint {
  font-size: 0.95rem;
  color: var(--ink-muted);
  line-height: 1.4;
}

.folio-toc__folio {
  font-family: var(--font-caps);
  font-size: 0.75rem;
  color: var(--ink-muted);
  opacity: 0.6;
}

.folio-epigraph {
  position: relative;
  margin: 2rem 0 0;
  padding: 1.35rem 1rem 1.35rem 2.15rem;
  border: 1px solid var(--rule-light);
  border-left: 3px solid var(--wine);
  font-style: italic;
  color: var(--ink-muted);
  background: linear-gradient(100deg, rgba(92, 36, 48, 0.06) 0%, rgba(255, 255, 255, 0.18) 55%);
}

.folio-epigraph::before {
  content: "";
  position: absolute;
  top: 0.65rem;
  right: 0.85rem;
  width: 2.5rem;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-ink), transparent);
  opacity: 0.4;
  pointer-events: none;
}

.folio-epigraph p {
  margin: 0 0 0.5rem;
  font-size: 1.08rem;
  line-height: 1.55;
}

.folio-epigraph cite {
  font-style: normal;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

.folio-colophon {
  margin-top: 2.25rem;
  text-align: center;
}

.folio-colophon__rule {
  width: 100%;
  max-width: 12rem;
  height: 1px;
  margin: 0 auto 1rem;
  background: linear-gradient(90deg, transparent, var(--rule), transparent);
  opacity: 0.5;
}

.folio-colophon p {
  margin: 0;
  font-family: var(--font-caps);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-muted);
  line-height: 1.6;
}

/* ——— Кнопки (прямоугольные, «типографские») ——— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  padding: 0.65rem 1.35rem;
  font-family: var(--font-caps);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  transition:
    color var(--t),
    background var(--t),
    border-color var(--t);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--ink);
  color: var(--paper-raised);
  border-color: var(--ink);
}

.btn-primary:hover:not(:disabled) {
  background: var(--wine);
  border-color: var(--wine);
  color: #fff;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.35);
  border-color: var(--rule);
  color: var(--ink);
}

.btn-ghost:hover:not(:disabled) {
  border-color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
}

.btn-danger {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
  font-size: 0.72rem;
  padding: 0.4rem 0.75rem;
}

.btn-danger:hover:not(:disabled) {
  background: rgba(139, 28, 16, 0.06);
}

.btn-next {
  margin-top: 1.5rem;
  width: 100%;
  max-width: 18rem;
  margin-left: auto;
  margin-right: auto;
  display: flex;
}

.btn-block {
  width: 100%;
}

.menu-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  justify-content: center;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-caps);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--forest);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.back-link:hover {
  border-bottom-color: var(--rule);
  color: var(--ink);
}

.back-icon {
  font-size: 1.2rem;
  line-height: 1;
}

/* ——— Квиз ——— */
.game-page {
  padding-bottom: 2.5rem;
}

.game-header {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 3vw, 1.75rem) 1.35rem;
  border-bottom: 3px double var(--rule-light);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.35) 0%, rgba(243, 237, 227, 0.95) 100%);
}

.game-header::after {
  content: "✦";
  position: absolute;
  left: 50%;
  bottom: -0.5rem;
  transform: translateX(-50%);
  font-size: 0.55rem;
  letter-spacing: 0.15em;
  color: var(--gold-ink);
  opacity: 0.5;
  pointer-events: none;
}

.game-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  justify-content: center;
  min-width: 0;
}

.game-brand__line {
  flex: 1;
  max-width: 5rem;
  height: 1px;
  background: var(--rule);
  opacity: 0.45;
}

.game-brand__text {
  font-family: var(--font-body);
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--wine);
  white-space: nowrap;
}

.game-header__scores {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.game-streak {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.06rem;
  padding: 0.28rem 0.5rem 0.32rem;
  border: 1px dashed var(--rule);
  background: rgba(255, 255, 255, 0.35);
  min-width: 3.1rem;
}

.game-streak__label {
  font-family: var(--font-caps);
  font-size: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-ink);
  line-height: 1;
}

.game-streak__value {
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  color: var(--ink);
}

.score {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.28rem 0.75rem 0.32rem;
  border: 1px solid var(--rule);
  background: rgba(255, 255, 255, 0.45);
  min-width: 4.25rem;
}

.score-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.12rem;
}

.score-label {
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 500;
  font-style: italic;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  color: var(--ink-muted);
  line-height: 1;
}

.score-value {
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  line-height: 1.1;
  min-width: 2ch;
  text-align: center;
}

.quiz-container {
  width: min(52rem, 94vw);
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
}

.quiz-panel {
  position: relative;
  padding: 1.75rem 1.25rem 2rem;
  border: 3px double var(--rule-light);
  background: var(--paper-raised);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset;
  animation: panel-in 0.5s var(--ease);
}

.quiz-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 8%;
  right: 8%;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(92, 36, 48, 0.2) 20%,
    rgba(107, 84, 32, 0.25) 50%,
    rgba(92, 36, 48, 0.2) 80%,
    transparent 100%
  );
  pointer-events: none;
}

.quiz-panel__meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
  text-align: center;
}

.quiz-round-hint {
  margin: 0;
  font-family: var(--font-caps);
  font-size: 0.52rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-muted);
  opacity: 0.82;
}

.quiz-stage {
  margin-bottom: 0.15rem;
}

.quiz-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  margin-top: 1.35rem;
  padding-top: 0.25rem;
}

.quiz-encouragement {
  margin: 0;
  max-width: 34rem;
  text-align: center;
  font-family: var(--font-body);
  font-size: 1rem;
  font-style: italic;
  font-weight: 500;
  line-height: 1.45;
  color: var(--forest);
}

.main-image-wrap--hero {
  perspective: 1200px;
}

.image-frame--hero {
  border-width: 2px;
  box-shadow:
    0 2px 0 rgba(26, 20, 16, 0.05),
    0 12px 32px rgba(26, 20, 16, 0.08);
  transform: translateZ(0);
  transition:
    box-shadow 0.35s ease,
    transform 0.35s ease;
}

.quiz-panel:hover .image-frame--hero {
  box-shadow:
    0 2px 0 rgba(26, 20, 16, 0.04),
    0 18px 44px rgba(26, 20, 16, 0.1);
}

.image-frame--hero img {
  max-height: min(440px, 48vh);
}

@media (max-width: 640px) {
  .image-frame--hero img {
    max-height: min(300px, 42vh);
  }
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .quiz-panel {
    animation: none;
  }
}

@keyframes quiz-panel-pulse {
  0% {
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.5) inset,
      0 0 0 0 rgba(30, 77, 50, 0.2);
  }
  70% {
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.5) inset,
      0 0 0 12px rgba(30, 77, 50, 0);
  }
  100% {
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.5) inset,
      0 0 0 0 rgba(30, 77, 50, 0);
  }
}

.quiz-panel--pulse {
  animation: quiz-panel-pulse 0.95s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .quiz-panel--pulse {
    animation: none;
  }
}

.quiz-mode-label {
  margin: 0 0 0.4rem;
  text-align: center;
  font-family: var(--font-caps);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--wine);
  opacity: 0.88;
  min-height: 1.15em;
}

.quiz-prompt {
  margin: 0 0 0.75rem;
  font-family: var(--font-body);
  font-weight: 500;
  font-style: italic;
  text-align: center;
  color: var(--ink);
}

.quiz-target-name {
  margin: 0 auto 1rem;
  max-width: 38rem;
  padding: 0.65rem 1rem;
  text-align: center;
  font-family: var(--font-caps);
  font-size: clamp(0.95rem, 2.4vw, 1.28rem);
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1.3;
  color: var(--ink);
  border: 1px solid var(--rule-light);
  background: rgba(255, 255, 255, 0.5);
}

.quiz-excerpt {
  margin: 0 auto 1.15rem;
  max-width: 40rem;
  padding: 0.9rem 1rem 0.95rem 1.15rem;
  border-left: 3px solid var(--wine);
  background: rgba(255, 255, 255, 0.38);
  font-family: var(--font-body);
  font-size: 1.02rem;
  line-height: 1.58;
  text-align: justify;
  color: var(--ink);
}

.main-image-wrap {
  margin-bottom: 1.25rem;
}

.image-frame {
  position: relative;
  border: 1px solid var(--rule);
  overflow: hidden;
  box-shadow: 0 2px 0 rgba(26, 20, 16, 0.06);
}

.image-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.image-frame img {
  width: 100%;
  max-height: min(400px, 52vh);
  object-fit: cover;
  display: block;
  vertical-align: middle;
}

.options-grid {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.options-grid--facades {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 720px) {
  .options-grid--facades {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@keyframes option-rise {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.option-card {
  position: relative;
  text-align: left;
  border: 1px solid var(--rule-light);
  background: rgba(255, 255, 255, 0.4);
  color: var(--ink);
  border-radius: var(--radius);
  cursor: pointer;
  overflow: hidden;
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
  animation: option-rise 0.58s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.options-grid .option-card:nth-child(1) {
  animation-delay: 0.04s;
}

.options-grid .option-card:nth-child(2) {
  animation-delay: 0.1s;
}

.options-grid .option-card:nth-child(3) {
  animation-delay: 0.16s;
}

.options-grid .option-card:nth-child(4) {
  animation-delay: 0.22s;
}

.options-grid .option-card:nth-child(5) {
  animation-delay: 0.28s;
}

.options-grid .option-card:nth-child(6) {
  animation-delay: 0.34s;
}

@media (prefers-reduced-motion: reduce) {
  .option-card {
    animation: none;
  }
}

.option-card:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--rule);
  box-shadow: 0 4px 14px rgba(26, 20, 16, 0.06);
}

.option-card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}

.option-card span,
.option-card.text-option {
  display: block;
  padding: 0.65rem 0.75rem;
  font-size: 0.98rem;
  line-height: 1.45;
}

.option-card.text-option {
  min-height: 3.25rem;
  display: flex;
  align-items: center;
}

.option-card.image-only {
  padding: 0;
  aspect-ratio: 4 / 3;
}

.option-card.image-only img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  display: block;
}

.option-correct {
  border-color: var(--success) !important;
  box-shadow: 0 0 0 1px rgba(30, 77, 50, 0.25);
  animation: correct-pulse 0.45s ease;
}

@keyframes option-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  18% {
    transform: translateX(-5px);
  }
  36% {
    transform: translateX(5px);
  }
  54% {
    transform: translateX(-3px);
  }
  72% {
    transform: translateX(3px);
  }
}

.option-wrong {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 1px rgba(139, 28, 16, 0.22);
  animation: option-shake 0.52s ease;
}

.option-should {
  border-color: var(--forest) !important;
  border-style: dashed;
  box-shadow: 0 0 0 1px rgba(30, 77, 50, 0.22);
  animation: correct-pulse 0.55s ease;
}

@media (prefers-reduced-motion: reduce) {
  .option-wrong,
  .option-should {
    animation: none;
  }
}

@keyframes correct-pulse {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.04);
  }
}

.hidden {
  display: none !important;
}

/* ——— Модальное окно ——— */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 20, 16, 0.45);
  animation: fade-in 0.25s ease;
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(32rem, 100%);
  padding: 2rem 1.75rem 1.75rem;
  border: 3px double var(--rule);
  background: var(--paper-raised);
  box-shadow: 0 18px 48px rgba(26, 20, 16, 0.15);
  animation: modal-in 0.4s var(--ease);
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: scale(0.98) translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal-card {
    animation: none;
  }
}

.modal-ornament {
  width: 3rem;
  height: 2px;
  margin: 0 auto 1rem;
  background: var(--wine);
  opacity: 0.5;
}

.modal-title {
  text-align: center;
  font-style: normal;
}

.modal-correct {
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: 600;
  font-style: italic;
  color: var(--forest);
  text-align: center;
  margin-bottom: 0.85rem;
}

.modal-desc {
  color: var(--ink-muted);
  font-size: 1.02rem;
  margin-bottom: 1.35rem;
  max-height: 38vh;
  overflow-y: auto;
  text-align: justify;
}

.modal-actions {
  justify-content: center;
}

.modal-card--wide {
  width: min(38rem, 100%);
  padding: 1.85rem 1.5rem 1.65rem;
}

.modal-figure {
  margin: 0 auto 1rem;
  max-width: 22rem;
}

.modal-figure img {
  width: 100%;
  height: auto;
  max-height: min(240px, 38vh);
  object-fit: cover;
  display: block;
  border: 1px solid var(--rule);
  box-shadow: 0 10px 32px rgba(26, 20, 16, 0.12);
}

.modal-figure__cap {
  margin: 0.5rem 0 0;
  text-align: center;
  font-size: 0.8rem;
  font-style: italic;
  color: var(--ink-muted);
}

.modal-actions.modal-actions--stack {
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  max-width: 22rem;
  margin-left: auto;
  margin-right: auto;
  gap: 0.75rem;
}

.modal-actions__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: center;
}

.modal-actions__row .btn {
  flex: 1 1 auto;
  min-width: min(10rem, 38vw);
}

/* ——— Обучение ——— */
.learn-page {
  padding-bottom: 0;
}

.learn-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 2rem;
}

.learn-cards-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 0;
}

.learn-app > .learn-list-panel:not(.hidden) {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.learn-journey {
  width: min(56rem, 94vw);
  margin: 0 auto;
  padding: 0.35rem clamp(1rem, 3vw, 1rem) 0.65rem;
  border-bottom: 1px solid var(--rule-light);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.25) 0%, transparent 100%);
}

.learn-journey[hidden] {
  display: none !important;
}

.learn-journey__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  margin-bottom: 0.5rem;
}

.learn-journey__label {
  font-family: var(--font-caps);
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--wine);
  opacity: 0.88;
}

.learn-journey__step {
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-style: italic;
  color: var(--ink-muted);
  line-height: 1.35;
  text-align: right;
  flex: 1;
  min-width: min(100%, 12rem);
}

.learn-progress--journey {
  width: 100%;
  margin: 0;
  padding: 0;
}

.learn-progress__track {
  height: 5px;
  border-radius: 999px;
  background: rgba(74, 60, 42, 0.1);
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) inset;
}

.learn-progress__fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--wine), rgba(107, 84, 32, 0.9));
  transition: width 0.45s var(--ease);
}

@media (prefers-reduced-motion: reduce) {
  .learn-progress__fill {
    transition: none;
  }
}

.learn-hint {
  margin: 0 auto 0.5rem;
  padding: 0.5rem 1rem 0;
  max-width: 44rem;
  text-align: center;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-style: italic;
  line-height: 1.45;
  color: var(--ink-muted);
  opacity: 0.9;
}

.learn-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem clamp(1rem, 3vw, 1.75rem);
  border-bottom: 3px double var(--rule-light);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.3) 0%, rgba(243, 237, 227, 0.95) 100%);
  position: relative;
  z-index: 2;
}

.learn-back {
  margin: 0;
}

.learn-header__right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.55rem;
  flex-shrink: 0;
  min-width: min-content;
}

.learn-view-toggle {
  display: inline-flex;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  border: 1px solid var(--rule-light);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.35);
}

.learn-toggle-btn {
  margin: 0;
  padding: 0.38rem 0.65rem;
  font-family: var(--font-caps);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition:
    background var(--t),
    color var(--t);
}

.learn-toggle-btn.is-active {
  color: var(--paper-raised);
  background: linear-gradient(165deg, var(--wine), #3a1720);
}

.learn-toggle-btn:not(.is-active):hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.5);
}

.learn-header__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
  text-align: right;
}

.learn-kicker {
  font-family: var(--font-caps);
  font-size: 0.58rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--wine);
  opacity: 0.88;
}

.learn-counter {
  font-family: var(--font-caps);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.lesson-spread {
  width: min(56rem, 96vw);
  margin: 0 auto 1rem;
}

.lesson-card-stack {
  border: 3px double var(--rule-light);
  border-radius: 3px;
  background: var(--paper-raised);
  overflow: hidden;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.5) inset,
    0 10px 36px rgba(26, 20, 16, 0.06);
}

.lesson-spread__sheet {
  display: grid;
  gap: 1.15rem 1.5rem;
  align-items: stretch;
  border: none;
  border-radius: 0;
  background: transparent;
  padding: clamp(1rem, 3vw, 1.45rem);
  box-shadow: none;
}

@keyframes lesson-sheet-fade {
  from {
    opacity: 0.45;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lesson-spread__sheet.lesson-sheet--reveal {
  animation: lesson-sheet-fade 0.4s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .lesson-spread__sheet.lesson-sheet--reveal {
    animation: none;
  }
}

@media (min-width: 800px) {
  .lesson-spread__sheet {
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  }
}

.lesson-figure {
  position: relative;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
}

.lesson-more-bar {
  border-top: 1px solid var(--rule-light);
  padding: 0.85rem clamp(1rem, 3vw, 1.5rem) 1rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.3) 0%, rgba(243, 237, 227, 0.72) 100%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
}

.lesson-more-bar[hidden] {
  display: none !important;
}

.lesson-more-bar .lesson-more-btn {
  width: 100%;
  max-width: 100%;
  justify-content: center;
  min-height: 2.65rem;
  font-family: var(--font-caps);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.lesson-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.lesson-more-btn::after {
  content: "↗";
  font-size: 0.85em;
  opacity: 0.85;
}

.lesson-article__eyebrow {
  margin: 0 0 0.28rem;
  font-family: var(--font-caps);
  font-size: 0.54rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--wine);
  opacity: 0.86;
}

.lesson-figure__frame {
  position: relative;
  z-index: 0;
  border: 1px solid var(--rule);
  background: rgba(255, 255, 255, 0.4);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  max-height: min(48vh, 420px);
}

.lesson-figure__frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lesson-figure__cap {
  font-size: 0.8rem;
  font-style: italic;
  color: var(--ink-muted);
  text-align: center;
  line-height: 1.35;
}

.lesson-article {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-left: none;
  padding-left: 0;
}

@media (min-width: 800px) {
  .lesson-article {
    border-left: 1px solid var(--rule-light);
    padding-left: 1.25rem;
  }
}

.lesson-article__head {
  margin-bottom: 0.6rem;
}

.lesson-article__title {
  margin: 0;
  font-family: var(--font-caps);
  font-size: clamp(1.15rem, 2.6vw, 1.55rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.06em;
  color: var(--ink);
}

.lesson-article__rule {
  height: 2px;
  margin-top: 0.5rem;
  max-width: 12rem;
  background: linear-gradient(90deg, var(--wine) 0%, transparent 100%);
  opacity: 0.4;
}

.lesson-article__body {
  flex: 1;
  overflow-y: auto;
  max-height: min(44vh, 380px);
  padding-right: 0.2rem;
}

.lesson-article__body p {
  margin: 0;
  font-size: 1.06rem;
  line-height: 1.62;
  text-align: justify;
  color: var(--ink);
}

.learn-list-panel {
  width: min(52rem, 100%);
  margin: 0 auto;
  padding: 0 clamp(0.65rem, 3vw, 1.35rem) 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 0;
}

.learn-catalog-head {
  padding: 0.15rem 0 0.25rem;
  border-bottom: 3px double var(--rule-light);
}

.learn-catalog-head__title {
  margin: 0 0 0.4rem;
  font-family: var(--font-caps);
  font-size: clamp(1rem, 2.8vw, 1.25rem);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
}

.learn-catalog-head__lead {
  margin: 0;
  max-width: 40rem;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink-muted);
}

.learn-catalog {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.learn-catalog__empty {
  margin: 0;
  padding: 2rem 1rem;
  text-align: center;
  font-size: 1rem;
  color: var(--ink-muted);
  border: 1px dashed var(--rule);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.35);
}

.learn-catalog__item {
  margin: 0;
}

.learn-catalog-card {
  display: grid;
  grid-template-columns: auto 5.5rem 1fr auto;
  gap: 0.65rem 0.85rem;
  align-items: center;
  width: 100%;
  padding: 0.65rem 0.75rem 0.65rem 0.65rem;
  text-align: left;
  border: 1px solid var(--rule-light);
  border-radius: 4px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.55) 0%, rgba(243, 237, 227, 0.65) 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.55) inset;
  cursor: pointer;
  color: inherit;
  font: inherit;
  transition:
    border-color 0.22s var(--ease),
    box-shadow 0.22s var(--ease),
    transform 0.22s var(--ease);
}

.learn-catalog-card:hover {
  border-color: rgba(92, 36, 48, 0.28);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.55) inset,
    0 8px 28px rgba(26, 20, 16, 0.08);
  transform: translateY(-1px);
}

.learn-catalog-card:active {
  transform: translateY(0);
}

.learn-catalog-card__ix {
  font-family: var(--font-caps);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--gold-ink);
  opacity: 0.85;
  padding: 0 0.15rem;
  min-width: 1.75rem;
  text-align: center;
}

.learn-catalog-card__media {
  position: relative;
  width: 5.5rem;
  height: 4rem;
  border-radius: 2px;
  border: 1px solid var(--rule);
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(92, 36, 48, 0.06) 0%, rgba(255, 255, 255, 0.4) 100%),
    repeating-linear-gradient(
      -12deg,
      rgba(74, 60, 42, 0.04) 0 2px,
      transparent 2px 6px
    );
}

.learn-catalog-card__media--broken {
  display: flex;
  align-items: center;
  justify-content: center;
}

.learn-catalog-card__media--broken::after {
  content: "◆";
  font-size: 0.85rem;
  color: var(--wine);
  opacity: 0.35;
}

.learn-catalog-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.learn-catalog-card__src-badge {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: rgba(30, 77, 50, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 2px 6px rgba(26, 20, 16, 0.15);
}

.learn-catalog-card__src-badge::after {
  content: "↗";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 0.55rem;
  color: var(--paper-raised);
  line-height: 1;
}

.learn-catalog-card__main {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
}

.learn-catalog-card__name {
  font-family: var(--font-caps);
  font-size: clamp(0.78rem, 2.2vw, 0.92rem);
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.28;
  color: var(--ink);
}

.learn-catalog-card__lede {
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--ink-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.learn-catalog-card__chev {
  font-size: 1.35rem;
  font-weight: 300;
  color: var(--wine);
  opacity: 0.45;
  line-height: 1;
  padding-left: 0.15rem;
}

@media (max-width: 520px) {
  .learn-catalog-card {
    grid-template-columns: auto 4.25rem 1fr auto;
    gap: 0.5rem 0.55rem;
    padding: 0.55rem 0.55rem 0.55rem 0.45rem;
  }

  .learn-catalog-card__media {
    width: 4.25rem;
    height: 3.35rem;
  }

  .learn-catalog-card__lede {
    -webkit-line-clamp: 3;
    font-size: 0.82rem;
  }
}

.lesson-controls {
  display: flex;
  gap: 0.65rem;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0 1rem 1.75rem;
}

.lesson-nav-btn {
  min-width: min(10.5rem, 44vw);
  min-height: 2.85rem;
}

.ctrl-arrow {
  font-size: 1rem;
  opacity: 0.85;
}

/* ——— Админка ——— */
.admin-wrap {
  min-height: 100vh;
  padding: clamp(1.25rem, 3vw, 2rem) 1rem 2.5rem;
}

.admin-layout {
  width: min(38rem, 100%);
  margin: 0 auto;
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.admin-back {
  margin: 0;
}

.admin-logout {
  font-family: var(--font-caps);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--wine);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.admin-logout:hover {
  border-bottom-color: var(--rule);
  color: var(--ink);
}

/* ——— Вход в канцелярию ——— */
.admin-login-page .spb-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem 1rem;
}

.admin-login-wrap {
  width: 100%;
  max-width: 22rem;
}

.admin-login-card {
  border: 3px double var(--rule);
  padding: 1.75rem 1.5rem 1.5rem;
  background: var(--paper-raised);
  box-shadow: 0 10px 32px rgba(26, 20, 16, 0.07);
}

.admin-login-eyebrow {
  font-family: var(--font-caps);
  font-size: 0.65rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--wine);
  margin: 0 0 0.45rem;
}

.admin-login-title {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  letter-spacing: 0.08em;
}

.admin-login-lead {
  margin: 0 0 1.1rem;
  font-size: 0.98rem;
  color: var(--ink-muted);
  line-height: 1.5;
}

.admin-login-error {
  margin: 0 0 0.85rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid rgba(139, 28, 16, 0.35);
  background: rgba(139, 28, 16, 0.06);
  color: var(--danger);
  font-size: 0.92rem;
}

.admin-login-form {
  display: grid;
  gap: 1rem;
}

.admin-login-back {
  margin: 1.25rem 0 0;
}

.admin-header-block {
  position: relative;
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 3px double var(--rule-light);
}

.admin-header-block::after {
  content: "⁂";
  position: absolute;
  right: 0;
  bottom: 0.35rem;
  font-size: 0.85rem;
  color: var(--gold-ink);
  opacity: 0.35;
  pointer-events: none;
}

.admin-eyebrow {
  font-family: var(--font-caps);
  font-size: 0.68rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--wine);
  margin: 0 0 0.4rem;
}

.admin-title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.45rem, 3.5vw, 1.85rem);
  letter-spacing: 0.1em;
}

.admin-lead {
  margin: 0;
  font-size: 1.02rem;
  color: var(--ink-muted);
  line-height: 1.55;
}

.admin-section {
  margin-bottom: 2rem;
}

.admin-card {
  padding: 1.35rem 1.15rem 1.25rem;
  border: 1px solid var(--rule);
  background: var(--paper-raised);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.45) inset;
}

.admin-form {
  display: grid;
  gap: 1rem;
}

.field {
  display: block;
}

.field-label {
  display: block;
  font-family: var(--font-caps);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 0.35rem;
}

.field-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--ink-muted);
  font-style: italic;
}

input,
textarea {
  width: 100%;
  margin: 0;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  padding: 0.6rem 0.75rem;
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  transition: border-color var(--t), box-shadow var(--t);
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 1px rgba(26, 20, 16, 0.08);
}

textarea {
  resize: vertical;
  min-height: 110px;
}

input[type="file"] {
  padding: 0.45rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.admin-status {
  margin-top: 0.85rem;
  min-height: 1.4em;
  font-size: 0.98rem;
}

.status-ok {
  color: var(--success);
}

.status-error {
  color: var(--danger);
}

.catalog-lead {
  font-size: 0.95rem;
  color: var(--ink-muted);
  margin: 0 0 0.85rem;
}

.building-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.building-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--rule-light);
  background: rgba(255, 255, 255, 0.35);
  animation: row-in 0.35s var(--ease);
  cursor: pointer;
  transition: border-color var(--t), background var(--t);
}

.building-row:hover,
.building-row:focus-visible {
  border-color: var(--rule);
  background: rgba(255, 255, 255, 0.52);
}

@keyframes row-in {
  from {
    opacity: 0;
    transform: translateX(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .building-row {
    animation: none;
  }
}

.building-row__thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border: 1px solid var(--rule);
  flex-shrink: 0;
  background: var(--paper-shadow);
}

.building-row__meta {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.building-row__name {
  font-family: var(--font-caps);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 0.1rem;
  line-height: 1.3;
  word-break: break-word;
}

.building-row__id {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  margin: 0;
}

.catalog-empty {
  text-align: center;
  font-size: 0.95rem;
  color: var(--ink-muted);
  padding: 1rem;
  border: 1px dashed var(--rule);
  background: rgba(255, 255, 255, 0.25);
}

body.modal-open {
  overflow: hidden;
}

.admin-edit-modal .modal-card {
  max-height: min(92vh, 860px);
  overflow: auto;
}

.admin-edit-card {
  text-align: left;
}

.admin-edit-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.admin-edit-head .admin-eyebrow {
  margin: 0 0 0.2rem;
}

.admin-edit-close {
  width: 2.25rem;
  height: 2.25rem;
  flex: 0 0 auto;
  border: 1px solid var(--rule);
  background: rgba(255, 255, 255, 0.45);
  color: var(--ink);
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
}

.admin-edit-close:hover {
  background: var(--paper-raised);
}

.admin-edit-form {
  gap: 0.85rem;
}

.admin-edit-preview {
  margin: 0;
  border: 1px solid var(--rule-light);
  background: rgba(255, 255, 255, 0.35);
  min-height: 180px;
}

.admin-edit-preview img {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: cover;
}

.admin-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.btn:focus-visible,
.option-card:focus-visible,
.back-link:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--forest);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .game-brand {
    order: 3;
    width: 100%;
    flex-basis: 100%;
  }

  .game-header {
    justify-content: center;
  }

  .building-row {
    flex-wrap: wrap;
  }

  .building-row .btn-danger {
    width: 100%;
    margin-top: 0.2rem;
  }

  .admin-edit-actions .btn {
    width: 100%;
  }
}

::selection {
  background: rgba(92, 36, 48, 0.18);
  color: var(--ink);
}

/**
 * Классический «фолиант»: EB Garamond + Cinzel, рамки, правила, без стеклянных карточек.
 */

:root {
  --paper: #ebe4d6;
  --paper-raised: #f3ede3;
  --paper-shadow: #d4cbb8;
  --ink: #1a1410;
  --ink-muted: #4a4238;
  --rule: #8b7a66;
  --rule-light: rgba(74, 66, 56, 0.22);
  --wine: #5c2430;
  --wine-soft: rgba(92, 36, 48, 0.12);
  --forest: #2f3d32;
  --gold-ink: #6b5420;
  --danger: #8b1c10;
  --success: #1e4d32;
  --font-caps: "Cinzel", "Palatino Linotype", Palatino, serif;
  --font-body: "EB Garamond", "Palatino Linotype", Georgia, serif;
  --font-ui: var(--font-body);
  --radius: 0;
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --t: 0.22s var(--ease);
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 1.2rem;
  line-height: 1.55;
  font-weight: 400;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

/* ——— Фон: бумага ——— */
.app-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.app-bg__paper {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 70% at 0% 40%, rgba(92, 36, 48, 0.04) 0%, transparent 45%),
    radial-gradient(ellipse 70% 60% at 100% 60%, rgba(107, 84, 32, 0.05) 0%, transparent 42%),
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(255, 255, 255, 0.48) 0%, transparent 55%),
    linear-gradient(180deg, #efe8dc 0%, var(--paper) 35%, #e2d9c8 100%);
}

.app-bg__fibers {
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.spb-shell {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 100vh;
}

.menu-page .spb-shell {
  padding: clamp(1.25rem, 4vw, 2.75rem) clamp(0.75rem, 3vw, 1.5rem) 2.5rem;
}

/* Разворот: поле набора + страница */
.folio-spread {
  display: grid;
  gap: 0 1.5rem;
  align-items: start;
  max-width: 52rem;
  margin: 0 auto;
}

@media (min-width: 860px) {
  .folio-spread {
    grid-template-columns: minmax(0, 2.75rem) minmax(0, 1fr);
  }
}

.folio-margin {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  padding-top: 2.5rem;
  border-right: 1px solid var(--rule-light);
  min-height: 12rem;
}

@media (min-width: 860px) {
  .folio-margin {
    display: flex;
  }
}

.folio-margin__rot {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: var(--font-caps);
  font-size: 0.58rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-muted);
  opacity: 0.85;
  max-height: 14rem;
}

.folio-margin__block {
  font-family: var(--font-caps);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--gold-ink);
  opacity: 0.75;
}

h1,
h2,
h3,
.admin-title,
.modal-title,
.section-heading {
  font-family: var(--font-caps);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.06em;
}

h2,
.quiz-prompt,
.section-heading {
  font-size: clamp(1.15rem, 2.2vw, 1.45rem);
  line-height: 1.35;
  margin: 0 0 0.85rem;
}

h3,
.modal-title {
  font-size: 1.35rem;
  margin: 0 0 0.6rem;
}

p {
  margin: 0 0 1rem;
}

[data-reveal] {
  opacity: 0;
  transform: translate3d(0, 20px, 0);
  transition:
    opacity 0.85s var(--ease),
    transform 0.85s var(--ease);
}

[data-reveal].is-inview {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* ——— Главная: фолиант ——— */
.folio {
  max-width: 42rem;
  margin: 0;
  min-width: 0;
}

@media (max-width: 859px) {
  .folio {
    margin: 0 auto;
  }
}

.folio-frame {
  position: relative;
  border: 3px double var(--rule);
  padding: 2px;
  background: var(--paper-raised);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.65) inset,
    0 12px 40px rgba(26, 20, 16, 0.08);
  animation: folio-settle 1.1s var(--ease) both;
}

@keyframes folio-settle {
  from {
    opacity: 0;
    transform: translateY(10px) rotate(-0.35deg);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .folio-frame {
    animation: none;
  }
}

.folio-frame__inner {
  position: relative;
  border: 1px solid var(--rule-light);
  padding: clamp(1.5rem, 4vw, 2.5rem) clamp(1.25rem, 3vw, 2rem);
}

/* Уголки «верстки» */
.folio-frame__inner::before,
.folio-frame__inner::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: var(--gold-ink);
  border-style: solid;
  opacity: 0.35;
  pointer-events: none;
}

.folio-frame__inner::before {
  top: 0.65rem;
  left: 0.65rem;
  border-width: 1px 0 0 1px;
}

.folio-frame__inner::after {
  right: 0.65rem;
  bottom: 0.65rem;
  border-width: 0 1px 1px 0;
}

.folio-masthead {
  text-align: center;
  margin-bottom: 1.75rem;
}

.folio-masthead__epoch {
  margin: 0 0 0.5rem;
  font-family: var(--font-caps);
  font-size: clamp(0.58rem, 1.8vw, 0.72rem);
  letter-spacing: clamp(0.18em, 1.2vw, 0.38em);
  text-transform: uppercase;
  color: var(--ink-muted);
  max-width: 22rem;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.45;
}

.folio-masthead__rule {
  width: 4rem;
  height: 1px;
  margin: 0 auto 1rem;
  background: var(--rule);
  opacity: 0.65;
}

.folio-masthead__city {
  margin: 0 0 0.35rem;
  font-family: var(--font-caps);
  font-size: clamp(1.65rem, 4.5vw, 2.35rem);
  font-weight: 700;
  letter-spacing: 0.18em;
  line-height: 1.2;
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.folio-masthead__tag {
  margin: 0;
  font-size: 0.95rem;
  font-style: italic;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
}

.folio-masthead__printer {
  margin-top: 1.1rem;
  font-family: var(--font-caps);
  font-size: 0.62rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--wine);
  opacity: 0.55;
}

.folio-fleuron {
  margin: 0.25rem 0 1.25rem;
  text-align: center;
  font-family: var(--font-body);
  font-size: 1.15rem;
  color: var(--gold-ink);
  letter-spacing: 0.35em;
  opacity: 0.55;
}

.folio-fleuron span {
  display: inline-block;
  padding: 0 0.25rem;
}

.folio-fleuron--arch span {
  font-family: var(--font-caps);
  font-size: 1.35rem;
  line-height: 1;
  color: var(--wine);
  opacity: 0.35;
}

.folio-fleuron--small {
  margin: 1.5rem 0 1.25rem;
  font-size: 0.95rem;
  letter-spacing: 0.5em;
  opacity: 0.45;
}

.folio-lead {
  margin-bottom: 1rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--rule-light);
}

.folio-lead__title {
  margin: 0 0 0.75rem;
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--forest);
}

.folio-lead__text {
  margin: 0;
  text-align: justify;
  hyphens: auto;
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.65;
}

.folio-lead__text::first-letter {
  float: left;
  margin: 0.16em 0.28rem 0 0;
  padding: 0.08rem 0.35rem 0.14rem;
  font-family: var(--font-caps);
  font-size: 3.1rem;
  line-height: 0.78;
  font-weight: 700;
  color: var(--paper-raised);
  background: linear-gradient(165deg, var(--wine) 0%, #3f1820 100%);
  border: 1px solid rgba(26, 20, 16, 0.2);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset;
}

.folio-toc {
  margin: 0;
  padding: 0;
}

.folio-toc__heading {
  margin: 0 0 0.5rem;
  padding: 0 0 0.35rem;
  font-size: 0.98rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--wine);
  border-bottom: 2px solid var(--wine-soft);
}

.folio-toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.folio-toc__list li {
  margin: 0;
  border-bottom: 1px solid var(--rule-light);
}

.folio-toc__list li:last-child {
  border-bottom: none;
}

.folio-toc__link {
  position: relative;
  display: grid;
  grid-template-columns: 3.25rem 1fr auto;
  gap: 0.75rem 1rem;
  align-items: center;
  padding: 1.05rem 0.35rem 1.05rem 0.5rem;
  text-decoration: none;
  color: inherit;
  transition: background var(--t), padding-left 0.28s var(--ease);
}

.folio-toc__link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.65rem;
  bottom: 0.65rem;
  width: 3px;
  background: var(--wine);
  opacity: 0;
  transform: scaleY(0.4);
  transform-origin: center top;
  transition: opacity 0.25s var(--ease), transform 0.28s var(--ease);
}

.folio-toc__link:hover {
  background: linear-gradient(90deg, rgba(92, 36, 48, 0.07) 0%, rgba(92, 36, 48, 0.02) 38%, transparent 100%);
  padding-left: 0.75rem;
}

.folio-toc__link:hover::before {
  opacity: 0.85;
  transform: scaleY(1);
}

.folio-toc__link:focus-visible {
  outline: 2px solid var(--wine);
  outline-offset: 2px;
}

.folio-toc__num-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  border: 3px double var(--rule-light);
  background: rgba(255, 255, 255, 0.35);
}

.folio-toc__num {
  font-family: var(--font-caps);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gold-ink);
  line-height: 1;
}

.folio-toc__link:hover .folio-toc__num-wrap {
  border-color: rgba(92, 36, 48, 0.25);
  background: rgba(255, 255, 255, 0.55);
}

.folio-toc__body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.folio-toc__name {
  font-family: var(--font-caps);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  transition: color 0.22s var(--ease), letter-spacing 0.28s var(--ease);
}

.folio-toc__link:hover .folio-toc__name {
  color: var(--wine);
  letter-spacing: 0.1em;
}

.folio-toc__hint {
  font-size: 0.95rem;
  color: var(--ink-muted);
  line-height: 1.4;
}

.folio-toc__folio {
  font-family: var(--font-caps);
  font-size: 0.75rem;
  color: var(--ink-muted);
  opacity: 0.6;
}

.folio-epigraph {
  position: relative;
  margin: 2rem 0 0;
  padding: 1.35rem 1rem 1.35rem 2.15rem;
  border: 1px solid var(--rule-light);
  border-left: 3px solid var(--wine);
  font-style: italic;
  color: var(--ink-muted);
  background: linear-gradient(100deg, rgba(92, 36, 48, 0.06) 0%, rgba(255, 255, 255, 0.18) 55%);
}

.folio-epigraph::before {
  content: "";
  position: absolute;
  top: 0.65rem;
  right: 0.85rem;
  width: 2.5rem;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-ink), transparent);
  opacity: 0.4;
  pointer-events: none;
}

.folio-epigraph p {
  margin: 0 0 0.5rem;
  font-size: 1.08rem;
  line-height: 1.55;
}

.folio-epigraph cite {
  font-style: normal;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

.folio-colophon {
  margin-top: 2.25rem;
  text-align: center;
}

.folio-colophon__rule {
  width: 100%;
  max-width: 12rem;
  height: 1px;
  margin: 0 auto 1rem;
  background: linear-gradient(90deg, transparent, var(--rule), transparent);
  opacity: 0.5;
}

.folio-colophon p {
  margin: 0;
  font-family: var(--font-caps);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-muted);
  line-height: 1.6;
}

/* ——— Кнопки (прямоугольные, «типографские») ——— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  padding: 0.65rem 1.35rem;
  font-family: var(--font-caps);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  transition:
    color var(--t),
    background var(--t),
    border-color var(--t);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--ink);
  color: var(--paper-raised);
  border-color: var(--ink);
}

.btn-primary:hover:not(:disabled) {
  background: var(--wine);
  border-color: var(--wine);
  color: #fff;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.35);
  border-color: var(--rule);
  color: var(--ink);
}

.btn-ghost:hover:not(:disabled) {
  border-color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
}

.btn-danger {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
  font-size: 0.72rem;
  padding: 0.4rem 0.75rem;
}

.btn-danger:hover:not(:disabled) {
  background: rgba(139, 28, 16, 0.06);
}

.btn-next {
  margin-top: 1.5rem;
  width: 100%;
  max-width: 18rem;
  margin-left: auto;
  margin-right: auto;
  display: flex;
}

.btn-block {
  width: 100%;
}

.menu-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  justify-content: center;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-caps);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--forest);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.back-link:hover {
  border-bottom-color: var(--rule);
  color: var(--ink);
}

.back-icon {
  font-size: 1.2rem;
  line-height: 1;
}

/* ——— Квиз ——— */
.game-page {
  padding-bottom: 2.5rem;
}

.game-header {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 3vw, 1.75rem) 1.35rem;
  border-bottom: 3px double var(--rule-light);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.35) 0%, rgba(243, 237, 227, 0.95) 100%);
}

.game-header::after {
  content: "✦";
  position: absolute;
  left: 50%;
  bottom: -0.5rem;
  transform: translateX(-50%);
  font-size: 0.55rem;
  letter-spacing: 0.15em;
  color: var(--gold-ink);
  opacity: 0.5;
  pointer-events: none;
}

.game-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  justify-content: center;
  min-width: 0;
}

.game-brand__line {
  flex: 1;
  max-width: 5rem;
  height: 1px;
  background: var(--rule);
  opacity: 0.45;
}

.game-brand__text {
  font-family: var(--font-body);
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--wine);
  white-space: nowrap;
}

.game-header__scores {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.game-streak {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.06rem;
  padding: 0.28rem 0.5rem 0.32rem;
  border: 1px dashed var(--rule);
  background: rgba(255, 255, 255, 0.35);
  min-width: 3.1rem;
}

.game-streak__label {
  font-family: var(--font-caps);
  font-size: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-ink);
  line-height: 1;
}

.game-streak__value {
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  color: var(--ink);
}

.score {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.28rem 0.75rem 0.32rem;
  border: 1px solid var(--rule);
  background: rgba(255, 255, 255, 0.45);
  min-width: 4.25rem;
}

.score-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.12rem;
}

.score-label {
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 500;
  font-style: italic;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  color: var(--ink-muted);
  line-height: 1;
}

.score-value {
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  line-height: 1.1;
  min-width: 2ch;
  text-align: center;
}

.quiz-container {
  width: min(52rem, 94vw);
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
}

.quiz-panel {
  position: relative;
  padding: 1.75rem 1.25rem 2rem;
  border: 3px double var(--rule-light);
  background: var(--paper-raised);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset;
  animation: panel-in 0.5s var(--ease);
}

.quiz-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 8%;
  right: 8%;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(92, 36, 48, 0.2) 20%,
    rgba(107, 84, 32, 0.25) 50%,
    rgba(92, 36, 48, 0.2) 80%,
    transparent 100%
  );
  pointer-events: none;
}

.quiz-panel__meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
  text-align: center;
}

.quiz-round-hint {
  margin: 0;
  font-family: var(--font-caps);
  font-size: 0.52rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-muted);
  opacity: 0.82;
}

.quiz-stage {
  margin-bottom: 0.15rem;
}

.quiz-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  margin-top: 1.35rem;
  padding-top: 0.25rem;
}

.quiz-encouragement {
  margin: 0;
  max-width: 34rem;
  text-align: center;
  font-family: var(--font-body);
  font-size: 1rem;
  font-style: italic;
  font-weight: 500;
  line-height: 1.45;
  color: var(--forest);
}

.main-image-wrap--hero {
  perspective: 1200px;
}

.image-frame--hero {
  border-width: 2px;
  box-shadow:
    0 2px 0 rgba(26, 20, 16, 0.05),
    0 12px 32px rgba(26, 20, 16, 0.08);
  transform: translateZ(0);
  transition:
    box-shadow 0.35s ease,
    transform 0.35s ease;
}

.quiz-panel:hover .image-frame--hero {
  box-shadow:
    0 2px 0 rgba(26, 20, 16, 0.04),
    0 18px 44px rgba(26, 20, 16, 0.1);
}

.image-frame--hero img {
  max-height: min(440px, 48vh);
}

@media (max-width: 640px) {
  .image-frame--hero img {
    max-height: min(300px, 42vh);
  }
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .quiz-panel {
    animation: none;
  }
}

@keyframes quiz-panel-pulse {
  0% {
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.5) inset,
      0 0 0 0 rgba(30, 77, 50, 0.2);
  }
  70% {
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.5) inset,
      0 0 0 12px rgba(30, 77, 50, 0);
  }
  100% {
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.5) inset,
      0 0 0 0 rgba(30, 77, 50, 0);
  }
}

.quiz-panel--pulse {
  animation: quiz-panel-pulse 0.95s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .quiz-panel--pulse {
    animation: none;
  }
}

.quiz-mode-label {
  margin: 0 0 0.4rem;
  text-align: center;
  font-family: var(--font-caps);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--wine);
  opacity: 0.88;
  min-height: 1.15em;
}

.quiz-prompt {
  margin: 0 0 0.75rem;
  font-family: var(--font-body);
  font-weight: 500;
  font-style: italic;
  text-align: center;
  color: var(--ink);
}

.quiz-target-name {
  margin: 0 auto 1rem;
  max-width: 38rem;
  padding: 0.65rem 1rem;
  text-align: center;
  font-family: var(--font-caps);
  font-size: clamp(0.95rem, 2.4vw, 1.28rem);
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1.3;
  color: var(--ink);
  border: 1px solid var(--rule-light);
  background: rgba(255, 255, 255, 0.5);
}

.quiz-excerpt {
  margin: 0 auto 1.15rem;
  max-width: 40rem;
  padding: 0.9rem 1rem 0.95rem 1.15rem;
  border-left: 3px solid var(--wine);
  background: rgba(255, 255, 255, 0.38);
  font-family: var(--font-body);
  font-size: 1.02rem;
  line-height: 1.58;
  text-align: justify;
  color: var(--ink);
}

.main-image-wrap {
  margin-bottom: 1.25rem;
}

.image-frame {
  position: relative;
  border: 1px solid var(--rule);
  overflow: hidden;
  box-shadow: 0 2px 0 rgba(26, 20, 16, 0.06);
}

.image-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.image-frame img {
  width: 100%;
  max-height: min(400px, 52vh);
  object-fit: cover;
  display: block;
  vertical-align: middle;
}

.options-grid {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.options-grid--facades {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 720px) {
  .options-grid--facades {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@keyframes option-rise {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.option-card {
  position: relative;
  text-align: left;
  border: 1px solid var(--rule-light);
  background: rgba(255, 255, 255, 0.4);
  color: var(--ink);
  border-radius: var(--radius);
  cursor: pointer;
  overflow: hidden;
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
  animation: option-rise 0.58s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.options-grid .option-card:nth-child(1) {
  animation-delay: 0.04s;
}

.options-grid .option-card:nth-child(2) {
  animation-delay: 0.1s;
}

.options-grid .option-card:nth-child(3) {
  animation-delay: 0.16s;
}

.options-grid .option-card:nth-child(4) {
  animation-delay: 0.22s;
}

.options-grid .option-card:nth-child(5) {
  animation-delay: 0.28s;
}

.options-grid .option-card:nth-child(6) {
  animation-delay: 0.34s;
}

@media (prefers-reduced-motion: reduce) {
  .option-card {
    animation: none;
  }
}

.option-card:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--rule);
  box-shadow: 0 4px 14px rgba(26, 20, 16, 0.06);
}

.option-card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}

.option-card span,
.option-card.text-option {
  display: block;
  padding: 0.65rem 0.75rem;
  font-size: 0.98rem;
  line-height: 1.45;
}

.option-card.text-option {
  min-height: 3.25rem;
  display: flex;
  align-items: center;
}

.option-card.image-only {
  padding: 0;
  aspect-ratio: 4 / 3;
}

.option-card.image-only img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  display: block;
}

.option-correct {
  border-color: var(--success) !important;
  box-shadow: 0 0 0 1px rgba(30, 77, 50, 0.25);
  animation: correct-pulse 0.45s ease;
}

@keyframes option-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  18% {
    transform: translateX(-5px);
  }
  36% {
    transform: translateX(5px);
  }
  54% {
    transform: translateX(-3px);
  }
  72% {
    transform: translateX(3px);
  }
}

.option-wrong {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 1px rgba(139, 28, 16, 0.22);
  animation: option-shake 0.52s ease;
}

.option-should {
  border-color: var(--forest) !important;
  border-style: dashed;
  box-shadow: 0 0 0 1px rgba(30, 77, 50, 0.22);
  animation: correct-pulse 0.55s ease;
}

@media (prefers-reduced-motion: reduce) {
  .option-wrong,
  .option-should {
    animation: none;
  }
}

@keyframes correct-pulse {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.04);
  }
}

.hidden {
  display: none !important;
}

/* ——— Модальное окно ——— */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 20, 16, 0.45);
  animation: fade-in 0.25s ease;
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(32rem, 100%);
  padding: 2rem 1.75rem 1.75rem;
  border: 3px double var(--rule);
  background: var(--paper-raised);
  box-shadow: 0 18px 48px rgba(26, 20, 16, 0.15);
  animation: modal-in 0.4s var(--ease);
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: scale(0.98) translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal-card {
    animation: none;
  }
}

.modal-ornament {
  width: 3rem;
  height: 2px;
  margin: 0 auto 1rem;
  background: var(--wine);
  opacity: 0.5;
}

.modal-title {
  text-align: center;
  font-style: normal;
}

.modal-correct {
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: 600;
  font-style: italic;
  color: var(--forest);
  text-align: center;
  margin-bottom: 0.85rem;
}

.modal-desc {
  color: var(--ink-muted);
  font-size: 1.02rem;
  margin-bottom: 1.35rem;
  max-height: 38vh;
  overflow-y: auto;
  text-align: justify;
}

.modal-actions {
  justify-content: center;
}

.modal-card--wide {
  width: min(38rem, 100%);
  padding: 1.85rem 1.5rem 1.65rem;
}

.modal-figure {
  margin: 0 auto 1rem;
  max-width: 22rem;
}

.modal-figure img {
  width: 100%;
  height: auto;
  max-height: min(240px, 38vh);
  object-fit: cover;
  display: block;
  border: 1px solid var(--rule);
  box-shadow: 0 10px 32px rgba(26, 20, 16, 0.12);
}

.modal-figure__cap {
  margin: 0.5rem 0 0;
  text-align: center;
  font-size: 0.8rem;
  font-style: italic;
  color: var(--ink-muted);
}

.modal-actions.modal-actions--stack {
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  max-width: 22rem;
  margin-left: auto;
  margin-right: auto;
  gap: 0.75rem;
}

.modal-actions__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: center;
}

.modal-actions__row .btn {
  flex: 1 1 auto;
  min-width: min(10rem, 38vw);
}

/* ——— Обучение ——— */
.learn-page {
  padding-bottom: 0;
}

.learn-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 2rem;
}

.learn-cards-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 0;
}

.learn-app > .learn-list-panel:not(.hidden) {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.learn-journey {
  width: min(56rem, 94vw);
  margin: 0 auto;
  padding: 0.35rem clamp(1rem, 3vw, 1rem) 0.65rem;
  border-bottom: 1px solid var(--rule-light);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.25) 0%, transparent 100%);
}

.learn-journey[hidden] {
  display: none !important;
}

.learn-journey__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  margin-bottom: 0.5rem;
}

.learn-journey__label {
  font-family: var(--font-caps);
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--wine);
  opacity: 0.88;
}

.learn-journey__step {
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-style: italic;
  color: var(--ink-muted);
  line-height: 1.35;
  text-align: right;
  flex: 1;
  min-width: min(100%, 12rem);
}

.learn-progress--journey {
  width: 100%;
  margin: 0;
  padding: 0;
}

.learn-progress__track {
  height: 5px;
  border-radius: 999px;
  background: rgba(74, 60, 42, 0.1);
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) inset;
}

.learn-progress__fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--wine), rgba(107, 84, 32, 0.9));
  transition: width 0.45s var(--ease);
}

@media (prefers-reduced-motion: reduce) {
  .learn-progress__fill {
    transition: none;
  }
}

.learn-hint {
  margin: 0 auto 0.5rem;
  padding: 0.5rem 1rem 0;
  max-width: 44rem;
  text-align: center;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-style: italic;
  line-height: 1.45;
  color: var(--ink-muted);
  opacity: 0.9;
}

.learn-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem clamp(1rem, 3vw, 1.75rem);
  border-bottom: 3px double var(--rule-light);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.3) 0%, rgba(243, 237, 227, 0.95) 100%);
  position: relative;
  z-index: 2;
}

.learn-back {
  margin: 0;
}

.learn-header__right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.55rem;
  flex-shrink: 0;
  min-width: min-content;
}

.learn-view-toggle {
  display: inline-flex;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  border: 1px solid var(--rule-light);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.35);
}

.learn-toggle-btn {
  margin: 0;
  padding: 0.38rem 0.65rem;
  font-family: var(--font-caps);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition:
    background var(--t),
    color var(--t);
}

.learn-toggle-btn.is-active {
  color: var(--paper-raised);
  background: linear-gradient(165deg, var(--wine), #3a1720);
}

.learn-toggle-btn:not(.is-active):hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.5);
}

.learn-header__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
  text-align: right;
}

.learn-kicker {
  font-family: var(--font-caps);
  font-size: 0.58rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--wine);
  opacity: 0.88;
}

.learn-counter {
  font-family: var(--font-caps);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.lesson-spread {
  width: min(56rem, 96vw);
  margin: 0 auto 1rem;
}

.lesson-card-stack {
  border: 3px double var(--rule-light);
  border-radius: 3px;
  background: var(--paper-raised);
  overflow: hidden;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.5) inset,
    0 10px 36px rgba(26, 20, 16, 0.06);
}

.lesson-spread__sheet {
  display: grid;
  gap: 1.15rem 1.5rem;
  align-items: stretch;
  border: none;
  border-radius: 0;
  background: transparent;
  padding: clamp(1rem, 3vw, 1.45rem);
  box-shadow: none;
}

@keyframes lesson-sheet-fade {
  from {
    opacity: 0.45;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lesson-spread__sheet.lesson-sheet--reveal {
  animation: lesson-sheet-fade 0.4s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .lesson-spread__sheet.lesson-sheet--reveal {
    animation: none;
  }
}

@media (min-width: 800px) {
  .lesson-spread__sheet {
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  }
}

.lesson-figure {
  position: relative;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
}

.lesson-more-bar {
  border-top: 1px solid var(--rule-light);
  padding: 0.85rem clamp(1rem, 3vw, 1.5rem) 1rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.3) 0%, rgba(243, 237, 227, 0.72) 100%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
}

.lesson-more-bar[hidden] {
  display: none !important;
}

.lesson-more-bar .lesson-more-btn {
  width: 100%;
  max-width: 100%;
  justify-content: center;
  min-height: 2.65rem;
  font-family: var(--font-caps);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.lesson-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.lesson-more-btn::after {
  content: "↗";
  font-size: 0.85em;
  opacity: 0.85;
}

.lesson-article__eyebrow {
  margin: 0 0 0.28rem;
  font-family: var(--font-caps);
  font-size: 0.54rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--wine);
  opacity: 0.86;
}

.lesson-figure__frame {
  position: relative;
  z-index: 0;
  border: 1px solid var(--rule);
  background: rgba(255, 255, 255, 0.4);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  max-height: min(48vh, 420px);
}

.lesson-figure__frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lesson-figure__cap {
  font-size: 0.8rem;
  font-style: italic;
  color: var(--ink-muted);
  text-align: center;
  line-height: 1.35;
}

.lesson-article {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-left: none;
  padding-left: 0;
}

@media (min-width: 800px) {
  .lesson-article {
    border-left: 1px solid var(--rule-light);
    padding-left: 1.25rem;
  }
}

.lesson-article__head {
  margin-bottom: 0.6rem;
}

.lesson-article__title {
  margin: 0;
  font-family: var(--font-caps);
  font-size: clamp(1.15rem, 2.6vw, 1.55rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.06em;
  color: var(--ink);
}

.lesson-article__rule {
  height: 2px;
  margin-top: 0.5rem;
  max-width: 12rem;
  background: linear-gradient(90deg, var(--wine) 0%, transparent 100%);
  opacity: 0.4;
}

.lesson-article__body {
  flex: 1;
  overflow-y: auto;
  max-height: min(44vh, 380px);
  padding-right: 0.2rem;
}

.lesson-article__body p {
  margin: 0;
  font-size: 1.06rem;
  line-height: 1.62;
  text-align: justify;
  color: var(--ink);
}

.learn-list-panel {
  width: min(52rem, 100%);
  margin: 0 auto;
  padding: 0 clamp(0.65rem, 3vw, 1.35rem) 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 0;
}

.learn-catalog-head {
  padding: 0.15rem 0 0.25rem;
  border-bottom: 3px double var(--rule-light);
}

.learn-catalog-head__title {
  margin: 0 0 0.4rem;
  font-family: var(--font-caps);
  font-size: clamp(1rem, 2.8vw, 1.25rem);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
}

.learn-catalog-head__lead {
  margin: 0;
  max-width: 40rem;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink-muted);
}

.learn-catalog {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.learn-catalog__empty {
  margin: 0;
  padding: 2rem 1rem;
  text-align: center;
  font-size: 1rem;
  color: var(--ink-muted);
  border: 1px dashed var(--rule);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.35);
}

.learn-catalog__item {
  margin: 0;
}

.learn-catalog-card {
  display: grid;
  grid-template-columns: auto 5.5rem 1fr auto;
  gap: 0.65rem 0.85rem;
  align-items: center;
  width: 100%;
  padding: 0.65rem 0.75rem 0.65rem 0.65rem;
  text-align: left;
  border: 1px solid var(--rule-light);
  border-radius: 4px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.55) 0%, rgba(243, 237, 227, 0.65) 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.55) inset;
  cursor: pointer;
  color: inherit;
  font: inherit;
  transition:
    border-color 0.22s var(--ease),
    box-shadow 0.22s var(--ease),
    transform 0.22s var(--ease);
}

.learn-catalog-card:hover {
  border-color: rgba(92, 36, 48, 0.28);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.55) inset,
    0 8px 28px rgba(26, 20, 16, 0.08);
  transform: translateY(-1px);
}

.learn-catalog-card:active {
  transform: translateY(0);
}

.learn-catalog-card__ix {
  font-family: var(--font-caps);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--gold-ink);
  opacity: 0.85;
  padding: 0 0.15rem;
  min-width: 1.75rem;
  text-align: center;
}

.learn-catalog-card__media {
  position: relative;
  width: 5.5rem;
  height: 4rem;
  border-radius: 2px;
  border: 1px solid var(--rule);
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(92, 36, 48, 0.06) 0%, rgba(255, 255, 255, 0.4) 100%),
    repeating-linear-gradient(
      -12deg,
      rgba(74, 60, 42, 0.04) 0 2px,
      transparent 2px 6px
    );
}

.learn-catalog-card__media--broken {
  display: flex;
  align-items: center;
  justify-content: center;
}

.learn-catalog-card__media--broken::after {
  content: "◆";
  font-size: 0.85rem;
  color: var(--wine);
  opacity: 0.35;
}

.learn-catalog-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.learn-catalog-card__src-badge {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: rgba(30, 77, 50, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 2px 6px rgba(26, 20, 16, 0.15);
}

.learn-catalog-card__src-badge::after {
  content: "↗";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 0.55rem;
  color: var(--paper-raised);
  line-height: 1;
}

.learn-catalog-card__main {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
}

.learn-catalog-card__name {
  font-family: var(--font-caps);
  font-size: clamp(0.78rem, 2.2vw, 0.92rem);
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.28;
  color: var(--ink);
}

.learn-catalog-card__lede {
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--ink-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.learn-catalog-card__chev {
  font-size: 1.35rem;
  font-weight: 300;
  color: var(--wine);
  opacity: 0.45;
  line-height: 1;
  padding-left: 0.15rem;
}

@media (max-width: 520px) {
  .learn-catalog-card {
    grid-template-columns: auto 4.25rem 1fr auto;
    gap: 0.5rem 0.55rem;
    padding: 0.55rem 0.55rem 0.55rem 0.45rem;
  }

  .learn-catalog-card__media {
    width: 4.25rem;
    height: 3.35rem;
  }

  .learn-catalog-card__lede {
    -webkit-line-clamp: 3;
    font-size: 0.82rem;
  }
}

.lesson-controls {
  display: flex;
  gap: 0.65rem;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0 1rem 1.75rem;
}

.lesson-nav-btn {
  min-width: min(10.5rem, 44vw);
  min-height: 2.85rem;
}

.ctrl-arrow {
  font-size: 1rem;
  opacity: 0.85;
}

/* ——— Админка ——— */
.admin-wrap {
  min-height: 100vh;
  padding: clamp(1.25rem, 3vw, 2rem) 1rem 2.5rem;
}

.admin-layout {
  width: min(38rem, 100%);
  margin: 0 auto;
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.admin-back {
  margin: 0;
}

.admin-logout {
  font-family: var(--font-caps);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--wine);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.admin-logout:hover {
  border-bottom-color: var(--rule);
  color: var(--ink);
}

/* ——— Вход в канцелярию ——— */
.admin-login-page .spb-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem 1rem;
}

.admin-login-wrap {
  width: 100%;
  max-width: 22rem;
}

.admin-login-card {
  border: 3px double var(--rule);
  padding: 1.75rem 1.5rem 1.5rem;
  background: var(--paper-raised);
  box-shadow: 0 10px 32px rgba(26, 20, 16, 0.07);
}

.admin-login-eyebrow {
  font-family: var(--font-caps);
  font-size: 0.65rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--wine);
  margin: 0 0 0.45rem;
}

.admin-login-title {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  letter-spacing: 0.08em;
}

.admin-login-lead {
  margin: 0 0 1.1rem;
  font-size: 0.98rem;
  color: var(--ink-muted);
  line-height: 1.5;
}

.admin-login-error {
  margin: 0 0 0.85rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid rgba(139, 28, 16, 0.35);
  background: rgba(139, 28, 16, 0.06);
  color: var(--danger);
  font-size: 0.92rem;
}

.admin-login-form {
  display: grid;
  gap: 1rem;
}

.admin-login-back {
  margin: 1.25rem 0 0;
}

.admin-header-block {
  position: relative;
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 3px double var(--rule-light);
}

.admin-header-block::after {
  content: "⁂";
  position: absolute;
  right: 0;
  bottom: 0.35rem;
  font-size: 0.85rem;
  color: var(--gold-ink);
  opacity: 0.35;
  pointer-events: none;
}

.admin-eyebrow {
  font-family: var(--font-caps);
  font-size: 0.68rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--wine);
  margin: 0 0 0.4rem;
}

.admin-title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.45rem, 3.5vw, 1.85rem);
  letter-spacing: 0.1em;
}

.admin-lead {
  margin: 0;
  font-size: 1.02rem;
  color: var(--ink-muted);
  line-height: 1.55;
}

.admin-section {
  margin-bottom: 2rem;
}

.admin-card {
  padding: 1.35rem 1.15rem 1.25rem;
  border: 1px solid var(--rule);
  background: var(--paper-raised);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.45) inset;
}

.admin-form {
  display: grid;
  gap: 1rem;
}

.field {
  display: block;
}

.field-label {
  display: block;
  font-family: var(--font-caps);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 0.35rem;
}

.field-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--ink-muted);
  font-style: italic;
}

input,
textarea {
  width: 100%;
  margin: 0;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  padding: 0.6rem 0.75rem;
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  transition: border-color var(--t), box-shadow var(--t);
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 1px rgba(26, 20, 16, 0.08);
}

textarea {
  resize: vertical;
  min-height: 110px;
}

input[type="file"] {
  padding: 0.45rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.admin-status {
  margin-top: 0.85rem;
  min-height: 1.4em;
  font-size: 0.98rem;
}

.status-ok {
  color: var(--success);
}

.status-error {
  color: var(--danger);
}

.catalog-lead {
  font-size: 0.95rem;
  color: var(--ink-muted);
  margin: 0 0 0.85rem;
}

.building-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.building-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--rule-light);
  background: rgba(255, 255, 255, 0.35);
  animation: row-in 0.35s var(--ease);
}

@keyframes row-in {
  from {
    opacity: 0;
    transform: translateX(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .building-row {
    animation: none;
  }
}

.building-row__thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border: 1px solid var(--rule);
  flex-shrink: 0;
  background: var(--paper-shadow);
}

.building-row__meta {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.building-row__name {
  font-family: var(--font-caps);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 0.1rem;
  line-height: 1.3;
  word-break: break-word;
}

.building-row__id {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  margin: 0;
}

.catalog-empty {
  text-align: center;
  font-size: 0.95rem;
  color: var(--ink-muted);
  padding: 1rem;
  border: 1px dashed var(--rule);
  background: rgba(255, 255, 255, 0.25);
}

.btn:focus-visible,
.option-card:focus-visible,
.back-link:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--forest);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .game-brand {
    order: 3;
    width: 100%;
    flex-basis: 100%;
  }

  .game-header {
    justify-content: center;
  }

  .building-row {
    flex-wrap: wrap;
  }

  .building-row .btn-danger {
    width: 100%;
    margin-top: 0.2rem;
  }
}

::selection {
  background: rgba(92, 36, 48, 0.18);
  color: var(--ink);
}
