:root {
  color-scheme: dark;
  --ink: #f7f4ea;
  --muted: #d6ddd9;
  --panel: rgba(11, 16, 19, .78);
  --line: rgba(255, 255, 255, .18);
  --accent: #e8b44b;
  --good: #5fc79c;
  --danger: #eaa493;
  --shadow: 0 18px 50px rgba(0, 0, 0, .36);
}

* {
  box-sizing: border-box;
}

html,
body,
.app {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: #070a0d;
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  border: 1px solid var(--line);
  background: rgba(12, 18, 22, .8);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

button:hover {
  border-color: rgba(255, 255, 255, .36);
  background: rgba(28, 38, 44, .92);
}

button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.landing-page {
  height: auto;
  min-height: 100%;
  overflow: auto;
}

.landing {
  min-height: 100vh;
  background: #070a0d;
}

.landing-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
}

.landing-hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.landing-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(4, 7, 9, .72), rgba(4, 7, 9, .2) 56%, rgba(4, 7, 9, .55)),
    linear-gradient(180deg, rgba(4, 7, 9, .12), rgba(4, 7, 9, .72));
}

.landing-nav {
  position: relative;
  z-index: 2;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px clamp(18px, 5vw, 72px);
}

.brand-link {
  font-size: 18px;
  font-weight: 900;
}

/* Кнопка входа намеренно почти невидима: её найдёт лишь знающий человек.
   Остаётся доступной — проявляется при наведении и фокусе с клавиатуры. */
.nav-login {
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(247, 244, 234, .07);
  font-weight: 800;
  transition: color .25s ease, background-color .25s ease;
}

.nav-login:hover {
  border: 0;
  background: rgba(255, 255, 255, .05);
  color: rgba(247, 244, 234, .32);
}

.nav-login:focus-visible {
  background: rgba(12, 18, 22, .8);
  color: var(--ink);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Одноэкранный hero: две колонки — питч и форма */
.hero-grid {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  align-items: center;
  gap: clamp(28px, 5vw, 72px);
  width: 100%;
  max-width: 1340px;
  margin: 0 auto;
  padding: clamp(6px, 1.5vh, 20px) clamp(20px, 5vw, 72px);
  min-height: 0;
}

.hero-pitch {
  max-width: 640px;
}

.eyebrow {
  display: inline-block;
  margin: 0 0 10px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid rgba(232, 180, 75, .32);
  background: rgba(232, 180, 75, .12);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 900;
  letter-spacing: .4px;
  text-transform: uppercase;
}

.hero-pitch h1 {
  margin: 0 0 12px;
  font-size: clamp(30px, 3.4vw, 54px);
  line-height: 1.03;
  letter-spacing: 0;
  text-wrap: balance;
  text-shadow: 0 2px 24px rgba(0, 0, 0, .5);
}

.hero-pitch .lead {
  max-width: 560px;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: clamp(16px, 1.3vw, 19px);
  line-height: 1.4;
  text-wrap: pretty;
  text-shadow: 0 1px 16px rgba(0, 0, 0, .4);
}

.value-points {
  display: grid;
  gap: 10px;
  max-width: 560px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.value-points li {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 14px;
  align-items: center;
  padding: 11px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .08);
  background: rgba(13, 18, 22, .46);
  color: var(--muted);
  font-size: clamp(14px, 1.05vw, 16px);
  line-height: 1.42;
  backdrop-filter: blur(6px);
  transition: border-color .25s ease, background-color .25s ease, transform .25s ease;
}

.value-points li:hover {
  border-color: rgba(232, 180, 75, .38);
  background: rgba(18, 24, 28, .62);
  transform: translateX(3px);
}

.value-points strong {
  color: var(--ink);
  font-weight: 800;
}

.vp-ico {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(232, 180, 75, .9), rgba(214, 150, 50, .82));
  color: #1c1305;
  font-size: 16px;
  font-weight: 900;
  box-shadow: 0 6px 16px rgba(232, 180, 75, .28);
}

.hero-form-wrap {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 480px;
  justify-self: end;
}

.waitlist-form {
  display: grid;
  gap: 0; /* интервалы заданы margin'ами ниже — чтобы сворачиваемые поля
            не оставляли пустой зазор, когда скрыты */
  width: 100%;
  padding: clamp(20px, 2vw, 28px);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 20px;
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(232, 180, 75, .08), transparent 60%),
    rgba(9, 13, 16, .76);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .46);
  backdrop-filter: blur(16px);
}

/* Равномерные интервалы между блоками формы (замена grid-gap) */
.waitlist-form > * + * {
  margin-top: 14px;
}

/* Плавное появление/скрытие полей «предмет» и «другое» — без скачков.
   Анимируем высоту строки сетки (0fr→1fr), отступ и прозрачность.
   Пока поле свёрнуто — margin:0 и высота 0, поэтому лишнего зазора нет. */
.waitlist-form .collapsible {
  display: grid;
  grid-template-rows: 0fr;
  margin-top: 0;
  opacity: 0;
  transition: grid-template-rows .32s ease, margin-top .32s ease, opacity .26s ease;
}

.waitlist-form .collapsible.is-open {
  grid-template-rows: 1fr;
  margin-top: 14px;
  opacity: 1;
}

.collapsible-inner {
  overflow: hidden;
  min-height: 0;
}

/* После раскрытия снимаем обрезку, чтобы не срезалось кольцо фокуса у поля */
.waitlist-form .collapsible.is-open .collapsible-inner {
  overflow: visible;
  transition: overflow 0s .32s;
}

.form-head {
  display: grid;
  gap: 6px;
  margin-bottom: 2px;
}

.form-head h2 {
  margin: 0;
  font-size: clamp(20px, 1.8vw, 26px);
  line-height: 1.1;
}

.form-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.waitlist-form .field {
  display: grid;
  gap: 6px;
}

.waitlist-form .field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.waitlist-form input,
.waitlist-form select,
.login-form input {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(6, 10, 12, .7);
  color: var(--ink);
  padding: 0 14px;
  font: inherit;
  font-size: 16px; /* >=16px — иначе iOS зумит поле при фокусе */
  transition: border-color .2s ease, box-shadow .2s ease;
}

/* Мягкое, приятное кольцо фокуса вместо жёсткого контура */
.waitlist-form input:focus,
.waitlist-form input:focus-visible,
.select-trigger:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232, 180, 75, .16);
}

.field-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

/* Кастомный выпадающий список */
.select {
  position: relative;
}

.select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(6, 10, 12, .7);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  text-align: left;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.select-trigger:hover {
  border-color: rgba(255, 255, 255, .34);
  background: rgba(6, 10, 12, .7);
}

.select.is-open .select-trigger {
  border-color: var(--accent);
}

/* Когда снизу мало места — список раскрывается вверх (JS добавляет .is-up) */
.select.is-up .select-list {
  top: auto;
  bottom: calc(100% + 6px);
}

.select-value {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.select-value.is-placeholder {
  color: rgba(214, 221, 217, .5);
}

.select-arrow {
  flex: none;
  color: var(--muted);
  font-size: 12px;
  transition: transform .2s ease;
}

.select.is-open .select-arrow {
  transform: rotate(180deg);
}

.select-list {
  position: absolute;
  z-index: 12;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  max-height: 264px;
  overflow-y: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(13, 18, 22, .98);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  animation: select-pop .14s ease;
}

@keyframes select-pop {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.select-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 12px;
  border-radius: 7px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.2;
  cursor: pointer;
}

.select-option.is-active {
  background: rgba(255, 255, 255, .08);
}

.select-option[aria-selected="true"] {
  color: var(--accent);
  font-weight: 800;
}

.select-option[aria-selected="true"]::after {
  content: "✓";
  margin-left: auto;
  font-weight: 900;
}

.waitlist-form .consent {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  cursor: pointer;
}

.waitlist-form .consent input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-height: 0;
  margin: 1px 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.waitlist-form .consent a {
  color: var(--accent);
  text-decoration: underline;
}

.waitlist-form .consent a:hover {
  text-decoration: none;
}

/* Атрибут hidden должен скрывать поля, несмотря на display:grid у .field */
.waitlist-form .field[hidden],
.field-error[hidden],
.select-list[hidden] {
  display: none;
}

/* Деликатные подсказки рядом с полями — не кричащие, но заметные */
.field-error {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 3px 0 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  animation: error-fade .22s ease;
}

@keyframes error-fade {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}

.field-error::before {
  content: "i";
  display: grid;
  place-items: center;
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(234, 164, 147, .18);
  color: var(--danger);
  font-size: 11px;
  font-weight: 800;
  font-style: italic;
}

.field.is-error input,
.field.is-error .select-trigger {
  border-color: rgba(234, 164, 147, .65);
}

.consent-wrap.is-error .consent {
  color: var(--danger);
}

.consent-wrap.is-error .consent input[type="checkbox"] {
  outline: 2px solid rgba(234, 164, 147, .55);
  outline-offset: 2px;
  border-radius: 4px;
}

.form-note.is-good {
  color: var(--good);
  font-weight: 600;
}

.form-note.is-bad {
  color: var(--danger);
  font-weight: 600;
}

.waitlist-submit {
  min-height: 54px;
  margin-top: 18px;
  border-radius: 12px;
  border-color: transparent;
  background: linear-gradient(145deg, #f0c065, #e0a73f);
  color: #1c1305;
  font-size: 16px;
  font-weight: 900;
  box-shadow: 0 10px 26px rgba(232, 180, 75, .26);
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

.waitlist-submit:hover {
  filter: brightness(1.05);
  box-shadow: 0 14px 32px rgba(232, 180, 75, .36);
  transform: translateY(-1px);
  background: linear-gradient(145deg, #f3c873, #e6ad45);
  border-color: transparent;
}

.waitlist-submit:active {
  transform: translateY(0);
  box-shadow: 0 8px 20px rgba(232, 180, 75, .24);
}

.login-form button[type="submit"] {
  min-height: 50px;
  padding: 0 18px;
  border-radius: 10px;
  background: rgba(232, 180, 75, .92);
  border-color: rgba(232, 180, 75, .92);
  color: #161006;
  font-weight: 900;
}

.login-form button[type="submit"]:hover {
  background: rgba(242, 196, 96, 1);
  border-color: rgba(242, 196, 96, 1);
}

.form-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
  text-shadow: 0 1px 14px rgba(0, 0, 0, .4);
}

.hero-footer {
  position: relative;
  z-index: 2;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px clamp(20px, 5vw, 72px);
  border-top: 1px solid rgba(255, 255, 255, .12);
  color: var(--muted);
  font-size: 13px;
}

.hero-footer p {
  margin: 0;
}

.hero-footer a {
  color: var(--muted);
  text-decoration: underline;
}

.hero-footer a:hover {
  color: var(--ink);
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 20;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--accent);
  color: #161006;
  font-weight: 900;
  transition: top .15s ease;
}

.skip-link:focus {
  top: 12px;
}

.login-dialog {
  width: min(420px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(11, 16, 19, .96);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.login-dialog::backdrop {
  background: rgba(0, 0, 0, .62);
}

.login-form {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 10px;
}

.login-form h2 {
  margin: 0 40px 4px 0;
  font-size: 26px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.login-form p {
  min-height: 20px;
  margin: 0;
  color: var(--accent);
}

.dialog-close {
  position: absolute;
  right: 6px;
  top: 6px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
}

/* Глиф/иконка во всех кнопках управления — строго по центру.
   place-items центрирует по осям, line-height:1 убирает вертикальный сдвиг. */
.viewer-actions button,
.chrome-toggle,
.back-button,
.panel-toggle,
.dialog-close,
#closeObject,
#objectNext,
.quest-next {
  display: grid;
  place-items: center;
  line-height: 1;
}

.is-hidden {
  display: none;
}

/* Страница документа (политика обработки ПДн) */
.doc-page {
  height: auto;
  min-height: 100%;
  overflow: auto;
  background: #070a0d;
}

.doc-nav {
  padding: 20px clamp(18px, 6vw, 86px);
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.doc {
  width: min(760px, calc(100% - 36px));
  margin: 0 auto;
  padding: 40px 0 64px;
}

.doc h1 {
  margin: 0 0 6px;
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.1;
}

.doc-meta {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 14px;
}

.doc section {
  margin-bottom: 28px;
}

.doc h2 {
  margin: 0 0 10px;
  font-size: clamp(19px, 3vw, 23px);
}

.doc p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.6;
}

.doc ul {
  margin: 0 0 12px;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.6;
}

.doc li {
  margin-bottom: 6px;
}

.doc a {
  color: var(--accent);
  text-decoration: underline;
}

.doc a:hover {
  text-decoration: none;
}

.doc-back {
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, .1);
}

/* ---------- Админ-панель ---------- */
.admin-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-logout {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  font-weight: 800;
}

.admin {
  width: min(960px, calc(100% - 36px));
  margin: 0 auto;
  padding: 40px 0 64px;
}

.admin h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 34px);
}

.admin-sub {
  margin: 8px 0 20px;
  color: var(--muted);
}

.admin-login {
  max-width: 380px;
}

.admin-login-form {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.admin-login-form label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.admin-login-form input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(6, 10, 12, .7);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}

.admin-login-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232, 180, 75, .16);
}

.admin-login-form button {
  min-height: 48px;
  margin-top: 4px;
  border-radius: 10px;
  border-color: transparent;
  background: linear-gradient(145deg, #f0c065, #e0a73f);
  color: #1c1305;
  font-weight: 900;
}

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.admin-count {
  color: var(--accent);
}

.admin-refresh {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 800;
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 12px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table th,
.admin-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  white-space: nowrap;
}

.admin-table th {
  position: sticky;
  top: 0;
  background: #0d1316;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.admin-table tbody tr:hover {
  background: rgba(255, 255, 255, .03);
}

.admin-empty {
  margin-top: 16px;
  color: var(--muted);
}

.admin-section {
  margin-top: 40px;
}

.admin-section h2 {
  margin: 0;
  font-size: clamp(18px, 3vw, 22px);
}

.admin-hint {
  margin: 6px 0 14px;
  color: var(--muted);
  font-size: 14px;
}

/* Карточки статистики */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.stat-card {
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 12px;
  background: rgba(13, 18, 22, .6);
}

.stat-val {
  font-size: 30px;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
}

.stat-key {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

/* Форма создания пользователя */
.admin-user-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.admin-user-form input {
  flex: 1 1 200px;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(6, 10, 12, .7);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
}

.admin-user-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232, 180, 75, .16);
}

.admin-user-form button {
  min-height: 46px;
  padding: 0 20px;
  border-radius: 10px;
  border-color: transparent;
  background: linear-gradient(145deg, #f0c065, #e0a73f);
  color: #1c1305;
  font-weight: 900;
}

.admin-ok {
  margin: 4px 0 12px;
  color: var(--good);
  font-size: 14px;
  font-weight: 600;
}

/* Кнопки действий в таблице */
.admin-actions {
  display: flex;
  gap: 8px;
  white-space: nowrap;
}

.admin-actions button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
}

.admin-actions button.danger {
  border-color: rgba(234, 164, 147, .5);
  color: var(--danger);
}

.admin-actions button.danger:hover {
  background: rgba(234, 164, 147, .12);
  border-color: var(--danger);
}

.map-screen,
.panorama-screen {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh; /* учитывает адрес-бар мобильных браузеров */
  overflow: hidden;
}

/* Свой жест перетаскивания карты — отключаем браузерные жесты прокрутки/зума. */
.map-screen {
  touch-action: none;
}

.world-art,
#gl {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

#gl {
  background: #000;
  touch-action: none;
}

.world-art {
  object-fit: contain;
  transform-origin: 0 0;
}

.map-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(6, 10, 12, .68), rgba(6, 10, 12, .16) 44%, rgba(6, 10, 12, .55)),
    linear-gradient(180deg, rgba(0, 0, 0, .18), rgba(0, 0, 0, .58));
  pointer-events: none;
}

.map-header {
  position: absolute;
  left: 16px;
  top: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 340px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(232, 180, 75, .62);
  border-radius: 7px;
  background: rgba(232, 180, 75, .14);
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.map-header h1,
.map-header p,
.scene-heading h2,
.scene-heading p,
.quest-panel p,
.object-panel p {
  margin: 0;
}

.map-header h1 {
  font-size: 17px;
  line-height: 1.1;
}

/* На карте описание под заголовком прячем — табличка компактная. */
.map-header p {
  display: none;
}

.map-header p,
.scene-heading p,
.quest-panel p,
.object-panel p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.38;
}

.map-points {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none; /* пустые места пропускают перетаскивание карты */
}

/* Кнопки приближения/отдаления карты */
.map-zoom {
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.map-zoom button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  backdrop-filter: blur(12px);
}

/* Вкладки карты: «История» / «География мультиков» */
.map-tabs {
  position: absolute;
  left: 50%;
  top: max(24px, env(safe-area-inset-top));
  z-index: 4;
  display: flex;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  transform: translateX(-50%);
}

.map-tab {
  min-height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.map-tab:hover {
  background: rgba(255, 255, 255, .06);
  border: 0;
  color: var(--ink);
}

.map-tab.is-active {
  background: var(--accent);
  color: #161006;
}

@media (max-width: 640px) {
  /* На узком экране вкладки уходят вниз, чтобы не накладываться на шапку. */
  .map-tabs {
    left: 12px;
    right: 12px;
    top: auto;
    bottom: max(16px, env(safe-area-inset-bottom));
    transform: none;
    justify-content: center;
  }

  .map-tab {
    padding: 0 12px;
    font-size: 13px;
  }
}

.map-point {
  position: absolute;
  left: var(--x);
  top: var(--y);
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  min-width: 0;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, .85);
  border-radius: 50%;
  background: var(--point);
  box-shadow: 0 0 0 4px rgba(232, 180, 75, .16), 0 6px 16px rgba(0, 0, 0, .3);
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: auto;
  z-index: 1;
}

/* Лишние пины при переключении вкладок реально скрываются
   (иначе .map-point{display:grid} перебивает атрибут [hidden]). */
.map-point[hidden] {
  display: none;
}

/* Эмодзи внутри пина — подсказывает, что внутри локации. */
.pin-emoji {
  font-size: 15px;
  line-height: 1;
  font-style: normal;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .45));
}

.logout-link {
  position: absolute;
  right: 24px;
  top: 24px;
  z-index: 3;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  font-weight: 800;
  backdrop-filter: blur(12px);
}

.map-point::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 9px;
  height: 9px;
  border-right: 2px solid rgba(255, 255, 255, .85);
  border-bottom: 2px solid rgba(255, 255, 255, .85);
  background: var(--point);
  transform: translateX(-50%) rotate(45deg);
  z-index: -1;
}

.map-point strong {
  display: block;
  position: absolute;
  left: 50%;
  top: calc(100% + 9px);
  width: max-content;
  max-width: 190px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.15;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(-4px);
  transition: opacity .16s ease, transform .16s ease;
  white-space: normal;
}

.map-point span {
  display: none;
  margin-top: 0;
  color: var(--muted);
  font-size: 12px;
}

.map-point:hover,
.map-point:focus-visible {
  z-index: 3;
}

.map-point:hover strong,
.map-point:focus-visible strong {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.hotspot-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hotspot {
  position: absolute;
  left: var(--x);
  top: var(--y);
  display: grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 999px;
  background: rgba(6, 10, 12, .78);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 0 0 6px rgba(95, 199, 156, .2), 0 14px 32px rgba(0, 0, 0, .36);
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

.hotspot.is-hidden {
  display: none;
}

.hotspot.is-target {
  box-shadow: 0 0 0 7px rgba(232, 180, 75, .25), 0 0 28px rgba(232, 180, 75, .38);
}

/* Кнопка взаимодействия (диалог) — просто круглая, в том же стиле, что и
   остальные хотспоты, без иконки и «хвостика» речевого облачка. */
.hotspot.is-dialogue {
  width: 40px;
  height: 40px;
  min-width: 0;
  padding: 0;
  border-radius: 50%;
  font-size: 0;
  opacity: .62;
  transition: opacity .16s ease;
}

/* При наведении/фокусе — снова чёткая. */
.hotspot.is-dialogue:hover,
.hotspot.is-dialogue:focus-visible {
  opacity: 1;
}

.viewer-top {
  position: absolute;
  left: max(18px, env(safe-area-inset-left));
  right: max(18px, env(safe-area-inset-right));
  top: max(18px, env(safe-area-inset-top));
  display: flex;
  align-items: flex-start;
  gap: 12px;
  pointer-events: none;
}

.viewer-primary-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.back-button,
.chrome-toggle,
.scene-heading,
.viewer-actions button,
.quest-panel,
.object-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.back-button {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 0 16px;
  font-weight: 800;
  text-align: center;
  pointer-events: auto;
}

.chrome-toggle {
  display: grid;
  place-items: center;
  min-width: 72px;
  height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 900;
  pointer-events: auto;
}

.scene-heading {
  position: relative;
  max-width: 480px;
  padding: 10px 38px 10px 13px; /* справа место под кнопку сворачивания */
}

/* Текст в панелях уровня — компактнее (карту не трогаем). */
.scene-heading p,
.quest-panel p,
.object-panel p {
  font-size: 13px;
  line-height: 1.32;
}

.scene-heading span {
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.scene-heading h2 {
  font-size: 20px;
  line-height: 1.08;
}

.viewer-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
  pointer-events: auto;
}

.viewer-actions button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 20px;
  font-weight: 900;
}

.quest-panel {
  position: absolute;
  left: max(18px, env(safe-area-inset-left));
  bottom: max(18px, env(safe-area-inset-bottom));
  width: min(340px, calc(100% - 36px));
  padding: 11px 38px 11px 13px; /* справа место под кнопку сворачивания */
}

/* Кнопка сворачивания панели (добавляется скриптом в .scene-heading и .quest-panel) */
.panel-toggle {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
  pointer-events: auto;
  z-index: 2;
}

/* Свёрнутая панель ужимается до одной кнопки. */
.scene-heading.is-collapsed,
.quest-panel.is-collapsed {
  padding: 6px;
  max-width: none;
  width: auto;
}

.scene-heading.is-collapsed > :not(.panel-toggle),
.quest-panel.is-collapsed > :not(.panel-toggle) {
  display: none;
}

.scene-heading.is-collapsed .panel-toggle,
.quest-panel.is-collapsed .panel-toggle {
  position: static;
}

.quest-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 8px;
}

.quest-title span {
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(95, 199, 156, .16);
  color: var(--good);
  font-size: 12px;
  font-weight: 900;
}

.quest-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 9px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

/* Кнопка перехода к следующей локации (появляется при выполнении квеста). */
.quest-next {
  display: inline-grid;
  place-items: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(232, 180, 75, .5);
  border-radius: 8px;
  background: rgba(232, 180, 75, .16);
  color: var(--accent);
  font-weight: 900;
  pointer-events: auto;
}

.quest-next:hover {
  background: rgba(232, 180, 75, .28);
}

.quest-next[hidden] {
  display: none;
}

.object-panel {
  position: absolute;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  width: min(330px, calc(100% - 36px));
  padding: 13px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}

.level-loader {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  background: #070a0d;
}

/* Без этого .is-hidden (display:none) проигрывает по каскаду правилу
   .level-loader (display:grid) выше, и загрузчик не скрывается. */
.level-loader.is-hidden {
  display: none;
}

.level-loader > div {
  width: min(420px, calc(100% - 40px));
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.level-loader strong {
  display: block;
  margin-bottom: 12px;
}

.level-loader span {
  display: block;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
}

.level-loader i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width .2s ease;
}

.object-panel.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#closeObject {
  position: absolute;
  right: 10px;
  top: 10px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 18px;
}

#objectKind {
  display: block;
  margin-right: 36px;
  color: var(--good);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.object-panel h3 {
  margin: 6px 34px 7px 0;
  font-size: 18px;
  line-height: 1.14;
}

.object-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

#objectStep {
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
}

#objectNext {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 20px;
  font-weight: 900;
}

/* Плавное приглушение интерфейса по кнопке «Панели». */
.viewer-primary-actions,
.viewer-actions,
.scene-heading,
.quest-panel {
  transition: opacity .2s ease;
}

/* «Скрыть»: прячем панели и кнопки управления, КРОМЕ кнопок «Карта»/«Показать».
   Метки диалогов НЕ скрываются — лишь становятся прозрачнее (и кликабельны).
   Карточка объекта (диалог) сюда не входит — она не меняется вообще. */
body.is-chrome-hidden .scene-heading,
body.is-chrome-hidden .viewer-actions,
body.is-chrome-hidden .quest-panel {
  opacity: 0;
  pointer-events: none;
}

/* «Карта» и «Показать» остаются видимыми, но полупрозрачными и кликабельными. */
body.is-chrome-hidden .viewer-primary-actions {
  opacity: .4;
}

/* Метки диалогов при «Скрыть» — прозрачнее, но видимы и активны;
   при наведении снова чёткие (правило .hotspot.is-dialogue:hover выше). */
body.is-chrome-hidden .hotspot {
  opacity: .55;
}

@media (max-width: 760px) {
  .map-header {
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    top: max(12px, env(safe-area-inset-top));
    max-width: none;
  }

  .map-header h1 {
    font-size: 22px;
  }

  .map-point {
    width: 27px;
    height: 27px;
  }

  .map-point .pin-emoji {
    font-size: 13px;
  }

  .map-point strong {
    font-size: 12px;
  }

  .map-point span,
  .scene-heading p {
    display: none;
  }

  /* Верхняя панель: кнопки в один ряд, заголовок переносится на свою строку. */
  .viewer-top {
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    top: max(10px, env(safe-area-inset-top));
    flex-wrap: wrap;
    gap: 8px;
  }

  .scene-heading {
    order: 3;
    flex-basis: 100%;
    max-width: none;
    padding: 10px 14px;
  }

  .scene-heading h2 {
    font-size: 18px;
  }

  .viewer-actions {
    margin-left: auto;
  }

  .quest-panel,
  .object-panel {
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    width: auto;
  }

  /* На узком экране панель объекта и задания делят низ — прячем задание,
     когда открыта карточка объекта, чтобы они не накладывались. */
  body:has(.object-panel.is-open) .quest-panel {
    opacity: 0;
    pointer-events: none;
  }
}

@media (max-width: 480px) {
  .map-header {
    gap: 10px;
    padding: 12px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .map-header h1 {
    font-size: 19px;
  }

  .scene-heading h2 {
    font-size: 16px;
  }

  .quest-panel {
    padding: 12px;
  }

  .quest-panel p {
    font-size: 14px;
  }

  .object-panel h3 {
    font-size: 19px;
  }

  /* Кнопка «Панели» — компактнее, чтобы влезал ряд управления. */
  .chrome-toggle {
    min-width: 56px;
    font-size: 12px;
  }
}

/* Планшет и уже: одна колонка, страница может прокручиваться */
@media (max-width: 900px) {
  .landing-hero {
    height: auto;
    min-height: 0;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 32px;
    padding: 24px clamp(16px, 5vw, 48px) 40px;
  }

  .hero-form-wrap {
    justify-self: stretch;
    max-width: 520px;
  }
}

/* Мобильная адаптация лендинга */
@media (max-width: 640px) {
  .landing-nav {
    padding: 14px 16px;
  }

  .hero-grid {
    gap: 28px;
    padding: 20px 16px 36px;
  }

  .hero-pitch h1 {
    line-height: 1.06;
  }

  .hero-form-wrap {
    max-width: none;
  }

  .hero-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  }
}

/* Невысокие экраны (ноутбуки): ужимаем вёрстку по высоте, чтобы лендинг
   целиком помещался в один экран при 100% масштабе без прокрутки. */
@media (min-width: 901px) and (max-height: 820px) {
  .landing-nav { padding-top: 12px; padding-bottom: 12px; }
  .hero-grid { padding-top: 10px; padding-bottom: 10px; gap: clamp(24px, 4vw, 56px); }
  .eyebrow { margin-bottom: 8px; }
  .hero-pitch h1 { margin-bottom: 10px; font-size: clamp(28px, 3vw, 46px); }
  .hero-pitch .lead { margin-bottom: 14px; font-size: clamp(15px, 1.2vw, 18px); }
  .value-points { gap: 8px; }
  .value-points li { padding: 10px 14px; }
  .waitlist-form { padding: 20px; }
  .waitlist-form > * + * { margin-top: 11px; }
  .form-head h2 { font-size: 22px; }
  .waitlist-form input,
  .waitlist-form select,
  .select-trigger { min-height: 48px; }
  .waitlist-submit { min-height: 50px; margin-top: 14px; }
  .hero-footer { padding-top: 11px; padding-bottom: 11px; }
}

@media (min-width: 901px) and (max-height: 700px) {
  .landing-nav { padding-top: 9px; padding-bottom: 9px; }
  .hero-grid { padding-top: 6px; padding-bottom: 6px; }
  .eyebrow { margin-bottom: 6px; padding: 5px 11px; }
  .hero-pitch h1 { margin-bottom: 8px; font-size: clamp(26px, 2.6vw, 38px); }
  .hero-pitch .lead { margin-bottom: 10px; font-size: 15px; line-height: 1.35; }
  .value-points { gap: 7px; }
  .value-points li { padding: 8px 13px; font-size: 14px; }
  .vp-ico { width: 30px; height: 30px; font-size: 15px; }
  .form-head { gap: 3px; }
  .form-head p { display: none; }
  .form-head h2 { font-size: 20px; }
  .waitlist-form { padding: 16px; border-radius: 16px; }
  .waitlist-form > * + * { margin-top: 9px; }
  .waitlist-form input,
  .waitlist-form select,
  .select-trigger { min-height: 44px; }
  .waitlist-submit { min-height: 46px; margin-top: 12px; }
  .hero-footer { padding-top: 9px; padding-bottom: 9px; font-size: 12px; }
}

/* Уважаем системную настройку «уменьшить движение» */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}
