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

/* ---------- Профиль после входа через Telegram (виджет в #tg-auth-area заменяется этим в JS) ---------- */
#tg-auth-area { display: flex; align-items: center; gap: 0.5rem; }
.tg-user-photo { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; border: 1px solid var(--accent); }
.tg-user-name { color: var(--text); font-size: 0.9rem; white-space: nowrap; }
.tg-logout-btn, .tg-my-topics-btn {
  background: var(--bg-card-soft); border: 1px solid var(--accent-dark); color: var(--text-dim);
  border-radius: 999px; padding: 0.35rem 0.8rem; font-size: 0.8rem; cursor: pointer; font-family: inherit;
}
.tg-logout-btn:hover, .tg-my-topics-btn:hover { border-color: var(--accent); color: var(--text); }

/* ---------- Экран "Мои расклады" ---------- */
.my-topics-list { display: flex; flex-direction: column; gap: 0.8rem; margin-top: 1rem; }
.my-topic-item {
  display: flex; flex-direction: column; gap: 0.3rem; text-align: left;
  background: var(--bg-card-soft); border: 1px solid var(--border); border-radius: 14px;
  padding: 1rem 1.1rem; cursor: pointer; font-family: inherit; color: var(--text);
}
.my-topic-item:hover { border-color: var(--accent); }
.my-topic-title { color: var(--accent); font-size: 0.95rem; }
.my-topic-meta { color: var(--text-dim); font-size: 0.85rem; }

/* ---------- Акцентный шрифт для лого и заголовков (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;
}

:root {
  --accent-light: #f2d9a1;
  --accent-dark: #8a6a34;
}

.mode-btn-title { color: var(--accent-light); }
.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);
}

/* ---------- Наклон при наведении: кнопки режимов, карты, вытяг ---------- */
.mode-btn, .card-tile, .tarot-card {
  transition: transform 0.2s ease, border-color 0.2s, filter 0.5s ease;
}

.suit-tab, .card-tile, .orient-btn { position: relative; }
.card-tile, .orient-btn { background: var(--bg-card-soft); }

/* Миниатюра-иконка карты в плитке — текст остаётся главным для быстрого сканирования */
.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; }
}
/* ---------- Карта уже открыта в этой теме — не повторяется, показана лицом вверх ---------- */
.card-tile.used, .card-tile:disabled {
  opacity: 0.4; cursor: default; filter: grayscale(0.4);
}
.card-tile.used:hover, .card-tile:disabled:hover { transform: none; box-shadow: none; }

/* ---------- Сетка рубашек для онлайн-режима: все 78 карт, кликом открывается случайная ---------- */
.online-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 0.5rem;
  margin: 1.2rem 0;
}
.online-tile {
  aspect-ratio: 160 / 260;
  border-radius: 8px;
  border: 1px solid var(--accent-dark);
  background-image: url("card-back.jpg");
  background-size: cover; background-position: center;
  cursor: pointer; padding: 0; position: relative;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.online-tile:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--accent);
}
.online-tile.used {
  cursor: default; opacity: 0.4; background-image: none; border-color: var(--border);
}
.online-tile-img { width: 100%; height: 100%; object-fit: cover; border-radius: 7px; }
@media (max-width: 480px) {
  .online-card-grid { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 0.4rem; }
}

/* ---------- Рубашка карты: тонкая золотая рамка ---------- */
.tarot-card { position: relative; }
.card-frame { position: absolute; inset: 10px; border: 1px solid var(--accent-dark); pointer-events: none; }
.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;
}

/* ---------- Выбор ориентации карты — над сеткой, явно отделён рамкой ---------- */
.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;
}

/* ---------- Десктоп: не просто растянутая мобильная колонка ---------- */
@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;
  }
  .reveal-on-scroll { opacity: 1 !important; transform: none !important; }
}
