/* Аркан — ночная лазурь, бумага старинной колоды, охра и киноварь ручной раскраски */
:root {
  --night: #11143a;
  --velvet: #1b1f4f;
  --velvet-2: #252a62;
  --paper: #efe6d2;
  --ink: #1d1f45;
  --ochre: #e2b04b;
  --vermilion: #c8452f;
  --azure: #7f9be6;
  --text: #eee6d4;
  --muted: #a8a6c8;
  --line: rgba(239, 230, 210, .14);
  --display: "Yeseva One", "Georgia", serif;
  --body: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--night); color: var(--text); }
body { font: 400 16px/1.55 var(--body); min-height: 100vh; overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ochre); outline-offset: 3px; }
[hidden] { display: none !important; }

/* Небо: два слоя неподвижных звёзд и свечение у горизонта */
.sky {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1px 1px at 12% 18%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 72% 9%, #fff9 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 38% 33%, #ffe9b8aa 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 41%, #fff7 50%, transparent 51%),
    radial-gradient(1px 1px at 22% 62%, #fff6 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 64% 70%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 8% 88%, #fff6 50%, transparent 51%),
    radial-gradient(1px 1px at 93% 84%, #ffe9b899 50%, transparent 51%),
    radial-gradient(120% 60% at 50% 0%, #2b3080 0%, transparent 60%),
    var(--night);
  background-size: 220px 260px, 300px 240px, 260px 300px, 340px 280px, 240px 320px, 280px 260px, 320px 300px, 260px 240px, 100% 100%, 100% 100%;
}

#app { max-width: 520px; margin: 0 auto; padding: 20px 18px calc(96px + var(--safe-b)); }
.screen { display: none; }
.screen.is-active { display: block; }

h1, h2 { font-family: var(--display); font-weight: 400; letter-spacing: .01em; margin: 0; }
h1 { font-size: 34px; line-height: 1.1; }
h2 { font-size: 22px; line-height: 1.2; }
p { margin: .4em 0; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: 13px; margin-top: 28px; }
.section-title { margin: 30px 0 12px; }
.screen-head { margin-bottom: 18px; }

.sheet {
  background: linear-gradient(180deg, var(--velvet), #181c48);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  margin-top: 14px;
}
.row { display: flex; gap: 10px; margin-top: 10px; }
.row > input { flex: 1; min-width: 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; }

input, select, textarea {
  background: #0e1132; border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px;
  color-scheme: dark;
}
textarea { width: 100%; resize: none; }

.btn {
  border: 1px solid var(--ochre); background: transparent; color: var(--ochre);
  border-radius: 999px; padding: 11px 20px; font-weight: 600;
}
.btn-gold { background: var(--ochre); color: var(--ink); border-color: var(--ochre); width: 100%; margin-top: 16px; padding: 14px 20px; }
.btn:active { transform: scale(.98); }

/* ---------- Сегодня */
.hello { text-align: center; margin: 6px 0 18px; }
.hello h1 { font-size: 30px; }

.daily { display: grid; justify-items: center; }
.flip { border: 0; background: none; padding: 0; perspective: 1200px; width: 196px; aspect-ratio: 7 / 12; }
.flip-inner {
  position: relative; display: block; width: 100%; height: 100%;
  transform-style: preserve-3d; transition: transform .9s cubic-bezier(.2, .7, .2, 1);
}
.flip.is-open .flip-inner { transform: rotateY(180deg); }
.flip-back, .flip-front { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.flip-front { transform: rotateY(180deg); }
.flip:not(.is-open) .flip-back { animation: breathe 3.2s ease-in-out infinite; }
@keyframes breathe { 50% { filter: drop-shadow(0 0 22px #e2b04b55); } }
.daily-hint { color: var(--muted); font-size: 14px; margin-top: 14px; }
.daily-text { text-align: center; max-width: 34ch; margin-top: 16px; animation: rise .6s .5s both; }
.daily-text h2 { font-size: 26px; }
.daily-text .kw { color: var(--ochre); font-size: 14px; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.streak {
  margin: 18px auto 0; width: fit-content; padding: 6px 14px; border-radius: 999px;
  background: #c8452f22; border: 1px solid #c8452f66; color: #f2b3a5; font-size: 14px;
}

.moon-sheet { display: grid; grid-template-columns: 64px 1fr; gap: 16px; align-items: center; }
.moon-disc { width: 64px; height: 64px; border-radius: 50%; background: #2b2f66; position: relative; overflow: hidden; box-shadow: 0 0 24px #efe6d233; }
.moon-disc i { position: absolute; inset: 0; border-radius: 50%; background: var(--paper); }
.mercury { border-color: #7f9be655; }
.mercury.is-retro { border-color: #c8452f88; background: linear-gradient(180deg, #3a1f3f, #24163a); }
.mercury b { font-family: var(--display); font-weight: 400; font-size: 19px; display: block; }

.horo-head { display: flex; align-items: center; gap: 12px; }
.horo-glyph, .zodiac button { font-family: "Segoe UI Symbol", "Apple Symbols", "DejaVu Sans", "Noto Sans Symbols", serif; }
.horo-glyph { font-size: 34px; color: var(--ochre); line-height: 1; }
.horo dl { margin: 12px 0 0; }
.horo dt { color: var(--ochre); font-size: 14px; margin-top: 10px; }
.horo dd { margin: 2px 0 0; }
.meters { display: grid; gap: 8px; margin-top: 14px; }
.meter { display: grid; grid-template-columns: 76px 1fr 36px; align-items: center; gap: 10px; font-size: 14px; }
.meter span:last-child { text-align: right; color: var(--muted); }
.bar { height: 6px; border-radius: 3px; background: #ffffff14; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--vermilion), var(--ochre)); border-radius: 3px; }
.lucky { display: flex; gap: 16px; margin-top: 14px; color: var(--muted); font-size: 14px; }

/* ---------- Карты: бумага, двойная рамка, ручная раскраска */
.card {
  width: 100%; height: 100%; border-radius: 12px; display: grid; grid-template-rows: auto 1fr auto;
  background: var(--paper); color: var(--ink); padding: 8% 7%;
  box-shadow: 0 10px 30px #00000066, inset 0 0 0 2px var(--paper), inset 0 0 0 3.5px var(--ink), inset 0 0 0 6px var(--paper), inset 0 0 0 7px var(--ink);
  text-align: center; position: relative; overflow: hidden;
}
.card::after { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 90% at 50% 40%, transparent 60%, #8a6a3a22); pointer-events: none; }
.card .num { font-family: var(--display); font-size: clamp(11px, 3.6vw, 16px); }
.card .art { display: grid; place-items: center; }
.card .halo { position: relative; }
.card .halo::before {
  content: ""; position: absolute; inset: -20%; border-radius: 50%; z-index: -1;
  background: repeating-conic-gradient(#1d1f4522 0 3deg, transparent 3deg 15deg);
}
.card .art { isolation: isolate; }
.card .corner { position: absolute; top: 9%; font-style: normal; font-size: clamp(8px, 2.6vw, 12px); color: var(--vermilion); }
.card .corner.tl { left: 12%; } .card .corner.tr { right: 12%; }
.card .halo {
  width: 74%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid var(--ink); background: radial-gradient(circle, var(--tint) 0 58%, transparent 59%);
  font-size: clamp(22px, 9vw, 48px); line-height: 1;
}
.card .name { font-family: var(--display); font-size: clamp(10px, 3.3vw, 15px); line-height: 1.15; border-top: 1px solid var(--ink); padding-top: 6%; }
.card.is-rev .art, .card.is-rev .num { transform: rotate(180deg); }

.back-face {
  width: 100%; height: 100%; border-radius: 12px; background: var(--velvet-2);
  box-shadow: 0 10px 30px #00000066, inset 0 0 0 5px var(--velvet-2), inset 0 0 0 6px var(--ochre);
  display: grid; place-items: center;
  background-image:
    radial-gradient(circle at 50% 50%, transparent 0 22%, var(--ochre) 22.5% 23.5%, transparent 24%),
    repeating-linear-gradient(45deg, #e2b04b14 0 1px, transparent 1px 12px),
    repeating-linear-gradient(-45deg, #e2b04b14 0 1px, transparent 1px 12px);
}
.back-face svg { width: 46%; fill: none; stroke: var(--ochre); stroke-width: 1.4; }

/* ---------- Таро */
.question { display: block; margin-bottom: 18px; }
.question span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.spreads, .products, .positions, .history { list-style: none; padding: 0; margin: 0; }
.spreads li + li { margin-top: 10px; }
.spread {
  width: 100%; display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; text-align: left;
  background: var(--velvet); border: 1px solid var(--line); border-radius: 16px; padding: 14px;
}
.spread .ico { font-size: 26px; text-align: center; }
.spread b { display: block; font-weight: 600; }
.spread small { color: var(--muted); font-size: 13px; }
.price { font-size: 14px; white-space: nowrap; color: var(--ochre); }
.price.free { color: #9fd7a6; }
.price.owned { color: var(--azure); }

.back { background: none; border: 0; color: var(--muted); padding: 0; margin-bottom: 14px; }
.back::before { content: "‹ "; }
.fan {
  display: flex; overflow-x: auto; padding: 22px 8px 26px; margin: 10px -18px 0; scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.fan::-webkit-scrollbar { display: none; }
.fan button {
  flex: 0 0 64px; height: 110px; margin-right: -26px; border: 0; padding: 0; background: none;
  transition: transform .25s; scroll-snap-align: center;
}
.fan button:hover, .fan button:focus-visible { transform: translateY(-10px); }
.fan button.is-taken { transform: translateY(-26px); opacity: .25; pointer-events: none; }
.laid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 14px; margin-top: 4px; }
.slot { display: grid; gap: 6px; justify-items: center; }
.slot .flip { width: 100%; }
.slot small { color: var(--muted); font-size: 12px; text-align: center; line-height: 1.25; }
.reading { margin-top: 22px; background: var(--paper); color: var(--ink); border-radius: 18px; padding: 20px 20px 22px; font-size: 16px; line-height: 1.6; }
.reading h2 { font-size: 24px; margin-bottom: 8px; }
.reading .yn { font-family: var(--display); font-size: 44px; color: var(--vermilion); }
.reading .actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.reading .btn { color: var(--ink); border-color: var(--ink); padding: 9px 16px; font-size: 15px; }

/* ---------- Звёзды */
.zodiac { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.zodiac button {
  aspect-ratio: 1; border-radius: 14px; border: 1px solid var(--line); background: var(--velvet);
  display: grid; place-items: center; font-size: 22px; padding: 0;
}
.zodiac button small { font-size: 9px; color: var(--muted); margin-top: -10px; }
.zodiac button[aria-checked="true"] { background: var(--ochre); color: var(--ink); border-color: var(--ochre); }
.zodiac button[aria-checked="true"] small { color: var(--ink); }
.compat-pick { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.compat-pick select { flex: 1; min-width: 0; }
.amp { font-family: var(--display); font-size: 26px; color: var(--ochre); }
.compat-score { font-family: var(--display); font-size: 64px; line-height: 1; color: var(--ochre); margin-top: 18px; }

/* ---------- Числа */
.octagram { width: 100%; max-width: 340px; display: block; margin: 0 auto; }
.octagram .sq { fill: none; stroke: var(--ochre); stroke-width: 1; opacity: .7; }
.octagram .sq2 { stroke: var(--azure); }
.octagram circle { fill: var(--velvet); stroke: var(--ochre); stroke-width: 1.2; }
.octagram .center { fill: var(--vermilion); stroke: var(--paper); }
.octagram text { fill: var(--text); font: 16px var(--display); text-anchor: middle; dominant-baseline: central; }
.octagram .lbl { font: 10px var(--body); fill: var(--muted); }
.lifepath { display: grid; grid-template-columns: 64px 1fr; gap: 14px; align-items: center; }
.lifepath .big { font-family: var(--display); font-size: 54px; color: var(--ochre); text-align: center; line-height: 1; }
.positions { margin-top: 14px; }
.positions li { display: grid; grid-template-columns: 40px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.positions .n { font-family: var(--display); font-size: 24px; color: var(--ochre); text-align: center; }
.positions small { color: var(--muted); display: block; font-size: 13px; }

/* ---------- Профиль и покупки */
.premium { background: radial-gradient(120% 120% at 100% 0%, #e2b04b33, transparent 55%), linear-gradient(180deg, var(--velvet-2), var(--velvet)); border-color: #e2b04b66; }
.premium.is-on h2::after { content: " ✦"; color: var(--ochre); }
.products li + li { margin-top: 8px; }
.product {
  width: 100%; display: flex; justify-content: space-between; gap: 12px; align-items: center; text-align: left;
  background: var(--velvet); border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px;
}
.product small { display: block; color: var(--muted); font-size: 13px; }
.history li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.history small { color: var(--muted); }
.history:empty::after { content: "Здесь появятся ваши расклады. Начните с вопроса во вкладке «Таро»."; color: var(--muted); }

.switch { appearance: none; width: 46px; height: 28px; border-radius: 14px; background: #ffffff22; position: relative; padding: 0; border: 0; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--paper); transition: transform .2s; }
.switch:checked { background: var(--ochre); }
.switch:checked::after { transform: translateX(18px); }

/* ---------- Навигация */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center;
  padding: 8px 6px calc(8px + var(--safe-b)); background: #0d1030ee; backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tabs button {
  flex: 1; max-width: 104px; background: none; border: 0; color: var(--muted); font-size: 11px;
  display: grid; justify-items: center; gap: 3px; padding: 4px 0;
}
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.tabs .is-active { color: var(--ochre); }

/* ---------- Пейволл и тост */
.paywall { position: fixed; inset: 0; background: #070920bb; display: flex; align-items: flex-end; z-index: 10; }
.paywall-card {
  width: 100%; max-width: 520px; margin: 0 auto; background: var(--velvet-2); border-radius: 22px 22px 0 0;
  padding: 24px 18px calc(24px + var(--safe-b)); position: relative; animation: up .3s ease-out;
}
@keyframes up { from { transform: translateY(40%); opacity: 0; } }
.close { position: absolute; top: 10px; right: 14px; background: none; border: 0; font-size: 28px; color: var(--muted); }
.toast {
  position: fixed; left: 50%; bottom: calc(86px + var(--safe-b)); transform: translateX(-50%);
  background: var(--paper); color: var(--ink); padding: 10px 18px; border-radius: 999px; z-index: 20; font-weight: 500;
  max-width: 90vw; text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.dream textarea { margin-top: 10px; }
.dream .btn { margin-top: 12px; }
.dream .reading { margin-top: 14px; }

/* Настоящие сканы колоды */
.card.photo {
  padding: 3%; display: block; border-radius: 5px;
  background: linear-gradient(160deg, #6a4c2f, #3a2818);
  box-shadow: 0 10px 30px #00000070, inset 0 0 0 1px #8a6a45;
}
.card.photo::after { background: linear-gradient(160deg, #fff3d61c, transparent 40%); border-radius: inherit; }
.card.photo img { width: 100%; height: 100%; object-fit: fill; display: block; border-radius: 2px; }
.card.photo.is-rev img { transform: rotate(180deg); }
#open-admin { width: 100%; margin-top: 16px; padding: 14px 20px; }
