/* Честное Таро — ночная тема. Одна тема, без переключателя. */
:root {
  --sky: #0c0f2e;          /* полночь */
  --sky-2: #171b4a;        /* сумерки у горизонта */
  --panel: rgba(22, 26, 68, .78);
  --field: rgba(9, 11, 36, .55);
  --ink: #f1e8d4;          /* пергамент */
  --muted: #a6aad2;        /* лунный туман */
  --line: rgba(230, 196, 126, .2);
  --gold: #e6c47e;         /* лунное золото */
  --gold-soft: rgba(230, 196, 126, .14);
  --rose: #eab0b9;         /* рассвет — только «бесплатно» */
  --accent: var(--gold);
  --accent-ink: #14122e;
  --shadow: 0 18px 40px rgba(2, 3, 18, .45);
  --radius: 20px;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Manrope", system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; min-height: 100%;
  background: linear-gradient(180deg, var(--sky) 0%, var(--sky) 45%, var(--sky-2) 100%) fixed var(--sky); }
body {
  margin: 0; color: var(--ink); font: 16px/1.6 var(--sans); overflow-x: hidden; min-height: 100vh; background: transparent;
}
/* звёздное небо: три слоя разной плотности + млечная дымка */
.sky { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.sky::before, .sky::after { content: ""; position: absolute; inset: 0; }
.sky::before {
  background:
    radial-gradient(1px 1px at 12px 18px, #fff 50%, transparent 51%) 0 0 / 97px 113px,
    radial-gradient(1px 1px at 60px 70px, #ffffffb0 50%, transparent 51%) 0 0 / 131px 89px,
    radial-gradient(1.5px 1.5px at 40px 30px, #fff6dd 50%, transparent 51%) 0 0 / 211px 173px,
    radial-gradient(1px 1px at 90px 120px, #c9d0ff 50%, transparent 51%) 0 0 / 157px 197px;
  opacity: .9;
}
.sky::after {
  background: radial-gradient(ellipse 90% 22% at 35% 40%, rgba(160, 150, 255, .09), transparent 70%),
              radial-gradient(circle at 85% 6%, rgba(230, 196, 126, .14), transparent 35%);
}
.star { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #fff6dd;
  box-shadow: 0 0 6px 1px rgba(255, 240, 200, .7); animation: twinkle 4s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.12; margin: 0 0 .5em; }
h1 { font-size: clamp(2.3rem, 9.4vw, 3.8rem); font-weight: 500; letter-spacing: -.01em; }
h2 { font-size: 2rem; font-weight: 500; }
h3 { font-size: 1.35rem; }
p { margin: 0 0 1em; }
img { max-width: 100%; }
a { color: var(--gold); }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--field);
  border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; resize: vertical;
}
textarea::placeholder { color: #7f84b0; }
textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }

.topbar { max-width: 820px; margin: 0 auto; padding: 16px 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.logo { font-family: var(--serif); font-size: 1.55rem; font-weight: 600; color: var(--ink); text-decoration: none; white-space: nowrap; }
.logo-mark { color: var(--gold); margin-right: 2px; }
.top-actions { display: flex; align-items: center; gap: 10px; }

.screen { max-width: 820px; margin: 0 auto; padding: 0 18px 48px; }

.btn { border: 0; border-radius: 999px; padding: 14px 26px; font-weight: 700; transition: transform .1s, opacity .2s, box-shadow .2s; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--gold); color: var(--accent-ink); box-shadow: 0 0 0 1px rgba(255, 236, 190, .4) inset, 0 8px 30px rgba(230, 196, 126, .28); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.wide { display: block; width: 100%; margin-top: 14px; }
.link-btn { background: none; border: 0; color: var(--gold); font-weight: 600; padding: 6px 0; text-decoration: none; }
.link-btn.center { display: block; margin: 8px auto 0; }
.mic-btn { padding: 9px 16px; font-weight: 600; font-size: .95rem; }
.mic-btn[data-state="listening"] { border-color: var(--rose); color: var(--rose); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 18px; box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.center { text-align: center; }
.note { color: var(--muted); font-size: .88rem; text-align: center; margin: 12px 0 0; }
.error { color: var(--rose); font-weight: 600; margin: 10px 0 0; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; }
.counter { color: var(--muted); font-size: .85rem; }
.eyebrow { font-size: .95rem; font-weight: 600; color: var(--gold); margin-bottom: .5em; }

/* ---------- Первый экран: веер карт ---------- */
.hero { text-align: center; padding: 8px 0 34px; }
.fan { position: relative; height: 270px; max-width: 360px; margin: 6px auto 26px; perspective: 1100px; }
.fc { position: absolute; left: 50%; bottom: 0; width: 132px; aspect-ratio: 360 / 620; margin-left: -66px;
  transform-origin: 50% 110%; transition: transform 1.1s cubic-bezier(.2, .8, .2, 1); }
.fc img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 10px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .55), 0 0 0 1px rgba(230, 196, 126, .25); }
.fc.l, .fc.r { filter: brightness(.82); }
.fc.c { z-index: 2; }
.fc-in { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform 1s .9s cubic-bezier(.3, .7, .3, 1); }
.fc-in img { backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.fc-in .f { transform: rotateY(180deg); }
.fc.c::after { content: ""; position: absolute; inset: -30px; z-index: -1; border-radius: 50%;
  background: radial-gradient(circle, rgba(230, 196, 126, .35), transparent 65%); opacity: 0; transition: opacity 1s 1.4s; }
/* стартовое положение — колода стопкой; .open раскрывает веер и переворачивает центральную */
.fan.open .fc.l { transform: rotate(-17deg) translateX(-18px); }
.fan.open .fc.r { transform: rotate(17deg) translateX(18px); }
.fan.open .fc.c { transform: translateY(-14px); }
.fan.open .fc-in { transform: rotateY(180deg); }
.fan.open .fc.c::after { opacity: 1; }
.fan-cap { font-family: var(--serif); font-style: italic; font-size: 1.1rem; color: var(--muted); margin: -12px 0 18px; }

.hero h1 { margin: 0 auto .35em; }
.hero .lead { font-size: 1.05rem; color: var(--muted); margin: 0 auto 26px; max-width: 34ch; }
.hero .btn.primary { font-size: 1.05rem; padding: 16px 30px; }
.hero .alt { display: block; margin: 14px auto 0; }

/* ---------- Форма ---------- */
.ask { scroll-margin-top: 16px; }
.ask h2 { margin-bottom: .4em; }
.themes { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip-btn { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 8px 15px; font-size: .95rem; color: var(--ink); }
.chip-btn.active { border-color: var(--gold); background: var(--gold-soft); color: var(--gold); font-weight: 700; }
.spreads-title { margin: 24px 0 10px; }
.spreads { display: grid; gap: 10px; }
.spread {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left; width: 100%;
  background: var(--field); border: 1px solid var(--line); border-radius: 14px; padding: 13px 15px; color: var(--ink);
}
.spread.active { border-color: var(--gold); background: var(--gold-soft); }
.spread b { display: block; font-size: 1rem; }
.spread small { display: block; color: var(--muted); font-size: .86rem; line-height: 1.4; }
.spread .price-tag { flex: none; font-family: var(--serif); font-size: 1.3rem; font-weight: 600; color: var(--gold); white-space: nowrap; }
.spread .price-tag.free { color: var(--rose); font-family: var(--sans); font-size: .95rem; font-weight: 700; }

/* ---------- Как это работает: путь по звёздам ---------- */
.how { margin-top: 48px; }
.how ol { list-style: none; padding: 0 0 0 4px; margin: 0; display: grid; gap: 22px; position: relative; }
.how ol::before { content: ""; position: absolute; left: 20px; top: 14px; bottom: 14px; width: 1px;
  background: linear-gradient(var(--gold), rgba(230, 196, 126, .1)); }
.how li { display: flex; gap: 16px; position: relative; }
.how h3 { margin-bottom: .15em; }
.how p { margin: 0; color: var(--muted); }
.step-n { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--sky); border: 1px solid var(--gold); color: var(--gold); font-family: var(--serif); font-size: 1.15rem; font-weight: 600;
  box-shadow: 0 0 14px rgba(230, 196, 126, .35); }

.footer { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: .86rem; text-align: center; }
.footer .small { font-size: .78rem; opacity: .85; }
.footer nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 14px; }
.footer nav a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }

/* ---------- Расклад ---------- */
.reading-head { text-align: center; margin: 8px 0 18px; }
.question-text { font-family: var(--serif); font-size: 1.55rem; line-height: 1.3; margin: 0; }
.table { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px 12px; margin-bottom: 22px; }
.tcard { width: calc((100% - 24px) / 3); max-width: 150px; text-align: center; perspective: 900px; }
.table.n1 .tcard { width: 200px; max-width: 60%; }
.tcard-inner { position: relative; aspect-ratio: 360 / 620; transform-style: preserve-3d; transition: transform .8s cubic-bezier(.3, .7, .3, 1); }
.tcard.flipped .tcard-inner { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 10px; overflow: hidden;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .5), 0 0 0 1px rgba(230, 196, 126, .22); }
.face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.face.front { transform: rotateY(180deg); background: #f3ead8; }
.face.front.rev img { transform: rotate(180deg); }
.tcard .pos { font-size: .82rem; color: var(--gold); font-weight: 700; margin: 8px 0 0; line-height: 1.3; }
.tcard .cname { font-family: var(--serif); font-size: 1.1rem; font-weight: 600; line-height: 1.2; margin: 2px 0 0; min-height: 1.2em; opacity: 0; transition: opacity .4s .5s; }
.tcard.flipped .cname { opacity: 1; }
.tcard .cname em { display: block; font-family: var(--sans); font-style: normal; font-size: .75rem; color: var(--muted); }
.tcard .n { position: absolute; top: 6px; left: 8px; z-index: 2; font-size: .75rem; font-weight: 700; color: var(--gold); }

.paywall { text-align: center; margin-bottom: 20px; }
.paywall .price { font-family: var(--serif); font-size: 2.2rem; font-weight: 600; color: var(--gold); margin: 0; }

.interpretation p { margin: 0 0 1em; font-size: 1.05rem; }
.interpretation .card-head { font-weight: 700; color: var(--gold); }
.interpretation .advice, .interpretation .step {
  background: var(--gold-soft); border-left: 2px solid var(--gold); border-radius: 0 14px 14px 0; padding: 12px 14px;
}
.interpretation .advice b, .interpretation .step b { color: var(--gold); }

.chat { display: grid; gap: 12px; margin: 10px 0; }
.bubble { padding: 12px 16px; border-radius: 16px; white-space: pre-wrap; }
.bubble.q { justify-self: end; max-width: 88%; background: var(--gold); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.bubble.a { background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.followup { margin-top: 16px; }
.followup h3 { margin-bottom: .2em; }
.finish { margin-top: 16px; }

.typing span { animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }

@media (min-width: 720px) {
  .card { padding: 28px 30px; }
  .fan { height: 330px; }
  .fc { width: 160px; margin-left: -80px; }
  .spreads { grid-template-columns: 1fr 1fr; }
  .how ol { grid-template-columns: 1fr 1fr; }
  .how ol::before { display: none; }
  .table.n10 .tcard { width: calc((100% - 48px) / 5); }
  .tcard { max-width: 170px; }
  .table.n1 .tcard { width: 220px; }
}
@media (prefers-reduced-motion: reduce) {
  .tcard-inner, .fc, .fc-in, .fc.c::after { transition: none; }
  .star { animation: none; opacity: .7; }
}
