/* Аудиогид «Крокус Сити Океанариум».
   Тёмная тема по сайту crocus-oceanarium.ru: тёмно-синий фон, белый текст.
   Ярко-голубой (как «Купить билет» в шапке сайта) — переходы по маршруту,
   оранжевый (как главная «Купить билет») — только прослушивание и оплата. */

:root {
  color-scheme: dark;

  --bg: #000B22;
  --surface: #021d47;
  --surface-hi: #012A60;
  --text: #F5FBFF;
  --text-soft: #9DB2D3;
  --line: rgba(255, 255, 255, .13);

  --cyan: #22E7F4;
  --accent: linear-gradient(5deg, #02BDCF 4%, #6AF1EF 94%);
  --accent-ink: #012A60;
  --orange: #FFA200;
  --orange-hot: #F52757;
  --cta: linear-gradient(-245deg, #F52757 0%, #FFA200 100%);

  --gutter: 16px;
  --radius: 14px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow-wrap: break-word;
}

h1, h2 { line-height: 1.2; margin: 0; }
a { color: var(--cyan); }

/* Страница уже уходит на лендинг за кодом (скрипт в <head>): не мигаем ею. */
html[data-locked] body { display: none; }

/* --- Экран аквариума ----------------------------------------------------- */

.exhibit { padding: calc(20px + env(safe-area-inset-top)) var(--gutter) 0; max-width: 640px; margin: 0 auto; }
.exhibit__kicker {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--cyan);
}
.exhibit__title { font-size: 28px; color: var(--text); }

/* Название между стрелками «назад» и «дальше» — переход без прокрутки вниз.
   Большие кнопки с подписями остаются внизу страницы (.next). */
.exhibit__kicker { text-align: center; }
.topnav { display: flex; align-items: center; gap: 10px; }
.topnav .exhibit__title { flex: 1 1 0; min-width: 0; font-size: 24px; text-align: center; }
.topnav__btn {
  position: relative;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-hi);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
.topnav__btn--none { visibility: hidden; }
.topnav__btn::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 9px;
  height: 9px;
  border-top: 3px solid currentColor;
  border-right: 3px solid currentColor;
}
.topnav__btn--prev::after { transform: translate(-30%, -50%) rotate(-135deg); }
.topnav__btn--next::after { transform: translate(-70%, -50%) rotate(45deg); }
/* «Дальше» — голубая, как большая кнопка внизу. */
.topnav__btn--next { background: var(--accent); color: var(--accent-ink); }
.topnav__btn:active { filter: brightness(.9); }

/* --- Плеер: главный элемент экрана ------------------------------------- */

.player { margin: 18px 0 0; }

.player__play {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 99px;
  background: var(--cta);
  color: #fff;
  font: inherit;
  font-size: 19px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.player__play:active { filter: brightness(.9); }

.player__icon { width: 26px; height: 26px; fill: currentColor; flex: none; }
.player__icon--pause { display: none; }
[data-state="playing"] .player__icon--play { display: none; }
[data-state="playing"] .player__icon--pause { display: block; }

.player__track { margin-top: 8px; }
/* До первого «Слушать» шкалы не видно, но место под неё занято: кнопка и
   текст ниже не прыгают, когда она появляется. */
.player:not([data-started]) .player__track { visibility: hidden; }
/* Подсказку про наушники пока не показываем. Сообщения (ошибка, остаток
   времени) — показываем. */
.player__hint:not([data-msg]) { display: none; }

.player__seek {
  width: 100%;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  height: 16px;
}
.player__seek::-webkit-slider-runnable-track {
  height: 5px; border-radius: 3px;
  background: linear-gradient(var(--cyan), var(--cyan)) no-repeat var(--line);
  background-size: var(--progress, 0%) 100%;
}
.player__seek::-moz-range-track { height: 5px; border-radius: 3px; background: var(--line); }
.player__seek::-moz-range-progress { height: 5px; border-radius: 3px; background: var(--cyan); }
.player__seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px; margin-top: -7px;
  border-radius: 50%; background: var(--cyan); border: 2px solid var(--bg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}
.player__seek::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--cyan); border: 2px solid var(--bg);
}

.player__times {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
  margin-top: -1px;
  line-height: 1.3;
}

.player__hint { font-size: 14px; color: var(--text-soft); margin: 2px 0 0; text-align: center; }

/* Плеер записи вида внутри карточки: та же механика, но не главный элемент
   экрана — ниже и тише, чтобы 16 карточек не превратились в 16 оранжевых плит. */
.player--compact { margin: 14px 0 4px; }
.player--compact .player__play { min-height: 44px; font-size: 17px; }
.player--compact .player__icon { width: 22px; height: 22px; }
.player--compact .player__track { margin-top: 6px; }
.player--compact .player__hint { margin-top: 2px; }
.player__hint--error { color: var(--orange); }

/* --- Факты и текст ----------------------------------------------------- */

.facts { margin: 14px 0 0; border-top: 1px solid var(--line); }
.facts__row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.facts__label { color: var(--text-soft); }
.facts__value { font-weight: 600; text-align: right; }

.text { margin: 14px 0 0; }
.text p { margin: 12px 0 0; }

.credits { margin: 24px 0 0; font-size: 13px; color: var(--text-soft); }

/* --- Обитатели аквариума (из выгрузки) ---------------------------------- */

/* Оглавление: в аквариуме бывает до 16 обитателей, листать вслепую долго. */
.tank { margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tank__title { flex: 0 0 100%; margin: 0 0 2px; font-size: 13px; color: var(--text-soft); }
.tank--expo { margin-top: 22px; }
.tank__item {
  padding: 5px 10px;
  border-radius: 99px;
  background: var(--surface-hi);
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
}

.inhabitants { margin: 16px 0 0; display: grid; gap: 22px; }

/* Небольшой отступ сверху, когда к карточке переходят из оглавления. */
.card {
  scroll-margin-top: 12px;
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.card__photos { background: var(--surface-hi); }
/* Все снимки — одной высоты: рамка 3:2 (так снято большинство фото в
   выгрузке), снимок другой формы заполняет её и обрезается по краям. */
.card__photos img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  object-position: center;
}
/* Несколько снимков листаются вбок, а не растягивают карточку. */
.card__photos--many {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.card__photos--many img { flex: 0 0 88%; width: 88%; scroll-snap-align: start; }

/* Текст об обитателях читают стоя у стекла — шрифт крупнее основного. */
.card__body { padding: 18px; font-size: 19px; line-height: 1.6; }
.card__title { font-size: 23px; color: var(--text); letter-spacing: .01em; }
.card__latin { margin: 2px 0 0; font-style: italic; color: var(--text-soft); }

.card__facts { margin: 14px 0 0; font-size: 18px; }
.card__facts dt {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.card__facts dd { margin: 0; }
.card__facts dd + dt, .card__facts dd + dd { margin-top: 8px; }

.card__text { margin-top: 12px; }
.card__text p, .card__fact p { margin: 10px 0 0; }
.card__text ul { margin: 10px 0 0; padding-left: 20px; }
.card__text li + li { margin-top: 8px; }

.card__fact {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-left: 4px solid var(--orange);
  border-radius: 0 10px 10px 0;
  background: var(--surface-hi);
  font-size: 18px;
}
.card__fact .card__fact-title { margin: 0; font-size: 14px; font-weight: 600; color: var(--orange); }

/* --- Переходы по маршруту ---------------------------------------------- */

/* Внизу страницы: назад / дальше и возврат в начало экспозиции (или на главную). */
.pager { max-width: 640px; margin: 0 auto; padding: 26px var(--gutter) 0; }
.next { display: flex; gap: 10px; }
/* «Назад» и «Дальше» — одной ширины, у каждой своя стрелка. */
.next__link {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: block;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--surface-hi);
  color: var(--text);
  text-decoration: none;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
}
.next__link::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  border-top: 3px solid currentColor;
  border-right: 3px solid currentColor;
}
/* «Назад»: стрелка слева, текст прижат к правому краю — зеркально «Дальше». */
.next__link--prev { padding-left: 40px; text-align: right; }
.next__link--prev::after { left: 18px; transform: translateY(-50%) rotate(-135deg); }
/* «Дальше» — ярко-голубая, как «Купить билет» в шапке сайта: следующий
   аквариум видно сразу. */
.next__link--next {
  padding-right: 40px;
  background: var(--accent);
  color: var(--accent-ink);
}
.next__link--next::after { right: 18px; transform: translateY(-50%) rotate(45deg); }
.next__link--next:active { filter: brightness(.92); }
.next__kicker { display: block; margin-bottom: 2px; font-size: 14px; font-weight: 500; color: var(--text-soft); }
.next__link--next .next__kicker { color: rgba(1, 42, 96, .75); }
.to-home {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  font-size: 17px;
  font-weight: 700;
}
.to-home svg { width: 20px; height: 20px; fill: currentColor; flex: none; }

/* --- Подвал ------------------------------------------------------------ */

/* Нижний отступ — под кнопку сканера: она висит поверх и не должна закрывать
   последние строки. */
.foot {
  padding: 24px var(--gutter);
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
  max-width: 640px;
  margin: 0 auto;
}

.langs { display: flex; justify-content: center; gap: 6px; }
.langs__item {
  padding: 5px 10px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: none;
  color: var(--text-soft);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.langs__item[aria-current="true"] {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
}

/* --- Сканер QR ---------------------------------------------------------- */

/* Кнопка всегда под большим пальцем: к следующему аквариуму подходят с
   открытой страницей предыдущего, и листать текст до конца ради сканера никто
   не станет. Ей пользуются постоянно, поэтому она акцентная — в том же
   оранжевом стиле, что и «Слушать». */
.scan-open {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 22px;
  border: 0;
  border-radius: 99px;
  background: var(--cta);
  color: #fff;
  font: inherit;
  font-size: 18px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .55);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.scan-open:active { filter: brightness(.9); }
.scan-open svg { width: 22px; height: 22px; fill: currentColor; flex: none; }

.scan {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 30;
  background: #000;
  color: #fff;
}
.scan[hidden], .scan [hidden] { display: none; }

.scan__view { position: absolute; top: 0; right: 0; bottom: 0; left: 0; overflow: hidden; }
.scan__video { display: block; width: 100%; height: 100%; object-fit: cover; }
/* Рамку области сканирования рисует библиотека, цвет задан у неё в style. */
.scan-region-highlight-svg { stroke: #fff !important; }

.scan__hint {
  position: absolute;
  top: calc(24px + env(safe-area-inset-top));
  left: 0; right: 0;
  margin: 0;
  padding: 0 var(--gutter);
  text-align: center;
  font-weight: 600;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .8);
}

.scan__error {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 0 28px;
  background: #000;
  text-align: center;
}
.scan__error p { margin: 0; }

.scan__bar {
  position: absolute;
  left: 0; right: 0;
  bottom: calc(24px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  gap: 12px;
}
.scan__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  min-height: 52px;
  padding: 0 24px;
  border: 0;
  border-radius: 99px;
  background: rgba(255, 255, 255, .92);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.scan__btn--icon { padding: 0; }
.scan__btn svg { width: 24px; height: 24px; fill: currentColor; }

/* --- Лендинг ----------------------------------------------------------- */

.hero {
  padding: calc(28px + env(safe-area-inset-top)) var(--gutter) 22px;
  text-align: center;
}
.hero__title { margin: 0; }
.hero__logo { display: block; margin: 0 auto; height: 110px; width: auto; }

.home__main {
  padding: 0 var(--gutter) calc(96px + env(safe-area-inset-bottom));
  max-width: 640px;
  margin: 0 auto;
}
.home__main .langs { margin-top: 28px; }

/* «Купить аудиогид» под карточками экспозиций. */
.buy-open {
  display: block;
  width: 100%;
  max-width: 360px;
  margin: 40px auto 0;
  padding: 15px 18px;
  border: 0;
  border-radius: 99px;
  background: var(--cta);
  color: #fff;
  font: inherit;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.buy-open:active { filter: brightness(.9); }

/* --- Окно оплаты: платное только прослушивание -------------------------- */

.paywall {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, .65);
}
.paywall[hidden] { display: none; }
.paywall__box {
  width: 100%;
  max-width: 480px;
  padding: 22px var(--gutter) calc(18px + env(safe-area-inset-bottom));
  border-radius: var(--radius) var(--radius) 0 0;
  background: radial-gradient(50% 50%, #023D77 0%, #022961 100%);
  text-align: center;
}
.paywall__title { font-size: 20px; color: var(--text); }
.paywall__msg { margin: 10px 0 0; font-size: 14px; color: var(--orange); }
.paywall__pay {
  display: block;
  width: 100%;
  margin-top: 18px;
  padding: 15px 18px;
  border: 0;
  border-radius: 99px;
  background: var(--cta);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.paywall__pay:active { filter: brightness(.9); }
.paywall__pay:disabled { opacity: .7; cursor: default; }
.paywall__code,
.paywall__close {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px;
  border: 0;
  background: none;
  color: var(--cyan);
  font: inherit;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
}
.paywall__close { color: var(--text-soft); }

/* Состояния окна (data-state, см. openPaywall в src/app.js). */
.paywall__form,
.paywall__done { display: none; }
.paywall[data-state="code"] .paywall__code { display: none; }
.paywall[data-state="code"] .paywall__form { display: flex; }
.paywall[data-state="valid"] .paywall__buy { display: none; }
.paywall[data-state="valid"] .paywall__done { display: block; }

.paywall__form { gap: 8px; margin-top: 14px; }
.paywall__input {
  flex: 1;
  min-width: 0;
  padding: 13px 14px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.paywall__input::placeholder { color: var(--text-soft); }
.paywall__input:focus { outline: 2px solid var(--cyan); outline-offset: 1px; }
.paywall__submit {
  flex: none;
  padding: 13px 18px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.paywall__submit:active { filter: brightness(.92); }
.paywall__submit:disabled { opacity: .7; cursor: default; }
.paywall__status { margin: 10px 0 0; font-size: 14px; color: var(--text-soft); }
.paywall__status[hidden] { display: none; }
.paywall__status--error { color: var(--orange); }
.paywall__ok { margin: 16px 0 0; font-size: 17px; font-weight: 600; color: #3EE08A; }
.paywall__left { margin: 6px 0 0; font-size: 15px; color: var(--text-soft); }

/* Карточки экспозиций — как блоки .item-list на crocus-oceanarium.ru:
   цветная плашка 230×330 со скруглением 15px, сверху название, снизу
   картинка, выступающая за края. */
.expositions__list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px 30px;
  margin-top: 6px;
}
.exposition { width: 230px; }
.exposition__card {
  display: block;
  position: relative;
  width: 230px;
  height: 330px;
  margin: 0 auto;
  padding: 25px 5px 0;
  border-radius: 15px;
  color: #fff;
  text-decoration: none;
  font-family: "Avenir Next", "Segoe UI", Roboto, sans-serif;
  transition: background .3s ease-in-out;
}
.exposition__card--1 { background: rgba(25, 161, 255, .9); }
.exposition__card--2 { background: rgba(34, 193, 118, .9); }
.exposition__card--3 { background: rgba(124, 205, 0, .9); }
.exposition__card--1:hover { background: rgba(25, 161, 255, .6); }
.exposition__card--2:hover { background: rgba(34, 193, 118, .6); }
.exposition__card--3:hover { background: rgba(124, 205, 0, .6); }
.exposition__title {
  display: block;
  position: relative;
  z-index: 4;
  padding: 0 10px;
  font-size: 22px;
  font-weight: 400;
  line-height: 1.1;
}
.exposition__kind { display: block; font-size: 16px; margin-bottom: 2px; }
.exposition__picture {
  position: absolute;
  left: 0;
  bottom: 0;
  background-repeat: no-repeat;
  background-size: cover;
}
.exposition__card--1 .exposition__picture { background-image: url(/expo-1.png); width: 266px; height: 237px; left: -19px; z-index: 3; }
.exposition__card--2 .exposition__picture { background-image: url(/expo-2.png); width: 253px; height: 271px; bottom: -2px; z-index: 2; }
.exposition__card--3 .exposition__picture { background-image: url(/expo-3.png); width: 242px; height: 244px; z-index: 1; }
