/* Слой атмосферы поверх style.css: звёзды, дымка, зерно, свечения, тайпрайтер.
   Ничего в style.css не переопределяется силой — только более специфичные/поздние правила. */

/* ---------- Фон-фото: наша сцена с картами и свечами, статичная — оживляем слоями поверх ---------- */
#card-swirl-bg {
  position: fixed; inset: 0; z-index: -6; overflow: hidden; pointer-events: none;
  background-image: url("hero-swirl.jpg"); background-size: cover; background-position: center;
}

/* Пульсирующее тёплое свечение поверх свечей на фото — имитирует живой огонёк */
.hero-glow {
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,246,216,0.55), var(--accent-soft) 40%, transparent 70%);
  filter: blur(14px); mix-blend-mode: screen; animation: heroGlowFlicker ease-in-out infinite;
}
.hero-glow-1 { left: 4%; top: 27%; width: 70px; height: 100px; animation-duration: 2.1s; }
.hero-glow-2 { left: 32%; top: 36%; width: 90px; height: 140px; animation-duration: 1.8s; animation-delay: 0.4s; }
.hero-glow-3 { left: 64%; top: 32%; width: 60px; height: 90px; animation-duration: 2.4s; animation-delay: 0.9s; }
.hero-glow-4 { left: 80%; top: 48%; width: 100px; height: 150px; animation-duration: 1.9s; animation-delay: 1.2s; }
@keyframes heroGlowFlicker {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  25% { opacity: 0.8; transform: scale(1.08); }
  50% { opacity: 0.45; transform: scale(0.95); }
  75% { opacity: 0.75; transform: scale(1.05); }
}

/* Мерцающие искры вдоль золотой дуги на фото */
#hero-sparkles { position: absolute; inset: 0; }
.hero-spark {
  position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #ffe9b0;
  box-shadow: 0 0 6px 2px rgba(255,220,150,0.8); animation: twinkle ease-in-out infinite;
}

#curtain, #stars-bg, #nebula, #smoke, #embers-bg, #vignette, #grain { position: fixed; inset: 0; pointer-events: none; }
#curtain { z-index: 50; background: var(--bg); display: flex; align-items: center; justify-content: center;
  animation: curtainLift 1.6s ease forwards; }
.curtain-glyph { font-size: 2.4rem; color: var(--accent); text-shadow: 0 0 24px var(--accent-soft);
  animation: curtainGlyph 1.6s ease forwards; }
@keyframes curtainLift { 0%, 40% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }
@keyframes curtainGlyph {
  0% { transform: scale(0.6); opacity: 0; }
  30% { transform: scale(1.15); opacity: 1; }
  60% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.4); opacity: 0; }
}

#stars-bg { z-index: -4; overflow: hidden; }
.star { position: absolute; border-radius: 50%; background: var(--text); animation: twinkle ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: 0.15; transform: scale(1); } 50% { opacity: 0.9; transform: scale(1.6); } }

#nebula { z-index: -3; overflow: hidden; }
#nebula::before, #nebula::after {
  content: ""; position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%;
  filter: blur(70px); opacity: 0.35; will-change: transform;
}
#nebula::before { background: radial-gradient(circle, var(--accent-soft), transparent 70%);
  top: -20%; left: -10%; animation: drift1 40s ease-in-out infinite; }
#nebula::after { background: radial-gradient(circle, var(--accent), transparent 70%);
  bottom: -25%; right: -15%; animation: drift2 55s ease-in-out infinite; }
@keyframes drift1 { 0%, 100% { transform: translate(0,0) scale(1); } 50% { transform: translate(8vw, 6vh) scale(1.15); } }
@keyframes drift2 { 0%, 100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-6vw, -8vh) scale(1.1); } }

/* ---------- Дымка/пар, поднимающийся снизу — как курящиеся свечи на референсе ---------- */
#smoke { z-index: -3; overflow: hidden; }
#smoke::before, #smoke::after {
  content: ""; position: absolute; width: 40vw; height: 70vh; left: 28%; bottom: -25%;
  background: radial-gradient(ellipse at center, var(--accent-soft), transparent 70%);
  filter: blur(55px); opacity: 0.16; border-radius: 50%; will-change: transform, opacity;
  animation: rise 16s ease-in infinite;
}
#smoke::after { left: 54%; width: 34vw; animation-duration: 21s; animation-delay: 4s; opacity: 0.12; }
@keyframes rise {
  0% { transform: translateY(0) scale(1); opacity: 0; }
  15% { opacity: 0.16; }
  100% { transform: translateY(-70vh) scale(1.5); opacity: 0; }
}

/* ---------- Угольки-искры, тёплый контраст к холодному туману ---------- */
#embers-bg { z-index: -2; overflow: hidden; }
.ember {
  position: absolute; bottom: -2%; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 6px 1px var(--accent); animation: emberRise linear infinite;
}
@keyframes emberRise {
  0% { transform: translate(0, 0); opacity: 0; }
  12% { opacity: 0.75; }
  85% { opacity: 0.4; }
  100% { transform: translate(var(--drift, 20px), -100vh); opacity: 0; }
}

#vignette { z-index: -1; background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.55) 100%); }
#grain {
  z-index: 5; opacity: 0.05; mix-blend-mode: overlay; background-size: 120px 120px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Акцентный шрифт для лого и заголовков (self-hosted, без внешнего CDN) ---------- */
@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/PlayfairDisplay-700-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/PlayfairDisplay-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/PlayfairDisplay-400-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/PlayfairDisplay-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Иерархия: бренд/hero — самые крупные и жирные; экранные h2 и лейблы секций — легче и мельче */
.brand, .hero-title, h2, .section-label {
  font-family: "Playfair Display", Georgia, serif;
}
.brand { font-weight: 700; }
.hero-title { font-weight: 700; font-size: 1.85rem; }
h2 { font-weight: 400; font-size: 1.4rem; }
.section-label { font-weight: 400; font-style: italic; font-size: 1.1rem; }

/* Заголовок и подзаголовок — белый текст с плотной тенью для контраста на видео-фоне */
.hero-title, h2 { color: var(--text); }
.hero-title { text-shadow: 0 2px 10px rgba(0,0,0,0.9); }
.hero-sub { color: var(--text); text-shadow: 0 2px 10px rgba(0,0,0,0.9); animation: fadeUp 1s ease both; animation-delay: 0.3s; }

/* Текст трактовки — крупнее и просторнее, это то, что читают вдумчиво, а не бегло */
.result-feed-answer { font-size: 1.05rem; line-height: 1.75; }
.example-answer { font-size: 0.95rem; line-height: 1.65; }
.example-question, .hint { font-size: 0.95rem; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Золотой outline фокуса вместо синего браузерного ---------- */
button:focus-visible, .card-tile:focus-visible, .suit-tab:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
button:focus:not(:focus-visible), .card-tile:focus:not(:focus-visible), .suit-tab:focus:not(:focus-visible) {
  outline: none;
}

/* ---------- Золотая подсветка при наведении вместо голубой (--glow/--accent-soft холодные, для атмосферы) ---------- */
:root {
  --glow-gold: rgba(209, 168, 94, 0.5);
  --accent-light: #f2d9a1;
  --accent-dark: #8a6a34;
}

/* ---------- Тон золота вместо одного плоского #d1a85e — светлый/базовый/тёмный для объёма ---------- */
.mode-btn {
  background: linear-gradient(160deg, rgba(242,217,161,0.28), rgba(19,35,47,0.9) 55%, rgba(19,35,47,0.94));
  border-color: var(--accent-dark);
}
.mode-btn-title { color: var(--accent-light); }
.draw-btn, .submit-btn {
  background: linear-gradient(160deg, var(--accent-light), var(--accent) 55%, var(--accent-dark));
}
.step-num { border-color: var(--accent-dark); color: var(--accent-light); }
.tg-login-btn:hover, .mode-btn:hover, .card-tile:hover, .orient-btn:hover, .feed-action-btn:hover {
  border-color: var(--accent);
}
.tg-login-btn:hover { box-shadow: 0 0 12px 1px var(--glow-gold); }
.draw-btn:hover, .submit-btn:hover { box-shadow: 0 0 0 1px rgba(255,255,255,0.35) inset, 0 0 18px 1px var(--glow-gold); }
.feed-action-btn:hover { box-shadow: 0 0 12px 0 var(--glow-gold); }
.tarot-card:not(.flipped) .tarot-card-back { animation: breatheGold 3.2s ease-in-out infinite; }
@keyframes breatheGold {
  0%, 100% { box-shadow: 0 0 20px 0 var(--glow-gold); }
  50% { box-shadow: 0 0 38px 6px var(--glow-gold); }
}

/* ---------- Наклон при наведении: кнопки режимов, карты, вытяг ---------- */
.mode-btn, .card-tile, .tarot-card {
  transition: transform 0.2s ease, border-color 0.2s, box-shadow 0.2s, filter 0.5s ease;
}
.mode-btn:hover { box-shadow: 0 0 24px 2px var(--glow-gold); }

/* ---------- Плитки колоды, вкладки мастей, кнопки ориентации — объёмные, с золотыми уголками ---------- */
.suit-tab, .card-tile, .orient-btn { position: relative; }
.card-tile, .orient-btn {
  background: linear-gradient(180deg, var(--bg-card-soft), rgba(0,0,0,0.28));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), inset 0 -8px 16px rgba(0,0,0,0.35), 0 4px 10px rgba(0,0,0,0.4);
}

/* Миниатюра-иконка карты в плитке — текст остаётся главным для быстрого сканирования */
.card-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
@media (max-width: 480px) {
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
}
.card-tile { display: flex; align-items: center; gap: 0.55rem; text-align: left; }
.card-tile-icon {
  width: 60px; height: 92px; flex: none; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--accent-dark);
}
.card-tile-name { flex: 1; }
@media (max-width: 480px) {
  .card-tile-icon { width: 48px; height: 74px; }
}
.suit-tab {
  background: linear-gradient(180deg, var(--bg-card-soft), rgba(0,0,0,0.3));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 2px 6px rgba(0,0,0,0.35);
}
.suit-tab.active {
  background: linear-gradient(180deg, var(--accent-light), var(--accent-dark));
  box-shadow: 0 0 16px 1px var(--glow-gold), inset 0 1px 0 rgba(255,255,255,0.3);
}
.card-tile::before, .card-tile::after {
  content: ""; position: absolute; width: 12px; height: 12px; opacity: 0.5;
  border: 1px solid var(--accent); pointer-events: none; transition: opacity 0.2s ease;
}
.card-tile::before { top: 3px; left: 3px; border-right: none; border-bottom: none; }
.card-tile::after { bottom: 3px; right: 3px; border-left: none; border-top: none; }
.card-tile:hover::before, .card-tile:hover::after,
.card-tile.selected::before, .card-tile.selected::after { opacity: 1; }
.card-tile:hover {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), inset 0 -8px 16px rgba(0,0,0,0.3),
    0 6px 18px rgba(0,0,0,0.5), 0 0 20px 1px var(--glow-gold);
}
.card-tile.selected {
  border-color: var(--accent);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), inset 0 -6px 14px rgba(0,0,0,0.25), 0 0 24px 2px var(--glow-gold);
}
.orient-btn:hover { box-shadow: 0 0 18px 1px var(--glow-gold), inset 0 1px 0 rgba(255,255,255,0.1); }

/* ---------- Рубашка карты: золотая рамка + вращающийся сигил вместо эмодзи ---------- */
.tarot-card { position: relative; }
.card-frame { position: absolute; inset: 10px; border: 1px solid var(--accent-dark); pointer-events: none; }
.card-frame::before { content: ""; position: absolute; inset: 4px; border: 1px solid var(--accent-light); opacity: 0.7; }
.tarot-card-back {
  background-image: url("card-back.jpg");
  background-size: cover; background-position: center;
}

/* ---------- Иллюстрация на лицевой стороне карты (если файл cards/<id>.png существует) ---------- */
.tarot-card-face { overflow: hidden; }
.tarot-card-face-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 14px; }
.tarot-card-face-label {
  position: absolute; top: 0; left: 0; right: 0; padding: 0.6rem 0.5rem; font-weight: bold;
  background: linear-gradient(180deg, rgba(4,9,14,0.85), transparent);
  text-shadow: 0 2px 8px rgba(0,0,0,0.9), 0 0 10px rgba(0,0,0,0.9);
}

/* ---------- Вспышка при раскрытии карты ---------- */
.tarot-card.bursting::after {
  content: ""; position: absolute; inset: -20px; border-radius: 50%;
  background: radial-gradient(circle, rgba(201,163,92,0.55), transparent 70%);
  animation: burst 0.6s ease-out forwards; pointer-events: none;
}
@keyframes burst { from { opacity: 1; transform: scale(0.3); } to { opacity: 0; transform: scale(1.8); } }

/* ---------- Мистический лоадер ---------- */
.mystic-loader { display: flex; gap: 0.4rem; justify-content: center; margin-bottom: 0.6rem; }
.mystic-loader span { display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); animation: loaderPulse 1.2s ease-in-out infinite; }
.mystic-loader span:nth-child(2) { animation-delay: 0.2s; }
.mystic-loader span:nth-child(3) { animation-delay: 0.4s; }
@keyframes loaderPulse { 0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; } 40% { transform: scale(1.2); opacity: 1; } }

/* ---------- Тайпрайтер для трактовки — клик пропускает анимацию ---------- */
.result-feed-answer.typing { cursor: pointer; }
.result-feed-answer.typing::after {
  content: "\258C"; margin-left: 2px; color: var(--accent); animation: blink 0.8s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Вариативность ритма контейнеров — не всё одинаковый бокс с золотой рамкой ---------- */
.how-it-works {
  background: none; border: none; border-radius: 0; backdrop-filter: none;
  border-top: 1px solid var(--border); padding-top: 1.3rem;
}

/* ---------- Лёгкая дифференциация экранов через бирюзу (только фон-атмосфера, не интерактив) ---------- */
#screen-physical { background: radial-gradient(ellipse at top, rgba(79,168,192,0.07), transparent 60%); }
#screen-online { background: radial-gradient(ellipse at top, rgba(209,168,94,0.08), transparent 60%); }

/* ---------- Выбор ориентации карты — теперь над сеткой, явно отделён и подсвечен при появлении ---------- */
.orientation-pick {
  margin-top: 0; margin-bottom: 1.3rem;
  background: var(--bg-card-soft); border: 1px solid var(--accent); border-radius: 14px;
  padding: 0.9rem 1rem;
}
.orientation-pick.pulse { animation: orientationPulse 1s ease-out; }
@keyframes orientationPulse {
  0% { box-shadow: 0 0 0 2px var(--glow-gold), 0 0 30px 4px var(--glow-gold); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ---------- Десктоп: не просто растянутая мобильная колонка ---------- */
@media (min-width: 860px) {
  #app { max-width: 940px; }
  .mode-buttons-top { flex-direction: row; }
  .mode-buttons-top .mode-btn { flex: 1; }
  .example-feed { flex-direction: row; align-items: stretch; }
  .example-item { flex: 1; }
  .steps-list { max-width: 640px; margin: 0 auto; }
}

/* ---------- Дисклеймер: развлекательный сервис, юридическая подстраховка (ПЛАН.md §6) ---------- */
.site-footer { text-align: center; padding: 0.5rem 1.2rem 2rem; }
.disclaimer { color: var(--text-dim); font-size: 0.78rem; line-height: 1.5; opacity: 0.7; max-width: 480px; margin: 0 auto; }

/* ---------- Scroll-reveal: блоки ниже экрана проявляются при прокрутке, а не сразу ---------- */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal-on-scroll.in-view { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important;
  }
  #nebula, #stars-bg, .hero-glow, #hero-sparkles { display: none; }
  .reveal-on-scroll { opacity: 1 !important; transform: none !important; }
}
