/* Мини-апп «Майя»: вид «Витраж», как сайт (22.10.2026): светлая бумага и стена, сиреневые кнопки в цвет светлой колоды,
   тёмно-синий текст, золото только линиями; Cormorant Garamond и PT Sans (как Maya Sans) из fonts/ проекта. */
@font-face { font-family: 'Cormorant Garamond'; src: url('fonts/cormorant-600.woff?v=a8b2585d') format('woff'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Cormorant Garamond'; src: url('fonts/cormorant-italic-500.woff?v=3a6199d7') format('woff'); font-weight: 500; font-style: italic; font-display: swap; }
@font-face { font-family: 'Maya Sans'; src: url('fonts/mayasans-400.woff?v=b330c70e') format('woff'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Maya Sans'; src: url('fonts/mayasans-700.woff?v=40efd3ad') format('woff'); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  /* «Витраж» (22.10.2026): прежние имена переменных, новые значения; роль у каждой та же, что была в ночном виде */
  --bg: #faf3e6;                       /* бумага */
  --night: #fffaf1;                    /* светлая бумага: карточки, лицо карты; текст на сиреневой кнопке */
  --gold: #c09246;                     /* золото: только линии, точки, кромки */
  --gold-2: #9a7130;                   /* тёмное золото: крупные числа и знаки от 24 px */
  --ivory: #1e2347;                    /* чернила: основной текст */
  --ivory-2: #454964;                  /* чернила-2: подписи, вторичный текст */
  --ivory-3: #454964;
  --cream: #454964;
  --muted: #5d5f72;
  --rose: #9b2c1e;                     /* ошибка */
  --line: rgba(192, 146, 70, .46);
  --line-2: rgba(192, 146, 70, .26);
  --ink: #1e2347;
  --gold-ink: #7a581c;                 /* золото для текста любого размера, 5,9:1 к бумаге */
  --paper: #faf3e6;
  --paper-2: #fffaf1;
  --wall: #f3e2c6;
  --wall-2: #ecd6b0;
  --lilac: #646ab3;                    /* главная кнопка, как на сайте */
  --lilac-2: #565ca5;
  --lilac-pale: #e3e3f4;
  --card-shadow: 0 14px 26px -16px rgba(92, 58, 18, .55), 0 2px 6px rgba(92, 58, 18, .12);
  --serif: 'Cormorant Garamond', 'PT Serif', Georgia, serif;
  --sans: 'Maya Sans', 'PT Sans', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --gutter: 16px;
  --radius: 14px;
  --ease: cubic-bezier(.22, .7, .2, 1);
  --vh: 100vh;
  /* отступ сверху: вырез экрана в браузере или кнопки Telegram в полноэкранном режиме. Переменные --tg-… ставит
     скрипт Telegram и сам обновляет их при смене режима; --js-… пишет shell.js из тех же чисел на случай клиента,
     который переменные не выставил */
  --top: max(env(safe-area-inset-top), calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)), var(--js-top, 0px));
  --bottom: max(env(safe-area-inset-bottom), calc(var(--tg-safe-area-inset-bottom, 0px) + var(--tg-content-safe-area-inset-bottom, 0px)), var(--js-bottom, 0px));
}
@supports (height: 100dvh) { :root { --vh: 100dvh; } }
html.in-tg { --vh: var(--tg-viewport-stable-height, 100vh); }

*, *::before, *::after { box-sizing: border-box; }
html {
  background: var(--bg);
  color-scheme: light;
  font-variant-numeric: lining-nums;               /* у Cormorant по умолчанию старинные цифры: «1o» вместо «10» */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: var(--vh);
  background: var(--bg);
  color: var(--ivory);
  font: 400 16px/1.45 var(--sans);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
img, svg { display: block; }
button { font: inherit; color: inherit; }
a { color: inherit; }

.app { max-width: 440px; margin: 0 auto; padding: 0 var(--gutter); }
.screen {
  min-height: var(--vh);
  display: flex;
  flex-direction: column;
  padding: calc(12px + var(--top)) 0 calc(14px + var(--dock-room, var(--bottom)));      /* снизу запас под панель вкладок */
}
.screen[hidden] { display: none; }
.screen.is-entering { animation: enter .25s ease both; }                               /* смена экрана: проявление */
@keyframes enter { from { opacity: 0; } to { opacity: 1; } }

/* ---------- общие ---------- */
.kicker {
  margin: 0;
  font: 700 14px/1.3 var(--sans);
  letter-spacing: .01em;
  color: var(--gold-ink);
}
.title {
  margin: 4px 0 0;
  font: 600 62px/1 var(--serif);
  letter-spacing: .01em;
  color: var(--ink);
}
.title:focus { outline: none; }
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  font: 700 17px/1.2 var(--sans);
  letter-spacing: .01em;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: transform .15s var(--ease), background-color .2s, box-shadow .2s;
}
.btn--gold {                                       /* имя прежнее, цвет сиреневый: 4,7:1 к светлому тексту */
  background: var(--lilac);
  color: #fffaf0;
  box-shadow: none;
}
.btn--gold:active { transform: scale(.98); background: var(--lilac-2); }
.btn--line {
  min-height: 50px;
  background: rgba(255, 250, 241, .78);
  color: var(--ink);
  border: 0;
  box-shadow: inset 0 0 0 1.5px rgba(30, 35, 71, .3);
}
.btn--line:active { transform: scale(.98); background: var(--paper-2); box-shadow: inset 0 0 0 1.5px var(--ink); }
.btn:focus-visible, .link-back:focus-visible, .card:focus-visible, .zoom__close:focus-visible, .fine a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* ---------- экран 1: дата ---------- */
.frame {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 20px 8px;
  text-align: center;
}
.portrait { position: relative; width: var(--portrait, 148px); height: var(--portrait, 148px); margin: 4px auto 16px; }
.portrait__rays {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--portrait, 148px) * 2.03);
  height: calc(var(--portrait, 148px) * 2.03);
  transform: translate(-50%, -50%);
  opacity: .32;
  pointer-events: none;
}
.portrait img {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--gold);
  box-shadow: 0 0 0 5px rgba(92, 58, 18, .21), 0 0 0 6px var(--line-2), 0 14px 40px rgba(92, 58, 18, .189);
}
.subtitle { margin: 8px 0 0; font: italic 500 23px/1.2 var(--serif); color: var(--cream); }
.intro { margin: 10px auto 0; max-width: 36ch; font-size: 16px; color: var(--ivory-2); text-wrap: balance; }

.form { width: 100%; max-width: 340px; margin: 22px auto 0; }
.field-label {
  display: block;
  margin-bottom: 8px;
  font: 700 15px/1.3 var(--sans);
  color: var(--ink);
}
.field {
  display: block;
  width: 100%;
  height: 60px;
  padding: 0 16px;
  border: 1.5px solid rgba(122, 90, 42, .42);
  border-radius: 16px;
  background: rgba(255, 252, 245, .97);
  box-shadow: inset 0 2px 4px rgba(70, 50, 20, .06);
  color: var(--ivory);
  font: 700 26px/1 var(--sans);
  letter-spacing: .08em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  caret-color: var(--gold-ink);
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .2s, box-shadow .2s;
}
.field::placeholder { color: #6f7184; opacity: 1; font-weight: 400; letter-spacing: .02em; }   /* светлее и тоньше введённой даты */
.field:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px rgba(192, 146, 70, .38); }
.field[aria-invalid="true"] { border-color: var(--rose); }
.field.is-shake { animation: shake .4s ease-in-out; }
@keyframes shake {
  20% { transform: translateX(-6px); } 40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); } 80% { transform: translateX(2px); }
}
.field-msg { min-height: 21px; margin: 8px 0 14px; font-size: 14px; line-height: 1.5; color: var(--muted); text-wrap: balance; }
.field-msg.is-error { color: var(--rose); }

.fine { margin: 18px auto 0; max-width: 40ch; font-size: 13px; line-height: 1.45; color: var(--muted); text-wrap: balance; }
.fine--links { margin-top: 6px; }
.fine a {
  display: inline-block;
  padding: 8px 2px;
  color: var(--ivory-2);
  text-decoration: underline;
  text-decoration-color: rgba(192, 146, 70, .42);
  text-underline-offset: 3px;
}

/* ---------- экран 2: карты ---------- */
/* .screen--cards: обычный запас под панелью вкладок (с 03.10 последним идёт плашка «В полном разборе…», а не кнопка) */
.topbar { display: flex; align-items: center; min-height: 44px; }
html.in-tg .topbar { display: none; }             /* в Telegram вместо неё «изменить» у даты */
.link-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 8px 10px 0;
  border: 0;
  background: none;
  color: var(--gold-ink);
  font: 700 15px/1 var(--sans);
  cursor: pointer;
}
.head { text-align: center; }
html.in-tg .head { margin-top: 10px; }
/* «изменить» у даты (навигация 07.10.2026) */
.date-change { position: relative; margin: 0 0 0 10px; padding: 0; border: 0; background: none; cursor: pointer;
  font: 500 13px/1.25 var(--sans); letter-spacing: .02em; text-transform: none; color: var(--gold-ink);
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(192, 146, 70, .5);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; -webkit-appearance: none; appearance: none; }
.date-change::before { content: ''; position: absolute; inset: -14px -10px; }
.date-change:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 3px; }
.title--sm { font-size: 40px; margin-top: 6px; }

.spread { display: flex; justify-content: center; align-items: flex-start; gap: 12px; margin-top: 16px; }
.slot {
  flex: 0 0 calc((100% - 24px) / 3);
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  transform: translateY(26px) scale(.96);
}
.spread[data-count="2"] .slot { flex-basis: 40%; }
.spread[data-count="1"] .slot { flex-basis: 50%; }
.spread.is-dealt .slot { opacity: 1; transform: none; transition: opacity .5s var(--ease), transform .6s var(--ease); }
.spread.is-dealt .slot:nth-child(2) { transition-delay: .09s; }
.spread.is-dealt .slot:nth-child(3) { transition-delay: .18s; }
.slot__label {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 27px;
  margin-bottom: 32px;                             /* место под кольцо с числом над картой */
  text-align: center;
  font: 700 11.5px/1.25 var(--sans);
  letter-spacing: .01em;
  color: var(--gold-ink);
}

.card {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: default;
  perspective: 900px;
}
.card.is-ready { cursor: zoom-in; }
/* число карты в кольце на верхнем крае (вариант Б, владелец 04.10: «сделай цифры крупнее»); видно, когда карта открыта */
.card__ring {
  position: absolute; z-index: 4; left: 50%; top: -24px; width: 48px; height: 48px; margin-left: -24px;
  display: grid; place-items: center; border-radius: 50%; background: #fffaf1;
  box-shadow: 0 0 0 1.8px var(--gold), 0 6px 14px rgba(92, 58, 18, .231);
  font: 600 27px/1 var(--serif); font-variant-numeric: lining-nums; color: var(--ink);
  opacity: 0; transform: scale(.8); transition: opacity .45s var(--ease) .25s, transform .45s var(--ease) .25s; pointer-events: none;
}
.card.is-open .card__ring { opacity: 1; transform: none; }
.cards-sub { margin: 6px 0 0; text-align: center; font-size: 16px; line-height: 1.35; color: var(--ivory-3); }
.card__inner {
  position: relative;
  display: block;
  transform-style: preserve-3d;
  transition: transform .85s var(--ease);
}
.card__inner::before { content: ''; display: block; padding-top: 171.4286%; }   /* 7:12, как у колоды */
.card.is-open .card__inner { transform: rotateY(180deg); }
.card__back, .card__face {
  position: absolute;
  inset: 0;
  display: block;
  border-radius: 7px;
  overflow: hidden;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  box-shadow: 0 10px 26px rgba(92, 58, 18, .189);
}
.card__back svg { width: 100%; height: 100%; }
.card__back::after {                               /* блик, пока карты загружаются */
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(192, 146, 70, .096) 50%, transparent 65%);
  transform: translateX(-120%);
}
.spread.is-loading .card__back::after { animation: sheen 1.6s ease-in-out infinite; }
@keyframes sheen { to { transform: translateX(120%); } }
.card__face { transform: rotateY(180deg); background: var(--night); }
.card__face img { width: 100%; height: 100%; object-fit: cover; }
.card.is-lit .card__face { animation: lit 1.4s var(--ease) 1; }
@keyframes lit {
  0% { box-shadow: 0 0 0 0 rgba(192, 146, 70, 0), 0 10px 26px rgba(92, 58, 18, .189); }
  35% { box-shadow: 0 0 28px 4px rgba(192, 146, 70, .231), 0 10px 26px rgba(92, 58, 18, .189); }
  100% { box-shadow: 0 0 0 0 rgba(192, 146, 70, 0), 0 10px 26px rgba(92, 58, 18, .189); }
}
.card__fallback {                                  /* если картинка не загрузилась */
  display: none;
  position: absolute;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  text-align: center;
  font: 600 18px/1.1 var(--serif);
  color: var(--ink);
}
.card__face.no-img img { display: none; }
.card__face.no-img .card__fallback { display: flex; }

.tap-hint {                                       /* «Раскладываю карты…», потом подсказка про крупный вид */
  min-height: 20px;
  margin: 12px 0 0;
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  opacity: 0;
  transition: opacity .4s;
}
.tap-hint.is-shown { opacity: 1; }

.ornament { position: relative; height: 18px; margin: 16px 0 2px; }
.ornament::before {                 /* линия с просветом под ромб: фон общий, закрашивать его нечем */
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: linear-gradient(90deg, var(--line-2) calc(50% - 11px), rgba(192, 146, 70, .02) calc(50% - 11px), rgba(192, 146, 70, .02) calc(50% + 11px), var(--line-2) calc(50% + 11px));
}
.ornament::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border: 1px solid var(--line);
  transform: rotate(45deg);
}

.captions { list-style: none; margin: 0; padding: 0; }
.cap {
  padding: 18px 2px 20px;
  border-top: 1px solid var(--line-2);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .5s var(--ease), transform .5s var(--ease);
}
.cap:first-child { border-top: 0; }
.cap.is-shown { opacity: 1; transform: none; }
.cap__label { margin: 0; font: 700 13px/1.25 var(--sans); letter-spacing: .01em; color: var(--gold-ink); }
.cap__name { margin: 6px 0 0; font: 600 28px/1.1 var(--serif); color: var(--ink); font-variant-numeric: lining-nums; }
.cap__keys { margin: 4px 0 0; font: italic 500 19px/1.3 var(--serif); color: var(--ivory-3); }
.cap__lead { margin: 10px 0 0; font-size: 17px; line-height: 1.5; color: var(--ivory); }

.next {
  margin-top: 14px;
  padding: 22px 18px 18px;
  border: 1px solid var(--line-2);
  border-radius: 18px;
  background: rgba(255, 250, 241, .77);
  text-align: center;
}
.next p { margin: 0 0 18px; font: italic 500 21px/1.35 var(--serif); color: var(--cream); text-wrap: balance; }

.cta-bar {                                        /* кнопка покупки прилипает над панелью вкладок; в конце страницы под ней плашка «В полном разборе…» (владелец 03.10) */
  position: sticky;
  bottom: var(--dock-room, var(--bottom));
  z-index: 5;
  margin: 16px calc(-1 * var(--gutter)) 0;
  padding: 16px var(--gutter) 10px;
  opacity: 0;
  transform: translateY(110%);
  pointer-events: none;
  transition: transform .45s var(--ease), opacity .3s;
}
.cta-bar.is-shown { opacity: 1; transform: none; pointer-events: auto; }
/* тёмная подложка только пока кнопка висит над текстом (текст под ней не просвечивает); на своём месте её нет */
.cta-bar::before, .cta-bar::after { content: ''; position: absolute; left: 0; right: 0; z-index: -1; opacity: 0; transition: opacity .25s; pointer-events: none; }
.cta-bar::before { top: 0; bottom: 0; background: linear-gradient(to top, #fffaf1 calc(100% - 22px), rgba(255, 250, 241, 0)); }
.cta-bar::after { top: 100%; height: var(--dock-room, var(--bottom)); background: #fffaf1; }
.cta-bar.is-stuck::before, .cta-bar.is-stuck::after { opacity: 1; }
.cta-note { margin: 8px 0 0; text-align: center; font-size: 12.5px; color: var(--muted); }
html.in-tg .cta-note { display: none; }

/* ---------- карта крупно ---------- */
.zoom {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(56px + var(--top)) 16px calc(24px + var(--bottom));
  background: rgba(255, 250, 241, .95);
  opacity: 0;
  transition: opacity .25s;
}
.zoom[hidden] { display: none; }
.zoom.is-open { opacity: 1; }
.zoom__fig { margin: 0; display: flex; flex-direction: column; align-items: center; }
.zoom__fig img {
  width: min(78vw, 320px, calc((var(--vh) - 190px) * 7 / 12));
  height: auto;
  border-radius: 10px;
  box-shadow: 0 24px 60px rgba(92, 58, 18, .252);
  transform: scale(.94);
  transition: transform .35s var(--ease);
}
.zoom.is-open .zoom__fig img { transform: none; }
.zoom__fig figcaption { margin-top: 16px; text-align: center; }
.zoom__name { display: block; margin-top: 4px; font: 600 26px/1.1 var(--serif); color: var(--ink); }
.zoom__close {
  position: absolute;
  top: calc(8px + var(--top));
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 0;
  background: none;
  color: var(--ivory);
  cursor: pointer;
}

.noscript { max-width: 440px; margin: 24px auto; padding: 0 16px; text-align: center; color: var(--ivory-2); }
.noscript a { color: var(--ink); }

/* ---------- вкладка «Числа», поле даты: ступени сжатия ----------
   Всё до ссылок внизу должно поместиться между кнопками Telegram и панелью вкладок. Высоту этого места медиазапрос
   не знает (отступы полного экрана приходят переменными), поэтому ступень ставит app.js (fitForm): первая, при
   которой экран помещается; портрет занимает оставшееся место в пределах своей ступени (--portrait). */
.screen--form[data-fit="m"] .portrait { margin-bottom: 12px; }
.screen--form[data-fit="m"] .title { font-size: 54px; }
.screen--form[data-fit="m"] .form { margin-top: 16px; }
.screen--form[data-fit="m"] .fine { margin-top: 12px; }
.screen--form[data-fit="s"] .portrait, .screen--form[data-fit="xs"] .portrait { margin: 0 auto 10px; }
.screen--form[data-fit="s"] .title, .screen--form[data-fit="xs"] .title { font-size: 48px; }
.screen--form[data-fit="s"] .subtitle, .screen--form[data-fit="xs"] .subtitle { font-size: 20px; margin-top: 4px; }
.screen--form[data-fit="s"] .intro, .screen--form[data-fit="xs"] .intro { font-size: 15px; margin-top: 6px; }
.screen--form[data-fit="s"] .frame, .screen--form[data-fit="xs"] .frame { padding: 10px 16px 6px; }
.screen--form[data-fit="s"] .form, .screen--form[data-fit="xs"] .form { margin-top: 12px; }
.screen--form[data-fit="s"] .field, .screen--form[data-fit="xs"] .field { height: 54px; }
.screen--form[data-fit="s"] .field-msg, .screen--form[data-fit="xs"] .field-msg { margin: 6px 0 10px; }
.screen--form[data-fit="s"] .fine, .screen--form[data-fit="xs"] .fine { margin-top: 8px; }
.screen--form[data-fit="s"] .fine--links, .screen--form[data-fit="xs"] .fine--links { margin-top: 0; }
.screen--form[data-fit="xs"] .portrait { display: none; }

/* ---------- невысокие экраны и узкие телефоны ---------- */
@media (max-height: 740px) {
  .title { font-size: 54px; }
}
@media (max-height: 660px) {
  .title { font-size: 48px; }
}
@media (max-width: 350px) {
  .title { font-size: 52px; }
  .frame { padding-left: 14px; padding-right: 14px; }
  .spread { gap: 8px; }
  .slot { flex-basis: calc((100% - 16px) / 3); }
  .slot__label { font-size: 9.5px; letter-spacing: .12em; margin-bottom: 28px; }
  .card__ring { width: 42px; height: 42px; margin-left: -21px; top: -21px; font-size: 24px; }
}

/* ---------- без анимаций, если так настроено в системе ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    transition-delay: 0s !important;
  }
  .slot, .cap, .cta-bar, .zoom__fig img { transform: none !important; }
}
