/* =========================================================================
   ФИРМЕННЫЕ ПЕРЕМЕННЫЕ СпикЭкспресс
   Значения сверены с действующим сайтом speak-express.ru (не с более
   старыми #2E3F6B/#9D302E/#ECEFF3/#818181 — они уже не актуальны).
   ========================================================================= */
:root {
  --navy: #0E1F50;       /* основной тёмно-синий: заголовки, кнопки, обводки */
  --navy-dark: #081638;  /* тёмный вариант: тёмные фоны, hover */
  --red: #AA0D16;        /* акценты, флажок паровозика */
  --gold: #F8C538;       /* колёса паровозика, медали, прогресс */
  --light: #F4F6FA;      /* фоны секций */
  --white: #FFFFFF;
  --grey: #6B7280;       /* второстепенный текст */
  --scene-mist: linear-gradient(100deg, #dbe5ed 0%, #cadcec 44%, #b9cce5 72%, #afa9d8 100%);
  --gallery-mist: #625095;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Montserrat', sans-serif;
  color: var(--navy);
  background: var(--white);
  overflow-x: hidden;
}
h1, h2, h3 { margin: 0 0 .5rem; }
p { line-height: 1.6; margin: 0; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }

.section-title {
  text-align: center;
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 800;
  color: var(--navy);
}
.section-subtitle {
  text-align: center;
  max-width: 620px;
  margin: 0 auto 2rem;
  color: var(--grey);
}

/* ===== Шапка ===== */
.site-header {
  position: absolute;
  z-index: 3;
  top: 1rem;
  left: clamp(1rem, 4vw, 4rem);
}
.brand { display: inline-flex; align-items: baseline; gap: .6rem; }
.brand__wordmark { font-weight: 800; font-size: 1.3rem; letter-spacing: -.01em; }
.brand__wordmark span:first-child { color: var(--navy); }
.brand__wordmark span:last-child { color: var(--red); }
.brand__sub { font-size: .8rem; font-weight: 600; color: var(--grey); }
.brand__logo { width: 300px; height: auto; }

/* =========================================================================
   ШАГ 1. HERO
   ========================================================================= */
.hero { padding: 1rem 1.5rem 2.5rem; text-align: center; }
.hero__inner { max-width: 640px; margin: 0 auto; }
.hero__title { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; color: var(--navy); }
.hero__subtitle { color: var(--grey); font-size: 1.02rem; margin-top: .8rem; }

.hero { padding: 0; }
.hero__scene {
  position: relative;
  isolation: isolate;
  min-height: max(600px, 100svh);
  width: 100%;
  margin: 0;
  overflow: hidden;
  border-radius: 0;
}
.hero__background {
  position: absolute;
  z-index: -2;
  inset: 0;
  background: url('output/imagegen/station-achievements-hero-panorama-v2.png') center / cover no-repeat;
}
.hero__background::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.68) 0%, rgba(255,255,255,.08) 48%, rgba(8,22,56,.18) 100%);
}
.hero__content {
  position: relative;
  z-index: 2;
  max-width: 620px;
  margin: 0 auto;
  padding: 6rem 1.5rem 3rem;
  text-align: center;
}
/* Общая дымка скрывает стык фонов, оставаясь позади Вилли. */
.hero__scene::after {
  content: '';
  position: absolute;
  z-index: 0;
  inset: auto 0 0;
  height: 220px;
  pointer-events: none;
  background: var(--scene-mist);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000);
  mask-image:
    radial-gradient(ellipse 36% 65% at 12% 90%, #000 0%, transparent 100%),
    radial-gradient(ellipse 30% 80% at 62% 100%, #000 0%, transparent 100%),
    radial-gradient(ellipse 24% 55% at 96% 86%, #000 0%, transparent 100%),
    linear-gradient(to bottom, transparent 0%, rgba(0,0,0,.12) 35%, rgba(0,0,0,.65) 78%, #000 100%);
}
.hero__title {
  display: inline-block;
  padding: .45rem 1rem;
  font-size: clamp(2rem, 4vw, 3rem);
  color: var(--navy);
  background: rgba(255,255,255,.88);
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(14,31,80,.16);
}
.hero__subtitle {
  max-width: 580px;
  margin: .9rem auto 0;
  padding: .65rem 1rem;
  color: var(--navy);
  background: rgba(255,255,255,.82);
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
}
.hero__villi {
  position: absolute;
  z-index: 1;
  bottom: 0;
  left: clamp(.4rem, 3vw, 2.2rem);
  width: min(31%, 285px);
  filter: drop-shadow(0 16px 18px rgba(8,22,56,.3));
}

/* =========================================================================
   ШАГ 2. РЕЙТИНГ ПАССАЖИРОВ
   ========================================================================= */
.leaderboard {
  position: relative;
  padding: 3rem 1.5rem 4rem;
  background: linear-gradient(180deg, rgba(255,255,255,.08) 0%, rgba(133,112,181,.28) 68%, rgba(98,76,151,.7) 100%), url('output/imagegen/leaderboard-fantasy-background-v1.png') left center / cover no-repeat;
}
.leaderboard::after {
  content: '';
  position: absolute;
  z-index: 0;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 140px;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent 0%, var(--gallery-mist) 100%);
}
.leaderboard::before {
  content: '';
  position: absolute;
  z-index: 0;
  inset: -1px 0 auto;
  height: 181px;
  pointer-events: none;
  background: var(--scene-mist);
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent);
  mask-image:
    radial-gradient(ellipse 32% 75% at 22% 0%, #000 0%, transparent 100%),
    radial-gradient(ellipse 38% 60% at 78% 0%, #000 0%, transparent 100%),
    linear-gradient(to bottom, #000 0%, rgba(0,0,0,.65) 22%, rgba(0,0,0,.12) 65%, transparent 100%);
}
.leaderboard > * { position: relative; z-index: 2; }
.leaderboard .section-title { color: var(--white); text-shadow: 0 3px 10px rgba(8,22,56,.7); }
.leaderboard .section-subtitle,
.leaderboard__hint { color: var(--white); font-weight: 600; text-shadow: 0 2px 8px rgba(8,22,56,.75); }

.collective-journey {
  position: relative;
  max-width: 1240px;
  margin: 1.5rem auto 2rem;
  isolation: isolate;
  overflow: hidden;
  color: #fff8df;
  border-radius: 24px;
  background: #071838 url('output/imagegen/collective-journey-concept-v2-early-progress.png') center / cover no-repeat;
  box-shadow: 0 24px 64px #0c102e66;
}
.collective-journey__caption {
  position: absolute;
  z-index: 2;
  top: 3.75rem;
  left: 50%;
  width: min(690px, 67%);
  padding: .8rem 2.5rem .9rem;
  transform: translateX(-50%);
  text-align: center;
  border: 2px solid #d79927;
  border-radius: 50% / 24%;
  background:
    linear-gradient(90deg, transparent, #071839e8 9% 91%, transparent),
    radial-gradient(ellipse, #11366beb, #061630f0 72%);
  box-shadow:
    inset 0 0 0 2px #6d3a10,
    inset 0 0 20px #061029,
    0 5px 18px #01081799,
    0 0 18px #f5bd4133;
}
.collective-journey__caption::before,
.collective-journey__caption::after {
  content: '◆';
  position: absolute;
  top: 50%;
  color: #ffd56b;
  font-size: .85rem;
  text-shadow: 0 0 8px #f9b926;
  transform: translateY(-50%);
}
.collective-journey__caption::before { left: 1.1rem; }
.collective-journey__caption::after { right: 1.1rem; }
.collective-journey__caption h3 {
  margin: 0;
  color: #ffd975;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(1.35rem, 2.3vw, 2rem);
  font-weight: 700;
  letter-spacing: .035em;
  text-transform: uppercase;
  text-shadow: 0 2px 0 #6b3306, 0 4px 10px #020716, 0 0 14px #f7c64a55;
}
.collective-journey__caption p {
  max-width: 620px;
  margin: .35rem auto 0;
  color: #fff4d2;
  font-size: .82rem;
  line-height: 1.45;
  text-shadow: 0 2px 7px #010716;
}
.collective-journey__scene {
  position: relative;
  z-index: 1;
  min-height: 420px;
}

.rays-guide {
  max-width: 1240px;
  margin: 0 auto 1rem;
  padding: 1rem 1.2rem;
  color: var(--white);
  background: rgba(8,22,56,.78);
  border: 1px solid rgba(255,255,255,.4);
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(8,22,56,.2);
}
.rays-guide h3,
.rays-guide h4 { margin: 0; color: var(--gold); }
.rays-guide h3 { font-size: 1.1rem; }
.rays-guide h4 { font-size: .95rem; }
.rays-guide p { margin: .45rem 0 0; font-size: .86rem; line-height: 1.5; }
.rays-guide__columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: .8rem;
}
.rays-guide__posters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin-top: .8rem;
}
.rays-guide__poster { margin: 0; }
.rays-guide__poster img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 16px;
}
@media (max-width: 760px) {
  .rays-guide__posters { grid-template-columns: 1fr; }
}

.rating-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .6rem;
  max-width: 760px;
  margin: 0 auto 1rem;
  padding: .7rem;
  background: rgba(8,22,56,.72);
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(8,22,56,.2);
}
.rating-type-btn {
  border: 2px solid rgba(255,255,255,.78);
  background: transparent;
  color: var(--white);
  border-radius: 999px;
  padding: .5rem 1.2rem;
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.rating-type-btn:hover { background: rgba(255,255,255,.18); }
.rating-type-btn.is-active { background: var(--gold); border-color: var(--gold); color: var(--navy); }
.rating-type-btn:focus-visible { outline: 3px solid var(--white); outline-offset: 2px; }

.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .6rem;
  margin-bottom: 2rem;
  padding: .7rem;
  background: rgba(255,255,255,.82);
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(8,22,56,.2);
}
.filter-btn {
  border: 2px solid var(--navy);
  background: var(--white);
  color: var(--navy);
  border-radius: 999px;
  padding: .5rem 1.2rem;
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
.filter-btn:hover { background: var(--light); }
.filter-btn.is-active { background: var(--navy); color: var(--white); }

.leaderboard__list {
  display: flex;
  flex-direction: column;
  gap: .7rem;
  max-width: 980px;
  margin: 0 auto;
  padding: .9rem;
  background: rgba(255,255,255,.74);
  border-radius: 20px;
  box-shadow: 0 12px 28px rgba(8,22,56,.24);
}

/* ----- Строка ученика ----- */
.row-wrapper {
  border-radius: 16px;
  overflow: hidden;
  background: var(--white);
  box-shadow: 0 3px 10px rgba(14, 31, 80, .06);
}
.row {
  display: grid;
  grid-template-columns: 3rem auto minmax(180px, 1fr) auto;
  align-items: center;
  gap: 1rem;
  background: var(--white);
  border-radius: 16px;
  padding: .9rem 1.1rem;
  box-shadow: none;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
  /* Появление строк при рендере/фильтрации */
  animation: row-in .35s ease both;
}
.row:hover, .row:focus-visible {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 8px 20px rgba(14, 31, 80, .14);
}
@keyframes row-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.row__rank {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-weight: 800;
  color: var(--grey);
  text-align: center;
}
.row__rank span { font-size: 1.15rem; line-height: 1; }
.row__rank small { margin-top: .2rem; font-size: .55rem; font-weight: 700; text-transform: uppercase; }
/* Топ-3 — фирменные цвета + лёгкая пульсация иконки места */
.row.is-top1 .row__rank, .row.is-top2 .row__rank, .row.is-top3 .row__rank {
  font-size: 1rem;
  animation: medal-glow 1.8s ease-in-out infinite;
}
.row.is-top1 .row__rank { color: var(--gold); }
.row.is-top2 .row__rank { color: var(--grey); filter: grayscale(0) brightness(1.3); }
.row.is-top3 .row__rank { color: var(--red); }
@keyframes medal-glow {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.row__avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--light);
  flex-shrink: 0;
  border: 2px solid var(--light);
}
.row.is-top1 .row__avatar { border-color: var(--gold); }
.row.is-top2 .row__avatar { border-color: var(--grey); }
.row.is-top3 .row__avatar { border-color: var(--red); }
.row__avatar img { width: 100%; height: 100%; object-fit: cover; }
.row__avatar--details {
  position: relative;
  padding: 0;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}
.row__avatar--details:hover { transform: scale(1.08); box-shadow: 0 0 0 3px rgba(248, 197, 56, .38); }
.row__avatar--details:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.row__main { min-width: 0; }
.row__name { font-weight: 700; font-size: .95rem; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__station { font-size: .78rem; color: var(--grey); margin-top: .1rem; }

/* Световой луч растёт вместе с количеством лучей света */
.row__progress {
  position: relative;
  height: 10px;
  background: rgba(8,22,56,.22);
  border-radius: 999px;
  margin-top: .5rem;
  overflow: visible;
}
.row__progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #f8c538 0%, #fff7bf 72%, #ffffff 100%);
  box-shadow: 0 0 8px rgba(248,197,56,.9), 0 0 18px rgba(255,247,191,.75);
  width: 0%; /* итоговая ширина проставляется в script.js и анимируется через transition */
  transition: width 1s ease;
}

.row__stats { min-width: 185px; text-align: right; flex-shrink: 0; }
.row__rays { display: flex; flex-direction: column; font-weight: 800; color: var(--navy); font-size: 1rem; }
.row__rays small { font-weight: 700; color: var(--grey); font-size: .66rem; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.row__rays strong { margin-top: .12rem; font-size: 1.05rem; }
.row__monthly-rays { display: block; color: var(--navy); font-size: .68rem; font-weight: 700; line-height: 1.25; white-space: nowrap; }
.row__breakdown {
  grid-column: 3 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .45rem;
  padding-top: .15rem;
}
.row__breakdown span {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: .4rem .5rem;
  border-radius: 9px;
  background: var(--light);
}
.row__breakdown small { color: var(--grey); font-size: .62rem; line-height: 1.15; }
.row__breakdown strong { margin-top: .15rem; color: var(--navy); font-size: .78rem; }
.row__details-toggle {
  margin-top: .45rem;
  padding: .35rem .55rem;
  border: 1px solid var(--navy);
  border-radius: 999px;
  background: var(--light);
  color: var(--navy);
  font: inherit;
  font-size: .72rem;
  font-weight: 700;
  cursor: pointer;
}
.row__details-toggle:hover { background: var(--gold); }
.row__details-toggle:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.row__weekly-details {
  margin: 0 .8rem .8rem;
  padding: .7rem .9rem;
  border-radius: 12px;
  background: var(--light);
  color: var(--navy);
}
.row__weekly-details p { margin: 0; font-size: .84rem; }
.row__weekly-section + .row__weekly-section { margin-top: .8rem; padding-top: .8rem; border-top: 1px solid rgba(14,31,80,.18); }
.row__weekly-section h4 { margin: 0 0 .5rem; color: var(--navy); font-size: .82rem; }
.row__weekly-details ol {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.row__weekly-details li { display: flex; flex-direction: column; gap: .15rem; font-size: .78rem; }
.row__weekly-details strong { font-size: .9rem; }
.row__weekly-gift { margin-left: .25rem; }
.row__weekly-breakdown { margin: .35rem 0 0; padding: 0; list-style: none; }
.row__weekly-details .row__weekly-breakdown li { display: block; font-size: .74rem; line-height: 1.35; }

.leaderboard__empty { text-align: center; color: var(--grey); padding: 2rem 0; }
.leaderboard__hint {
  text-align: center;
  color: var(--white);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.6;
  margin-top: 1.5rem;
  text-shadow: 0 2px 4px rgba(8,22,56,.95), 0 0 12px rgba(8,22,56,.65);
}

/* =========================================================================
   СТАНЦИЯ ПОДАРКОВ
   ========================================================================= */
.gift-station {
  position: relative;
  overflow: hidden;
  padding: 4rem 1.5rem 4.8rem;
  background:
    radial-gradient(circle at 15% 18%, rgba(255,247,191,.38) 0 2px, transparent 3px),
    radial-gradient(circle at 84% 14%, rgba(255,247,191,.3) 0 2px, transparent 3px),
    linear-gradient(180deg, #3b2a69 0%, #192d5d 100%);
}
.gift-station::before,
.gift-station::after {
  content: '';
  position: absolute;
  right: 0;
  left: 0;
  pointer-events: none;
}
.gift-station::before {
  top: 0;
  height: 132px;
  background: linear-gradient(to bottom, var(--gallery-mist), transparent);
}
.gift-station::after {
  bottom: -30px;
  height: 118px;
  background:
    radial-gradient(ellipse 34% 70% at 18% 100%, rgba(98,80,149,.94), transparent 72%),
    radial-gradient(ellipse 42% 78% at 72% 100%, rgba(98,80,149,.88), transparent 74%),
    linear-gradient(to bottom, transparent 0%, rgba(98,80,149,.64) 58%, var(--gallery-mist) 100%);
  filter: blur(16px);
  transform: scaleX(1.04);
}
.gift-station > * { position: relative; z-index: 1; }
.gift-station .section-title {
  color: var(--white);
  text-shadow: 0 3px 10px rgba(8,22,56,.7);
}
.gift-station .section-subtitle,
.gift-station__rule,
.gift-station__opening {
  max-width: 860px;
  margin-right: auto;
  margin-left: auto;
  text-align: center;
}
.gift-station .section-subtitle {
  padding: .7rem 1rem;
  color: var(--navy);
  background: rgba(255,255,255,.9);
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(8,22,56,.22);
}
.gift-station__rule {
  margin-top: 1rem;
  color: var(--white);
  font-weight: 700;
  text-shadow: 0 2px 6px rgba(8,22,56,.8);
}
.gift-station__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  max-width: 980px;
  margin: 2rem auto;
}
.gift-station__item {
  display: grid;
  grid-template-rows: minmax(220px, 1fr) auto auto auto;
  gap: .65rem;
  padding: 1rem;
  color: var(--navy);
  background: rgba(255,255,255,.95);
  border: 2px solid rgba(248,197,56,.85);
  border-radius: 18px;
  box-shadow: 0 12px 24px rgba(8,22,56,.28);
  text-align: center;
}
.gift-station__item img {
  width: 100%;
  height: 260px;
  object-fit: contain;
  border-radius: 12px;
  background: #f8f4ec;
}
.gift-station__keychain-sides {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .45rem;
}
.gift-station__keychain-sides figure {
  min-width: 0;
  margin: 0;
}
.gift-station__keychain-sides img {
  height: 210px;
  aspect-ratio: 1 / 1;
  object-fit: contain;
}
.gift-station__keychain-sides figcaption {
  margin-top: .3rem;
  color: var(--navy);
  font-size: .78rem;
  font-weight: 700;
  text-align: center;
}
.gift-station__item h3,
.gift-station__price { margin: 0; }
.gift-station__item h3 { font-size: 1rem; }
.gift-station__price {
  color: var(--red);
  font-size: 1.15rem;
  font-weight: 800;
}
.gift-station__exchange {
  justify-self: center;
  min-width: 170px;
  padding: .55rem 1rem;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 800;
}
.gift-station__exchange:disabled {
  color: #687184;
  background: #dfe3ea;
  cursor: not-allowed;
}
.gift-station__opening {
  margin-top: 1.5rem;
  padding: .85rem 1rem;
  color: var(--white);
  background: rgba(8,22,56,.6);
  border: 2px solid var(--gold);
  border-radius: 12px;
  font-weight: 800;
}

/* =========================================================================
   ШАГ 4. ГАЛЕРЕЯ АРТЕФАКТОВ (витрина / вагон-музей)
   ========================================================================= */
.artifacts-gallery {
  position: relative;
  padding: 4rem 1.5rem;
  background: linear-gradient(180deg, rgba(98,76,151,.7) 0%, rgba(48,36,94,.5) 45%, rgba(8,22,56,.72) 100%), url('output/imagegen/leaderboard-fantasy-background-v1.png') right center / cover no-repeat;
}
/* По обе стороны стыка размытая дымка сходится к одному непрозрачному цвету. */
.artifacts-gallery::before {
  content: '';
  position: absolute;
  z-index: 0;
  inset: -24px -2% auto;
  height: 168px;
  pointer-events: none;
  background:
    radial-gradient(ellipse 38% 68% at 22% 0%, var(--gallery-mist), transparent 74%),
    radial-gradient(ellipse 44% 72% at 78% 0%, var(--gallery-mist), transparent 76%),
    linear-gradient(to bottom, var(--gallery-mist) 0%, rgba(98,80,149,.7) 46%, transparent 100%);
  filter: blur(16px);
}
.artifacts-gallery > .section-title,
.artifacts-gallery > .section-subtitle {
  position: relative;
  z-index: 1;
}
.artifacts-gallery .section-title { color: var(--white); text-shadow: 0 3px 10px rgba(8,22,56,.7); }
.artifacts-gallery .section-subtitle { padding: .6rem 1rem; color: var(--navy); background: rgba(255,255,255,.78); border-radius: 12px; box-shadow: 0 8px 22px rgba(8,22,56,.18); }

/* Внешняя "рамка вагона": скруглённая крыша + декоративные колёса снизу */
.artifacts-gallery__wagon {
  position: relative;
  width: 100vw;
  max-width: none;
  aspect-ratio: 3 / 2;
  margin: 3rem calc(50% - 50vw) 1rem;
  padding: 19% 10% 24%;
}
/* Растворяем только фон вагона: табличка и карточки сохраняют чёткость. */
.artifacts-gallery__wagon::before {
  content: '';
  position: absolute;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  background: url('output/imagegen/artifact-museum-wagon-v2.png') center / 100% 100% no-repeat;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 16%);
  mask-image: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,.15) 3%, rgba(0,0,0,.55) 8%, #000 16%);
}
.artifacts-gallery__sign {
  position: absolute;
  z-index: 2;
  top: -1.45rem;
  left: 50%;
  padding: .6rem 1.4rem;
  color: var(--navy);
  background: var(--gold);
  border: 3px solid var(--white);
  border-radius: 9px;
  box-shadow: 0 5px 0 rgba(8,22,56,.28);
  font-size: clamp(.78rem, 2vw, 1rem);
  font-weight: 800;
  text-align: center;
  transform: translateX(-50%);
  white-space: nowrap;
}
.artifacts-gallery__coupler {
  content: '';
  position: absolute;
  bottom: 34px;
  width: 38px;
  height: 18px;
  background: var(--navy);
  border: 4px solid var(--gold);
  border-radius: 8px;
}
.artifacts-gallery__coupler--left { left: -38px; }
.artifacts-gallery__coupler--right { right: -38px; }
.artifacts-gallery__rail { position: absolute; right: 0; bottom: -21px; left: 0; height: 10px; background: linear-gradient(var(--gold) 0 30%, var(--navy) 30% 70%, var(--gold) 70%); }
.artifacts-gallery__wheel { position: absolute; bottom: -35px; width: 62px; height: 62px; border: 9px solid var(--gold); border-radius: 50%; background: var(--navy-dark); box-shadow: inset 0 0 0 8px var(--light); }
.artifacts-gallery__wheel--left { left: 11%; }
.artifacts-gallery__wheel--right { right: 11%; }

.artifacts-gallery__grid {
  position: relative;
  z-index: 1;
  display: grid;
  align-items: start;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5% 3%;
}

/* Карточка-рамка под реальный арт артефакта (картинка уже содержит
   название, описание и "силу артефакта" — сверху ничего не накладываем) */
.exhibit-card {
  cursor: zoom-in;
  min-width: 0;
  position: relative;
  z-index: 0;
  background: rgba(255,255,255,.82);
  border: 0;
  border-radius: 14px;
  padding: .35rem;
  box-shadow: 0 8px 18px rgba(8,22,56,.24);
  transition: transform .2s ease, box-shadow .2s ease;
  /* Небольшое появление при загрузке страницы, чтобы витрина не выглядела статично */
  animation: exhibit-in .4s ease backwards;
}
/* Поднимаем выбранный артефакт над соседними, не сдвигая сетку. */
@media (hover: hover) and (pointer: fine) {
  .exhibit-card:hover {
    z-index: 3;
    transform: translateY(-6px) scale(1.2);
    box-shadow: 0 18px 36px rgba(8,22,56,.45);
  }
}
@keyframes exhibit-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.exhibit-card__img { border-radius: 10px; width: 100%; }
/* Первые девять карточек имеют единый формат независимо от высоты десятой. */
.exhibit-card:nth-child(-n + 9) .exhibit-card__img {
  aspect-ratio: 3 / 4;
  object-fit: contain;
}
.exhibit-card:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }
body.artifact-viewer-open { overflow: hidden; }
.artifact-viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 60px 20px 20px;
  border: 0;
  background: rgba(8,22,56,.94);
}
.artifact-viewer[open] { display: flex; align-items: center; justify-content: center; }
.artifact-viewer::backdrop { background: rgba(8,22,56,.8); }
.artifact-viewer__image { width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 12px; }
.artifact-viewer__close {
  position: absolute;
  top: 10px;
  right: 16px;
  width: 44px;
  height: 44px;
  border: 2px solid white;
  border-radius: 50%;
  color: white;
  background: var(--navy);
  font-size: 24px;
  cursor: pointer;
}
.artifacts-gallery__coupler,
.artifacts-gallery__rail,
.artifacts-gallery__wheel { display: none; }

/* =========================================================================
   ШАГ 5. ГЕРОИ-ПОМОЩНИКИ
   ========================================================================= */
/* Светлая дымка соединяет вагон и карту, оставаясь позади содержимого. */
.artifacts-gallery::after {
  content: '';
  position: absolute;
  inset: auto 0 -1px;
  height: 220px;
  pointer-events: none;
  background: var(--scene-mist);
  mask-image: linear-gradient(to bottom, transparent, #000);
}
.characters {
  position: relative;
  padding: 3.5rem 1.5rem 1rem;
  background: linear-gradient(90deg, #edf5fa, #f8f9fc 55%, #e9e7f5);
}
.characters::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 180px;
  pointer-events: none;
  background: var(--scene-mist);
  mask-image:
    radial-gradient(ellipse 38% 75% at 20% 0%, #000, transparent),
    radial-gradient(ellipse 35% 60% at 80% 0%, #000, transparent),
    linear-gradient(to bottom, #000, transparent);
}
.characters > * { position: relative; z-index: 1; }
.characters > .section-title { color: var(--navy); }
.characters > .section-subtitle { color: #435677; }
.characters-map { position: relative; max-width: 1536px; margin: 0 auto; }
.characters-map__image { width: 100%; height: auto; border-radius: 18px; }
.characters-map__point {
  position: absolute;
  width: 11%;
  padding: 0;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(248,197,56,.65);
  border-radius: 50%;
  background: transparent;
  box-shadow: 0 0 16px rgba(248,197,56,.6);
  cursor: zoom-in;
  transition: transform .2s, box-shadow .2s;
}
.characters-map__point span { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); padding: 4px 8px; color: #081638; background: #f8c538; border-radius: 8px; font-size: clamp(8px, 1vw, 14px); white-space: nowrap; }
.characters-map__point:hover, .characters-map__point:focus-visible { transform: translate(-50%, -50%) scale(1.12); box-shadow: 0 0 28px #f8c538; outline: 3px solid white; }
body.hero-viewer-open { overflow: hidden; }
.hero-viewer { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 70px 24px 24px; border: 0; background: rgba(8,22,56,.95); overflow-y: auto; }
.hero-viewer[open] { display: grid; place-items: center; }
.hero-viewer::backdrop { background: #081638; }
.hero-viewer__card { width: min(100%, 1100px); display: grid; grid-template-columns: minmax(200px, .8fr) 1.2fr; align-items: center; gap: 32px; padding: clamp(20px, 4vw, 48px); background: #faf3df; border: 3px solid var(--gold); border-radius: 24px; }
.hero-viewer__portrait { width: 100%; max-height: 70vh; object-fit: contain; }
.hero-viewer__card h2 { font-size: clamp(30px, 4vw, 56px); }
.hero-viewer__card p { margin: 12px 0; font-size: clamp(16px, 1.6vw, 21px); }
.characters #charactersGrid { display: none; }
@media (max-width: 760px) {
  .characters { padding-inline: 12px; }
  .characters #charactersGrid { display: grid; margin-top: 24px; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .characters .character-card { flex-direction: column; padding: 12px 4px; border: 0; cursor: pointer; }
  .characters .character-card__station, .characters .character-card__who { display: none; }
  .characters .character-card__name { font-size: 14px; }
  .characters-map__point span { display: none; }
  .hero-viewer__card { grid-template-columns: 1fr; gap: 12px; }
  .hero-viewer__portrait { max-height: 32vh; }
}
.characters__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
  max-width: 1000px;
  margin: 0 auto;
}
.character-card {
  background: var(--white);
  border-radius: 16px;
  padding: 1rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 3px 10px rgba(14, 31, 80, .06);
  transition: transform .15s ease, box-shadow .15s ease;
}
.character-card:hover { transform: translateY(-3px); box-shadow: 0 8px 18px rgba(14, 31, 80, .12); }
.character-card__avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid var(--light);
}
.character-card__avatar img { width: 100%; height: 100%; object-fit: cover; }
.character-card__body { min-width: 0; }
.character-card__name { font-weight: 700; color: var(--navy); font-size: .95rem; }
.character-card__station { font-size: .68rem; color: var(--red); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; margin-bottom: .2rem; }
.character-card__who { font-size: .8rem; color: var(--grey); line-height: 1.35; }

/* =========================================================================
   ШАГ 6. ПОДВАЛ
   ========================================================================= */
.footer {
  background: linear-gradient(90deg, #edf5fa, #f8f9fc 55%, #e9e7f5);
  text-align: center;
  padding: .5rem 1.5rem 1.5rem;
  border-top: 0;
}
.footer__motto { color: var(--red); font-weight: 600; margin-top: .25rem; }
.footer__copy { margin-top: 1.2rem; font-size: .75rem; color: var(--grey); }
.brand__logo--footer { width: 190px; margin: 0 auto; }

/* =========================================================================
   ШАГ 3. КАРТОЧКА УЧЕНИКА (модальное окно)
   ========================================================================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
}
.modal.is-open { display: flex; }
body.no-scroll { overflow: hidden; }

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 22, 56, .65);
  animation: modal-fade .2s ease;
}
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }

.modal__card {
  position: relative;
  background: var(--white);
  color: var(--navy);
  border-radius: 22px;
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2.2rem 1.7rem 1.8rem;
  animation: modal-pop .25s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes modal-pop {
  from { opacity: 0; transform: scale(.92); }
  to   { opacity: 1; transform: scale(1); }
}

.modal__close {
  position: absolute;
  top: .9rem; right: .9rem;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--light);
  border: none;
  color: var(--navy);
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
}
.modal__close:hover { background: var(--gold); }

.modal__header { text-align: center; margin-bottom: 1.6rem; }
.modal__avatar {
  width: 84px; height: 84px;
  margin: 0 auto .8rem;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--gold);
  box-shadow: 0 6px 16px rgba(14, 31, 80, .18);
}
.modal__avatar img { width: 100%; height: 100%; object-fit: cover; }
.modal__name { font-size: 1.2rem; color: var(--navy); }
.modal__station { color: var(--grey); font-size: .88rem; margin-top: .2rem; }

/* ----- Мини-карта маршрута ----- */
.mini-route {
  position: relative;
  display: flex;
  justify-content: space-between;
  padding-top: 1.6rem;
  margin: 0 0 2rem;
}
.mini-route::before {
  content: '';
  position: absolute;
  top: calc(1.6rem + 12px);
  left: 4%;
  right: 4%;
  height: 2px;
  background: var(--light);
  z-index: 0;
}
.mini-route__stop {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}
.mini-route__dot {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .64rem;
  font-weight: 800;
  background: var(--white);
  border: 2px solid var(--light);
  color: var(--grey);
  transition: transform .2s ease;
}
.mini-route__stop--passed .mini-route__dot { background: var(--navy); border-color: var(--navy); color: var(--white); }
.mini-route__stop--current .mini-route__dot {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--navy);
  transform: scale(1.3);
  box-shadow: 0 0 0 5px rgba(248, 197, 56, .3);
  animation: here-pulse 1.6s ease-in-out infinite;
}
@keyframes here-pulse {
  0%, 100% { box-shadow: 0 0 0 5px rgba(248, 197, 56, .3); }
  50% { box-shadow: 0 0 0 9px rgba(248, 197, 56, .15); }
}
.mini-route__here {
  position: absolute;
  top: 100%;
  margin-top: .4rem;
  font-size: .6rem;
  font-weight: 800;
  color: var(--red);
  white-space: nowrap;
}

/* ----- Артефакты в карточке ----- */
.modal__artifacts-block { margin-bottom: 1.6rem; }
.modal__artifacts-block h4 { font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--grey); margin-bottom: .9rem; }
.modal__artifacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: .9rem;
}
.artifact-badge { display: flex; flex-direction: column; align-items: center; gap: .35rem; text-align: center; }
.artifact-badge__icon {
  width: 50px; height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  background: var(--light);
  box-shadow: 0 3px 8px rgba(14, 31, 80, .1);
}
.artifact-badge__label { font-size: .66rem; color: var(--navy); font-weight: 600; line-height: 1.2; }
.artifact-badge__parts { display: flex; justify-content: center; gap: .08rem; font-size: .92rem; line-height: 1; }
.artifact-badge__part { opacity: .24; filter: grayscale(1); transform: scale(.88); }
.artifact-badge__part.is-collected { opacity: 1; filter: none; transform: scale(1); }
.artifact-badge--locked .artifact-badge__icon { filter: grayscale(1); opacity: .4; }
.artifact-badge--locked .artifact-badge__label { color: var(--grey); opacity: .6; }
.modal__artifacts-empty { color: var(--grey); font-size: .82rem; grid-column: 1 / -1; }

/* ===== Адаптивность ===== */
@media (max-width: 960px) {
  .site-header { position: relative; top: auto; left: auto; padding: 0 1.5rem; }
  .site-header .brand__logo { width: 130px; }
  .hero__content { padding-top: 0; }
}
@media (max-width: 560px) {
  .rays-guide { padding: .9rem; }
  .rays-guide__columns { grid-template-columns: 1fr; }
  .row__weekly-details ol { grid-template-columns: repeat(2, 1fr); }

  .leaderboard { padding-right: .75rem; padding-left: .75rem; }
  .collective-journey {
    border-radius: 18px;
    background-position: 62% center;
    background-size: auto 100%;
  }
  .collective-journey__caption {
    top: 3.1rem;
    width: calc(100% - 3.25rem);
    padding: .65rem 1.6rem .75rem;
  }
  .collective-journey__caption::before { left: .6rem; }
  .collective-journey__caption::after { right: .6rem; }
  .collective-journey__caption h3 { font-size: 1.05rem; letter-spacing: .015em; }
  .collective-journey__caption p { margin-top: .25rem; font-size: .68rem; line-height: 1.35; }
  .collective-journey__scene { min-height: 360px; }


  .hero { padding: 0; }
  .hero__scene { min-height: max(640px, 100svh); border-radius: 0; }
  .site-header { padding-bottom: 2rem; }
  .site-header .brand__logo { width: 260px; }
  .hero__content { padding-top: 0; }
  .hero__subtitle { font-size: .9rem; }
  .hero__villi { width: min(47%, 220px); left: .5rem; }
  .hero__background { background-position: 53% center; }

  .filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .45rem;
    padding: .55rem;
  }
  .filter-btn { width: 100%; padding: .55rem .35rem; font-size: .78rem; }
  .filter-btn:first-child { grid-column: 1 / -1; }

  .gift-station { padding: 3rem 1rem 3.8rem; }
  .gift-station__grid { grid-template-columns: 1fr; gap: 1rem; }
  .gift-station__item img { height: 220px; }

  .artifacts-gallery__wagon { width: 100%; min-width: 0; aspect-ratio: auto; margin: 3rem 0 1rem; padding: 19% 10% 24%; }
  .artifacts-gallery__grid { grid-template-columns: 1fr; gap: 1.25rem; }
  .artifacts-gallery__coupler { display: none; }

  .row { grid-template-columns: 2.2rem auto 1fr; gap: .65rem; padding: .8rem; }
  .row__stats { grid-column: 1 / -1; min-width: 0; text-align: left; margin-top: .3rem; display: flex; flex-wrap: wrap; gap: .3rem .7rem; align-items: center; }
  .row__rays { flex-direction: row; gap: .35rem; align-items: baseline; }
  .row__breakdown { grid-column: 1 / -1; grid-template-columns: 1fr; }
  .row__details-toggle { margin-top: 0; }

  .mini-route__dot { width: 20px; height: 20px; font-size: .58rem; }
  .mini-route__here { font-size: .54rem; }
}

@media (min-width: 961px) {
  .hero__content { max-width: 1240px; }
  .hero__title { max-width: 572px; }
  .hero__subtitle { max-width: 1160px; padding: 1.3rem 2rem; font-size: 2rem; }
}

@media (min-width: 961px) and (max-width: 1800px) {
  .hero__subtitle { max-width: 580px; padding: .65rem 1rem; font-size: 1rem; }
}

@media (min-width: 1801px) {
  .leaderboard .section-title,
  .artifacts-gallery .section-title { font-size: 4rem; }
  .leaderboard .section-subtitle,
  .artifacts-gallery .section-subtitle { max-width: 1240px; font-size: 2rem; }
  .artifacts-gallery .section-subtitle { padding: 1.2rem 2rem; }
}
