/* AstroGen — Светлый эфир — style.css */
/* Цвета: #F8F4EE фон, #1A1B3E индиго, #D4AF7A золото */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #F8F4EE;
  --ink: #1A1B3E;
  --gold: #D4AF7A;
  --ink-soft: rgba(26,27,62,0.55);
  --ink-faint: rgba(26,27,62,0.15);
  --ink-rule: rgba(26,27,62,0.1);
  --gold-soft: rgba(212,175,122,0.35);
  --cream-tint: #F0EBE3;
  --radius: 16px;
  --page-px: 24px;
}

html, body {
  height: 100%;
  overflow-x: hidden;
}

body {
  background: var(--bg);
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--ink);
  min-height: 100%;
  /* safe-area поддержка для iPhone */
  padding-bottom: env(safe-area-inset-bottom);
}

/* ===== ТИПОГРАФИЯ ===== */
.serif { font-family: 'PT Serif', Georgia, serif; }

h1, h2, h3 { font-family: 'PT Serif', Georgia, serif; }

/* ===== ШАПКА ===== */
.app-header {
  background: var(--ink);
  padding: 22px var(--page-px) 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-family: 'PT Serif', Georgia, serif;
  font-size: 24px;
  color: var(--bg);
  letter-spacing: 0.02em;
  line-height: 1;
}

.logo span { color: var(--gold); }

.tagline {
  font-size: 11px;
  color: rgba(248,244,238,0.5);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 300;
  margin-top: 4px;
}

.header-right {
  font-size: 12px;
  color: rgba(212,175,122,0.8);
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 1;
  padding-top: 4px;
}

/* ===== ДЕКОРАТИВНЫЙ РАЗДЕЛИТЕЛЬ ===== */
.rule {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 var(--page-px);
  margin: 20px 0;
}

.rule-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(26,27,62,0.15), transparent);
}

.rule-diamond {
  width: 6px;
  height: 6px;
  background: var(--gold);
  transform: rotate(45deg);
  flex-shrink: 0;
}

/* ===== ЭКРАНЫ (SPA) ===== */
.screen {
  display: none;
  min-height: calc(100vh - 60px);
}

.screen.active {
  display: block;
}

/* ===== ЗАСТАВКА ===== */
#screen-splash {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px var(--page-px);
  text-align: center;
  background: var(--ink);
  position: relative;
  overflow: hidden;
}

#screen-splash::before {
  content: '';
  position: absolute;
  top: -80px; left: 50%;
  transform: translateX(-50%);
  width: 400px;
  height: 400px;
  background: radial-gradient(ellipse, rgba(212,175,122,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.splash-logo {
  font-family: 'PT Serif', Georgia, serif;
  font-size: 48px;
  color: var(--bg);
  letter-spacing: 0.02em;
  line-height: 1;
  margin-bottom: 8px;
}

.splash-logo span { color: var(--gold); }

.splash-tagline {
  font-size: 13px;
  color: rgba(248,244,238,0.5);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 300;
  margin-bottom: 48px;
}

.splash-diamond {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(212,175,122,0.4);
  transform: rotate(45deg);
  margin: 0 auto 48px;
  position: relative;
}

.splash-diamond::after {
  content: '';
  position: absolute;
  inset: 5px;
  background: rgba(212,175,122,0.15);
}

/* ===== КНОПКИ ===== */
.btn {
  display: block;
  width: 100%;
  border: none;
  cursor: pointer;
  font-family: 'PT Serif', Georgia, serif;
  font-size: 17px;
  text-align: center;
  padding: 17px;
  border-radius: 14px;
  letter-spacing: 0.01em;
  position: relative;
  overflow: hidden;
  transition: opacity 0.15s;
  min-height: 56px;
}

.btn:active { opacity: 0.82; }

.btn-primary {
  background: var(--bg);
  color: var(--ink);
}

.btn-primary::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.btn-dark {
  background: var(--ink);
  color: var(--bg);
}

.btn-dark::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.btn-outline {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink-faint);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 500;
}

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 400;
  padding: 12px 17px;
}

.btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

/* ===== ОНБОРДИНГ ===== */
#screen-onboarding {
  padding-bottom: 100px;
}

.onboarding-inner {
  padding: 0 var(--page-px) 32px;
}

.ob-step-label {
  font-size: 10px;
  color: var(--gold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ob-step-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gold-soft);
}

.ob-title {
  font-family: 'PT Serif', Georgia, serif;
  font-size: 22px;
  color: var(--ink);
  margin-bottom: 24px;
  line-height: 1.3;
}

/* Поля ввода */
.field-group {
  margin-bottom: 16px;
}

.field-label {
  font-size: 11px;
  color: var(--ink-soft);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
  margin-bottom: 6px;
  display: block;
}

.field-input {
  width: 100%;
  background: var(--cream-tint);
  border: 1px solid var(--ink-faint);
  border-radius: 10px;
  padding: 13px 15px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
  min-height: 48px;
}

.field-input:focus {
  border-color: rgba(26,27,62,0.35);
}

.field-row {
  display: flex;
  gap: 12px;
}

.field-row .field-group { flex: 1; }

/* Чекбокс */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--ink);
  cursor: pointer;
  flex-shrink: 0;
}

.checkbox-label {
  font-size: 13px;
  color: var(--ink-soft);
}

/* Геокодинг */
.geo-results {
  margin-top: 6px;
  background: #fff;
  border: 1px solid var(--ink-faint);
  border-radius: 10px;
  overflow: hidden;
  display: none;
}

.geo-results.visible { display: block; }

.geo-result-item {
  padding: 11px 15px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  border-bottom: 1px solid var(--ink-rule);
  transition: background 0.12s;
}

.geo-result-item:last-child { border-bottom: none; }
.geo-result-item:active { background: var(--cream-tint); }

/* Выбор тем */
.topics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 8px;
}

.topic-tile {
  background: var(--cream-tint);
  border: 1.5px solid var(--ink-faint);
  border-radius: 12px;
  padding: 14px 12px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
  min-height: 70px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.topic-tile.selected {
  border-color: var(--gold);
  background: rgba(212,175,122,0.08);
}

.topic-emoji {
  font-size: 22px;
  line-height: 1;
}

.topic-name {
  font-size: 12px;
  color: var(--ink);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.topic-tile.selected .topic-name { color: var(--ink); }

.topics-counter {
  font-size: 12px;
  color: var(--ink-soft);
  text-align: right;
  margin-top: 8px;
}

.topics-counter.ready { color: var(--gold); font-weight: 600; }

/* Кнопка-фиксер внизу экрана */
.bottom-action {
  position: fixed;
  bottom: env(safe-area-inset-bottom, 0);
  left: 0; right: 0;
  padding: 12px var(--page-px) 20px;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
  z-index: 50;
}

/* ===== ЭКРАН-РИТУАЛ ===== */
#screen-ritual {
  padding-bottom: 40px;
  text-align: center;
}

.ritual-wheel-wrap {
  padding: 28px var(--page-px) 0;
  display: flex;
  justify-content: center;
}

.ritual-status {
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 400;
  margin: 20px var(--page-px) 0;
}

.ritual-status::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--gold);
  border-radius: 50%;
  margin-right: 8px;
  animation: pulse 1.8s ease-in-out infinite;
  vertical-align: middle;
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}

/* Карусель инсайтов */
.insight-carousel {
  margin: 28px var(--page-px) 0;
  overflow: hidden;
}

.insight-track {
  display: flex;
  transition: transform 0.45s cubic-bezier(.4,0,.2,1);
}

.insight-card {
  min-width: 100%;
  background: var(--cream-tint);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--ink-rule);
  text-align: left;
}

.insight-eyebrow {
  font-size: 10px;
  color: var(--gold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 8px;
}

.insight-text {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.7;
  font-style: italic;
  font-family: 'PT Serif', Georgia, serif;
}

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
}

.carousel-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--ink-faint);
  transition: background 0.2s, transform 0.2s;
  cursor: pointer;
}

.carousel-dot.active {
  background: var(--gold);
  transform: scale(1.3);
}

/* ===== РАЗБОР ===== */
#screen-reading {
  padding-bottom: 80px;
}

.reading-wheel-section {
  padding: 28px var(--page-px) 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.chart-title-block {
  margin-top: 20px;
  text-align: center;
  width: 100%;
  padding: 0 0 24px;
  border-bottom: 1px solid var(--ink-rule);
}

.chart-eyebrow {
  font-size: 10px;
  color: var(--ink-soft);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
  margin-bottom: 6px;
}

.chart-title {
  font-family: 'PT Serif', Georgia, serif;
  font-size: 20px;
  color: var(--ink);
  line-height: 1.35;
}

.chart-date {
  font-size: 12px;
  color: rgba(26,27,62,0.4);
  margin-top: 5px;
  font-weight: 300;
}

/* Индикатор блока N/6 */
.block-indicator {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 20px var(--page-px) 0;
  align-items: center;
}

.block-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ink-faint);
  transition: background 0.25s, transform 0.25s;
  cursor: pointer;
}

.block-dot.active {
  background: var(--gold);
  transform: scale(1.3);
}

.block-dot.done {
  background: rgba(212,175,122,0.5);
}

.block-counter-text {
  font-size: 11px;
  color: var(--ink-soft);
  margin-left: 8px;
  letter-spacing: 0.06em;
}

/* Блоки контента разбора */
.content-area {
  padding: 0 var(--page-px) 24px;
}

.article-block {
  padding: 22px 0;
  border-bottom: 1px solid var(--ink-rule);
  animation: fadeUp 0.4s ease both;
}

.article-block:last-of-type { border-bottom: none; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.article-eyebrow {
  font-size: 10px;
  color: var(--gold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.article-eyebrow::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gold-soft);
}

.article-title {
  font-family: 'PT Serif', Georgia, serif;
  font-size: 17px;
  color: var(--ink);
  margin-bottom: 10px;
  line-height: 1.35;
}

.article-text {
  font-size: 14px;
  color: rgba(26,27,62,0.72);
  line-height: 1.78;
}

.article-text p { margin-bottom: 12px; }
.article-text p:last-child { margin-bottom: 0; }
.article-text strong { color: var(--ink); font-weight: 600; }
.article-text em { font-style: italic; }
.article-text h4 { display: none; } /* заголовки блоков из API убираем — у нас свои eyebrow */

/* Блок даров (тёмный) */
.gifts-block {
  background: var(--ink);
  border-radius: var(--radius);
  padding: 22px;
  margin: 4px 0 8px;
}

.gifts-eyebrow {
  font-size: 10px;
  color: var(--gold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 10px;
}

.gifts-title {
  font-family: 'PT Serif', Georgia, serif;
  font-size: 16px;
  color: var(--bg);
  margin-bottom: 14px;
  line-height: 1.4;
  font-style: italic;
}

.gifts-body {
  font-size: 13px;
  color: rgba(248,244,238,0.75);
  line-height: 1.7;
}

.gifts-body p { margin-bottom: 10px; }
.gifts-body p:last-child { margin-bottom: 0; }
.gifts-body strong { color: var(--bg); }

/* Навигация блоков (prev/next) */
.block-nav {
  display: flex;
  gap: 10px;
  padding: 0 var(--page-px) 20px;
}

/* ===== ФИНАЛ ===== */
#screen-finale {
  padding-bottom: 100px;
}

.finale-mirror {
  margin: 0 var(--page-px);
  padding: 28px;
  background: var(--ink);
  border-radius: 20px;
}

.finale-mirror-eyebrow {
  font-size: 10px;
  color: var(--gold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 12px;
}

.finale-mirror-text {
  font-family: 'PT Serif', Georgia, serif;
  font-size: 15px;
  color: rgba(248,244,238,0.9);
  line-height: 1.8;
  font-style: italic;
}

.finale-mirror-text p { margin-bottom: 14px; }
.finale-mirror-text p:last-child { margin-bottom: 0; }

.finale-actions {
  padding: 28px var(--page-px) 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.finale-meta {
  text-align: center;
  font-size: 11px;
  color: rgba(26,27,62,0.35);
  letter-spacing: 0.05em;
  margin-top: 12px;
}

/* ===== ПОПАП ПЛАНЕТЫ ===== */
.planet-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,27,62,0.45);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.planet-popup-overlay.visible {
  display: flex;
}

.planet-popup {
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  padding: 28px var(--page-px) calc(var(--page-px) + env(safe-area-inset-bottom, 0));
  width: 100%;
  max-width: 500px;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.planet-popup-name {
  font-family: 'PT Serif', Georgia, serif;
  font-size: 22px;
  color: var(--ink);
  margin-bottom: 4px;
}

.planet-popup-sub {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 16px;
}

.planet-popup-glyph {
  font-size: 36px;
  margin-bottom: 12px;
  display: block;
}

.popup-close {
  position: absolute;
  top: 16px; right: 20px;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 8px;
  line-height: 1;
}

.planet-popup { position: relative; }

/* ===== ОШИБКА ===== */
.error-banner {
  background: rgba(185,28,28,0.08);
  border: 1px solid rgba(185,28,28,0.2);
  border-radius: 10px;
  padding: 12px 15px;
  font-size: 13px;
  color: #991b1b;
  margin: 16px var(--page-px);
  display: none;
}

.error-banner.visible { display: block; }

/* ===== ЛОАДЕР ===== */
.loader-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  gap: 16px;
}

.spinner {
  width: 36px; height: 36px;
  border: 2px solid var(--ink-faint);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loader-text {
  font-size: 13px;
  color: var(--ink-soft);
  letter-spacing: 0.06em;
}

/* ===== МОБАЙЛ АДАПТАЦИЯ ===== */
@media (max-width: 390px) {
  :root { --page-px: 18px; }
  .splash-logo { font-size: 40px; }
  .topics-grid { gap: 8px; }
}
