/* ===========================================================
   TENET × Фиксики — Веб-квест (мобильный, база 375px)
   viewport width=375 → браузер масштабирует под ширину телефона.
   =========================================================== */
:root {
  --beige: #d2c2b5;
  --card: #ece1d9;
  --cream: #fff9f3;
  --teal: #004e73;
  --blue: #4557d9;
  --ink: #111111;
  --ink-60: rgba(0,0,0,0.6);
  --ink-45: rgba(0,0,0,0.45);
  --purple: linear-gradient(135deg, #bcaaed 0%, #9577e3 100%);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { background: var(--beige); }
body {
  font-family: 'TENET Sans', 'Segoe UI', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  color: var(--ink);
  min-height: 100dvh;
}
#app { width: 375px; margin: 0 auto; position: relative; }
img { display: block; }

/* ---------- Экраны ---------- */
.screen { display: none; min-height: 100dvh; flex-direction: column; }
.screen.is-active { display: flex; animation: screenIn .28s ease; }  /* плавное появление экрана */
@keyframes screenIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Логотип ---------- */
.logo { display: flex; align-items: center; gap: 11px; }
.logo-t { height: 14px; width: auto; }
.logo-f { height: 24px; width: auto; }
.logo-x { font-size: 13px; color: #1a1a1a; opacity: .6; }

/* ---------- Заголовки ---------- */
.h-title {
  font-family: 'TENET Sans', 'Segoe UI', sans-serif;
  font-weight: 700; font-size: 46px; line-height: 0.98;
  text-transform: uppercase; color: var(--ink); letter-spacing: -0.01em;
}
.h-title .teal { color: var(--teal); }

/* ---------- Кнопки ---------- */
.btn {
  position: relative; width: 100%; height: 64px;
  border: none; border-radius: 999px; cursor: pointer;
  font-family: 'TENET Sans', 'Segoe UI', sans-serif; font-weight: 700; font-size: 18px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.btn--primary {
  background: var(--purple); color: #fff; border: 2px solid #fff;
  box-shadow: 0 12px 30px rgba(120,85,210,0.35);
}
.btn--ghost { background: #efe7df; color: var(--ink); box-shadow: 0 6px 18px rgba(0,0,0,0.06); }
.btn-arrow { position: absolute; right: 24px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; }
.btn-cam { width: 22px; height: 18px; }

/* =====================================================
   ЭКРАН 1 · ВХОД
   ===================================================== */
.screen--entry { padding: 32px 24px; }
.entry-title { margin-top: 32px; }
.tasks { list-style: none; margin-top: 24px; display: flex; flex-direction: column; gap: 4px; }
.task {
  height: 48px; display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: var(--card); border-radius: 14px;
  font-weight: 400; font-size: 16px; color: var(--ink);
}
.task-ico { flex: 0 0 auto; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }
.task-ico img { width: 22px; height: 22px; object-fit: contain; }
.task-ico--circle { background: #3a3632; border-radius: 50%; }
.task-ico--circle img { width: 13px; filter: brightness(0) invert(1); }
.entry-foot { margin-top: 282px; }          /* 282px от карточек до «Начать квест» */
.caption { text-align: center; font-weight: 400; font-size: 14px; color: var(--ink-60); margin-top: 8px; } /* 8px от кнопки */

/* =====================================================
   ЭКРАН 2–6 · СТОРИС
   ===================================================== */
.screen--story { padding: 32px 24px 32px; }          /* 32px снизу у кнопки до низа экрана */
.screen--story .progress { display: flex; gap: 6px; }
.screen--story .pcell {                               /* незаполненная ячейка */
  width: 62.2px; height: 4px; border-radius: 2px; overflow: hidden;
  background: rgba(255,249,243,0.5);                  /* FFF9F3 50% */
}
.screen--story .pcell i {                             /* заполнение (анимируется шириной 0→100%) */
  display: block; height: 100%; width: 0; border-radius: 2px;
  background: #7c5fd6; transition: width .4s ease;
}
.screen--story .pcell.on i { width: 100%; }
.screen--story .progress.no-anim i { transition: none; }   /* мгновенный сброс при перезапуске */
.screen--story .skip {
  margin-top: 28px; align-self: flex-end;             /* 28px от прогресс-бара */
  background: none; border: none; cursor: pointer;
  font-family: inherit; font-weight: 400; font-size: 20px; color: var(--ink-45);
}
/* контейнер контента слайда — кроссфейд при переходе */
.story-content { flex: 1 1 auto; display: flex; flex-direction: column; opacity: 0; transition: opacity .24s ease; }
.story-content.show { opacity: 1; }
.story-visual { margin-top: 16px; display: flex; justify-content: center; }  /* 16px от «Пропустить» */
.story-visual.is-dedus { margin-top: 68px; }          /* стр.6: 68px от прогресс-бара (без «Пропустить») */
.story-visual.is-car img { width: 100%; border-radius: 20px; }
.story-visual.is-char img,
.story-visual.is-dedus img { max-height: 330px; width: auto; max-width: 100%; object-fit: contain; }  /* персонаж поднят наверх */
.story-kicker { font-weight: 700; font-size: 13px; color: var(--ink); }        /* margin-top (отступ от img) задаётся из JS по слайду */
.story-title { font-family: inherit; font-weight: 700; font-size: 46px; line-height: 0.98; text-transform: uppercase; margin-top: 12px; }
.story-title .teal { color: var(--teal); }
.story-text { font-weight: 400; font-size: 18px; line-height: 1.33; color: var(--ink); margin-top: 24px; margin-bottom: 24px; }
.story-btns { display: flex; gap: 12px; margin-top: auto; }   /* кнопки прижаты к низу слайда */
.story-btns .btn { flex: 1 1 0; }

/* =====================================================
   ЭКРАН 7–8 · КАРТА (НАЙДИ 5 ТОЧЕК)
   ===================================================== */
.screen--map { padding: 32px 24px 24px; }
.map-title { margin-top: 32px; color: #3E3A39; }     /* «НАЙДИ» #3E3A39 (а «5 ТОЧЕК» — teal через span) */
.points { list-style: none; margin-top: 16px; display: flex; flex-direction: column; gap: 4px; }
.point {
  height: 61px; display: flex; align-items: center; gap: 8px; padding: 0 12px;
  background: var(--card); border: 1.5px solid #d2c2b5; border-radius: 16px;
}
.point-status {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px dashed rgba(64,60,59,0.65); color: rgba(64,60,59,0.7);
  font-weight: 700; font-size: 13px;
}
.point-main { flex: 1 1 auto; min-width: 0; }
.point-name { display: block; font-weight: 700; font-size: 18px; color: rgba(0,0,0,0.82); line-height: 1.1; }
.point-place { display: block; font-weight: 400; font-size: 15px; color: var(--ink-60); line-height: 1.1; margin-top: 3px; }
.point-badge {
  flex: 0 0 auto; padding: 6px 12px; border-radius: 999px;
  border: 1.5px solid #c9b8a8; color: rgba(0,0,0,0.6);
  font-weight: 700; font-size: 11px; text-transform: uppercase;
}
/* найденная точка */
.point.is-found { background: #fff; border-color: #fff; }
.point.is-found .point-status { border: none; background: var(--blue); position: relative; }
.point.is-found .point-status::after {   /* белая галочка прямо в синем кружке */
  content: ''; position: absolute; left: 50%; top: 47%;
  width: 9px; height: 16px;
  border: solid #fff; border-width: 0 3px 3px 0;
  transform: translate(-50%, -55%) rotate(45deg);
}
.point.is-found .point-name { color: #000; }
.point.is-found .point-place { color: var(--blue); }
.point.is-found .point-badge { background: var(--blue); border-color: var(--blue); color: #fff; }

.map-hint {
  margin-top: 8px; padding: 16px; border-radius: 16px; background: var(--card);
  text-align: center; font-weight: 400; font-size: 16px; line-height: 1.3; color: var(--ink);
}
.map-cam { margin-top: 4px; }     /* 4px от подсказки до «Открыть камеру» */
.screen--map .btn--ghost { margin-top: 12px; }

/* =====================================================
   ФАКТ (после скана QR)
   ===================================================== */
.screen--fact { padding: 48px 24px 24px; }
.fact-found { text-align: center; font-weight: 700; font-size: 14px; color: var(--blue); }
.fact-img-wrap { position: relative; width: 327px; margin: 30px auto 0; }
.fact-img { width: 327px; border-radius: 20px; }
.fact-char { position: absolute; pointer-events: none; width: 110px; right: 12px; bottom: -50px; }
.fact-title { font-family: inherit; font-weight: 700; font-size: 32px; line-height: 1.02; text-transform: uppercase; color: var(--ink); }
.fact-desc { font-weight: 400; font-size: 18px; line-height: 1.4; color: var(--ink); margin-top: 24px; }
.fact-btn { margin-top: 24px; }

/* =====================================================
   ФИНАЛ · ВСЕ QR-КОДЫ НАЙДЕНЫ
   ===================================================== */
.screen--done { padding: 24px; background: var(--beige); }
.done-card {
  position: relative; background: #fbf7f2; border-radius: 32px; padding: 24px;
  min-height: 430px;
}
.done-title { margin-top: 24px; font-size: 46px; }
.done-lead { font-weight: 400; font-size: 16px; line-height: 1.33; color: var(--blue); margin-top: 16px; max-width: 250px; }
.done-show { font-weight: 700; font-size: 22px; line-height: 1.15; color: var(--ink); margin-top: 20px; max-width: 215px; }
.done-sub { font-weight: 400; font-size: 16px; color: var(--ink-60); margin-top: 4px; max-width: 215px; }
.done-simka { position: absolute; right: 2px; bottom: -120px; width: 110px; z-index: 1; }
.seal-frame {
  position: relative; z-index: 2;
  margin-top: 92px; padding: 14px 18px; border-radius: 20px;
  background: rgba(255,249,243,0.9);
}
.seal-kicker { font-weight: 700; font-size: 12px; color: var(--blue); }
.seal-text { font-weight: 400; font-size: 16px; line-height: 1.3; color: var(--ink); margin-top: 4px; }
.done-back { margin-top: 10px; }

/* =====================================================
   СКАНЕР QR
   ===================================================== */
.scanner {
  position: fixed; inset: 0; z-index: 100; background: #0d0d0f;
  display: flex; flex-direction: column; align-items: center;
  padding: 24px; color: #fff;
}
.scanner[hidden] { display: none; }
.scanner-close {
  align-self: flex-end; width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,0.12); color: #fff; border: none; font-size: 22px; cursor: pointer;
}
.scanner-view {
  position: relative; width: 280px; height: 280px; margin-top: 12px;
  border-radius: 24px; overflow: hidden; background: #000;
}
#scanVideo { width: 100%; height: 100%; object-fit: cover; }
.scanner-frame {
  position: absolute; inset: 24px; border: 3px solid rgba(255,255,255,0.9); border-radius: 18px;
  box-shadow: 0 0 0 2000px rgba(0,0,0,0.25);
}
.scanner-hint { margin-top: 20px; font-weight: 400; font-size: 16px; text-align: center; opacity: .85; }
.scanner-sim { margin-top: auto; width: 100%; }
.scanner-sim-label { font-weight: 400; font-size: 13px; opacity: .6; text-align: center; margin-bottom: 10px; }
.scanner-sim-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.scanner-sim-row button {
  width: 48px; height: 48px; border-radius: 14px; border: 1.5px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.08); color: #fff; font-family: inherit; font-weight: 700; font-size: 18px; cursor: pointer;
}
.scanner-sim-row button:disabled { opacity: .3; }

/* Страница организатора со ссылками/QR (#stand) */
.stand { padding: 24px; }
.stand h2 { font-weight: 700; font-size: 28px; text-transform: uppercase; margin-bottom: 8px; }
.stand p { font-size: 14px; color: var(--ink-60); margin-bottom: 16px; }
.stand-item { background: #fff; border-radius: 16px; padding: 16px; margin-bottom: 12px; text-align: center; }
.stand-item img { width: 160px; height: 160px; margin: 0 auto 8px; }
.stand-item b { display: block; font-size: 15px; margin-bottom: 4px; }
.stand-item code { font-size: 11px; word-break: break-all; color: var(--ink-60); }

/* =====================================================
   ПК-ПРЕВЬЮ · «телефон в рамке»
   На узких экранах (телефон, viewport=375) не применяется —
   приложение на весь экран. На широких (ПК) показываем рамку,
   чтобы видеть, как это выглядит на телефоне.
   ===================================================== */
@media (min-width: 480px) {
  html, body { background: #9f8f7d; }
  body { display: flex; align-items: center; justify-content: center; min-height: 100dvh; padding: 28px 0; }
  #app {
    width: 375px; height: 812px;
    overflow-y: auto; overflow-x: hidden;
    border-radius: 46px;
    background: var(--beige);
    box-shadow: 0 0 0 2px #3a3a3a, 0 0 0 13px #141414, 0 36px 80px rgba(0,0,0,.5);
    scrollbar-width: none;
  }
  #app::-webkit-scrollbar { display: none; }
  .screen { min-height: 812px; }   /* высота = экран «телефона» */
}
