/* Портал Натальи — Telegram Mini App
   Палитра (ТЗ Фарангиз 24.09.2026): warm cream, terracotta, brown, muted green, soft gold.
   Zen Art, rounded cards, subtle shadows, soft gradients, elegant typography. */

:root {
  --cream: #f8ecda;
  --cream-deep: #f0dfc2;
  --cream-card: #fffaf1;
  --terracotta: #c1633f;
  --terracotta-dark: #a24f31;
  --terracotta-ink: #7d3f27;
  --brown: #5b4230;
  --brown-deep: #3c2a1c;
  --green: #7f8a68;
  --green-soft: #a9b491;
  --gold: #c79a3d;
  --gold-soft: #e6cf98;
  --shadow: 91, 58, 41;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --tg-safe-t: 0px;
  --tg-safe-b: 0px;
  --tg-content-t: 0px;
  --tg-content-b: 0px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  background: var(--cream);
  overscroll-behavior: none;
}

body {
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--brown-deep);
  background:
    radial-gradient(1200px 800px at 15% -10%, rgba(199,154,61,0.14), transparent 55%),
    radial-gradient(900px 700px at 100% 10%, rgba(127,138,104,0.10), transparent 50%),
    linear-gradient(180deg, var(--cream) 0%, var(--cream-deep) 100%);
  overflow-x: hidden;
}

h1, h2, h3, .display {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  letter-spacing: 0.01em;
}

#app {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: calc(var(--safe-t) + var(--tg-safe-t) + var(--tg-content-t) + 18px);
  padding-bottom: calc(var(--safe-b) + var(--tg-safe-b) + var(--tg-content-b) + 22px);
  padding-left: calc(var(--safe-l) + 16px);
  padding-right: calc(var(--safe-r) + 16px);
  display: flex;
  flex-direction: column;
  max-width: 560px;
  margin: 0 auto;
}

/* ---------- Splash ---------- */
#splash {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
  background: linear-gradient(180deg, var(--cream) 0%, var(--cream-deep) 100%);
  transition: opacity 700ms ease, visibility 700ms ease;
}
#splash.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
#splash .lotus-wrap {
  animation: splash-in 1100ms cubic-bezier(.2,.7,.3,1) both;
}
#splash .splash-caption {
  font-size: 15px;
  color: var(--brown);
  opacity: 0.75;
  letter-spacing: 0.04em;
  animation: splash-fade 1400ms ease 300ms both;
}
@keyframes splash-in {
  0% { opacity: 0; transform: scale(0.72) translateY(10px); filter: blur(6px); }
  60% { opacity: 1; filter: blur(0); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes splash-fade {
  0% { opacity: 0; transform: translateY(6px); }
  100% { opacity: 0.75; transform: translateY(0); }
}

.lotus {
  width: 96px;
  height: 96px;
  filter: drop-shadow(0 6px 18px rgba(var(--shadow), 0.25));
}
.lotus-glow {
  position: relative;
}
.lotus-glow::after {
  content: "";
  position: absolute;
  inset: -30%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(230,207,152,0.55), transparent 65%);
  z-index: -1;
  animation: glow-pulse 3200ms ease-in-out infinite;
}
@keyframes glow-pulse {
  0%, 100% { opacity: 0.55; transform: scale(0.94); }
  50% { opacity: 0.95; transform: scale(1.08); }
}

/* ---------- Screen transitions ---------- */
#screen-container { position: relative; flex: 1; display: flex; flex-direction: column; }
.screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  animation: screen-in 520ms cubic-bezier(.22,.7,.32,1) both;
}
.screen.leaving { animation: screen-out 260ms ease both; }
@keyframes screen-in {
  0% { opacity: 0; transform: translateY(14px) scale(0.99); filter: blur(3px); }
  100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}
@keyframes screen-out {
  0% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-8px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  /* без дыхания/блика/лесенки/Ken Burns — статичный, но полностью видимый экран */
  .lang-btn, .btn-primary, .card-list > *, .grid-cards > *,
  .hero-photo-wrap, .hero-photo-wrap img {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .lang-btn::after, .btn-primary::after { animation: none !important; opacity: 0 !important; }
}

/* ---------- Common elements ---------- */
.center-col { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; flex: 1; justify-content: center; }
.top-col { display: flex; flex-direction: column; gap: 16px; flex: 1; }

.eyebrow {
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--terracotta-ink);
  opacity: 0.85;
}

.screen h1.display { font-size: 26px; line-height: 1.28; margin: 0; color: var(--brown-deep); }
.screen h2.display { font-size: 21px; line-height: 1.32; margin: 0; color: var(--brown-deep); }

.lede {
  font-size: 16px;
  line-height: 1.62;
  color: var(--brown);
  white-space: pre-line;
  margin: 0;
}

.hero-photo-wrap {
  width: 100%;
  max-width: 320px;
  margin: 4px auto 6px;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 18px 40px -14px rgba(var(--shadow), 0.45), 0 2px 10px rgba(var(--shadow), 0.15);
  border: 3px solid var(--cream-card);
  animation: frame-glow 10s ease-in-out infinite;
}
.hero-photo-wrap img {
  width: 100%;
  display: block;
  object-fit: cover;
  aspect-ratio: 4 / 5;
  animation: kenburns 10s ease-in-out infinite;
}
/* Живое фото (просьба владельца 24.09): очень мягкий Ken Burns 1.00→1.04 в ритме дыхания
   (4s вдох / 6s выдох = 10s цикл), лицо не искажается — просто scale контейнера img,
   без crop-сдвига и без генерации. Тёплое свечение рамки в том же ритме. */
@keyframes kenburns {
  0%, 100% { transform: scale(1); }
  40% { transform: scale(1.04); }
}
@keyframes frame-glow {
  0%, 100% {
    box-shadow: 0 18px 40px -14px rgba(var(--shadow), 0.45), 0 2px 10px rgba(var(--shadow), 0.15);
    border-color: var(--cream-card);
  }
  40% {
    box-shadow: 0 20px 48px -12px rgba(201, 165, 106, 0.55), 0 0 0 5px rgba(201, 165, 106, 0.22);
    border-color: rgba(199, 154, 61, 0.55);
  }
}

/* ---------- Buttons ---------- */
.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  border-radius: 20px;
  padding: 17px 22px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
  text-align: center;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(160deg, var(--terracotta) 0%, var(--terracotta-dark) 100%);
  color: #fff8ee;
  box-shadow: 0 14px 26px -10px rgba(162, 79, 49, 0.55), inset 0 1px 0 rgba(255,255,255,0.18);
}
.btn-primary:active { filter: brightness(0.96); }

.btn-secondary {
  background: var(--cream-card);
  color: var(--terracotta-ink);
  border: 1.5px solid rgba(199,154,61,0.45);
  box-shadow: 0 8px 18px -12px rgba(var(--shadow), 0.35);
}

.btn-ghost {
  background: transparent;
  color: var(--brown);
  font-weight: 600;
  box-shadow: none;
  padding: 12px 16px;
  opacity: 0.8;
}
.btn-ghost:active { opacity: 1; }

.lang-row { display: flex; flex-direction: column; gap: 14px; width: 100%; margin-top: 8px; }
.lang-btn {
  width: 100%;
  border: none;
  cursor: pointer;
  border-radius: 24px;
  padding: 22px 20px;
  font-family: "Fraunces", serif;
  font-size: 19px;
  font-weight: 600;
  color: #fff8ee;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(160deg, var(--terracotta) 0%, var(--terracotta-dark) 90%);
  box-shadow: 0 16px 28px -12px rgba(162, 79, 49, 0.55), inset 0 1px 0 rgba(255,255,255,0.2);
  transition: transform 160ms ease, filter 160ms ease;
}
.lang-btn .flag { font-size: 22px; }
.lang-btn:active { transform: scale(0.97); filter: brightness(0.96); }

/* ---------- Живые кнопки (Фарангиз 24.09, msg 798/далее): дыхание 4с вдох/6с выдох (10с
   цикл, в ритме мандалы), редкий блик, появление по очереди, мягкий отклик на нажатие.
   Один эффект дыхания + один блик — не перегружаем. prefers-reduced-motion — ниже, статично. */
.lang-btn,
.btn-primary {
  position: relative;
  overflow: hidden;
  animation: btn-breathe 10s ease-in-out infinite;
}
.lang-btn::after,
.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 240, 220, 0.45) 45%, transparent 60%);
  background-size: 250% 100%;
  animation: btn-shine 4s ease-in-out infinite;
}
@keyframes btn-shine {
  0% { background-position: 150% 0; }
  55%, 100% { background-position: -60% 0; }
}
@keyframes btn-breathe {
  0%, 100% { box-shadow: 0 10px 22px -10px rgba(126, 52, 23, 0.45); }
  40% { box-shadow: 0 14px 34px -8px rgba(214, 122, 72, 0.75), 0 0 0 4px rgba(201, 165, 106, 0.18); }
}
/* кнопки языка появляются по очереди (~150–250мс), дыхание стартует следом */
.lang-btn {
  opacity: 0;
  transform: translateY(12px);
  animation: btn-in 0.6s ease forwards, btn-breathe 10s ease-in-out 1s infinite;
}
.lang-btn:nth-child(1) { animation-delay: 0s, 1s; }
.lang-btn:nth-child(2) { animation-delay: 0.2s, 1.2s; }
.lang-btn:nth-child(3) { animation-delay: 0.4s, 1.4s; }
@keyframes btn-in {
  to { opacity: 1; transform: none; }
}
/* мягкий отклик при нажатии — вспышка блика поверх обычного :active */
.lang-btn:active::after,
.btn-primary:active::after {
  animation: none;
  background-position: -60% 0;
  opacity: 0.9;
}

/* ---------- Cards (options) ---------- */
.card-list { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
/* карточки ответов всплывают лесенкой (stagger), мягкий отклик при нажатии */
.card-list > *,
.grid-cards > * {
  opacity: 0;
  transform: translateY(10px);
  animation: btn-in 0.5s ease forwards;
}
.card-list > *:nth-child(1), .grid-cards > *:nth-child(1) { animation-delay: 0s; }
.card-list > *:nth-child(2), .grid-cards > *:nth-child(2) { animation-delay: 0.08s; }
.card-list > *:nth-child(3), .grid-cards > *:nth-child(3) { animation-delay: 0.16s; }
.card-list > *:nth-child(4), .grid-cards > *:nth-child(4) { animation-delay: 0.24s; }
.card-list > *:nth-child(5), .grid-cards > *:nth-child(5) { animation-delay: 0.32s; }
.card-list > *:nth-child(6), .grid-cards > *:nth-child(6) { animation-delay: 0.4s; }
.card-list > *:active, .grid-cards > *:active { transform: scale(0.98); transition: transform 120ms ease; }
.opt-card {
  width: 100%;
  text-align: left;
  border: 1.5px solid rgba(199,154,61,0.28);
  background: linear-gradient(160deg, var(--cream-card) 0%, #fbf1de 100%);
  border-radius: 20px;
  padding: 18px 18px;
  font-family: inherit;
  font-size: 16.5px;
  font-weight: 600;
  color: var(--brown-deep);
  cursor: pointer;
  box-shadow: 0 10px 22px -14px rgba(var(--shadow), 0.4);
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease, background 150ms ease;
  display: flex;
  align-items: center;
  gap: 12px;
}
.opt-card:active {
  transform: scale(0.98);
  border-color: var(--gold);
  background: linear-gradient(160deg, #fff6e6 0%, #f6e6c4 100%);
}
.opt-card .opt-mark {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold-soft);
  flex: 0 0 auto;
}

.grid-cards { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 4px; }
.grid-card {
  border: 1.5px solid rgba(199,154,61,0.28);
  background: linear-gradient(160deg, var(--cream-card) 0%, #fbf1de 100%);
  border-radius: 22px;
  padding: 18px;
  cursor: pointer;
  box-shadow: 0 10px 24px -16px rgba(var(--shadow), 0.4);
  transition: transform 150ms ease, border-color 150ms ease;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  text-align: left;
}
.grid-card:active { transform: scale(0.98); border-color: var(--gold); }
.grid-card .g-icon {
  font-size: 26px;
  line-height: 1;
  flex: 0 0 auto;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px;
  background: rgba(127,138,104,0.14);
}
.grid-card .g-body { display: flex; flex-direction: column; gap: 3px; }
.grid-card .g-name { font-family: "Fraunces", serif; font-size: 17px; font-weight: 600; color: var(--brown-deep); }
.grid-card .g-desc { font-size: 14px; color: var(--brown); opacity: 0.85; line-height: 1.4; }
.g-soon {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--terracotta-ink);
  background: rgba(199, 154, 61, 0.18);
  border-radius: 999px;
  padding: 2px 8px;
  margin-left: 7px;
  vertical-align: middle;
}

/* ---------- Progress ---------- */
.progress-row { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 2px 0 4px; }
.progress-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(91,66,48,0.18); transition: background 300ms ease, transform 300ms ease; }
.progress-dot.done { background: var(--gold); }
.progress-dot.active { background: var(--terracotta); transform: scale(1.3); }
.progress-label { font-size: 12.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brown); opacity: 0.65; text-align: center; margin-bottom: 2px; }

/* ---------- Name screen ---------- */
.name-input-wrap { width: 100%; margin-top: 6px; }
.name-input {
  width: 100%;
  border-radius: 18px;
  border: 1.5px solid rgba(199,154,61,0.4);
  background: var(--cream-card);
  padding: 16px 18px;
  font-size: 17px;
  font-family: inherit;
  color: var(--brown-deep);
  outline: none;
  box-shadow: inset 0 2px 6px rgba(var(--shadow), 0.08);
}
.name-input:focus { border-color: var(--terracotta); }
.name-hint { font-size: 13px; color: var(--brown); opacity: 0.6; }
.name-tg-btn {
  width: 100%;
  border-radius: 18px;
  border: 1.5px dashed rgba(199,154,61,0.55);
  background: rgba(230,207,152,0.18);
  padding: 15px 18px;
  font-size: 16px;
  font-weight: 700;
  color: var(--terracotta-ink);
  cursor: pointer;
  margin-bottom: 10px;
}
.name-tg-btn:active { transform: scale(0.98); }

/* ---------- Practice / breathing ---------- */
.breath-wrap { position: relative; width: 168px; height: 168px; margin: 6px auto 4px; display: flex; align-items: center; justify-content: center; }
.breath-ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(127,138,104,0.35);
  background: radial-gradient(circle, rgba(230,207,152,0.35), rgba(127,138,104,0.08) 70%);
  animation: breathe 10000ms ease-in-out infinite;
}
@keyframes breathe {
  0% { transform: scale(0.82); opacity: 0.7; }
  40% { transform: scale(1.08); opacity: 1; }
  60% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(0.82); opacity: 0.7; }
}
.video-wrap {
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 16px 34px -16px rgba(var(--shadow), 0.5);
  border: 3px solid var(--cream-card);
}
.video-wrap video { width: 100%; display: block; }

/* ---------- Talk / textarea ---------- */
textarea.name-input { resize: none; min-height: 96px; }

/* ---------- Toast / interstitial ---------- */
.interstitial { display: flex; align-items: center; justify-content: center; flex: 1; }
.interstitial .msg { font-family: "Fraunces", serif; font-size: 21px; color: var(--brown-deep); text-align: center; animation: splash-fade 900ms ease both; }

/* ---------- Fine print ---------- */
.fine {
  font-size: 12.5px;
  color: var(--brown);
  opacity: 0.55;
  text-align: center;
  margin-top: 10px;
}

/* Back link (fallback for browsers without Telegram BackButton) */
.back-link {
  align-self: flex-start;
  background: none;
  border: none;
  color: var(--terracotta-ink);
  font-size: 14px;
  font-weight: 600;
  padding: 6px 0 10px;
  cursor: pointer;
  opacity: 0.8;
}

::selection { background: var(--gold-soft); }
