/* site2 — styles (design Appendix A + architecture §§2,5,6) */

:root{
  /* палитра — глубокие морские чернила + тёплый свет лампы */
  --bg:#0F171E; --bg-deep:#0A1016; --surface:#1A232E; --surface-2:#222D39;
  --line:#2E3C4A; --line-strong:#57708A;
  --text:#F2EBDD; --text-2:#B9B2A6; --text-muted:#948E80;
  --accent:#E8A33D; --accent-soft:#F3C179; --on-accent:#0F171E;

  /* ветки */
  --a:#E2795F; --a-tint:rgba(226,121,95,.12);
  --b:#4FA8B8; --b-tint:rgba(79,168,184,.12);
  --c:#C07BA0; --c-tint:rgba(192,123,160,.12);
  --d:#7FB069; --d-tint:rgba(127,176,105,.12);
  --e:#8FA6E0; --e-tint:rgba(143,166,224,.12);

  /* бейджи */
  --badge-noege:#7FB069; --badge-work:#4FA8B8; --badge-home:#D9B26A;
  --badge-budget:#E8A33D; --badge-free:#7FB069;

  /* радиусы, тени, отступы */
  --r-sm:6px; --r-md:12px; --r-lg:16px; --r-xl:22px;
  --shadow-1:0 2px 8px rgba(0,0,0,.35);
  --shadow-2:0 10px 28px rgba(0,0,0,.45);
  --s-1:4px; --s-2:8px; --s-3:12px; --s-4:16px; --s-5:24px;
  --s-6:32px; --s-7:48px; --s-8:64px; --s-9:96px;

  /* движение */
  --dur-fast:140ms; --dur-base:220ms; --dur-slow:340ms; --dur-reveal:420ms;
  --ease-out:cubic-bezier(.22,1,.36,1); --ease-inout:cubic-bezier(.4,0,.2,1);

  color-scheme: dark;

  /* типографика — дизайн 3.1 */
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
                  "Times New Roman", serif;
  --font-text:    system-ui, -apple-system, "Segoe UI", Roboto,
                  "Helvetica Neue", Arial, sans-serif;
  --font-mono:    ui-monospace, "Cascadia Mono", Consolas, "SF Mono",
                  Menlo, "DejaVu Sans Mono", monospace;

  --container: 100%;
  --gutter: 16px;
  --section-gap: var(--s-8);
  --prose-max: 34em;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  color-scheme: dark;
  overflow-x: hidden;
}
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-text);
  font-size: clamp(1.0625rem, 1.03rem + .15vw, 1.125rem);
  line-height: 1.6;
  font-weight: 400;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
/* Многослойный «вечер у лампы»: тёплый свет сверху, глубина снизу, виньетка */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(1100px 640px at 50% -12%, rgba(232,163,61,.11), transparent 62%),
    radial-gradient(920px 660px at 92% 112%, rgba(79,168,184,.09), transparent 60%),
    radial-gradient(780px 600px at -8% 108%, rgba(192,123,160,.07), transparent 60%),
    linear-gradient(180deg, transparent 55%, rgba(10,16,22,.55));
}
img, svg { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-soft); }
ul, ol { margin: 0; padding: 0; list-style: none; }
p, h1, h2, h3, h4, dl, dd, dt { margin: 0; }
h1, h2, h3, h4 { font-weight: 600; text-wrap: pretty; hyphens: none; }
hr { border: 0; }
summary { list-style: none; }
summary::-webkit-details-marker { display: none; }
[hidden] { display: none !important; }

/* ---------- typography ---------- */
h1 {
  font-family: var(--font-display);
  font-size: clamp(2.125rem, 1.35rem + 3.3vw, 3.75rem);
  line-height: 1.12;
  letter-spacing: -.01em;
  font-weight: 600;
}
h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5625rem, 1.25rem + 1.35vw, 2.375rem);
  line-height: 1.2;
  font-weight: 600;
}
h3 {
  font-family: var(--font-text);
  font-size: clamp(1.1875rem, 1.13rem + .24vw, 1.375rem);
  line-height: 1.3;
  font-weight: 650;
}
h4 {
  font-family: var(--font-text);
  font-size: 1rem;
  line-height: 1.35;
  font-weight: 600;
}
.lead {
  font-size: clamp(1.1875rem, 1.1rem + .3vw, 1.3125rem);
  line-height: 1.55;
  color: var(--text);
  max-width: var(--prose-max);
}
.meta-label,
.node__meta,
.branch__meta,
.divider__seal,
.bonus__label {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-2);
}
.screen__note,
.find,
.route__pricenote,
.route__footnote,
.quiz-nojs,
.trail__note,
.node__note {
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-muted);
}
.route__price,
.step__num,
.sum {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ---------- layout shell ---------- */
.icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  color: currentColor;
}
.sprite { display: none !important; }

main {
  position: relative;
  z-index: 1;
}

.screen {
  width: min(100% - (var(--gutter) * 2), var(--container));
  margin-inline: auto;
  padding-block: var(--section-gap);
  max-width: 100%;
}
.screen > .lead { margin-top: var(--s-4); margin-bottom: var(--s-6); }
.screen > h2 + .lead { margin-top: var(--s-3); }
.screen__note { margin-top: var(--s-5); max-width: var(--prose-max); }

@media (min-width: 768px) {
  :root {
    --container: 704px;
    --gutter: 24px;
    --section-gap: 88px;
  }
  h1 { line-height: 1.08; }
  h2 { line-height: 1.15; }
  .lead { line-height: 1.6; }
}
@media (min-width: 1024px) {
  :root {
    --container: 928px;
    --gutter: 32px;
    --section-gap: 96px;
  }
}
@media (min-width: 1280px) {
  :root {
    --container: 1120px;
    --gutter: 40px;
    --section-gap: 112px;
  }
  .screen > .lead,
  .screen__note {
    max-width: 720px;
  }
}
@media (max-width: 320px) {
  h1 { font-size: 1.875rem; } /* 30px */
}

/* ---------- grain (data-URI feTurbulence) ---------- */
.grain {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: .05;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 180px 180px;
}

/* ---------- lamp light + section glows ---------- */
.screen {
  position: relative;
}
.screen > * {
  position: relative;
  z-index: 1;
}
#s1-cover,
#s5-razvilka {
  position: relative;
}
#s1-cover::before,
#s5-razvilka::before {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232,163,61,.22) 0%, rgba(232,163,61,.09) 38%, transparent 70%);
  animation: lamp-breathe 7s ease-in-out infinite alternate;
}
#s1-cover::before {
  width: min(90vw, 520px);
  height: min(90vw, 520px);
  top: -12%;
  right: -18%;
}
#s5-razvilka::before {
  width: min(100vw, 640px);
  height: min(100vw, 640px);
  top: 8%;
  left: 50%;
  transform: translateX(-50%);
}
@keyframes lamp-breathe {
  from { opacity: .7; }
  to { opacity: 1; }
}
/* Мягкое цветное свечение над остальными экранами */
#s2-bez-ege::before,
#s3-baza::before,
#s4-igry::before,
#s6-trofei::before,
#s7-pervyj-shag::before,
#s8-karta-goda::before,
#s9-zapiska::before {
  content: "";
  position: absolute;
  top: -70px;
  left: 50%;
  transform: translateX(-50%);
  width: min(780px, 96vw);
  height: 480px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(closest-side, var(--glow, rgba(232,163,61,.06)), transparent 72%);
}
#s2-bez-ege { --glow: rgba(232,163,61,.08); }
#s3-baza { --glow: rgba(217,178,106,.07); }
#s4-igry { --glow: rgba(192,123,160,.055); }
#s6-trofei { --glow: rgba(232,163,61,.075); }
#s7-pervyj-shag { --glow: rgba(127,176,105,.06); }
#s8-karta-goda { --glow: rgba(143,166,224,.06); }
#s9-zapiska { --glow: rgba(232,163,61,.09); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 44px;
  padding: 0 22px;
  border-radius: var(--r-md);
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 1;
  font-weight: 600;
  text-decoration: none;
  transition:
    background-color var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out),
    color var(--dur-base) var(--ease-out),
    transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-base) var(--ease-out);
}
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn:active { transform: scale(.98); }

.btn--primary {
  min-height: 52px;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-1);
}
.btn--primary:hover {
  background: var(--accent-soft);
  color: var(--on-accent);
  transform: translateY(-1px);
  text-decoration: none;
}
.btn--primary:active {
  transform: scale(.98);
  box-shadow: none;
}

.btn--secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line-strong);
}
.btn--secondary:hover {
  background: var(--surface-2);
  border-color: var(--accent);
  color: var(--text);
  text-decoration: none;
}

.btn--ghost {
  background: transparent;
  color: var(--accent);
  padding-inline: 4px;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  min-height: 44px;
}
.btn--ghost:hover {
  color: var(--accent-soft);
  text-decoration-thickness: 2px;
  text-decoration: underline;
}
.btn--back {
  gap: var(--s-2);
}
.btn--back .icon { width: 1.125rem; height: 1.125rem; }

@media (min-width: 768px) {
  .btn--primary { min-height: 48px; }
}

/* ---------- badges ---------- */
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  align-items: center;
}
.badges--inline {
  display: inline-flex;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1;
  font-weight: 500;
  letter-spacing: .01em;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge .icon {
  width: 14px;
  height: 14px;
}
.badge--noege {
  color: var(--badge-noege);
  background: color-mix(in srgb, var(--badge-noege) 10%, transparent);
  border-color: color-mix(in srgb, var(--badge-noege) 45%, transparent);
}
.badge--work {
  color: var(--badge-work);
  background: color-mix(in srgb, var(--badge-work) 10%, transparent);
  border-color: color-mix(in srgb, var(--badge-work) 45%, transparent);
}
.badge--home {
  color: var(--badge-home);
  background: color-mix(in srgb, var(--badge-home) 10%, transparent);
  border-color: color-mix(in srgb, var(--badge-home) 45%, transparent);
}
.badge--budget {
  color: var(--badge-budget);
  background: color-mix(in srgb, var(--badge-budget) 10%, transparent);
  border-color: color-mix(in srgb, var(--badge-budget) 45%, transparent);
}
.badge--free {
  color: var(--badge-free);
  background: color-mix(in srgb, var(--badge-free) 10%, transparent);
  border-color: color-mix(in srgb, var(--badge-free) 45%, transparent);
}

/* ---------- links / find ---------- */
.link-out {
  display: flex;
  width: -moz-fit-content;
  width: fit-content;
  align-items: center;
  min-height: 44px;
  gap: 4px;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
/* Stacked action links keep a >=8px gap so their 44px tap targets never touch. */
.link-out + .link-out { margin-top: var(--s-2); }
.link-out .icon {
  width: 12px;
  height: 12px;
  transform: rotate(-45deg);
  display: inline-block;
}
.branch[data-branch="a"] .link-out { color: var(--a); }
.branch[data-branch="b"] .link-out { color: var(--b); }
.branch[data-branch="c"] .link-out { color: var(--c); }
.branch[data-branch="d"] .link-out { color: var(--d); }
.branch[data-branch="e"] .link-out { color: var(--e); }
.find {
  display: block;
  margin-top: var(--s-2);
}

/* ---------- calm cards (screen 2) ---------- */
.calm-cards {
  display: grid;
  gap: var(--s-4);
}
.calm-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  box-shadow: var(--shadow-1);
  border: 1px solid var(--line);
}
.calm-card__icon {
  width: 2rem;
  height: 2rem;
  color: var(--accent);
  margin-bottom: var(--s-3);
}
.calm-card h3 { margin-bottom: var(--s-2); }
.calm-card p {
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.5;
}
@media (min-width: 768px) {
  .calm-cards {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--s-4);
    align-items: stretch;
  }
  .calm-card { height: 100%; }
}

/* ---------- chips + motifs (screen 4) ---------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-bottom: var(--s-6);
}
.chip {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-2);
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
}
.motif-cards {
  display: grid;
  gap: var(--s-4);
}
.motif-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  border: 1px solid var(--line);
  border-left-width: 4px;
  box-shadow: var(--shadow-1);
}
.motif-card[data-branch="a"] { border-left-color: var(--a); }
.motif-card[data-branch="a"] h3 { color: var(--a); }
.motif-card[data-branch="b"] { border-left-color: var(--b); }
.motif-card[data-branch="b"] h3 { color: var(--b); }
.motif-card[data-branch="c"] { border-left-color: var(--c); }
.motif-card[data-branch="c"] h3 { color: var(--c); }
.motif-card[data-branch="d"] { border-left-color: var(--d); }
.motif-card[data-branch="d"] h3 { color: var(--d); }
.motif-card[data-branch="e"] { border-left-color: var(--e); }
.motif-card[data-branch="e"] h3 { color: var(--e); }
.motif-card h3 { margin-bottom: var(--s-3); }
.motif-card__games,
.motif-card__work {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-2);
}
.motif-card__work { margin-top: var(--s-2); }
@media (min-width: 768px) {
  .motif-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 1280px) {
  #s4-igry {
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    column-gap: var(--s-6);
    align-items: start;
  }
  #s4-igry > h2,
  #s4-igry > .lead,
  #s4-igry > .screen__note {
    grid-column: 1 / -1;
  }
  #s4-igry > .chips { grid-column: 1; margin-bottom: 0; }
  #s4-igry > .motif-cards { grid-column: 2; }
}

/* ---------- year seals + inventory (screen 3) ---------- */
.year-seals {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin-bottom: var(--s-6);
}
.year-seal {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--s-2);
  min-width: 72px;
  flex: 1 1 0;
}
.year-seal--stamped .icon {
  width: 48px;
  height: 48px;
  padding: 12px;
  box-sizing: border-box;
  border-radius: 50%;
  color: var(--accent);
  background: rgba(232,163,61,.12);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
.year-seal--outline::before {
  content: "";
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px dashed var(--line-strong);
  background: transparent;
}
.year-seal span {
  font-size: 14px;
  line-height: 1.35;
  color: var(--text-2);
}
.year-seal small {
  display: block;
  font-size: 14px;
  line-height: 1.35;
  color: var(--text-muted);
  max-width: 9em;
}

.inventory {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-3);
}
.slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  text-align: center;
  min-height: 132px;
  min-width: 0;
  border-radius: var(--r-lg);
  padding: var(--s-4) var(--s-3);
  background: var(--surface);
  border: 1px solid var(--line-strong);
}
.slot .icon {
  width: 56px;
  height: 56px;
  padding: 14px;
  box-sizing: border-box;
  border-radius: 50%;
  flex-shrink: 0;
}
.slot span {
  font-size: 15px;
  line-height: 1.35;
  color: var(--text);
}
.slot small {
  font-size: 14px;
  line-height: 1.35;
  color: var(--text-muted);
}
.slot--filled {
  box-shadow:
    inset 0 0 0 1px rgba(232,163,61,.25),
    inset 0 1px 0 rgba(242,235,221,.055),
    var(--shadow-1);
}
.slot--filled .icon {
  color: var(--accent);
  background: rgba(232,163,61,.13);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.slot--empty {
  border-style: dashed;
  background: repeating-linear-gradient(135deg, transparent 0 10px, rgba(148,142,128,.06) 10px 12px);
}
.slot--empty .icon {
  color: var(--text-muted);
  border: 1px dashed var(--line-strong);
}
.slot--empty span { color: var(--text-2); }

@media (min-width: 768px) {
  .inventory { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1280px) {
  #s3-baza {
    display: grid;
    grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
    column-gap: var(--s-7);
    align-items: start;
  }
  #s3-baza > h2,
  #s3-baza > .lead {
    grid-column: 1;
  }
  #s3-baza > .year-seals {
    grid-column: 1;
  }
  #s3-baza > .inventory {
    grid-column: 2;
    grid-row: 1 / span 4;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-self: start;
  }
  #s3-baza > .screen__note {
    grid-column: 1;
  }
}

/* ---------- dividers ---------- */
.divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  width: min(100% - (var(--gutter) * 2), var(--container));
  margin: 0 auto;
  position: relative;
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 0;
  border-top: 2px dashed var(--line);
}
.divider__seal {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--accent);
}

/* ---------- trail nodes ---------- */
.trail {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  padding-left: 24px;
}
.trail::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 12px;
  bottom: 12px;
  width: 2px;
  background-image: linear-gradient(to bottom, var(--line) 40%, transparent 40%);
  background-size: 2px 10px;
  background-repeat: repeat-y;
  pointer-events: none;
}
.node {
  position: relative;
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--s-4) var(--s-4) var(--s-4) calc(var(--s-4) + 8px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
}
.node > .icon {
  position: absolute;
  left: -24px;
  top: 18px;
  width: 24px;
  height: 24px;
  padding: 4px;
  box-sizing: content-box;
  border-radius: 50%;
  background: var(--bg);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  z-index: 1;
}
.node__meta {
  display: block;
  margin-bottom: var(--s-2);
  color: var(--accent);
}
.node__text {
  font-size: clamp(1.0625rem, 1.03rem + .15vw, 1.125rem);
  line-height: 1.5;
}
.node__note {
  display: block;
  margin-top: var(--s-2);
}
.node .badges { margin-top: var(--s-3); }

.crossroad {
  position: relative;
  padding: var(--s-5) 0 var(--s-3);
}
.crossroad h2 { margin-bottom: var(--s-3); }
.crossroad::before {
  content: "";
  position: absolute;
  left: -24px;
  top: calc(var(--s-5) + .35em);
  width: 14px;
  height: 14px;
  border: 2px solid var(--accent);
  background: var(--bg);
  transform: rotate(45deg);
  z-index: 1;
}

.bridge {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-2);
  margin: calc(var(--s-2) * -1) 0;
  padding-left: var(--s-2);
  transition: color var(--dur-base) var(--ease-out);
}
.bridge__brace {
  width: 16px;
  height: 28px;
  flex-shrink: 0;
  color: var(--line-strong);
}
.bridge.is-lit {
  color: var(--accent);
}
.bridge.is-lit .bridge__brace { color: var(--accent); }

.trail__note {
  margin-top: var(--s-4);
  padding-left: var(--s-2);
}

.fan {
  display: none;
}
.trail > .fan {
  grid-column: 1 / -1;
}

/* ---------- branches accordion (5.1) ---------- */
.branch {
  position: relative;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  transition:
    background-color var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out),
    opacity var(--dur-base) var(--ease-out),
    transform var(--dur-base) var(--ease-out);
}
.branch::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: var(--r-lg) 0 0 var(--r-lg);
  background: var(--accent);
  transition: width var(--dur-base) var(--ease-out);
}
.branch[data-branch="a"]::before { background: var(--a); }
.branch[data-branch="b"]::before { background: var(--b); }
.branch[data-branch="c"]::before { background: var(--c); }
.branch[data-branch="d"]::before { background: var(--d); }
.branch[data-branch="e"]::before { background: var(--e); }

.branch__spine {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas:
    "icon meta chev"
    "icon title chev"
    "icon roles chev"
    "icon badges chev";
  column-gap: var(--s-3);
  row-gap: 6px;
  align-items: center;
  min-height: 118px;
  padding: var(--s-4) var(--s-4) var(--s-4) calc(var(--s-4) + 4px);
  cursor: pointer;
  border-radius: var(--r-lg);
}
.branch__spine > .icon:first-of-type {
  grid-area: icon;
  width: 28px;
  height: 28px;
  align-self: start;
  margin-top: 2px;
}
.branch[data-branch="a"] .branch__spine > .icon:first-of-type { color: var(--a); }
.branch[data-branch="b"] .branch__spine > .icon:first-of-type { color: var(--b); }
.branch[data-branch="c"] .branch__spine > .icon:first-of-type { color: var(--c); }
.branch[data-branch="d"] .branch__spine > .icon:first-of-type { color: var(--d); }
.branch[data-branch="e"] .branch__spine > .icon:first-of-type { color: var(--e); }

.branch__meta { grid-area: meta; }
.branch__title {
  grid-area: title;
  font-size: clamp(1.1875rem, 1.13rem + .24vw, 1.375rem);
  line-height: 1.3;
  font-weight: 650;
  color: var(--text);
}
.branch__roles {
  grid-area: roles;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-2);
}
.branch__spine .badges { grid-area: badges; }
.branch__chevron {
  grid-area: chev;
  width: 1.25rem;
  height: 1.25rem;
  color: var(--text-2);
  transition: transform var(--dur-slow) var(--ease-inout);
  align-self: start;
  margin-top: 4px;
}
.branch__hint {
  display: inline-block;
  margin-left: var(--s-2);
  padding: 2px 8px;
  border-radius: 999px;
  font-style: normal;
  font-size: 14px;
  letter-spacing: .04em;
  text-transform: none;
  vertical-align: middle;
}
.branch[data-branch="a"] .branch__hint { color: var(--a); background: var(--a-tint); }
.branch[data-branch="b"] .branch__hint { color: var(--b); background: var(--b-tint); }
.branch[data-branch="c"] .branch__hint { color: var(--c); background: var(--c-tint); }
.branch[data-branch="d"] .branch__hint { color: var(--d); background: var(--d-tint); }
.branch[data-branch="e"] .branch__hint { color: var(--e); background: var(--e-tint); }

.branch__spine:hover {
  background: var(--surface-2);
}
.branch:hover {
  transform: translateY(-2px);
}
.branch:hover::before { width: 6px; }
.branch__spine:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.branch.is-open,
.branch[open].is-open {
  background: var(--surface-2);
}
.branch[data-branch="a"].is-open { background: var(--a-tint); }
.branch[data-branch="b"].is-open { background: var(--b-tint); }
.branch[data-branch="c"].is-open { background: var(--c-tint); }
.branch[data-branch="d"].is-open { background: var(--d-tint); }
.branch[data-branch="e"].is-open { background: var(--e-tint); }
.branch.is-open::before { width: 6px; }
.branch.is-open .branch__chevron { transform: rotate(180deg); }
.branch.is-dimmed { opacity: .55; }

/* accordion grid-template-rows */
.branch__body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--dur-slow) var(--ease-inout);
}
.branch.is-open .branch__body {
  grid-template-rows: 1fr;
}
.branch__inner {
  overflow: hidden;
  min-height: 0;
  opacity: 0;
  transition: opacity var(--dur-base) 80ms var(--ease-out);
  padding: 0 var(--s-4) 0 calc(var(--s-4) + 4px);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
}
.branch.is-open .branch__inner {
  opacity: 1;
  padding-bottom: var(--s-5);
}

/* no-js / native details fallback */
html.no-js .branch__body {
  transition: none;
}
html.no-js details.branch[open] .branch__body {
  grid-template-rows: 1fr;
}
html.no-js details.branch[open] .branch__inner {
  opacity: 1;
  padding-bottom: var(--s-5);
  transition: none;
}
html.no-js details.branch[open]::before { width: 6px; }
html.no-js details.branch[open] .branch__chevron { transform: rotate(180deg); }

/* ---------- quiz ---------- */
.quiz-nojs {
  display: none;
  margin: var(--s-3) 0;
}
html.no-js .quiz-nojs { display: block; }
html.no-js .quiz { opacity: .55; pointer-events: none; }

.quiz {
  background: var(--surface-2);
  border-radius: var(--r-xl);
  padding: var(--s-5);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
}
.quiz__dots {
  display: flex;
  gap: var(--s-2);
  margin-bottom: var(--s-4);
}
.quiz__dots i {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line-strong);
}
.quiz__dots i.is-done { background: var(--accent); }
.quiz__dots i.is-current {
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);
}
.quiz__q {
  margin-bottom: var(--s-4);
}
.quiz__opt {
  display: block;
  width: 100%;
  text-align: left;
  min-height: 56px;
  padding: 14px 16px;
  margin-bottom: var(--s-2);
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  line-height: 1.4;
  transition:
    background-color var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}
.quiz__opt:hover {
  background: var(--surface-2);
  border-color: var(--accent);
}
.quiz__opt:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.quiz__opt:active { transform: scale(.98); }
.quiz__opt.is-selected[data-branch="a"],
.quiz__opt[aria-pressed="true"][data-branch="a"] {
  background: var(--a-tint); border-color: var(--a);
}
.quiz__opt.is-selected[data-branch="b"],
.quiz__opt[aria-pressed="true"][data-branch="b"] {
  background: var(--b-tint); border-color: var(--b);
}
.quiz__opt.is-selected[data-branch="c"],
.quiz__opt[aria-pressed="true"][data-branch="c"] {
  background: var(--c-tint); border-color: var(--c);
}
.quiz__opt.is-selected[data-branch="d"],
.quiz__opt[aria-pressed="true"][data-branch="d"] {
  background: var(--d-tint); border-color: var(--d);
}
.quiz__opt.is-selected[data-branch="e"],
.quiz__opt[aria-pressed="true"][data-branch="e"] {
  background: var(--e-tint); border-color: var(--e);
}
.quiz__nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin-top: var(--s-4);
  min-height: 44px;
  align-items: center;
}
.quiz__step {
  transition:
    opacity var(--dur-base) var(--ease-out),
    transform var(--dur-base) var(--ease-out);
}
.quiz__step.is-leaving {
  opacity: 0;
  transform: translateX(-8px);
}
.quiz__result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin-top: var(--s-4);
  align-items: center;
}
.quiz__result p {
  max-width: var(--prose-max);
  line-height: 1.55;
}

/* ---------- route card + steps ---------- */
.route__prof {
  margin-bottom: var(--s-4);
}
.branch[data-branch="a"] .route__prof { color: var(--a); }
.branch[data-branch="b"] .route__prof { color: var(--b); }
.branch[data-branch="c"] .route__prof { color: var(--c); }
.branch[data-branch="d"] .route__prof { color: var(--d); }
.branch[data-branch="e"] .route__prof { color: var(--e); }

.route__facts {
  display: grid;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}
.route__facts dt {
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-muted);
}
.route__facts dd {
  font-size: 17px;
  line-height: 1.45;
  color: var(--text);
  margin-top: 2px;
}
.route__price {
  font-size: 17px;
  line-height: 1.2;
  font-weight: 600;
}
.route__pricenote {
  display: inline;
  margin-left: var(--s-2);
  font-family: var(--font-text);
  font-weight: 400;
  font-variant-numeric: normal;
}
.route__hr {
  height: 0;
  border-top: 1px dashed var(--line);
  margin: var(--s-4) 0;
}
.route__footnote,
.route__intro {
  margin-bottom: var(--s-4);
  max-width: 40em;
}
.route__alt {
  margin: var(--s-3) 0 var(--s-4);
}
.route__alt summary {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  font-size: 14px;
}
.route__alt summary:hover { color: var(--accent-soft); }
.route__alt summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.route__alt p {
  margin-top: var(--s-2);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-muted);
}
.route__bottom {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  align-items: flex-start;
  margin-top: var(--s-4);
}
.route__bottom .btn--back {
  width: 100%;
  justify-content: flex-start;
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  padding-left: 0;
}
.step {
  display: grid;
  grid-template-columns: 28px 1fr;
  column-gap: var(--s-3);
  position: relative;
  padding-bottom: var(--s-5);
}
.step:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 30px;
  bottom: 0;
  width: 2px;
  background-image: linear-gradient(to bottom, var(--line) 45%, transparent 45%);
  background-size: 2px 8px;
  background-repeat: repeat-y;
}
.step__num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  position: relative;
  z-index: 1;
}
.branch[data-branch="a"] .step__num { border-color: var(--a); background: var(--a-tint); color: var(--a); }
.branch[data-branch="b"] .step__num { border-color: var(--b); background: var(--b-tint); color: var(--b); }
.branch[data-branch="c"] .step__num { border-color: var(--c); background: var(--c-tint); color: var(--c); }
.branch[data-branch="d"] .step__num { border-color: var(--d); background: var(--d-tint); color: var(--d); }
.branch[data-branch="e"] .step__num { border-color: var(--e); background: var(--e-tint); color: var(--e); }

.step--first .step__num {
  color: var(--on-accent);
  border-color: transparent;
}
.branch[data-branch="a"] .step--first .step__num { background: var(--a); }
.branch[data-branch="b"] .step--first .step__num { background: var(--b); }
.branch[data-branch="c"] .step--first .step__num { background: var(--c); }
.branch[data-branch="d"] .step--first .step__num { background: var(--d); }
.branch[data-branch="e"] .step--first .step__num { background: var(--e); }

.step__text {
  font-size: 17px;
  line-height: 1.5;
}
/* Internal "как начать" anchors in steps also get a full 44px tap target. */
.step__text > a:not(.link-out) {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: var(--s-1);
}
.step .badges {
  grid-column: 2;
  margin-top: var(--s-2);
}
.step:last-child { padding-bottom: 0; }

@media (min-width: 768px) {
  .route__facts {
    grid-template-columns: auto 1fr;
    column-gap: var(--s-4);
    align-items: baseline;
  }
  .route__facts dt { margin: 0; }
  .route__facts dd { margin: 0; }
  .route__price { font-size: 19px; }
  .route__bottom {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
  }
  .route__bottom .btn--back { width: auto; }
}

/* ---------- cover (screen 1) ---------- */
.screen--cover {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  background: var(--bg-deep);
  width: 100%;
  max-width: none;
  margin: 0;
  padding: var(--s-8) var(--gutter) var(--s-7);
  box-sizing: border-box;
}
.screen--cover .meta-label {
  color: var(--accent);
  margin-bottom: var(--s-3);
}
.screen--cover h1 { margin-bottom: var(--s-4); }
.screen--cover .lead {
  margin: 0 0 var(--s-4);
  max-width: 34em;
}
.cover-note {
  margin: 0 0 var(--s-6);
  max-width: 34em;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-muted);
}
.screen--cover .btn--primary {
  width: 100%;
  max-width: 100%;
}
.cover-chevron {
  display: flex;
  justify-content: center;
  margin-top: auto;
  padding-top: var(--s-7);
  color: var(--text-muted);
  animation: chevron-breathe 2.4s ease-in-out infinite alternate;
}
.cover-chevron .icon {
  width: 1.5rem;
  height: 1.5rem;
}
@keyframes chevron-breathe {
  from { transform: translateY(0); }
  to { transform: translateY(6px); }
}

@media (min-width: 768px) {
  .screen--cover {
    padding-inline: max(var(--gutter), calc((100% - 704px) / 2));
    justify-content: center;
  }
  .screen--cover > * {
    max-width: 520px;
  }
  .screen--cover .btn--primary {
    width: auto;
    align-self: flex-start;
  }
  .cover-chevron {
    max-width: none;
    width: 100%;
    position: absolute;
    left: 0;
    right: 0;
    bottom: var(--s-5);
  }
}
@media (min-width: 1280px) {
  .screen--cover {
    padding-inline: max(var(--gutter), calc((100% - 1120px) / 2));
    display: grid;
    grid-template-columns: minmax(0, 620px) 1fr;
    grid-template-rows: auto auto auto auto 1fr;
    column-gap: var(--s-8);
    align-content: center;
  }
  .screen--cover .cover-art {
    position: static;
    transform: none;
    grid-column: 2;
    grid-row: 1 / span 5;
    align-self: center;
    justify-self: center;
    width: min(100%, 560px);
    opacity: 1;
  }
  #s1-cover::before {
    right: 8%;
    top: 10%;
  }
  .screen--cover .meta-label,
  .screen--cover h1,
  .screen--cover .lead,
  .screen--cover .btn--primary {
    grid-column: 1;
    max-width: 620px;
  }
  .cover-chevron {
    grid-column: 1 / -1;
  }
}

/* ---------- first step (screen 7) ---------- */
.first-blocks {
  display: grid;
  gap: var(--s-4);
}
.first-block {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
}
.first-block > .icon {
  width: 1.75rem;
  height: 1.75rem;
  color: var(--accent);
  margin-bottom: var(--s-3);
}
.first-block h3 { margin-bottom: var(--s-2); }
.first-block p {
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.5;
}
.first-block .badges { margin-top: var(--s-3); }
.probe-list {
  margin: var(--s-3) 0;
  display: grid;
  gap: var(--s-2);
}
.probe-list li {
  position: relative;
  padding-left: var(--s-4);
  font-size: 14px;
  color: var(--text-2);
}
.probe-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: .7;
}

.soft-checklist {
  margin-top: var(--s-6);
  padding: var(--s-4);
  border-radius: var(--r-lg);
  border: 1px dashed var(--line-strong);
  background: var(--surface);
}
.soft-checklist__caption {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: var(--s-3);
}
.soft-checklist__items {
  display: grid;
  gap: var(--s-2);
}
.soft-checklist__items label {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 44px;
  cursor: pointer;
  color: var(--text);
}
.soft-checklist__items input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--d);
  flex-shrink: 0;
}
.soft-checklist__items input[type="checkbox"]:checked + span,
.soft-checklist__items label:has(input:checked) {
  color: var(--d);
  text-decoration: none;
}

@media (min-width: 768px) {
  .first-blocks {
    grid-template-columns: repeat(3, 1fr);
    align-items: stretch;
  }
}

/* ---------- timeline (screen 8) ---------- */
.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
  padding-left: 44px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background-image: linear-gradient(to bottom, var(--line) 40%, transparent 40%);
  background-size: 2px 10px;
  background-repeat: repeat-y;
}
.milestone {
  position: relative;
  display: grid;
  gap: var(--s-2);
}
.milestone__seal {
  position: absolute;
  left: -44px;
  top: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  color: var(--accent);
  z-index: 1;
}
.milestone__seal .icon {
  width: 16px;
  height: 16px;
}
.milestone__card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--s-4);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
}
.milestone__card h3 { margin-bottom: var(--s-2); }
.milestone__card p {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-2);
}
.milestone__note {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: var(--s-1);
}
.milestone__tries {
  display: inline-flex;
  gap: 4px;
  margin-top: var(--s-3);
}
.milestone__tries i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  opacity: .75;
}

.bonus-points {
  display: grid;
  gap: var(--s-3);
  margin-top: var(--s-6);
}
.bonus {
  opacity: .72;
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--s-4);
  border: 1px dashed var(--line-strong);
}
.bonus__label {
  display: block;
  margin-bottom: var(--s-2);
  color: var(--text-muted);
}
.bonus .icon {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--badge-budget);
  margin-bottom: var(--s-2);
}
.bonus p {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-2);
}

@media (min-width: 768px) {
  .timeline {
    padding-left: 0;
    max-width: 720px;
    margin-inline: auto;
  }
  .timeline::before {
    left: 50%;
    transform: translateX(-50%);
  }
  .milestone {
    width: calc(50% - 28px);
  }
  .milestone:nth-child(odd) {
    margin-right: auto;
    padding-right: 28px;
    text-align: right;
  }
  .milestone:nth-child(even) {
    margin-left: auto;
    padding-left: 28px;
  }
  .milestone:nth-child(odd) .milestone__seal {
    left: auto;
    right: -16px;
  }
  .milestone:nth-child(even) .milestone__seal {
    left: -16px;
  }
  .milestone:nth-child(odd) .milestone__tries {
    justify-content: flex-end;
  }
}
@media (min-width: 1280px) {
  .timeline {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--s-4);
    max-width: none;
    padding: 48px 0 0;
  }
  .timeline::before {
    left: 10%;
    right: 10%;
    top: 15px;
    bottom: auto;
    width: auto;
    height: 2px;
    transform: none;
    background-image: linear-gradient(to right, var(--line) 40%, transparent 40%);
    background-size: 10px 2px;
    background-repeat: repeat-x;
  }
  .milestone {
    width: auto;
    margin: 0 !important;
    padding: 0 !important;
    text-align: center !important;
  }
  .milestone__seal {
    position: relative;
    left: auto !important;
    right: auto !important;
    margin: 0 auto var(--s-4);
  }
  .milestone__tries { justify-content: center; }
  .bonus-points {
    grid-template-columns: 1fr 1fr;
    max-width: 640px;
    margin-inline: auto;
  }
}

/* ---------- note + footer (screen 9) ---------- */
.note-paper {
  background: #232029;
  background-image: linear-gradient(180deg, rgba(232,163,61,.10), transparent 30%);
  border: 1px solid rgba(232,163,61,.16);
  border-radius: var(--r-xl);
  padding: var(--s-6) var(--s-5);
  box-shadow: var(--shadow-2);
  max-width: 100%;
  transform: none;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 10px, #000 calc(100% - 4px), transparent);
  mask-image: linear-gradient(180deg, transparent 0, #000 8px, #000 100%);
}
.note-paper p {
  font-family: var(--font-display);
  font-size: clamp(1.1875rem, 1.1rem + .3vw, 1.3125rem);
  line-height: 1.7;
  color: var(--text);
  margin-bottom: var(--s-4);
  max-width: 34em;
}
.note-paper__sign {
  font-style: italic;
  text-align: right;
  margin-bottom: 0;
  margin-top: var(--s-5);
}
.footer {
  margin-top: var(--s-7);
  padding-bottom: var(--s-6);
  text-align: center;
}
.footer p {
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-muted);
}
.footer p + p { margin-top: var(--s-2); }

@media (min-width: 768px) {
  .note-paper {
    max-width: 620px;
    margin-inline: auto;
    padding: var(--s-7) var(--s-6);
  }
}
@media (min-width: 1280px) {
  .note-paper {
    max-width: 680px;
    transform: rotate(-0.4deg);
  }
}

/* ---------- dots nav + to-top ---------- */
.dots {
  display: none;
}
.to-top {
  position: fixed;
  right: var(--gutter);
  bottom: var(--s-5);
  z-index: 40;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  color: var(--accent);
  box-shadow: var(--shadow-1);
  cursor: pointer;
}
.to-top::before {
  content: "";
  display: block;
  width: 10px;
  height: 10px;
  margin: 16px auto 0;
  border-left: 2px solid currentColor;
  border-top: 2px solid currentColor;
  transform: rotate(45deg);
}
.to-top:hover {
  border-color: var(--accent);
  background: var(--surface);
}
.to-top:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
@media (min-width: 1360px) {
  .to-top { display: none !important; }
  .dots {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: fixed;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 40;
  }
  .dots a {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    box-sizing: border-box;
    border-radius: 50%;
    background: transparent;
    text-decoration: none;
  }
  .dots a::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--line-strong);
    transition: background-color var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
  }
  .dots a.is-active::before {
    background-color: var(--accent);
    transform: scale(1.25);
  }
  .dots a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }
}

/* ---------- trail responsive: 768 / 1280 ---------- */
@media (min-width: 768px) {
  .trail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: var(--s-4);
    row-gap: var(--s-4);
    padding-left: 0;
  }
  .trail::before {
    left: 50%;
    transform: translateX(-50%);
    top: 0;
    bottom: auto;
    height: 120px;
  }
  .trail > .node,
  .trail > .crossroad,
  .trail > .quiz-nojs,
  .trail > .quiz,
  .trail > .bridge,
  .trail > .trail__note,
  .trail > .branch.is-open,
  .trail > .branch[open] {
    grid-column: 1 / -1;
  }
  .trail > .node {
    max-width: 640px;
    margin-inline: auto;
    width: 100%;
    padding-left: var(--s-5);
  }
  .trail > .node > .icon {
    left: -12px;
  }
  .crossroad {
    text-align: center;
  }
  .crossroad::before { left: 50%; margin-left: -7px; }
  .bridge {
    grid-column: 1 / -1;
    justify-content: center;
  }
  /* Auto-placement honours order-modified document order: the full-width
     bridge sits in DOM between A and B, so explicit order keeps A+B in one
     row and drops the bridge to its own row below them. */
  #vetka-a { grid-column: 1; order: 1; }
  #vetka-b { grid-column: 2; order: 2; }
  .trail > .bridge { order: 3; }
  #vetka-c { grid-column: 1; order: 4; }
  #vetka-d { grid-column: 2; order: 5; }
  #vetka-e { grid-column: 1 / -1; order: 6; }
  .trail > .trail__note { order: 99; }
  /* An open branch (spine + full-width panel) always renders AFTER every
     closed spine, so the route panel sits strictly below the spine row and
     no spine is ever pushed beneath it. !important beats the #id order rules. */
  .branch.is-open,
  html.no-js .branch[open] {
    grid-column: 1 / -1 !important;
    order: 50 !important;
  }
}

@media (min-width: 1280px) {
  .trail {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    column-gap: var(--s-4);
    padding-top: 24px;
  }
  .trail::before { display: none; }
  .trail > .node {
    max-width: 420px;
  }
  .trail > .node > .icon {
    left: -28px;
  }
  .crossroad::before { display: none; }
  /* One row of five spines; the bridge caption drops below the A+B pair. */
  #vetka-a { grid-column: 1; order: 1; }
  #vetka-b { grid-column: 2; order: 2; }
  #vetka-c { grid-column: 3; order: 3; }
  #vetka-d { grid-column: 4; order: 4; }
  #vetka-e { grid-column: 5; order: 5; }
  .trail > .bridge {
    grid-column: 1 / 3;
    order: 6;
  }
  .trail > .trail__note { order: 99; }
  .branch.is-dimmed { opacity: .55; }
  .fan {
    display: block;
    height: 96px;
    margin: 0 0 var(--s-4);
  }
  .fan svg {
    width: 100%;
    height: 96px;
    overflow: visible;
  }

  .branch.is-open .branch__inner,
  html.no-js details.branch[open] .branch__inner {
    display: grid;
    grid-template-columns: 28% 44% 28%;
    column-gap: var(--s-5);
    padding: var(--s-6);
    padding-top: 0;
  }
  .route__prof,
  .route__intro {
    grid-column: 1 / -1;
  }
  .route__facts { grid-column: 1; grid-row: 2; }
  .steps { grid-column: 2; grid-row: 2; }
  .route__hr { grid-column: 1 / -1; }
  .route__footnote,
  .route__alt { grid-column: 1 / -1; }
  .route__bottom {
    grid-column: 3;
    grid-row: 2;
    flex-direction: column;
    align-items: stretch;
  }
  .route__bottom .btn--back { width: 100%; }
}

/* Fix 768 route: facts | steps side by side */
@media (min-width: 768px) and (max-width: 1279px) {
  .branch.is-open .branch__inner,
  html.no-js details.branch[open] .branch__inner {
    display: grid;
    grid-template-columns: 2fr 3fr;
    column-gap: var(--s-5);
    grid-auto-flow: dense;
  }
  .route__prof,
  .route__intro,
  .route__footnote,
  .route__alt,
  .route__bottom,
  .route__hr {
    grid-column: 1 / -1;
  }
  .route__hr:first-of-type {
    display: none;
  }
  .route__facts { grid-column: 1; }
  .steps { grid-column: 2; }
}

/* ---------- shared card surface (градиент + волосяная подсветка сверху) ---------- */
.calm-card,
.motif-card,
.slot,
.node,
.first-block,
.milestone__card,
.branch,
.bonus {
  background: linear-gradient(180deg, #232E3B, #1A232E);
  box-shadow: inset 0 1px 0 rgba(242,235,221,.055), var(--shadow-1);
}
.quiz {
  box-shadow: inset 0 1px 0 rgba(242,235,221,.05), var(--shadow-1);
}
/* Пустые слоты и открытые ветки остаются своими фонами */
.slot--empty {
  background: repeating-linear-gradient(135deg, transparent 0 10px, rgba(148,142,128,.06) 10px 12px);
  box-shadow: none;
}
.branch[data-branch="a"].is-open { background: linear-gradient(180deg, rgba(226,121,95,.16), rgba(226,121,95,.10)); }
.branch[data-branch="b"].is-open { background: linear-gradient(180deg, rgba(79,168,184,.16), rgba(79,168,184,.10)); }
.branch[data-branch="c"].is-open { background: linear-gradient(180deg, rgba(192,123,160,.16), rgba(192,123,160,.10)); }
.branch[data-branch="d"].is-open { background: linear-gradient(180deg, rgba(127,176,105,.16), rgba(127,176,105,.10)); }
.branch[data-branch="e"].is-open { background: linear-gradient(180deg, rgba(143,166,224,.16), rgba(143,166,224,.10)); }

/* ---------- обложка: сцена «стол картографа» ---------- */
.cover-art {
  position: absolute;
  top: 3%;
  left: 50%;
  transform: translateX(-50%);
  width: min(88vw, 430px);
  height: auto;
  opacity: .92;
  pointer-events: none;
}
@media (min-width: 768px) {
  .cover-art { width: min(72vw, 500px); top: 5%; }
}

/* ---------- reveal (only when html.js) ---------- */
html.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity var(--dur-reveal) var(--ease-out),
    transform var(--dur-reveal) var(--ease-out);
}
html.js .reveal.is-in {
  opacity: 1;
  transform: translateY(0);
}
html.js .reveal-note {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 620ms var(--ease-out),
    transform 620ms var(--ease-out);
}
html.js .reveal-note.is-in {
  opacity: 1;
  transform: translateY(0);
}
@media (min-width: 768px) {
  html.js .reveal-note {
    transform: translateY(20px) rotate(-1.2deg);
  }
  html.js .reveal-note.is-in {
    transform: translateY(0) rotate(-0.4deg);
  }
}

/* ---------- focus / interactive spacing ---------- */
:focus:not(:focus-visible) { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- 1280 route three columns polish ---------- */
@media (min-width: 1280px) {
  .branch.is-open .branch__inner,
  html.no-js details.branch[open] .branch__inner {
    grid-auto-flow: dense;
  }
  .route__hr:first-of-type { display: none; }
  .route__hr { grid-column: 1 / -1; }
}

/* ═══ мобильный hero ≤767px: карта сверху → текст ниже ═══ */
@media (max-width: 767px) {
  /* Glow: приглушить чтобы не глушил карту */
  #s1-cover::before {
    opacity: 0.45;
  }

  /* 1. Карта: из absolute в поток, яркая, сверху */
  .cover-art {
    position: relative;
    top: auto;
    left: auto;
    bottom: auto;
    transform: none;
    width: min(86vw, 340px);
    height: auto;
    margin: 0 auto var(--s-5);  /* центр + 24px снизу до meta-label */
    opacity: 0.92;
  }

  /* 2. Hero: стек сверху вниз, умеренный padding */
  .screen--cover {
    justify-content: flex-start;
    padding-top: var(--s-5);    /* 24px */
    padding-bottom: var(--s-5); /* 24px */
  }

  /* 3. Воздух между блоками */
  .screen--cover .meta-label { margin-bottom: var(--s-4); }   /* 16px */
  .screen--cover h1          { margin-bottom: var(--s-5); }   /* 24px */
  .screen--cover .lead       { margin: 0 0 var(--s-5); }      /* 24px */
  .cover-note                { margin: 0 0 var(--s-5); }      /* 24px */

  /* 4. Шеврон: остаётся на дне через margin-top:auto */
  .cover-chevron { padding-top: var(--s-4); }                 /* 16px */
}
/* ═══════════════════════════════════════════════════════════ */

/* ---------- prefers-reduced-motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .cover-chevron,
  #s1-cover::before,
  #s5-razvilka::before {
    animation: none !important;
  }
  html.js .reveal,
  html.js .reveal-note {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .branch__body,
  .branch__inner {
    transition: none !important;
  }
  .branch.is-open .branch__body,
  html.no-js details.branch[open] .branch__body,
  details.branch[open] .branch__body {
    grid-template-rows: 1fr;
  }
  .branch.is-open .branch__inner,
  html.no-js details.branch[open] .branch__inner,
  details.branch[open] .branch__inner {
    opacity: 1;
  }
  .note-paper { transform: none; }
}

/* ---------- small polish ---------- */
.branch__inner > .route__hr:last-of-type {
  margin-bottom: var(--s-4);
}
@media (hover: hover) and (pointer: fine) {
  .calm-card,
  .first-block,
  .motif-card,
  .milestone__card,
  .trophy,
  .budget-card {
    transition:
      background-color var(--dur-base) var(--ease-out),
      border-color var(--dur-base) var(--ease-out),
      transform var(--dur-base) var(--ease-out);
  }
  .calm-card:hover,
  .first-block:hover,
  .motif-card:hover,
  .milestone__card:hover,
  .trophy:hover,
  .budget-card:hover {
    background: var(--surface-2);
    transform: translateY(-2px);
  }
}

/* ---------- звёздное небо над морем (фиксированный слой) ---------- */
.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.sky::before,
.sky::after {
  content: "";
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
}
/* дальние мелкие звёзды */
.sky::before {
  background-image:
    radial-gradient(2.5px 2.5px at 8% 12%, rgba(242,235,221,.34), transparent 100%),
    radial-gradient(2px 2px at 22% 38%, rgba(143,166,224,.30), transparent 100%),
    radial-gradient(2.5px 2.5px at 34% 8%, rgba(242,235,221,.26), transparent 100%),
    radial-gradient(2px 2px at 47% 26%, rgba(243,193,121,.30), transparent 100%),
    radial-gradient(2px 2px at 61% 10%, rgba(242,235,221,.30), transparent 100%),
    radial-gradient(2.5px 2.5px at 74% 34%, rgba(143,166,224,.26), transparent 100%),
    radial-gradient(2px 2px at 88% 16%, rgba(242,235,221,.30), transparent 100%),
    radial-gradient(2px 2px at 95% 46%, rgba(243,193,121,.24), transparent 100%),
    radial-gradient(2px 2px at 4% 58%, rgba(242,235,221,.22), transparent 100%),
    radial-gradient(2px 2px at 16% 78%, rgba(143,166,224,.20), transparent 100%),
    radial-gradient(2px 2px at 84% 72%, rgba(242,235,221,.20), transparent 100%),
    radial-gradient(2px 2px at 68% 88%, rgba(243,193,121,.18), transparent 100%);
}
/* ближние яркие звёзды — мягкое мерцание */
.sky::after {
  background-image:
    radial-gradient(3px 3px at 15% 22%, rgba(243,193,121,.55), transparent 100%),
    radial-gradient(3px 3px at 41% 14%, rgba(242,235,221,.50), transparent 100%),
    radial-gradient(3px 3px at 69% 20%, rgba(143,166,224,.45), transparent 100%),
    radial-gradient(3px 3px at 91% 34%, rgba(243,193,121,.45), transparent 100%),
    radial-gradient(3px 3px at 28% 66%, rgba(242,235,221,.32), transparent 100%),
    radial-gradient(3px 3px at 78% 58%, rgba(242,235,221,.32), transparent 100%);
}
@media (prefers-reduced-motion: no-preference) {
  .sky::after { animation: sky-twinkle 6s ease-in-out infinite alternate; }
}
@keyframes sky-twinkle {
  from { opacity: .35; }
  to { opacity: .9; }
}

/* ---------- сцена обложки: цвета и движение ---------- */
.ca-sheet { fill: #1A232E; stroke: var(--line-strong); stroke-width: 1.5; }
.ca-fold { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 6; }
.ca-coast { stroke: var(--line-strong); stroke-width: 1.5; opacity: .65; fill: none; stroke-linecap: round; }
.ca-route {
  stroke: var(--accent); stroke-width: 2.25; fill: none;
  stroke-linecap: round; stroke-dasharray: 3 9;
}
.ca-accent { stroke: var(--accent); stroke-width: 2; stroke-linecap: round; fill: none; }
.ca-accent-fill { fill: var(--accent); }
.ca-soft { stroke: var(--accent-soft); stroke-width: 1.5; stroke-linecap: round; fill: none; }
.ca-line { stroke: var(--line-strong); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.ca-faint { stroke: #3A4A5C; stroke-width: 1.5; stroke-linecap: round; fill: none; }
.ca-star { fill: var(--accent-soft); }
.ca-dot { fill: var(--e); opacity: .8; }
@media (prefers-reduced-motion: no-preference) {
  .ca-route { animation: ca-dash 9s linear infinite; }
  .ca-star { animation: ca-twinkle 3.4s ease-in-out infinite alternate; animation-delay: var(--d, 0s); transform-origin: center; }
  .ca-thread { stroke-dasharray: 1 7; }
}
@keyframes ca-dash { to { stroke-dashoffset: -120; } }
@keyframes ca-twinkle { from { opacity: .3; } to { opacity: 1; } }

/* ---------- виньетки у секций ---------- */
.vignette {
  position: absolute;
  z-index: 0;
  pointer-events: none;
}
#s3-baza .vignette--thread { top: 6px; right: -14px; width: 140px; opacity: .5; }
#s4-igry .vignette--const { top: -24px; right: -8px; width: 140px; opacity: .7; }
@media (min-width: 768px) {
  #s3-baza .vignette--thread { width: 190px; right: 0; }
  #s4-igry .vignette--const { width: 190px; }
}
.vg-thread { stroke: var(--accent-soft); stroke-width: 1.5; stroke-dasharray: 1 7; stroke-linecap: round; fill: none; }
.vg-needle { stroke: var(--line-strong); stroke-width: 2; stroke-linecap: round; fill: none; }
.vg-link { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 2 5; opacity: .7; fill: none; }
.vg-star { fill: var(--accent-soft); }
@media (prefers-reduced-motion: no-preference) {
  .vg-star { animation: ca-twinkle 3.8s ease-in-out infinite alternate; animation-delay: var(--d, 0s); }
}
.waves { display: block; width: 140px; margin: 0 auto var(--s-6); }
.vg-wave { stroke: var(--line-strong); stroke-width: 1.75; stroke-linecap: round; fill: none; }
.vg-wave--2 { opacity: .55; }
.vg-wave-star { fill: var(--accent-soft); }

/* ---------- наметочный стежок: линия раскроя = курс корабля ---------- */
.calm-card,
.motif-card,
.first-block,
.milestone__card,
.trophy,
.budget-card,
.ask-school {
  position: relative;
}
.calm-card::after,
.motif-card::after,
.first-block::after,
.milestone__card::after,
.node::after,
.branch::after,
.trophy::after,
.budget-card::after,
.ask-school::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px dashed color-mix(in srgb, var(--line-strong) 38%, transparent);
  border-radius: calc(var(--r-lg) - 7px);
  pointer-events: none;
}
.node::after { border-radius: calc(var(--r-lg) - 7px); }
.branch::after { inset: 5px; }
.branch.is-open::after { border-color: color-mix(in srgb, var(--line-strong) 55%, transparent); }

/* ---------- иконки веток: цветной свет лампы ---------- */
.branch__spine > .icon:first-of-type {
  padding: 7px;
  box-sizing: content-box;
  border-radius: 50%;
}
.branch[data-branch="a"] .branch__spine > .icon:first-of-type { background: var(--a-tint); box-shadow: 0 0 22px 2px var(--a-tint); }
.branch[data-branch="b"] .branch__spine > .icon:first-of-type { background: var(--b-tint); box-shadow: 0 0 22px 2px var(--b-tint); }
.branch[data-branch="c"] .branch__spine > .icon:first-of-type { background: var(--c-tint); box-shadow: 0 0 22px 2px var(--c-tint); }
.branch[data-branch="d"] .branch__spine > .icon:first-of-type { background: var(--d-tint); box-shadow: 0 0 22px 2px var(--d-tint); }
.branch[data-branch="e"] .branch__spine > .icon:first-of-type { background: var(--e-tint); box-shadow: 0 0 22px 2px var(--e-tint); }

/* ---------- экран s6: трофеи ---------- */
.trophies {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-3);
}
@media (min-width: 640px) {
  .trophies { grid-template-columns: repeat(2, 1fr); gap: var(--s-4); }
}
@media (min-width: 1024px) {
  .trophies { grid-template-columns: repeat(3, 1fr); }
}
.trophy {
  background: linear-gradient(180deg, #232E3B, #1A232E);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-4) var(--s-4) var(--s-4);
  box-shadow: inset 0 1px 0 rgba(242,235,221,.05), var(--shadow-1);
}
.trophy .icon {
  width: 2rem;
  height: 2rem;
  padding: 6px;
  box-sizing: content-box;
  border-radius: 50%;
  color: var(--accent);
  background: rgba(232,163,61,.12);
  margin-bottom: var(--s-3);
}
.trophy h3 { font-size: 1.0625rem; margin-bottom: var(--s-1); }
.trophy p { font-size: 14px; line-height: 1.5; color: var(--text-2); }

.rhythm-note {
  margin-top: var(--s-6);
  max-width: var(--prose-max);
  padding: var(--s-4) var(--s-5);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-2);
}
.rhythm-note strong { color: var(--text); font-weight: 600; }

/* ---------- экран s6: три бюджета ---------- */
.budget-title { margin-top: var(--s-7); margin-bottom: var(--s-4); }
.budget-cards { display: grid; gap: var(--s-4); }
@media (min-width: 768px) {
  .budget-cards { grid-template-columns: repeat(3, 1fr); align-items: stretch; }
}
.budget-card {
  background: linear-gradient(180deg, #232E3B, #1A232E);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  box-shadow: inset 0 1px 0 rgba(242,235,221,.05), var(--shadow-1);
}
.budget-card__sum {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.375rem;
  line-height: 1.2;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: var(--s-2);
}
.budget-card h4 { margin-bottom: var(--s-2); }
.budget-card__desc { font-size: 14px; line-height: 1.5; color: var(--text-2); }
.budget-card--main {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(242,235,221,.05),
    var(--shadow-1),
    0 8px 36px rgba(232,163,61,.10);
}
.budget-card--main::after {
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

/* ---------- экран s6: вопросы школе ---------- */
.ask-school {
  margin-top: var(--s-6);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  padding: var(--s-2) var(--s-5) var(--s-4);
}
.ask-school summary {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 44px;
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  font-size: 15px;
}
.ask-school summary .icon { flex-shrink: 0; }
.ask-school summary:hover { color: var(--accent-soft); }
.ask-school summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ask-school__chevron { margin-left: auto; transition: transform var(--dur-slow) var(--ease-inout); }
.ask-school[open] .ask-school__chevron { transform: rotate(180deg); }
.ask-school__list {
  counter-reset: ask;
  display: grid;
  gap: var(--s-2);
  margin-top: var(--s-3);
}
.ask-school__list li {
  counter-increment: ask;
  position: relative;
  padding-left: calc(var(--s-5) + 8px);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-2);
}
.ask-school__list li::before {
  content: counter(ask);
  position: absolute;
  left: 0;
  top: 0;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: rgba(232,163,61,.10);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}
