/* ============================================================
   Дорога Никиты — эзотерический адвент
   Палитра, типографика, экраны, модули.
   ============================================================ */

:root {
  --bg-0: #0a0713;
  --bg-1: #140a24;
  --bg-card: #170e28;
  --gold: #d9b872;
  --gold-hi: #f0d089;
  --mystic: #7c5cff;
  --text: #ece6f5;
  --text-dim: #a99fc0;
  --line: rgba(217, 184, 114, 0.28);
  --line-soft: rgba(217, 184, 114, 0.14);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --display: 'Cinzel', 'Times New Roman', serif;
  --body: 'Cormorant Garamond', Georgia, serif;
  --ease: cubic-bezier(0.22, 0.8, 0.3, 1);
  --pad: clamp(16px, 4vw, 32px);

  /* ---- Арт ритуального стола (утверждённый рендер t3 magic) ----
     Градиент-подложка снизу — на случай медленной загрузки PNG. */
  --table-bg: url('/assets/hero/table-desktop.png'),
              linear-gradient(180deg, #140a24 0%, #0a0713 65%, #060410 100%);
  --table-bg-mobile: url('/assets/hero/table-mobile.png'),
              linear-gradient(180deg, #140a24 0%, #0a0713 65%, #060410 100%);

  /* ---- слоты расклада дня: % от .hero__table, подогнать под финальный стол ---- */
  --slot-message-x: 28%;
  --slot-message-y: 34%;
  --slot-pattern-x: 50%;
  --slot-pattern-y: 30%;
  --slot-next-x: 72%;
  --slot-next-y: 34%;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg-0);
}

body {
  font-family: var(--body);
  font-size: clamp(17px, 1.1rem + 0.3vw, 20px);
  line-height: 1.55;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

h1, h2, h3, .display {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: 0.06em;
  margin: 0;
}

/* ---------- фон ---------- */
#stars {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}

.veil {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(124, 92, 255, 0.18), transparent 60%),
    radial-gradient(90% 60% at 50% 110%, rgba(217, 184, 114, 0.10), transparent 65%),
    linear-gradient(180deg, rgba(10, 7, 19, 0.35), rgba(20, 10, 36, 0.75));
}

#app {
  position: relative;
  z-index: 2;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- экраны ---------- */
.screen {
  flex: 1;
  padding: max(var(--pad), env(safe-area-inset-top)) var(--pad)
           calc(var(--pad) + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: screen-in 0.55s var(--ease) both;
}

.screen[hidden] { display: none; }

@keyframes screen-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- одностраничный сайт (hero + адвент) ---------- */
.site { display: block; }
.site[hidden] { display: none; }

body.no-scroll { overflow: hidden; }

/* ============================================================
   HERO — ритуальный стол, 3D-колода, расклад дня
   ============================================================ */
.hero {
  position: relative;
  min-height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: hidden;
}

.hero__table {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 0;
  background-image: var(--table-bg);
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 0 160px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  perspective: 1600px;
}

@media (max-width: 640px) {
  .hero__table {
    background-image: var(--table-bg-mobile);
  }
}

/* ---------- колода в центре стола ---------- */
.hero__deckzone {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
  z-index: 3;
}

.hero__deckzone.is-hidden { opacity: 0; transform: translate(-50%, -50%) scale(0.9); pointer-events: none; }

.deck3d {
  position: relative;
  width: min(30vw, 34vh, 190px);
  aspect-ratio: 5 / 8;
  transform-style: preserve-3d;
  cursor: pointer;
  transition: transform 0.35s var(--ease);
  touch-action: manipulation;
  outline: none;
}

.deck3d:hover, .deck3d:focus-visible { transform: translateY(-6px) scale(1.03); }

.deck3d__pile { position: absolute; inset: 0; transform-style: preserve-3d; }

.deck3d__pile i {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: var(--card-back);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}

.deck3d:hover .deck3d__pile i,
.deck3d:focus-visible .deck3d__pile i {
  box-shadow: var(--shadow), 0 0 26px rgba(217, 184, 114, 0.3);
}

.hero__deck-hint {
  margin: 0;
  font-family: var(--display);
  font-size: 0.72em;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.85;
  text-align: center;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
  animation: pulse 4s ease-in-out infinite;
}

/* ---------- расклад дня: 3 слота ---------- */
.spread {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.spread[hidden] { display: none; }

.spread__slot {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: min(34vw, 42vh, 320px);
  transform: translate(-50%, -50%) translateY(-40px) scale(0.5);
  opacity: 0;
  transition: transform 0.6s var(--ease), opacity 0.6s var(--ease);
}

.spread__slot.is-in { opacity: 1; transform: translate(-50%, -50%); }

.spread__slot--message { left: var(--slot-message-x); top: var(--slot-message-y); }
.spread__slot--pattern { left: var(--slot-pattern-x); top: var(--slot-pattern-y); }
.spread__slot--next    { left: var(--slot-next-x);    top: var(--slot-next-y); }

.spread__label {
  font-family: var(--display);
  font-size: 0.6em;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-hi);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
}

.card3d--mini {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 8;
  transform-style: preserve-3d;
}

.card3d--mini .card3d__inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.7s var(--ease);
}

.card3d--mini.is-flipped .card3d__inner { transform: rotateY(180deg); }
.card3d--mini.is-reversed.is-flipped .card3d__inner { transform: rotateY(180deg) rotate(180deg); }

.card3d--mini .card3d__face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 5px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow), 0 0 24px rgba(217, 184, 114, 0.14);
  overflow: hidden;
}

.card3d--mini .card3d__face--back { background: var(--card-back); }

.card3d--mini .card3d__face--front {
  transform: rotateY(180deg);
  background: linear-gradient(170deg, #1d1233, #0c0718);
}

.card3d--mini .card3d__face--front img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}

/* заглушка колоды (.cardph) внутри мини-карты — уменьшаем под размер слота */
.card3d--mini .cardph { padding: 9%; gap: 0.15em; }
.card3d--mini .cardph::before, .card3d--mini .cardph::after { width: 8px; height: 8px; }
.card3d--mini .cardph__num { font-size: clamp(0.6rem, 2.6vw, 0.95rem); }
.card3d--mini .cardph__glyph { font-size: clamp(0.7rem, 3vw, 1.05rem); }
.card3d--mini .cardph__name { font-size: clamp(0.4rem, 1.3vw, 0.58rem); letter-spacing: 0.06em; }

/* ---------- панель чтения под столом ---------- */
/* панель разбора — оверлей снизу поверх полноэкранного стола */
.hero__reading {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(1000px, 96vw);
  max-height: 52dvh;
  overflow-y: auto;
  z-index: 6;
  padding: clamp(12px, 2vw, 22px) clamp(12px, 2vw, 22px) calc(clamp(12px, 2vw, 22px) + env(safe-area-inset-bottom));
  border-radius: 18px 18px 0 0;
  background: linear-gradient(180deg, rgba(8,5,15,0.72), rgba(8,5,15,0.94));
  backdrop-filter: blur(6px);
  box-shadow: 0 -18px 50px rgba(0,0,0,0.6);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(10px, 2vw, 18px);
}
.hero__synth { grid-column: 1 / -1; }

.hero__reading[hidden] { display: none; }

/* современно: без плашек-боксов — чистая типографика, тонкая линия сверху */
.hero__reading-item {
  text-align: center;
  padding: 0.4rem 0.6rem 0;
  border: none;
  border-top: 1px solid var(--line-soft);
  background: none;
  animation: screen-in 0.5s var(--ease) both;
}

.hero__reading-pos {
  margin: 0;
  font-family: var(--display);
  font-size: 0.62em;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--mystic);
}

.hero__reading-name { margin: 0.3rem 0 0; font-size: clamp(1rem, 3vw, 1.3rem); color: var(--gold-hi); }
.hero__reading-orient { margin: 0.15rem 0 0; font-size: 0.72em; font-style: italic; color: var(--text-dim); }
.hero__reading-text { margin: 0.5rem 0 0; font-size: 0.92em; color: var(--text); opacity: 0.92; }

.hero__reading-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
}

@media (max-width: 640px) {
  .hero__reading { grid-template-columns: 1fr; }
}

/* ---------- скролл-индикатор ---------- */
.hero__scroll {
  position: absolute;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 14px);
  transform: translateX(-50%);
  z-index: 5;
  margin-top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  color: var(--text-dim);
  text-decoration: none;
  font-family: var(--display);
  font-size: 0.7em;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.hero__scroll i { font-style: normal; font-size: 1.1rem; color: var(--gold); animation: bob 2.6s ease-in-out infinite; }

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(6px); }
}

/* ============================================================
   ХОТСПОТЫ — каркас под предметы стола (арт подставится позже)
   ============================================================ */
.hotspot-layer { position: absolute; inset: 0; z-index: 2; }

.hotspot {
  position: absolute;
  left: var(--hx);
  top: var(--hy);
  width: var(--hw);
  height: var(--hh);
  transform: translate(-50%, -50%);
  border: 1px dashed rgba(217, 184, 114, 0.35);
  border-radius: 50%;
  background: rgba(217, 184, 114, 0.04);
  padding: 0;
  cursor: pointer;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease), background 0.25s var(--ease);
  touch-action: manipulation;
}

.hotspot:hover, .hotspot:focus-visible, .hotspot.is-active {
  border-color: var(--gold-hi);
  background: rgba(217, 184, 114, 0.14);
  box-shadow: 0 0 22px rgba(217, 184, 114, 0.35);
  transform: translate(-50%, -50%) scale(1.08);
  outline: none;
}

.hotspot__mark {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.hotspot__mark::before {
  content: '✦';
  color: var(--gold-hi);
  font-size: 0.9rem;
  opacity: 0.55;
  text-shadow: 0 0 10px rgba(240, 208, 137, 0.6);
}

.hotspot:hover .hotspot__mark::before,
.hotspot.is-active .hotspot__mark::before { opacity: 1; }

.hotspot-card {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  width: max(160px, 12vw);
  max-width: 220px;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(12, 8, 20, 0.96);
  box-shadow: var(--shadow);
  text-align: center;
  z-index: 5;
  animation: screen-in 0.25s var(--ease) both;
  cursor: default;
}

/* хотспоты у верхнего края стола — карточка раскрывается вниз, иначе её
   обрежет overflow:hidden контейнера стола */
.hotspot--flip .hotspot-card {
  bottom: auto;
  top: calc(100% + 10px);
}

.hotspot-card__title {
  margin: 0 0 0.35rem;
  font-family: var(--display);
  font-size: 0.75em;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-hi);
}

.hotspot-card__text { margin: 0; font-size: 0.8em; color: var(--text-dim); line-height: 1.4; }

.hotspot-card__qr {
  width: min(140px, 40vw);
  margin: 0.3rem auto 0.5rem;
  background: #fff;
  border-radius: 3px;
  padding: 6px;
  line-height: 0;
}

.hotspot-card__qr svg { width: 100%; height: 100%; display: block; }

/* ============================================================
   АДВЕНТ — секция ниже по скроллу
   ============================================================ */
.advent {
  position: relative;
  min-height: 100dvh;
  width: 100%;
  padding: calc(var(--pad) * 2) var(--pad) calc(var(--pad) + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  scroll-margin-top: 0;
}

/* ============================================================
   ДЕНЬ — модальный оверлей поверх страницы
   ============================================================ */
.day-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(6, 4, 12, 0.86);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  overflow-y: auto;
  animation: screen-in 0.35s var(--ease) both;
}

.day-overlay[hidden] { display: none; }

/* ---------- кнопки ---------- */
.btn {
  font-family: var(--display);
  font-size: 0.82em;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 0.85em 1.7em;
  border-radius: 2px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--gold-hi);
  cursor: pointer;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease),
              box-shadow 0.3s var(--ease), transform 0.15s var(--ease), opacity 0.3s;
  touch-action: manipulation;
  min-height: 46px;
}

.btn:hover, .btn:focus-visible {
  border-color: var(--gold);
  background: rgba(217, 184, 114, 0.09);
  box-shadow: 0 0 26px rgba(217, 184, 114, 0.18);
  outline: none;
}

.btn:active { transform: translateY(1px); }

.btn--gold {
  background: linear-gradient(180deg, rgba(217, 184, 114, 0.16), rgba(217, 184, 114, 0.05));
  box-shadow: 0 0 30px rgba(217, 184, 114, 0.12), inset 0 0 0 1px rgba(240, 208, 137, 0.12);
}

.btn--ghost { border-color: transparent; color: var(--text-dim); letter-spacing: 0.1em; }
.btn--ghost:hover { color: var(--gold-hi); background: transparent; box-shadow: none; }

.btn[disabled] { opacity: 0.4; pointer-events: none; }

/* ============================================================
   ПОРТАЛ
   ============================================================ */
.screen--portal { justify-content: center; text-align: center; }

.portal {
  max-width: 34rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
}

.portal__sigil {
  position: relative;
  width: min(46vw, 190px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  margin-bottom: 0.4rem;
}

.portal__ring, .portal__ring--2 {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
}

.portal__ring { animation: spin 46s linear infinite; border-style: dashed; }

.portal__ring--2 {
  inset: 14%;
  border-color: rgba(124, 92, 255, 0.35);
  animation: spin 30s linear infinite reverse;
}

.portal__star {
  font-size: 2.4rem;
  color: var(--gold-hi);
  text-shadow: 0 0 24px rgba(240, 208, 137, 0.6);
  animation: pulse 4.5s ease-in-out infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
  0%, 100% { opacity: 0.65; transform: scale(1); }
  50%      { opacity: 1;    transform: scale(1.12); }
}

.portal__title {
  font-size: clamp(2rem, 9vw, 3.4rem);
  line-height: 1.1;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 40px rgba(217, 184, 114, 0.22);
}

.portal__sub {
  margin: 0;
  font-family: var(--display);
  letter-spacing: 0.4em;
  text-transform: uppercase;
  font-size: 0.72em;
  color: var(--text-dim);
}

.portal__intro { margin: 0.6rem 0 0.4rem; color: var(--text); opacity: 0.92; }
.portal__note { margin: 0; font-size: 0.82em; font-style: italic; color: var(--text-dim); }

/* ============================================================
   ШАПКИ
   ============================================================ */
.crown {
  text-align: center;
  max-width: 40rem;
  width: 100%;
  margin-bottom: 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: center;
}

.crown__title { font-size: clamp(1.3rem, 5.5vw, 2rem); }

.crown__meta, .crown__daynum {
  margin: 0;
  font-family: var(--display);
  font-size: 0.72em;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.8;
}

.crown__lead { margin: 0.2rem 0 0; color: var(--text-dim); max-width: 32rem; }

.crown--day { position: relative; padding-top: 2.6rem; }

.btn--back {
  position: absolute;
  top: 0;
  left: 0;
  padding: 0.5em 0.9em;
  font-size: 0.72em;
}

/* ============================================================
   СЕТКА 30 ДВЕРЕЙ
   ============================================================ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: clamp(8px, 2.4vw, 16px);
  width: 100%;
  max-width: 640px;
}

.cell {
  position: relative;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  background: linear-gradient(160deg, rgba(23, 14, 40, 0.92), rgba(10, 7, 19, 0.92));
  color: var(--text-dim);
  font-family: var(--display);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15em;
  cursor: default;
  padding: 4px;
  overflow: hidden;
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease),
              box-shadow 0.3s var(--ease), color 0.3s var(--ease);
  touch-action: manipulation;
}

.cell__num { font-size: clamp(0.95rem, 3.6vw, 1.25rem); font-weight: 600; letter-spacing: 0.04em; }
.cell__sigil { font-size: clamp(0.85rem, 3.2vw, 1.1rem); opacity: 0.55; line-height: 1; }
.cell__mark { position: absolute; top: 5px; right: 6px; font-size: 0.7rem; opacity: 0.75; }

/* уголки таро-рамки */
.cell::before, .cell::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border: 1px solid var(--line);
  opacity: 0.5;
  transition: opacity 0.3s var(--ease);
}
.cell::before { top: 4px; left: 4px; border-right: 0; border-bottom: 0; }
.cell::after  { bottom: 4px; right: 4px; border-left: 0; border-top: 0; }

.cell--locked { opacity: 0.42; filter: saturate(0.4); }
.cell--locked .cell__sigil { opacity: 0.3; }

.cell--available {
  cursor: pointer;
  color: var(--gold-hi);
  border-color: var(--gold);
  animation: cell-glow 3.2s ease-in-out infinite;
}

.cell--available .cell__sigil { opacity: 0.9; color: var(--gold); }
.cell--available::before, .cell--available::after { opacity: 1; }

@keyframes cell-glow {
  0%, 100% { box-shadow: 0 0 0 rgba(217, 184, 114, 0), inset 0 0 18px rgba(217, 184, 114, 0.05); }
  50%      { box-shadow: 0 0 26px rgba(217, 184, 114, 0.35), inset 0 0 22px rgba(217, 184, 114, 0.12); }
}

.cell--opened {
  cursor: pointer;
  color: var(--text);
  border-color: rgba(124, 92, 255, 0.45);
  background: linear-gradient(160deg, rgba(40, 26, 70, 0.95), rgba(18, 11, 32, 0.95));
}

.cell--opened .cell__mark { color: var(--gold-hi); }

.cell--available:hover, .cell--opened:hover { transform: translateY(-3px) scale(1.03); }
.cell--locked:active { animation: shake 0.4s ease; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-4px); }
  75%      { transform: translateX(4px); }
}

.grid__hint {
  margin: 1.6rem 0 0;
  font-size: 0.85em;
  font-style: italic;
  color: var(--text-dim);
  text-align: center;
  max-width: 30rem;
}

/* ============================================================
   ТАРО
   ============================================================ */
.phase {
  width: 100%;
  max-width: 40rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.4rem;
}

.phase[hidden] { display: none; }

.deck {
  position: relative;
  width: min(64vw, 240px);
  aspect-ratio: 5 / 8;
  perspective: 1200px;
  display: grid;
  place-items: center;
}

/* стопка рубашек */
.deck__pile { position: absolute; inset: 0; }

.deck__pile i {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: var(--card-back);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transition: transform 0.45s var(--ease);
}

.deck.is-shuffling .deck__pile i { animation: shuffle 0.62s var(--ease) infinite; }

@keyframes shuffle {
  0%   { transform: translate3d(0, 0, 0) rotate(0deg); }
  35%  { transform: translate3d(-24%, -4%, 0) rotate(-7deg); }
  65%  { transform: translate3d(20%, 3%, 0) rotate(6deg); }
  100% { transform: translate3d(0, 0, 0) rotate(0deg); }
}

.deck.is-drawn .deck__pile { opacity: 0.35; transform: scale(0.9); transition: 0.5s var(--ease); }

/* рубашка карты — НАША сгенерённая back.png (root-absolute путь: url в
   CSS-переменной резолвится от стиля /css/, поэтому от корня). Снизу —
   градиент-фолбэк на время загрузки. */
:root {
  --card-back:
    url('/assets/deck/back.png'),
    linear-gradient(160deg, #1b1030, #0d0819);
}
/* всё, что рисует рубашку через переменную, тянет картинку по размеру */
.deck3d__pile i,
.card3d__face--back,
.fan__card,
.shuffle3d i {
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
}

.card3d {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  animation: card-out 0.7s var(--ease) both;
}

.card3d[hidden] { display: none; }

@keyframes card-out {
  from { transform: translateY(26%) scale(0.86); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.card3d__inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.9s var(--ease);
}

.card3d.is-flipped .card3d__inner { transform: rotateY(180deg); }
.card3d.is-reversed.is-flipped .card3d__inner { transform: rotateY(180deg) rotate(180deg); }

.card3d__face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 6px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow), 0 0 40px rgba(217, 184, 114, 0.12);
  overflow: hidden;
}

.card3d__face--back { background: var(--card-back); }

.card3d__face--front {
  transform: rotateY(180deg);
  background: linear-gradient(170deg, #1d1233, #0c0718);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 8%;
  text-align: center;
}

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

/* заглушка, когда картинки колоды ещё нет */
.cardph {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35em;
  width: 100%;
  height: 100%;
  padding: 12%;
}

.cardph::before, .cardph::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 1px solid var(--line);
}
.cardph::before { top: 6%; left: 6%; border-right: 0; border-bottom: 0; }
.cardph::after  { bottom: 6%; right: 6%; border-left: 0; border-top: 0; }

.cardph__num {
  font-family: var(--display);
  font-size: 1.9rem;
  color: var(--gold-hi);
  text-shadow: 0 0 22px rgba(240, 208, 137, 0.45);
}

.cardph__glyph { font-size: 2.2rem; color: var(--mystic); opacity: 0.75; line-height: 1; }

.cardph__name {
  font-family: var(--display);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}

.reading {
  text-align: center;
  max-width: 30rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  animation: screen-in 0.6s var(--ease) both;
}

.reading[hidden] { display: none; }

.reading__pos {
  margin: 0;
  font-family: var(--display);
  font-size: 0.68em;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--mystic);
}

.reading__name { font-size: clamp(1.4rem, 6vw, 2rem); color: var(--gold-hi); }
.reading__text { margin: 0; color: var(--text); opacity: 0.92; }

/* ============================================================
   МОДУЛИ
   ============================================================ */
.module { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 1.2rem; }

.frame {
  position: relative;
  width: 100%;
  max-width: 30rem;
  padding: clamp(18px, 5vw, 30px);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  background: linear-gradient(160deg, rgba(23, 14, 40, 0.9), rgba(12, 8, 22, 0.9));
  box-shadow: var(--shadow);
}

.frame::before, .frame::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border: 1px solid var(--gold);
  opacity: 0.55;
}
.frame::before { top: 7px; left: 7px; border-right: 0; border-bottom: 0; }
.frame::after  { bottom: 7px; right: 7px; border-left: 0; border-top: 0; }

.module__title {
  font-family: var(--display);
  font-size: 0.7em;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
  text-align: center;
  margin: 0 0 0.9rem;
}

.module__hint { font-size: 0.85em; font-style: italic; color: var(--text-dim); text-align: center; margin: 0; }

/* ---------- puzzle ---------- */
.puzzle {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  width: min(86vw, 340px);
  aspect-ratio: 1;
  margin: 0 auto 1rem;
  border: 1px solid var(--line);
  padding: 3px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.4);
  touch-action: manipulation;
}

.puzzle__tile {
  position: relative;
  background-size: 300% 300%;
  background-repeat: no-repeat;
  border-radius: 2px;
  cursor: pointer;
  transition: transform 0.18s var(--ease), box-shadow 0.25s var(--ease), opacity 0.4s;
}

.puzzle__tile--empty { background-image: none !important; background: rgba(255, 255, 255, 0.03); cursor: default; }
.puzzle__tile--movable:hover { box-shadow: inset 0 0 0 1px var(--gold-hi); }
.puzzle.is-solved { gap: 0; padding: 0; }   /* собранная картинка сходится без швов */
.puzzle.is-solved .puzzle__tile { cursor: default; }
.puzzle.is-solved .puzzle__tile--empty { opacity: 1; }
.puzzle.is-solved { box-shadow: 0 0 40px rgba(217, 184, 114, 0.35); }

.puzzle__row { display: contents; }

.puzzle-bar { display: flex; gap: 0.7rem; align-items: center; justify-content: center; flex-wrap: wrap; margin-top: 1rem; }
.puzzle-caption { margin: 1.1rem 0 0; text-align: center; animation: screen-in 0.6s var(--ease) both; }

/* ---------- wish ---------- */
.wish__text { margin: 0; white-space: pre-line; text-align: center; font-size: 1.05em; }

.wish__quote {
  display: block;
  text-align: center;
  font-size: 1.6rem;
  color: var(--gold);
  opacity: 0.5;
  line-height: 0.6;
  margin-bottom: 0.4rem;
}

/* ---------- аудиоплеер (wish + track) ---------- */
.player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  width: 100%;
}

.player__cover {
  width: min(60vw, 210px);
  aspect-ratio: 1;
  border-radius: 4px;
  border: 1px solid var(--line);
  object-fit: cover;
  box-shadow: var(--shadow), 0 0 40px rgba(124, 92, 255, 0.16);
}

.player__cover.is-playing { animation: spin 18s linear infinite; border-radius: 50%; }

.player__meta { text-align: center; }
.player__name { font-family: var(--display); font-size: 1.1rem; color: var(--gold-hi); margin: 0; }
.player__artist { margin: 0.1rem 0 0; font-size: 0.85em; color: var(--text-dim); }

.player__row { display: flex; align-items: center; gap: 0.8rem; width: 100%; }

.player__play {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  padding: 0;
  min-height: 0;
}

.player__bar {
  position: relative;
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(236, 230, 245, 0.14);
  cursor: pointer;
  touch-action: none;
}

.player__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--mystic), var(--gold-hi));
}

.player__time {
  flex: 0 0 auto;
  font-family: var(--display);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* ---------- zine ---------- */
.reveal {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--line);
  cursor: pointer;
  touch-action: none;
}

.reveal img { width: 100%; height: 100%; object-fit: cover; display: block; }

.reveal__blur {
  position: absolute;
  inset: 0;
  backdrop-filter: blur(18px) saturate(0.7) brightness(0.55);
  -webkit-backdrop-filter: blur(18px) saturate(0.7) brightness(0.55);
  background: rgba(10, 7, 19, 0.35);
  display: grid;
  place-items: center;
  transition: opacity 0.7s var(--ease);
}

.reveal.is-open .reveal__blur { opacity: 0; pointer-events: none; }

.reveal__label {
  font-family: var(--display);
  font-size: 0.72em;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-hi);
  text-shadow: 0 0 18px rgba(0, 0, 0, 0.8);
  padding: 0.6em 1.1em;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: rgba(10, 7, 19, 0.45);
}

.zine__hint { margin: 1rem 0 0; animation: screen-in 0.6s var(--ease) both; }

.zine__cta { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; margin-top: 1.1rem; }

.zine__note { font-size: 0.82em; font-style: italic; color: var(--text-dim); text-align: center; margin: 0; }

a.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }

/* ---------- hidden / скретч ---------- */
.scratch {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0d0819;
  touch-action: none;
}

.scratch img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scratch canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; transition: opacity 0.6s var(--ease); }
.scratch.is-cleared canvas { opacity: 0; pointer-events: none; }

.scratch__clue {
  margin-top: 1rem;
  text-align: center;
  font-size: 1.05em;
  color: var(--gold-hi);
  animation: screen-in 0.6s var(--ease) both;
}

/* ---------- video ---------- */
.videobox { width: 100%; }

.videobox__stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #000;
  box-shadow: var(--shadow), 0 0 50px rgba(124, 92, 255, 0.14);
}

.videobox__stage video, .videobox__stage iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.videobox__title {
  margin: 0.9rem 0 0;
  text-align: center;
  font-family: var(--display);
  font-size: 1rem;
  color: var(--gold-hi);
}

/* ---------- memory / полароид ---------- */
.polaroid {
  background: linear-gradient(180deg, #f4efe4, #e5ddcc);
  padding: 12px 12px 46px;
  border-radius: 2px;
  box-shadow: var(--shadow);
  transform: rotate(-1.6deg);
  width: min(78vw, 300px);
  margin: 0 auto;
}

.polaroid img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  display: block;
  background: #1a1030;
}

.polaroid__cap {
  margin: 12px 0 0;
  text-align: center;
  font-family: var(--display);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #3a2b46;
}

.memory__text { margin: 0; text-align: center; white-space: pre-line; }

.memory__wish {
  margin: 0;
  padding: 1rem 1.2rem;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  text-align: center;
  font-family: var(--display);
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--gold-hi);
  text-shadow: 0 0 28px rgba(217, 184, 114, 0.25);
}

/* ============================================================
   СЛУЖЕБНОЕ
   ============================================================ */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 50;
  padding: 0.7em 1.2em;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(16, 10, 28, 0.95);
  color: var(--text);
  font-size: 0.85em;
  max-width: min(92vw, 26rem);
  text-align: center;
  box-shadow: var(--shadow);
  animation: screen-in 0.35s var(--ease) both;
}

.toast[hidden] { display: none; }

#confetti {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
}

#confetti[hidden] { display: none; }

.fatal {
  margin: auto;
  max-width: 34rem;
  text-align: center;
  color: var(--text-dim);
}

.fatal code {
  display: inline-block;
  margin-top: 0.6rem;
  padding: 0.4em 0.8em;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  font-size: 0.8em;
  color: var(--gold-hi);
  font-family: ui-monospace, monospace;
}

/* ---------- адаптив ---------- */
@media (max-width: 420px) {
  .grid { grid-template-columns: repeat(4, 1fr); max-width: 100%; }
  .btn { padding: 0.8em 1.3em; letter-spacing: 0.12em; }
  .crown--day { padding-top: 3rem; }
  /* капслок с широким трекингом на узком экране упирается в края */
  .crown__meta, .crown__daynum { letter-spacing: 0.18em; }
  .reading__pos { letter-spacing: 0.16em; }
  .module__title { letter-spacing: 0.18em; }

  .deck3d { width: min(40vw, 32vh, 170px); }
  .hero__deck-hint { font-size: 0.62em; letter-spacing: 0.14em; }
  .spread__label { font-size: 0.56em; letter-spacing: 0.14em; }
  .hotspot-card { width: 140px; padding: 0.65rem 0.7rem; }
  .hotspot-card__title { font-size: 0.68em; }
  .hotspot-card__text { font-size: 0.75em; }
}

@media (min-width: 760px) {
  .grid { grid-template-columns: repeat(6, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.06s !important;
  }
}

/* ============================================================
   АДВЕНТ-ДВЕРИ В СТИЛЕ КАРТ (рубашка + медальон числа) — 30.08
   Override поверх базовых .cell: каждая ячейка = карта-дверь.
   ============================================================ */
.grid { gap: clamp(8px, 2.2vw, 16px); }

.cell {
  /* верхний слой — тёмная вуаль, средний — уникальная дверь дня (--door),
     нижний — рубашка-фолбэк, если дверь ещё не сгенерилась */
  background-image:
    linear-gradient(160deg, rgba(10, 7, 19, 0.30), rgba(10, 7, 19, 0.55)),
    var(--door, none),
    url('../assets/deck/back.png');
  background-size: cover, cover, cover;
  background-position: center, center, center;
  background-repeat: no-repeat, no-repeat, no-repeat;
  border: 1px solid rgba(217, 184, 114, 0.35);
  border-radius: 7px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

/* золотой медальон с числом дня по центру двери */
.cell__num {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(30px, 8vw, 44px);
  height: clamp(30px, 8vw, 44px);
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, rgba(30, 18, 52, 0.94), rgba(10, 7, 19, 0.96));
  border: 1.5px solid var(--gold);
  color: var(--gold-hi);
  font-size: clamp(0.95rem, 3.4vw, 1.3rem);
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  box-shadow: 0 0 10px rgba(217, 184, 114, 0.25), inset 0 0 6px rgba(0, 0, 0, 0.5);
  z-index: 2;
}

/* сигил прячем на закрытых дверях — рубашка сама несёт узор */
.cell__sigil { display: none; }

/* ЗАПЕРТА — приглушённая запечатанная дверь */
.cell--locked {
  opacity: 1;
  filter: saturate(0.55) brightness(0.5);
}
.cell--locked .cell__num {
  color: rgba(217, 184, 114, 0.55);
  border-color: rgba(217, 184, 114, 0.4);
}

/* СЕГОДНЯ/ДОСТУПНА — светится золотом, «дышит» */
.cell--available {
  filter: none;
  border-color: var(--gold);
  animation: door-breathe 3.4s ease-in-out infinite;
}
@keyframes door-breathe {
  0%, 100% { box-shadow: 0 6px 18px rgba(0,0,0,0.45), 0 0 0 rgba(217,184,114,0); }
  50%      { box-shadow: 0 6px 22px rgba(0,0,0,0.5), 0 0 26px rgba(217,184,114,0.45); }
}
.cell--available .cell__num {
  box-shadow: 0 0 16px rgba(217, 184, 114, 0.55), inset 0 0 6px rgba(0, 0, 0, 0.5);
}

/* ОТКРЫТА — чуть притушена, галочка */
.cell--opened { filter: saturate(0.8) brightness(0.72); }
.cell--opened .cell__mark {
  position: absolute; top: 6px; right: 8px;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 7, 19, 0.8);
  border: 1px solid var(--gold);
  color: var(--gold-hi); font-size: 0.7rem; opacity: 1; z-index: 3;
}

.cell--available:hover, .cell--opened:hover { transform: translateY(-4px) scale(1.04); }

/* ФЛИП-ОТКРЫТИЕ ДВЕРИ — клик → 3D-переворот с золотой вспышкой (30.08) */
.grid { perspective: 1400px; }
.cell { transform-style: preserve-3d; will-change: transform; }

@keyframes door-flip-out {
  0%   { transform: rotateY(0) scale(1); }
  45%  { transform: rotateY(-78deg) scale(1.12);
         box-shadow: 0 10px 40px rgba(0,0,0,0.6), 0 0 46px rgba(217,184,114,0.75); }
  100% { transform: rotateY(-100deg) scale(1.18); opacity: 0.1; }
}
.cell--opening {
  z-index: 6;
  animation: door-flip-out 0.6s cubic-bezier(0.6, 0, 0.3, 1) forwards;
  pointer-events: none;
}

/* ЖИВОЙ СВЕТ на сегодняшней двери — движущийся золотой блик по рельефу (30.08) */
.cell--today { border-color: var(--gold-hi); }
.cell__light {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 1;                 /* над дверью, под медальоном (num z-index:2) */
  mix-blend-mode: screen;
  background:
    radial-gradient(circle at var(--lx, 50%) var(--ly, 32%),
      rgba(255, 236, 180, 0.55) 0%,
      rgba(240, 208, 137, 0.28) 18%,
      rgba(217, 184, 114, 0.10) 38%,
      transparent 62%);
  transition: none;
}
/* лёгкий контр-блик снизу для объёма рельефа */
.cell--today::before { /* переопределяем: уголок остаётся, но добавляем тень-объём через box-shadow */ }
.cell--today {
  box-shadow: 0 8px 24px rgba(0,0,0,0.5),
              inset 0 0 30px rgba(0,0,0,0.35),
              0 0 30px rgba(217,184,114,0.4);
  animation: door-breathe 3.4s ease-in-out infinite;
}

/* ============================================================
   РИТУАЛ РАСКЛАДА + живой свет на объектах стола
   ============================================================ */

/* ---- живой свет: дрейфующие тёплые блики по предметам стола ---- */
.hero__fx {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0.9;
}
.hero__fx::before,
.hero__fx::after {
  content: "";
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(circle at 22% 74%, rgba(255, 196, 120, 0.35), transparent 26%),
    radial-gradient(circle at 78% 70%, rgba(255, 170, 90, 0.30), transparent 24%),
    radial-gradient(circle at 50% 30%, rgba(150, 200, 255, 0.16), transparent 30%);
  animation: fx-drift 9s ease-in-out infinite alternate;
}
.hero__fx::after {
  background:
    radial-gradient(circle at 20% 76%, rgba(255, 220, 150, 0.22), transparent 18%),
    radial-gradient(circle at 80% 72%, rgba(255, 190, 110, 0.20), transparent 18%);
  animation: fx-flicker 2.6s steps(1) infinite;
  mix-blend-mode: screen;
}
@keyframes fx-drift {
  0%   { transform: translate3d(-1.2%, -0.8%, 0) scale(1.02); opacity: 0.85; }
  100% { transform: translate3d(1.4%, 1.0%, 0) scale(1.05); opacity: 1; }
}
@keyframes fx-flicker {
  0%, 100% { opacity: 0.55; }
  33%      { opacity: 0.9; }
  66%      { opacity: 0.4; }
}
@media (prefers-reduced-motion: reduce) {
  .hero__fx::before, .hero__fx::after { animation: none; }
}

/* ---- панель ритуала (вопрос / тасовка / веер) ---- */
.ritual {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  width: min(88%, 560px);
  z-index: 5;
  text-align: center;
  opacity: 0;
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}
.ritual.is-in { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.ritual__eyebrow {
  font-size: 0.66rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.85;
}
.ritual__title {
  font-family: var(--serif, Georgia, serif);
  font-size: clamp(1.5rem, 4.4vw, 2.1rem);
  color: #f4ead2;
}
.ritual__sub {
  font-size: 0.92rem;
  line-height: 1.5;
  color: rgba(244, 234, 210, 0.72);
  max-width: 42ch;
}
.ritual__sub--wait { animation: pulse-soft 1.6s ease-in-out infinite; }
@keyframes pulse-soft { 0%,100%{opacity:0.6} 50%{opacity:1} }

.ritual__input {
  width: 100%;
  max-width: 420px;
  padding: 0.78rem 1rem;
  background: rgba(10, 8, 16, 0.55);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  color: #f4ead2;
  font-size: 0.98rem;
  text-align: center;
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.ritual__input::placeholder { color: rgba(244, 234, 210, 0.4); }
.ritual__input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(217, 184, 114, 0.16);
}

.ritual__prompt {
  font-size: 1rem;
  color: #f4ead2;
  min-height: 1.4em;
}
.ritual__prompt-pos {
  display: block;
  font-size: 0.66rem;
  letter-spacing: 0.28em;
  color: var(--gold);
  margin-bottom: 0.3rem;
}

/* ---- перетасовка ---- */
.shuffle3d {
  position: relative;
  width: 120px;
  height: 168px;
  margin: 0 auto 0.4rem;
}
.shuffle3d i {
  position: absolute;
  inset: 0;
  border-radius: 9px;
  border: 1px solid var(--line-soft);
  background: var(--card-back);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  animation: shuffle-swap 0.8s var(--ease) infinite;
}
@keyframes shuffle-swap {
  0%, 100% { transform: translate(0,0) rotate(0deg); }
  25% { transform: translate(-26px, -6px) rotate(-7deg); }
  50% { transform: translate(0, 2px) rotate(0deg); }
  75% { transform: translate(26px, -6px) rotate(7deg); }
}

/* ---- веер, из которого тянут ---- */
.fan {
  position: relative;
  height: 200px;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}
.fan__card {
  position: absolute;
  bottom: 0;
  width: 92px;
  height: 150px;
  border-radius: 9px;
  border: 1px solid var(--line-soft);
  background: var(--card-back);
  box-shadow: 0 8px 22px rgba(0,0,0,0.5), inset 0 0 24px rgba(217,184,114,0.12);
  cursor: pointer;
  padding: 0;
  transform: translate(0, 40px) rotate(0deg) scale(0.9);
  opacity: 0;
  transition: transform 0.5s var(--ease), opacity 0.4s var(--ease), box-shadow 0.25s var(--ease);
  transition-delay: calc(var(--i) * 0.05s);
}
.fan.is-in .fan__card {
  opacity: 1;
  transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(1);
}
@media (hover: hover) {
  .fan__card:hover:not(:disabled) {
    transform: translate(var(--dx), calc(var(--dy) - 18px)) rotate(var(--rot)) scale(1.04);
    box-shadow: 0 14px 30px rgba(0,0,0,0.55), inset 0 0 30px rgba(240,208,137,0.35);
  }
}
.fan__card.is-pulled {
  opacity: 0;
  transform: translate(var(--dx), -60px) rotate(var(--rot)) scale(0.7);
  pointer-events: none;
}
.fan__card:disabled { cursor: default; }

/* ---- краткие подписи под вытянутыми ---- */
.hero__reading-item--brief { animation: screen-in 0.4s var(--ease) both; }
.hero__reading-orient { font-size: 0.8em; opacity: 0.65; font-weight: 400; }

/* ---- общий разбор ---- */
/* общее предсказание — без бокса, воздух и стильная типографика */
.hero__synth {
  margin-top: 1.6rem;
  padding: 1.4rem 0 0.4rem;
  border: none;
  border-top: 1px solid rgba(217, 184, 114, 0.22);
  background: none;
  box-shadow: none;
  text-align: center;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}
.hero__synth.is-in { opacity: 1; transform: translateY(0); }
.hero__synth-eyebrow {
  font-size: 0.64rem;
  letter-spacing: 0.36em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.85;
  margin-bottom: 0.9rem;
}
.hero__synth-q {
  font-family: var(--serif, Georgia, serif);
  font-style: italic;
  font-size: clamp(1.15rem, 2.6vw, 1.5rem);
  color: #f6ecd6;
  margin-bottom: 1.1rem;
}
.hero__synth-body {
  max-width: 60ch;
  margin: 0 auto;
}
.hero__synth-body p {
  font-size: clamp(1rem, 1.5vw, 1.12rem);
  line-height: 1.72;
  color: rgba(246, 236, 214, 0.9);
  margin-bottom: 1rem;
}
.hero__synth-body p:first-child::first-letter {
  font-family: var(--serif, Georgia, serif);
  font-size: 2.6em;
  float: left;
  line-height: 0.82;
  padding: 0.06em 0.12em 0 0;
  color: var(--gold-hi);
}
.hero__synth-body b { color: var(--gold-hi); font-weight: 600; }

/* ============================================================
   ПАННО адвента — двери разного размера, вживлённые в единое полотно
   (masonry со спанами, плотная упаковка, общий узорный фон-рамка)
   ============================================================ */
.grid {
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: clamp(74px, 12.2vh, 158px);
  grid-auto-flow: dense;
  gap: 6px;
  width: 100%;
  max-width: min(1240px, 96vw);
  padding: clamp(10px, 1.6vw, 20px);
  border: 1px solid rgba(217, 184, 114, 0.28);
  border-radius: 18px;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(124, 92, 255, 0.10), transparent 60%),
    radial-gradient(80% 60% at 50% 100%, rgba(217, 184, 114, 0.08), transparent 60%),
    linear-gradient(180deg, rgba(14, 9, 24, 0.9), rgba(8, 5, 15, 0.94));
  box-shadow: var(--shadow), inset 0 0 80px rgba(0, 0, 0, 0.5);
}

/* в панно размер задаётся спанами — фиксированный aspect убираем */
.grid .cell {
  aspect-ratio: auto;
  border-radius: 6px;
  min-height: 0;
}

/* узор разного калибра: 4 крупные двери 2×2, 3 широкие, 2 высокие, прочие 1×1.
   dense-упаковка сама заполняет промежутки. */
.grid .cell:nth-child(1)  { grid-column: span 2; grid-row: span 2; }
.grid .cell:nth-child(6)  { grid-column: span 2; }
.grid .cell:nth-child(9)  { grid-row: span 2; }
.grid .cell:nth-child(12) { grid-column: span 2; grid-row: span 2; }
.grid .cell:nth-child(16) { grid-column: span 2; }
.grid .cell:nth-child(19) { grid-row: span 2; }
.grid .cell:nth-child(23) { grid-column: span 2; grid-row: span 2; }
.grid .cell:nth-child(27) { grid-column: span 2; }
.grid .cell:nth-child(30) { grid-column: span 2; grid-row: span 2; }

/* крупные двери — медальон числа побольше */
.grid .cell:nth-child(1) .cell__num,
.grid .cell:nth-child(12) .cell__num,
.grid .cell:nth-child(23) .cell__num,
.grid .cell:nth-child(30) .cell__num {
  width: clamp(44px, 5vw, 64px);
  height: clamp(44px, 5vw, 64px);
  font-size: clamp(1.1rem, 2vw, 1.5rem);
}

@media (max-width: 720px) {
  .grid {
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: clamp(82px, 20vw, 130px);
    gap: 5px;
    max-width: 100%;
  }
  /* на узком экране гасим самые большие споны, чтобы не разъезжалось */
  .grid .cell:nth-child(9),
  .grid .cell:nth-child(19) { grid-row: span 1; }
}
