/* Guiding Light — Prism. Общие стили.
 * Принцип: почти монохром; цвет — событие, он рождается только вместе с ответом. */

:root {
  --bg: #08090b;
  --text: #e7e5e4;
  --text-strong: #f2efe9;
  --muted: #8b8f96;
  --faint: #6b6f77;
  --ghost: #5f636b;
  --card: rgba(255, 255, 255, 0.035);
  --card-border: rgba(255, 255, 255, 0.09);
  --hairline: rgba(255, 255, 255, 0.06);
  --accent: #8ec9c2;
}

* { box-sizing: border-box; }

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

body {
  min-height: 100vh;
  background: radial-gradient(120% 90% at 50% 22%, #15181d 0%, #0a0b0e 55%, #07080a 100%);
  color: var(--text);
  font-family: Onest, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  align-items: center;
}

a { color: inherit; }

.wrap {
  width: 100%;
  max-width: 760px;
  padding: 0 20px;
}

/* ---------- шапка ---------- */

.site-header {
  width: 100%;
  max-width: 760px;
  padding: 28px 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
}

.brand-logo {
  display: block;
  border-radius: 8px;
}

.brand span {
  font-weight: 600;
  letter-spacing: 0.26em;
  font-size: 13px;
  color: #c7c4bf;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.site-nav a {
  font-size: 13.5px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.3s ease;
}

.site-nav a:hover { color: var(--text-strong); }

.site-nav a.btn-tg {
  color: #101114;
  background: var(--text);
  padding: 8px 16px;
  border-radius: 99px;
  font-weight: 600;
}

.site-nav a.btn-tg:hover { background: #fff; color: #101114; }

/* ---------- герой: почти пустой экран ---------- */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding-top: 64px;
}

.hero .hero-ask {
  margin: 0;
  font-weight: 500;
  font-size: clamp(22px, 4.6vw, 28px);
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text-strong);
  text-wrap: balance;
}

.hero-sub {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--faint);
  max-width: 420px;
  text-wrap: balance;
}

/* ---------- сцена ---------- */

.scene {
  width: 100%;
  max-width: 640px;
  padding: 26px 20px 0;
  display: flex;
  flex-direction: column;
}

.story-card {
  align-self: center;
  width: 100%;
  max-width: 520px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 58px;
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.story-card:focus-within {
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 0 40px rgba(255, 255, 255, 0.04);
}

.story-card .prompt-mark {
  color: var(--faint);
  font-size: 14px;
  line-height: 1.5;
  user-select: none;
}

.story-card input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  line-height: 1.5;
  padding: 0;
  caret-color: var(--accent);
}

.story-card input::placeholder { color: var(--ghost); }

.stage {
  width: 100%;
  height: auto;
  display: block;
  margin-top: -6px;
  overflow: visible;
  touch-action: pan-y;
}

/* точка-история: пульсирует, пока свет ищет направление */
#lightDot.pulse { animation: dotpulse 1.1s ease-in-out infinite; }

/* история демо-примера: живёт ПОД полем ввода, само поле демо не трогает */
.demo-story {
  align-self: center;
  margin: 12px 0 0;
  min-height: 1.6em;
  max-width: 520px;
  text-align: center;
  font-size: 13.5px;
  line-height: 1.55;
  font-style: italic;
  color: var(--ghost);
  opacity: 0;
  transition: opacity 1s ease;
}

.demo-story.visible { opacity: 1; }

/* ---------- шапка ответа: эмодзи + имя роли (как в телеграм-боте) ---------- */

.answer-head {
  align-self: center;
  width: 100%;
  max-width: 560px;
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  pointer-events: none;
}

.answer-head.visible {
  opacity: 1;
  transform: translateY(0);
}

/* эмодзи + имя роли в одну строку */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.role-emoji {
  font-size: 20px;
  line-height: 1;
}

.role-name {
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: 0.01em;
  transition: color 0.6s ease;
}

/* выход рассказчика (actor_intro из API) — под именем роли */
.answer-head .answer-intro {
  margin: 0;
  width: 100%;
  font-size: 14px;
  line-height: 1.55;
  font-style: italic;
  color: var(--muted);
}

.answer-head .answer-intro:empty { display: none; }

/* ---------- карточка ответа ---------- */

.answer-card {
  position: relative;
  align-self: center;
  width: 100%;
  max-width: 560px;
  margin-top: 9px;
  border-radius: 16px;
  padding: 20px 22px;
  background: var(--card);
  border: 1px solid var(--card-border);
  opacity: 0;
  transform: translateY(10px);
  transition: background 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
  pointer-events: none;
  overflow: hidden;
}

.answer-card.visible {
  animation: riselamp 0.5s ease both;
  pointer-events: auto;
}

/* луч света проходит по стеклу карточки один раз при появлении */
.answer-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: linear-gradient(115deg, transparent 32%, rgba(255, 255, 255, 0.07) 50%, transparent 68%);
  background-size: 250% 100%;
  background-position: 120% 0;
  opacity: 0;
  pointer-events: none;
}

.answer-card.visible::after {
  opacity: 1;
  animation: lightsweep 1.8s ease 0.15s forwards;
}

.answer-card .answer-text {
  margin: 0;
  font-size: 15.5px;
  line-height: 1.62;
  color: #eceae5;
  min-height: 1.6em;
}

/* проявление на стекле: слова выходят из размытия волной */
.answer-text span,
.answer-intro span {
  opacity: 0;
  filter: blur(7px);
  transition: opacity 0.9s ease, filter 0.9s ease;
}

.answer-text.revealed span,
.answer-intro.revealed span {
  opacity: 1;
  filter: blur(0);
}

.cta-in-card {
  display: inline-flex;
  margin-top: 14px;
  text-decoration: none;
  background: var(--text);
  color: #101114;
  font-weight: 600;
  font-size: 13.5px;
  padding: 10px 18px;
  border-radius: 10px;
}

.cta-in-card:hover { background: #fff; }

/* ---------- управление демо ---------- */

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 26px;
  flex-wrap: wrap;
}

.dots { display: flex; align-items: center; gap: 9px; }

.dots button {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  padding: 0;
  cursor: pointer;
  border: none;
  transition: all 0.35s ease;
  background: rgba(255, 255, 255, 0.18);
}

.dots button.active { width: 22px; }

.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #c7c4bf;
  font-family: inherit;
  font-size: 13px;
  padding: 8px 15px;
  border-radius: 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  transition: background 0.3s ease;
}

.btn-ghost:hover { background: rgba(255, 255, 255, 0.08); }

.cta-main {
  align-self: center;
  margin-top: 20px;
  text-decoration: none;
  background: var(--text);
  color: #101114;
  font-family: inherit;
  font-weight: 600;
  font-size: 14.5px;
  padding: 13px 26px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  transition: background 0.3s ease, transform 0.3s ease;
}

.cta-main:hover { background: #fff; transform: translateY(-1px); }

/* ---------- секции ---------- */

.section {
  width: 100%;
  max-width: 640px;
  padding: 44px 20px 0;
}

.section-label {
  margin: 0 0 16px;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--faint);
  text-transform: uppercase;
}

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.step {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 18px 18px 16px;
}

.step .num {
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--faint);
}

.step h3 {
  margin: 8px 0 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-strong);
}

.step p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--muted);
}

.philosophy {
  text-align: center;
  max-width: 520px;
  margin: 0 auto;
}

.philosophy p {
  font-size: 16.5px;
  line-height: 1.65;
  color: #c9c6c0;
  text-wrap: balance;
}

.philosophy p em {
  font-style: normal;
  color: var(--text-strong);
}

/* ---------- страница «Одна история» ---------- */

.story-quote {
  margin: 0 auto;
  max-width: 480px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 18px 22px;
  font-size: 16.5px;
  line-height: 1.55;
  color: var(--text-strong);
  text-align: center;
}

.ways {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 34px;
}

.way-card {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-left: 3px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  padding: 20px 22px;
  opacity: 0;
  transform: translateY(12px);
  animation: riselamp 0.9s ease both;
  transition: border-color 0.8s ease, background 0.8s ease;
}

.way-card .way-num {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 10px;
}

.way-card .way-quality {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  opacity: 0;
  transition: opacity 0.9s ease;
}

.way-card .way-name {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--ghost);
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.9s ease;
}

.way-card p {
  margin: 0;
  font-size: 15px;
  line-height: 1.62;
  color: #d9d6d0;
}

.ways.revealed .way-card { background: var(--card); }

.ways.revealed .way-quality,
.ways.revealed .way-name { opacity: 1; }

.story-finale {
  text-align: center;
  margin-top: 40px;
}

.story-finale .finale-line {
  font-size: 16.5px;
  color: var(--text-strong);
  margin: 0 0 18px;
}

/* ---------- подвал ---------- */

.site-footer {
  width: 100%;
  max-width: 760px;
  margin-top: 56px;
  padding: 26px 20px 40px;
  border-top: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--faint);
}

.site-footer nav { display: flex; gap: 18px; }

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover { color: var(--text-strong); }

/* ---------- анимации ---------- */

@keyframes shimmer { 0%, 100% { opacity: 0.1; } 50% { opacity: 0.55; } }

/* дыхание потоков света (в дополнение к общей яркости группы #inflow) */
@keyframes inflowbreathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.9; }
}

/* пульс точки-истории */
@keyframes dotpulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

@keyframes riselamp { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes lightsweep { to { background-position: -60% 0; } }

/* живая радуга в сердце призмы: дышит постоянно, ярче — в моменты «вспышек» */
@keyframes rainbowlive {
  0%, 100% { opacity: 0.22; }
  38% { opacity: 0.5; }
  52% { opacity: 0.32; }
  70% { opacity: 0.58; }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
}

@media (max-width: 560px) {
  .site-header { flex-direction: column; gap: 14px; padding-top: 22px; }
  .hero { padding-top: 40px; }
  .stage { margin-top: 0; }
}
