/*
 * Общая вёрстка гида. Облик задаёт оформление издателя: стиль (data-style на <html>), шрифт заголовков
 * и цвета — переменные из partials/theme.html; особенности стилей — в styles.css. Неон «ночного города»
 * живёт только в заголовках, номере экспоната и моментах анимаций; основной текст ровный.
 */

@font-face {
  font-family: "Golos Text";
  src: url("/static/fonts/golos-text-cyrillic-wght-normal.woff2") format("woff2-variations");
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Golos Text";
  src: url("/static/fonts/golos-text-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Фон, текст, линии и акцент задаёт оформление издателя (partials/theme.html, guide/theme.py):
     --wall, --surface, --ink, --stone, --line — по стилю; --accent, --accent-ink, --accent-soft,
     --glow — цвет музея; --heading — шрифт заголовков. Здесь — только общее для всех стилей. */
  --error: #a4322b;
  --error-soft: #f8e6e4;

  /* Логотип платформы (символ #i-logo): цвета бренда, не музея. */
  --logo-main: #c67139;
  --logo-grille: #f5ead8;
  --logo-wave: #7a8a5e;

  /* Движение: одна кривая и два темпа на весь гид. Вход медленнее выхода. */
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --t-enter: 220ms;
  --t-exit: 140ms;

  --sans: "Golos Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;

  --r-card: 14px;
  --r-control: 12px;
  --r-plaque: 6px;
  --tap: 48px;
  --page: 600px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --error: #f0aaa4; --error-soft: #3a1f1c; --logo-grille: #201e1d; --logo-wave: #a9b78a; }
}
:root[data-theme="dark"] { --error: #f0aaa4; --error-soft: #3a1f1c; --logo-grille: #201e1d; --logo-wave: #a9b78a; }

/* ── Основа ── */
*, *::before, *::after { box-sizing: border-box; }
[x-cloak], [hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--wall);
  color: var(--ink);
  font: 400 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img { display: block; max-width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
h1, h2 { font-family: var(--heading); font-weight: 600; line-height: 1.15; margin: 0; text-wrap: balance; letter-spacing: -0.01em; }
h1 { font-size: clamp(28px, 7.5vw, 36px); }
h2 { font-size: 22px; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.icon { width: 24px; height: 24px; flex: none; }
.icon-sm { width: 18px; height: 18px; }
.is-accent { color: var(--accent); }
.muted { color: var(--stone); }
.hint { font-size: 14px; color: var(--stone); line-height: 1.45; }

.page {
  max-width: var(--page);
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
           max(40px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 32px;
}
/* Под нижнюю панель с мини-плеером и кнопкой номера. */
.page-tour { padding-bottom: calc(176px + env(safe-area-inset-bottom)); }
.page-tour:has(.tour[data-view="keypad"]),
.page-tour:has(.tour[data-view="access"]) { padding-bottom: max(24px, env(safe-area-inset-bottom)); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  margin-bottom: -12px;
}
.theme-btn {
  margin-left: auto;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--stone);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.theme-btn .icon { width: 22px; height: 22px; }
.theme-btn .theme-light, .theme-btn .theme-dark { display: none; }
:root[data-theme-choice="light"] .theme-btn .theme-auto,
:root[data-theme-choice="dark"] .theme-btn .theme-auto { display: none; }
:root[data-theme-choice="light"] .theme-btn .theme-light,
:root[data-theme-choice="dark"] .theme-btn .theme-dark { display: block; }

.page-back {
  align-self: flex-start;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  margin-left: -6px;
  padding-right: 8px;
  color: var(--stone);
  text-decoration: none;
  font-size: 15px;
}
.page-back span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-back .icon { width: 22px; height: 22px; }
/* В Telegram и MAX есть системная кнопка «Назад». */
[data-platform="telegram"] .page-back,
[data-platform="max"] .page-back { display: none; }

/* ── Вступление страниц ── */
.intro { display: flex; flex-direction: column; gap: 12px; }
.intro-mark { width: 56px; height: 56px; }
.brand { display: flex; align-items: center; gap: 12px; }
/* Название платформы — не переводится. */
.wordmark { font-family: var(--heading); font-weight: 600; font-size: 26px; letter-spacing: -0.01em; color: var(--ink); }
.intro-owner { font-size: 15px; color: var(--stone); }
.intro-cover,
.museum-cover {
  width: calc(100% + 32px);
  max-width: none;
  margin: 0 -16px 4px;
}
.intro-cover { aspect-ratio: 16 / 9; object-fit: cover; }
@media (min-width: 632px) {
  .intro-cover, .museum-cover { width: 100%; margin: 0 0 4px; border-radius: var(--r-card); }
}
.museum-intro { text-align: center; overflow-wrap: anywhere; }
.museum-intro .lead { margin-inline: auto; }
.museum-cover {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: end;
  overflow: hidden;
}
.museum-cover::before { content: ""; grid-area: 1 / 1; width: 100%; aspect-ratio: 16 / 9; }
.museum-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.museum-cover-title { position: relative; grid-area: 1 / 1; margin-top: 72px; padding: 12px 16px; }
.lead { font-size: 17px; line-height: 1.55; color: var(--stone); max-width: 36em; }
/* Страница выбора канала и «скоро опубликуют»: логотип музея как есть, фото автора — кружком. */
.promo-logo { width: 72px; height: 72px; object-fit: contain; border-radius: var(--r-plaque); }
.promo-photo { width: 96px; height: 96px; object-fit: cover; border-radius: 50%; }
.promo-soon { margin-top: 24px; font-family: var(--heading); font-size: 20px; color: var(--ink); }
.channels { display: grid; gap: 10px; }
.channel {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: var(--tap);
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}
.channel:active { background: var(--accent-soft); }
/* Браузер — главная кнопка: открывается у всех. */
.channel-web { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.channel-icon { width: 26px; height: 26px; flex: none; }
.channel-body { display: flex; flex-direction: column; gap: 2px; }
.channel-name { font-weight: 600; font-size: 16px; }
.channel-hint { font-size: 14px; opacity: .75; }

.group { display: flex; flex-direction: column; gap: 14px; }
.group-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.group-head a { font-size: 15px; }

/* Главная: кнопки разделов «Музеи» и «Авторы» */
.catalog-home-intro { text-align: center; }
.catalog-home-intro .lead { margin-inline: auto; }
.portals { display: grid; gap: 14px; }
@media (min-width: 560px) { .portals { grid-template-columns: 1fr 1fr; } }
.portal {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  min-height: 210px;
  padding: 22px 22px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  color: inherit;
  text-decoration: none;
  text-align: center;
  transition: border-color .15s ease, background-color .15s ease;
}
.portal:hover { border-color: var(--accent); }
.portal:active { background: var(--accent-soft); }
.portal:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.portal-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--logo-wave);  /* зелёный, как сигнал в логотипе */
  box-shadow: inset 0 0 0 1px var(--accent);
}
.portal-icon .icon { width: 30px; height: 30px; }
/* В тёмной теме круг без заливки — только обводка. */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .portal-icon { background: transparent; } }
:root[data-theme="dark"] .portal-icon { background: transparent; }
.portal-body { display: flex; flex: 1; flex-direction: column; align-items: center; gap: 8px; }
.portal-body .tag { align-self: center; margin-top: auto; }
.portal-title { font-family: var(--heading); font-size: 30px; font-weight: 600; line-height: 1.1; letter-spacing: -0.01em; }
.portal-text { color: var(--stone); font-size: 15px; line-height: 1.45; }
.portal-arrow { position: absolute; top: 22px; right: 20px; color: var(--stone); }
.portal:hover .portal-arrow { color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .portal { transition: none; } }

/* Главная: купленные гиды — над разделами, чтобы вернуться в одно касание. */
.my-guides { display: flex; flex-direction: column; gap: 10px; }
.my-guide {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px 10px 10px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--r-card);
  color: inherit;
  text-decoration: none;
}
.my-guide:active { background: var(--accent-soft); }
.my-guide:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.my-guide-cover { width: 64px; height: 64px; flex: none; border-radius: calc(var(--r-card) - 6px); object-fit: cover; }
.my-guide-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.my-guide-name { font-family: var(--heading); font-size: 20px; font-weight: 600; line-height: 1.2; }
.my-guide-until { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--stone); }
/* Зелёная точка — доступ действует. */
.my-guide-until::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--logo-wave); flex: none; }
.my-guide-arrow { flex: none; color: var(--stone); }

/* Музей или тур в списке */
.venue {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--r-card);
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  border: 1px solid var(--line);
}
.venue:active { background: var(--accent-soft); }
.venue-cover { width: 100%; aspect-ratio: 2 / 1; object-fit: cover; }
.venue-body { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px 18px; }
.venue-name { font-family: var(--heading); font-size: 21px; font-weight: 600; line-height: 1.2; }
.venue-text { color: var(--stone); font-size: 15px; line-height: 1.45; }
.museum-tours :is(.venue-name, .venue-text) { text-align: center; overflow-wrap: anywhere; }
.museum-tours .venue-body { padding-top: 10px; }
.museum-tour-head {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr;
}
.museum-tour-head[data-cover]::before { content: ""; grid-area: 1 / 1 / 3 / 2; width: 100%; aspect-ratio: 2 / 1; }
.museum-tour-head .venue-cover { position: absolute; inset: 0; height: 100%; }
.museum-tour-head .venue-name {
  position: relative;
  grid-area: 2 / 1;
  align-self: end;
  padding: 10px 14px 12px;
}
.museum-tour-head .tags {
  position: relative;
  grid-area: 1 / 1;
  align-self: start;
  justify-content: flex-end;
  padding: 10px 12px 0;
}
.museum-tour-head .tag { white-space: normal; overflow-wrap: anywhere; }
.museum-tour-head[data-cover] .tag { background: rgb(10 16 26 / 78%); color: white; }

/* Разделы «Музеи» и «Авторы»: плитки по очереди всплывают снизу. */
.page.catalog-section,
.page.museum-profile {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  height: 100vh;
  height: 100dvh;
  gap: 0;
  padding: 0;
}
.catalog-section > .topbar,
.catalog-section > [data-catalog-list],
.museum-profile > .topbar,
.museum-content {
  padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right));
}
.catalog-section > .topbar,
.museum-profile > .topbar {
  margin: 0;
  padding-block: max(8px, env(safe-area-inset-top)) 8px;
  border-bottom: 1px solid var(--line);
}
.catalog-section > .topbar { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; }
.catalog-section > .topbar h1 { grid-column: 2; text-align: center; }
.catalog-section > .topbar .theme-btn { grid-column: 3; margin: 0; }
.museum-profile > .topbar .theme-btn { margin-right: 0; }
.museum-header-brand { gap: 8px; }
.museum-header-brand .wordmark { font-size: 20px; }
.museum-header-mark { flex: none; width: 32px; height: 32px; }
.catalog-section > [data-catalog-list],
.museum-content {
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding-block: 12px;
}
.museum-content { display: flex; flex-direction: column; gap: 32px; }
.museum-content > * { flex-shrink: 0; }
.catalog-section > [data-catalog-list] > .venue { flex-shrink: 0; }
.catalog-lead { margin-inline: auto; text-align: center; }
.catalog-empty { text-align: center; }
.catalog-section > .catalog-foot,
.museum-profile > .page-foot {
  margin: 0;
  padding-block: 4px max(4px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
.catalog-section > .catalog-foot a { min-height: var(--tap); }
.museum-profile > .page-foot .powered {
  display: flex;
  align-items: center;
  gap: .25em;
  min-height: var(--tap);
}
.venue[data-catalog-card] { position: relative; }
.venue-summary {
  position: relative;
  display: block;
  cursor: pointer;
  list-style: none;
}
.venue-summary::-webkit-details-marker { display: none; }
.venue-summary:not([data-cover]) { display: grid; align-content: center; min-height: 10rem; }
[data-catalog-list]:has(> .venue[open]:not([data-closing])) > .venue:is(:not([open]), [data-closing]) > .venue-summary { filter: brightness(.5); }
.venue[data-catalog-card]:has(.venue-summary:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.venue-summary .venue-body { position: relative; text-align: center; overflow-wrap: anywhere; }
.venue[open]:not([data-closing]) > .venue-summary .venue-body { opacity: 0; }
.venue-summary .venue-body .tag { align-self: center; }
.venue-summary[data-cover] {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: end;
}
.venue-summary[data-cover]::before {
  content: "";
  grid-area: 1 / 1;
  width: 100%;
  aspect-ratio: 2 / 1;
}
.venue-summary[data-cover] .venue-cover { position: absolute; inset: 0; height: 100%; }
.venue[data-author] .venue-cover { object-position: center 35%; }
.venue-initial {
  display: grid;
  place-items: center;
  align-self: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-soft);
  font: 600 28px/1 var(--heading);
}
.venue-summary[data-cover] .venue-body {
  grid-area: 1 / 1;
  margin-top: 72px;
  padding-block: 10px 12px;
}
.museum-cover-title,
.museum-tour-head[data-cover] .venue-name,
.venue-summary[data-cover] .venue-body {
  border-top: 1px solid rgb(255 255 255 / 28%);
  /* Подложка сохраняет контраст на светлом фото и без размытия. */
  background: rgb(10 16 26 / 68%);
  color: white;
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  backdrop-filter: blur(12px) saturate(1.2);
}
.venue-summary .venue-cover-count {
  position: absolute;
  z-index: 2;
  inset-block-start: 12px;
  inset-inline-end: 12px;
  background: rgb(10 16 26 / 78%);
  color: white;
}
.venue-reveal {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  background: rgb(10 16 26 / 78%);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  backdrop-filter: blur(12px) saturate(1.2);
  color: white;
  cursor: pointer;
  text-align: center;
  overflow-wrap: anywhere;
}
.venue-reveal-copy {
  align-self: center;
  min-height: 0;
  max-height: 100%;
  padding: 10px 12px;
  overflow: auto;
}
.venue-reveal-copy .venue-name { display: block; }
.venue-summary[data-cover] + .venue-reveal .venue-name { padding-inline: 58px; }
.venue-reveal .venue-text { margin-top: 4px; color: inherit; font-size: 1rem; line-height: 1.3; }
.venue-reveal .venue-text-medium { font-size: .9375rem; }
.venue-reveal .venue-text-long { font-size: .875rem; }
.venue-reveal .btn {
  min-height: 44px;
  justify-content: space-between;
  padding: 8px 16px;
  border: 0;
  border-radius: 0;
  background: rgb(0 0 0 / 16%);
  color: white;
  text-decoration: none;
}
.venue-reveal .btn:focus-visible { outline-offset: -3px; }
.venue-reveal .btn:is(:hover, :active) { background: rgb(0 0 0 / 24%); }
@media (prefers-reduced-motion: no-preference) {
  .venue-summary { transition: filter var(--t-enter) var(--ease-out); }
  .venue[data-closing] > .venue-summary .venue-body { transition: opacity var(--t-enter) var(--ease-out); }
  .venue[open] > .venue-reveal { animation: venue-glass-in 360ms var(--ease-out) both; }
  .venue[open] .venue-reveal-copy { animation: venue-copy-in 360ms var(--ease-out) both; }
}
@keyframes venue-glass-in { from { opacity: 0; } }
@keyframes venue-copy-in { from { opacity: 0; transform: translateY(16px); } }
.rise { animation: rise-up .8s cubic-bezier(.16, 1, .3, 1) both; animation-delay: calc(min(var(--i, 0), 8) * 85ms + 120ms); }
@keyframes rise-up {
  from { opacity: 0; transform: translateY(72px) scale(.96); filter: blur(4px); }
  55% { filter: blur(0); }
  to { opacity: 1; transform: none; }
}

/* Подпись внизу раздела — ссылка на главную. */
.catalog-foot { display: flex; justify-content: center; margin-top: auto; padding-top: 24px; }
.catalog-foot a { display: inline-flex; align-items: center; gap: 10px; color: var(--stone); text-decoration: none; opacity: .8; }
.catalog-foot a:hover { opacity: 1; }
.catalog-foot-mark { width: 30px; height: 30px; }
.catalog-foot .wordmark { font-size: 20px; color: inherit; }

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

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  align-self: flex-start;
  font-size: 13px;
  line-height: 1;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--wall);
  color: var(--stone);
  white-space: nowrap;
}
/* Текст метки — основным цветом: акцент на мягком фоне акцента не дотягивает до 4.5:1. */
.tag-free { background: var(--accent-soft); color: var(--ink); font-weight: 600; box-shadow: inset 0 0 0 1px var(--accent); }

/* ── Переключатели (язык, версия гида) ── */
.segmented {
  display: inline-flex;
  align-self: flex-start;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  max-width: 100%;
  overflow-x: auto;
}
.segment {
  min-height: 40px;
  padding: 8px 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--stone);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.segment.is-active { background: var(--accent); color: var(--accent-ink); }
.segmented-sm .segment { min-height: 44px; padding: 8px 16px; font-size: 14px; }

/* ── Кнопки ── */
.btn {
  min-height: var(--tap);
  padding: 12px 20px;
  border-radius: var(--r-control);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  touch-action: manipulation;
}
.btn:disabled { opacity: .4; cursor: default; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-quiet { background: transparent; border-color: var(--line); color: var(--ink); font-weight: 500; }
.link-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: 0; padding: 4px; margin-left: 4px;
  color: var(--accent); font-size: inherit; cursor: pointer;
}

/* ── Сообщения ── */
.notice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--r-card);
  background: var(--surface);
  border: 1px solid var(--line);
}
.notice-ok { background: var(--accent-soft); border-color: transparent; }
.notice-error { background: var(--error-soft); color: var(--error); border-color: transparent; }
.key { font-weight: 700; letter-spacing: .08em; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── Номер экспоната ── */
.numeral {
  font-family: var(--heading);
  font-weight: 500;
  font-size: 28px;
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: lining-nums tabular-nums;
}
.numeral-sm { font-size: 22px; }

.plaque {
  font-family: var(--heading);
  font-weight: 500;
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--accent);
  background: var(--surface);
  border: 1px solid var(--accent);
  outline: 1px solid var(--accent);
  outline-offset: -5px;
  border-radius: var(--r-plaque);
  line-height: 1;
}

/* ── Список экспонатов ── */
.tour-list { display: flex; flex-direction: column; gap: 22px; }
.exhibits { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.exhibits li { border-bottom: 1px solid var(--line); }
.exhibit-row {
  width: 100%;
  min-height: 76px;
  display: grid;
  grid-template-columns: 3.25rem minmax(0, 1fr) auto 56px;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  background: none;
  border: 0;
  text-align: left;
  cursor: pointer;
}
.exhibit-row:active { background: var(--accent-soft); }
.exhibit-row .numeral { text-align: right; }
.exhibit-row-main { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.exhibit-row-title { font-size: 17px; line-height: 1.3; overflow-wrap: anywhere; }
.exhibit-row-side { display: inline-flex; align-items: center; gap: 8px; color: var(--stone); }
.exhibit-row img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }
.exhibit-row.is-locked .exhibit-row-title { color: var(--stone); }
.exhibit-row.is-locked .numeral { opacity: .55; }
.exhibit-row.is-playing .numeral { color: var(--accent); }
@media (max-width: 359px) {
  .exhibit-row { grid-template-columns: 2.4rem minmax(0, 1fr) auto 44px; gap: 10px; }
  .exhibit-row img { width: 44px; height: 44px; }
  .exhibit-row .numeral { font-size: 24px; }
  .exhibit-row-title { font-size: 16px; }
}

/* ── Нижняя панель ── */
.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  padding: 10px max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: linear-gradient(to top, var(--wall) 70%, transparent);
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: calc(var(--page) + 0px);
  margin: 0 auto;
}
.dock-keypad {
  min-height: 60px;
  border: 0;
  border-radius: var(--r-control);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 17px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
}
.mini {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  overflow: hidden;
}
.mini-open {
  display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 8px 12px 8px 14px;
  background: none; border: 0; text-align: left; cursor: pointer; min-width: 0;
}
.mini-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.mini-play {
  width: 56px; height: 56px; border: 0; background: none; color: var(--accent); cursor: pointer;
  display: grid; place-items: center;
}
.mini-progress { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--accent); }

/* ── Клавиатура ── */
.keypad { display: flex; flex-direction: column; gap: 14px; padding-top: 8px; }
/* Клавиши прижаты к низу экрана: туда дотягивается большой палец. */
.tour[data-view="keypad"] .keypad { min-height: calc(100vh - 130px); min-height: calc(100dvh - 130px); }
.keypad-grid { margin-top: auto; }
.keypad-label { text-align: center; color: var(--stone); font-size: 15px; }
.plaque-input {
  display: grid;
  place-items: center;
  min-height: clamp(84px, 15dvh, 120px);
  padding: 16px;
  font-size: clamp(48px, 9dvh, 72px);
  letter-spacing: .04em;
  transition: border-color .15s, color .15s;
}
.plaque-input.is-empty { color: var(--line); }
.plaque-input.is-error { border-color: var(--error); outline-color: var(--error); color: var(--error); }
.keypad-error { min-height: 1.45em; text-align: center; color: var(--error); font-size: 15px; }
.keypad-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.key-btn {
  min-height: clamp(52px, 9dvh, 76px);
  border-radius: var(--r-control);
  border: 1px solid var(--line);
  background: var(--surface);
  font-family: var(--sans);
  font-size: 28px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  display: grid;
  place-items: center;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}
.key-btn:active { background: var(--accent-soft); border-color: var(--accent); }
.key-btn:disabled { opacity: .4; cursor: default; }
.key-quiet { background: transparent; border-color: transparent; color: var(--stone); }
.key-go { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-size: 17px; font-weight: 600; }
.key-go:active { background: var(--accent); filter: brightness(1.1); }

/* ── Экспонат ── */
.exhibit-body { display: flex; flex-direction: column; gap: 18px; }
.exhibit-figure { position: relative; margin: 0 -16px 18px; }
.exhibit-figure img { width: 100%; aspect-ratio: 4 / 3; max-height: 42vh; max-height: 42dvh; object-fit: cover; }
@media (min-width: 632px) {
  .exhibit-figure { margin: 0 0 18px; }
  .exhibit-figure img { border-radius: var(--r-card); }
}
.exhibit-figure .plaque {
  position: absolute;
  left: 16px;
  bottom: -18px;
  min-width: 64px;
  padding: 12px 14px 10px;
  font-size: 34px;
  text-align: center;
  box-shadow: 0 8px 24px -12px rgb(0 0 0 / .45);
}
.exhibit-figure.no-image { margin-bottom: 0; }
.exhibit-figure.no-image .plaque { position: static; display: inline-block; box-shadow: none; }
.exhibit-title { font-size: clamp(26px, 7vw, 32px); }
.exhibit-content { display: flex; flex-direction: column; gap: 14px; }
.exhibit-text {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  white-space: pre-line;
  max-width: 34em;
}

/* Плеер */
.player {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 16px 16px;
  border-radius: var(--r-card);
  background: var(--surface);
  border: 1px solid var(--line);
}
.player-scrub { display: flex; flex-direction: column; gap: 6px; padding-right: 64px; }
.player-time { display: flex; justify-content: space-between; font-size: 13px; color: var(--stone); font-variant-numeric: tabular-nums; }
.player-controls { display: flex; align-items: center; justify-content: center; gap: 28px; }
.play-btn {
  width: 72px; height: 72px;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  touch-action: manipulation;
}
.play-btn .icon { width: 30px; height: 30px; }
.round-btn {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.round-btn .icon { width: 28px; height: 28px; }
.round-btn:disabled { opacity: .3; cursor: default; }
.rate-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  min-width: 56px;
  height: 44px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 44px;
  margin: -10px 0;
  background: transparent;
  cursor: pointer;
  touch-action: none;
}
input[type="range"]:disabled { cursor: default; }
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--accent) var(--progress, 0%), var(--line) var(--progress, 0%));
}
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px; margin-top: -7px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--accent);
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
}
input[type="range"]:disabled::-webkit-slider-thumb { background: var(--line); box-shadow: none; }

.prev-next { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 6px; }
.prev-next .btn { padding: 12px; min-width: 0; }
.prev-next .btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 359px) {
  .prev-next .btn { padding: 10px 6px; gap: 2px; font-size: 14px; }
  .prev-next .btn .icon { width: 16px; height: 16px; }
}

/* ── Доступ ── */
.access { display: flex; flex-direction: column; gap: 14px; }
.pay-only { display: flex; flex-direction: column; gap: 10px; }
.tariffs { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.tariffs li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.tariff-term { color: var(--stone); white-space: nowrap; }
.redeem { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.redeem label { font-weight: 600; }
.redeem-row { display: flex; gap: 8px; }
.redeem input {
  flex: 1;
  min-width: 0;
  min-height: 52px;
  padding: 10px 14px;
  border-radius: var(--r-control);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: 600 17px var(--sans);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.redeem input::placeholder { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--stone); }
.redeem input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.redeem .btn { min-height: 52px; }
#redeem-result:not(:empty) { margin-top: 6px; }
@media (max-width: 380px) { .redeem-row { flex-direction: column; } }

/* Оплата не показывается в Telegram и VK (правила площадок), подсказка — только там. */
.messenger-only { display: none; }
[data-platform="telegram"] .pay-only,
[data-platform="vk"] .pay-only { display: none; }
[data-platform="telegram"] .messenger-only,
[data-platform="vk"] .messenger-only { display: block; }

/* ── Запуск и ошибки ── */
.launch {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  color: var(--stone);
}
.launch .logo { width: 72px; height: 72px; animation: breathe 1.6s ease-in-out infinite; }
.launch .wordmark { font-size: 24px; }
@keyframes breathe { 50% { opacity: .35; } }
.overlay {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: rgb(10 16 13 / .55);
}
.overlay-card {
  max-width: 400px;
  display: flex; flex-direction: column; gap: 14px;
  padding: 24px;
  border-radius: var(--r-card);
  background: var(--surface);
}
.error-code { font-family: var(--heading); font-size: 64px; line-height: 1; color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* В вебе и VK название владельца уже есть в ссылке «Назад» над заголовком. */
[data-platform="web"] .intro-owner,
[data-platform="vk"] .intro-owner { display: none; }

/* ── Невысокие экраны и горизонтальная ориентация ── */
@media (max-height: 700px) {
  .page, .museum-content { gap: 24px; }
  .dock-keypad { min-height: 52px; }
  .page-tour { padding-bottom: calc(160px + env(safe-area-inset-bottom)); }
}
@media (orientation: landscape) and (max-height: 520px) {
  .exhibit-figure img { max-height: 60dvh; }
  /* Табло слева, клавиши справа — иначе клавиатура не помещается по высоте. */
  .tour[data-view="keypad"] .keypad {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
    grid-template-rows: auto auto 1fr;
    column-gap: 20px;
    row-gap: 8px;
    align-items: start;
  }
  .keypad-label, .plaque-input, .keypad-error { grid-column: 1; }
  .keypad-grid { grid-column: 2; grid-row: 1 / span 3; margin-top: 0; gap: 8px; }
  .key-btn { min-height: 44px; font-size: 22px; }
  .plaque-input { min-height: 96px; font-size: 52px; }
  .dock { flex-direction: row; }
  .dock .mini { flex: 1; }
  .dock-keypad { flex: 1; min-height: 52px; }
}
/* Планшет и компьютер: колонка гида по центру, нижняя панель — по ширине колонки. */
@media (min-width: 632px) {
  .dock { left: 50%; right: auto; width: min(var(--page), 100%); transform: translateX(-50%); }
}

/* ── Предпросмотр черновика из кабинета ── */
.preview-banner {
  padding: 10px 14px;
  border-radius: var(--r-control);
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 14px;
  text-align: center;
}

/* Ссылка на каталог внизу страницы издателя — тихая, чтобы не уводить из гида. */
.page-foot { display: flex; justify-content: center; padding-top: 16px; border-top: 1px solid var(--line); font-size: 14px; }
.page-foot a { color: var(--stone); }
.page-foot .powered { font-size: 13px; text-decoration: none; opacity: .8; }
.page-foot .powered:hover { opacity: 1; }
.leave-dialog {
  width: min(360px, calc(100vw - 32px));
  padding: 24px 22px 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  color: var(--ink);
}
.leave-dialog::backdrop { background: rgba(0, 0, 0, .55); }
.leave-dialog h2 { margin: 0 0 8px; }
.leave-dialog p { margin: 0 0 20px; color: var(--stone); line-height: 1.45; }
.leave-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.powered-name { font-family: var(--heading); font-weight: 600; font-size: 16px; color: var(--ink); }

.exhibit-keypad { width: 100%; }

/* ── Слабая связь ── */
.player-error {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: var(--r-control);
  background: var(--error-soft); color: var(--error); font-size: 15px;
}
.player-error .btn { min-height: 44px; padding: 8px 16px; color: var(--ink); }
/* Пока аудио грузится — тонкое кольцо вокруг кнопки «Слушать». */
.play-btn { position: relative; }
.play-btn.is-loading::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 2px solid transparent; border-top-color: var(--accent);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Прослушано ── */
.listened-mark { display: inline-grid; place-items: center; color: var(--accent); animation: mark-in var(--t-enter) var(--ease-out); }
@keyframes mark-in { from { opacity: 0; transform: scale(.6); } }

/* ── Движение: без фанатизма ── */
/* Экран появляется: лёгкий подъём и проявление. CSS-анимация запускается сама, когда экран
   перестаёт быть display: none, и не может «застрять»: без неё экран просто виден сразу. */
.tour > section, .dock .mini { animation: rise-in var(--t-enter) var(--ease-out); }
@keyframes rise-in { from { opacity: 0; transform: translateY(8px); } }
.mini-progress { transition: width .25s linear; }
/* Нажатие: кнопка чуть проседает и сразу возвращается. */
.play-btn, .round-btn, .key-btn, .mini-play, .btn { transition: transform .12s var(--ease-out); }
.play-btn:active, .round-btn:active:not(:disabled), .mini-play:active { transform: scale(.94); }
.key-btn:active, .btn:active:not(:disabled) { transform: scale(.97); }
/* Неверный номер: табличка коротко качнётся. */
.plaque-input.is-error { animation: shake .28s ease-in-out; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
