/* Bulgarian mythology tarot — общи стилове и начална страница.
   Шрифтовете Cormorant Garamond и EB Garamond се зареждат самохоствано през /css/fonts.css (генерира се от
   наличните файлове в public/fonts, виж fonts/README.txt). Докато ги няма, ползва се системен резервен шрифт. */

:root {
  --gold: #d9b26a; --gold-hi: #f6e4ab; --gold-lo: #8a6420; --gold-d: #a97f2e;
  --ink: #06120f; --ink-2: #0b231d; --cream: #f4e8c8; --text: #f3ead2;
  --display: 'Cormorant Garamond', 'EB Garamond', Georgia, 'DejaVu Serif', serif;
  --body: 'EB Garamond', 'Cormorant Garamond', Georgia, 'DejaVu Serif', serif;
  --focus: 0 0 0 3px rgba(246, 228, 171, .85);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100svh; background: var(--ink); color: var(--text); font-family: var(--body); font-size: 18px; line-height: 1.5; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: none; box-shadow: var(--focus); }
[hidden] { display: none !important; }

/* ── фон */
.hero-bg { position: fixed; inset: 0; z-index: -3; overflow: hidden; background: radial-gradient(circle at 50% 45%, #0f4a3b, var(--ink) 70%); }
.hero-bg img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%; opacity: 0; transform: scale(1.04); transition: opacity 1.2s ease; animation: drift 38s ease-in-out infinite alternate; }
.hero-bg img.on { opacity: 1; }
@keyframes drift { to { transform: scale(1.12) translate3d(0, -1.2%, 0); } }
.hero-veil { position: fixed; inset: 0; z-index: -2; background: linear-gradient(180deg, rgba(2, 10, 8, .82) 0, rgba(2, 10, 8, .25) 26%, rgba(2, 10, 8, .08) 52%, rgba(2, 10, 8, .78) 100%); pointer-events: none; }

/* ── оформление */
.page { min-height: 100svh; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr auto; padding: max(12px, env(safe-area-inset-top)) 18px max(14px, env(safe-area-inset-bottom)); }
.topbar { display: flex; justify-content: flex-end; }
.lang { display: inline-flex; border: 1px solid rgba(217, 178, 106, .55); border-radius: 999px; overflow: hidden; background: rgba(4, 18, 14, .55); backdrop-filter: blur(8px); }
.lang button { min-width: 52px; min-height: 44px; background: none; border: 0; font-family: var(--display); font-weight: 700; letter-spacing: .12em; font-size: 1rem; color: var(--gold-hi); }
.lang button[aria-pressed="true"] { background: linear-gradient(135deg, var(--gold-hi), var(--gold) 55%, var(--gold-lo)); color: #1b1206; }

.stage { min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 18px; padding: clamp(8px, 3vh, 36px) 0; }
.titles { text-align: center; max-width: 960px; }
.title { margin: 0; font-family: var(--display); font-weight: 600; font-size: clamp(2.3rem, 8.4vw, 5.6rem); line-height: 1.02; letter-spacing: .03em; color: var(--gold-hi);
  background: linear-gradient(180deg, #fff4cc 0%, var(--gold) 55%, #a97f2e 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 3px 16px rgba(0, 0, 0, .75)); }
.subtitle { margin: .5em 0 0; font-family: var(--display); font-size: clamp(1rem, 3.4vw, 1.55rem); letter-spacing: .5em; text-transform: uppercase; color: var(--gold-hi); text-shadow: 0 2px 12px rgba(0, 0, 0, .9); padding-left: .5em; }

.panel { position: relative; width: min(100%, 520px); display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 22px 20px 18px; border: 1px solid rgba(217, 178, 106, .5); border-radius: 22px;
  background: linear-gradient(160deg, rgba(8, 36, 29, .72), rgba(3, 14, 11, .78)); backdrop-filter: blur(14px) saturate(1.2); box-shadow: 0 18px 60px rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(246, 228, 171, .08); }
.field label { display: block; margin: 0 0 6px; font-family: var(--display); font-weight: 600; font-size: 1.15rem; letter-spacing: .08em; color: var(--gold-hi); text-align: center; }
.dob { position: relative; display: flex; align-items: stretch; }
.dob input { flex: 1; min-width: 0; min-height: 56px; padding: 0 52px 0 12px; text-align: center; font-family: var(--display); font-weight: 600; font-size: clamp(1.3rem, 6.4vw, 1.7rem); letter-spacing: clamp(.04em, 1.1vw, .18em); color: var(--cream); background: rgba(0, 0, 0, .4); border: 1px solid rgba(217, 178, 106, .6); border-radius: 14px; }
.dob input::placeholder { color: rgba(243, 234, 210, .38); letter-spacing: .12em; }
.dob input[aria-invalid="true"] { border-color: #ff9a8a; }
.cal-btn { position: absolute; right: 4px; top: 4px; bottom: 4px; width: 48px; display: grid; place-items: center; background: none; border: 0; border-radius: 10px; color: var(--gold); }
.cal-btn:hover { color: var(--gold-hi); background: rgba(217, 178, 106, .12); }

.gender { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chip { min-height: 52px; padding: 0 14px; font-family: var(--display); font-weight: 700; font-size: 1.3rem; letter-spacing: .08em; color: var(--gold-hi); background: rgba(0, 0, 0, .35); border: 1px solid rgba(217, 178, 106, .6); border-radius: 14px; transition: transform .15s, background .2s; }
.chip:hover { transform: translateY(-1px); background: rgba(217, 178, 106, .14); }
.chip[aria-pressed="true"] { color: #1b1206; border-color: var(--gold-hi); background: linear-gradient(135deg, var(--gold-hi), var(--gold) 55%, var(--gold-lo)); box-shadow: 0 0 22px rgba(217, 178, 106, .45); }

.spin { min-height: 60px; font-family: var(--display); font-weight: 700; font-size: 1.6rem; letter-spacing: .22em; text-transform: uppercase; color: #1b1206; border: 0; border-radius: 16px;
  background: linear-gradient(135deg, var(--gold-hi), var(--gold) 50%, var(--gold-lo)); box-shadow: 0 6px 28px rgba(217, 178, 106, .4); transition: transform .15s, box-shadow .2s, opacity .2s, filter .2s; }
.spin:hover { transform: translateY(-2px); box-shadow: 0 10px 36px rgba(217, 178, 106, .6); }
.spin[aria-disabled="true"] { opacity: .42; filter: saturate(.5); box-shadow: none; transform: none; cursor: not-allowed; }
.err { min-height: 0; margin: 0; text-align: center; color: #ffb4a6; font-size: 1.02rem; }

.bottom { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 12px; padding-top: 8px; }
.link { min-height: 44px; padding: 0 6px; background: none; border: 0; font-family: var(--display); font-weight: 600; font-size: clamp(.92rem, 3.6vw, 1.1rem); letter-spacing: clamp(.06em, .9vw, .14em); text-transform: uppercase; color: var(--gold-hi); text-shadow: 0 2px 10px rgba(0, 0, 0, .9); border-bottom: 1px solid rgba(217, 178, 106, .55); border-radius: 0; }
.link:hover { color: #fff; border-bottom-color: var(--gold-hi); }

/* ── Моите прочити */
.hist-link { justify-self: center; align-self: center; max-width: 100%; min-height: 44px; padding: 0 14px; background: none; border: 0; font-family: var(--display); font-weight: 600; font-size: clamp(.95rem, 3.8vw, 1.05rem); letter-spacing: clamp(.08em, 1vw, .14em); text-transform: uppercase; color: var(--gold-hi); text-shadow: 0 2px 10px rgba(0, 0, 0, .9); opacity: .9; }
.hist-link span:first-child { border-bottom: 1px solid rgba(217, 178, 106, .45); padding-bottom: 2px; }
.hist-link:hover { opacity: 1; color: #fff; }
.hist-count { letter-spacing: .04em; color: var(--gold); }
.hist-card { width: min(640px, 100%); }
.hist-note { margin: 0 0 14px; font-size: 1.02rem; color: #4a3820; }
.hist-warn { margin: 0 0 14px; padding: 10px 14px; border-radius: 12px; background: rgba(170, 60, 40, .1); border: 1px solid rgba(170, 60, 40, .45); color: #6b2414; }
.hist-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.hist-item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px; padding: 12px 14px; border-radius: 14px; border: 1px solid rgba(169, 127, 46, .45); background: rgba(255, 252, 240, .55); }
.hist-item.bad { opacity: .75; border-style: dashed; }
.hist-info { display: grid; gap: 2px; min-width: 0; }
.hist-info b { font-family: var(--display); font-size: 1.35rem; letter-spacing: .06em; color: #2b1d10; }
.hist-info small { font-size: .95rem; color: #6b4f22; }
.hist-row { display: flex; flex-wrap: wrap; gap: 8px; }
.hist-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px; text-decoration: none; font-family: var(--display); font-weight: 700; font-size: 1rem; letter-spacing: .1em; text-transform: uppercase; color: #2b1d10; background: rgba(169, 127, 46, .16); border: 1px solid var(--gold-d); border-radius: 12px; }
.hist-btn:hover { background: rgba(169, 127, 46, .32); }
.hist-btn.pri { color: #1b1206; border-color: var(--gold-lo); background: linear-gradient(135deg, var(--gold-hi), var(--gold) 55%, #c49a4c); }
.hist-btn.danger { color: #fff7ef; background: #7a2e1c; border-color: #5a1e10; }
.hist-btn.danger:hover { background: #923824; }
.hist-empty { margin: 6px 0 0; font-style: italic; color: #6b4f22; }
.hist-clear { margin-top: 22px; padding-top: 16px; border-top: 1px solid rgba(169, 127, 46, .45); }
.hist-confirm { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: rgba(122, 46, 28, .08); border: 1px solid rgba(122, 46, 28, .4); }
.hist-confirm p { margin: 0 0 10px; }
.hist-done { margin: 12px 0 0; color: #2f5a2a; font-weight: 600; }

/* ── календар */
.cal { position: absolute; z-index: 20; left: 50%; bottom: calc(100% + 10px); transform: translateX(-50%); width: min(340px, calc(100vw - 36px)); padding: 12px; border-radius: 16px; border: 1px solid rgba(217, 178, 106, .7);
  background: linear-gradient(160deg, #0d3a2f, #061a15); box-shadow: 0 18px 50px rgba(0, 0, 0, .7); }
.cal-head { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 6px; margin-bottom: 8px; }
.cal-head button { min-height: 44px; background: rgba(0, 0, 0, .3); border: 1px solid rgba(217, 178, 106, .4); border-radius: 10px; color: var(--gold-hi); font-size: 1.3rem; }
.cal-title { display: grid; grid-template-columns: 1fr 96px; gap: 6px; }
.cal-title select { min-height: 44px; width: 100%; font-family: var(--display); font-weight: 700; font-size: 1.05rem; color: var(--cream); background: rgba(0, 0, 0, .4); border: 1px solid rgba(217, 178, 106, .4); border-radius: 10px; padding: 0 6px; }
.cal-title select option { color: #111; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-dow { text-align: center; font-family: var(--display); font-weight: 700; font-size: .9rem; letter-spacing: .06em; color: var(--gold); padding: 4px 0; }
.cal-day { min-height: 42px; background: none; border: 1px solid transparent; border-radius: 10px; color: var(--cream); font-family: var(--display); font-weight: 600; font-size: 1.1rem; }
.cal-day:hover:not(:disabled) { background: rgba(217, 178, 106, .18); }
.cal-day[aria-selected="true"] { background: linear-gradient(135deg, var(--gold-hi), var(--gold)); color: #1b1206; }
.cal-day:disabled { opacity: .25; cursor: not-allowed; }

/* ── Intro / Поверителност */
.doc { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: rgba(2, 8, 6, .78); backdrop-filter: blur(6px); animation: fade .25s ease; }
.doc-card { width: min(760px, 100%); max-height: min(88svh, 900px); display: flex; flex-direction: column; border-radius: 20px; border: 1px solid var(--gold-d); background: linear-gradient(180deg, #f6ebcd, #ecdcb4); color: #2b1d10; box-shadow: 0 30px 90px rgba(0, 0, 0, .7); overflow: hidden; }
.doc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid rgba(169, 127, 46, .5); }
.doc-head h2 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 1.6rem; letter-spacing: .08em; text-transform: uppercase; color: #2b1d10; }
.doc-close { min-height: 44px; padding: 0 16px; font-family: var(--display); font-weight: 700; letter-spacing: .1em; color: #2b1d10; background: rgba(169, 127, 46, .2); border: 1px solid var(--gold-d); border-radius: 12px; }
.doc-close:hover { background: rgba(169, 127, 46, .38); }
.doc-body { padding: 18px 22px 26px; overflow: auto; overscroll-behavior: contain; }
.rich { font-family: var(--body); font-size: 1.12rem; line-height: 1.7; hyphens: auto; }
.rich h1, .rich h2, .rich h3 { font-family: var(--display); line-height: 1.2; margin: 1.1em 0 .4em; color: #2b1d10; }
.rich h1 { font-size: 1.9rem; } .rich h2 { font-size: 1.55rem; } .rich h3 { font-size: 1.3rem; }
.rich p { margin: 0 0 .9em; } .rich ul, .rich ol { margin: 0 0 1em; padding-left: 1.4em; } .rich li { margin: .2em 0; }
.rich a { color: #7a5a22; text-decoration: underline; text-underline-offset: 3px; }
.rich blockquote { margin: 1em 0; padding: .2em 1em; border-left: 3px solid var(--gold-d); color: #4a3820; }
.rich hr { border: 0; border-top: 1px solid rgba(169, 127, 46, .6); margin: 1.4em 0; }
@keyframes fade { from { opacity: 0; } }

/* ── холограма */
.holo { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: radial-gradient(ellipse at 50% 46%, rgba(0, 14, 11, .6), rgba(0, 6, 5, .92) 80%); transition: opacity .6s ease; animation: fade .6s ease; }
.holo.out { opacity: 0; pointer-events: none; }
.holo-stage { display: grid; justify-items: center; gap: 18px; width: min(560px, 100%); }
.holo-fig { position: relative; width: min(300px, 58vw, 44svh * .667 + 60px); aspect-ratio: 2 / 3; animation: holoIn 1.1s cubic-bezier(.2, .8, .2, 1) both; }
.holo.out .holo-fig { transform: scale(.7) translateY(30px); filter: blur(8px); transition: transform .6s, filter .6s; }
.holo-media { position: absolute; inset: 0; animation: flick 3.4s steps(1) infinite; -webkit-mask-image: radial-gradient(ellipse 62% 58% at 50% 50%, #000 52%, transparent 100%); mask-image: radial-gradient(ellipse 62% 58% at 50% 50%, #000 52%, transparent 100%); }
.holo-media img, .holo-media video { width: 100%; height: 100%; object-fit: cover; display: block; mix-blend-mode: screen; filter: hue-rotate(-22deg) saturate(1.35) brightness(1.15) drop-shadow(0 0 22px rgba(90, 255, 205, .65)); }
.holo-scan { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen; background: repeating-linear-gradient(0deg, rgba(130, 255, 225, .16) 0 1px, transparent 1px 4px); -webkit-mask-image: radial-gradient(ellipse 60% 56% at 50% 50%, #000 40%, transparent 100%); mask-image: radial-gradient(ellipse 60% 56% at 50% 50%, #000 40%, transparent 100%); animation: scan 6s linear infinite; }
.holo-beam { position: absolute; left: 12%; right: 12%; bottom: -14%; height: 62%; clip-path: polygon(30% 100%, 70% 100%, 100% 0, 0 0); background: linear-gradient(0deg, rgba(110, 255, 215, .5), rgba(110, 255, 215, 0)); filter: blur(10px); opacity: .7; transform: scaleY(-1); transform-origin: 50% 100%; }
.holo-rings { position: absolute; left: 50%; bottom: -8%; width: 90%; height: 0; transform: translateX(-50%); }
.holo-rings i { position: absolute; left: 50%; bottom: 0; width: 100%; aspect-ratio: 5 / 1; border: 2px solid rgba(120, 255, 220, .65); border-radius: 50%; transform: translate(-50%, 50%) scale(.5); opacity: 0; box-shadow: 0 0 18px rgba(120, 255, 220, .6); animation: ring 3.2s ease-out infinite; }
.holo-rings i:nth-child(2) { animation-delay: 1.06s; } .holo-rings i:nth-child(3) { animation-delay: 2.12s; }
.holo-text { margin: 0; max-width: 34em; text-align: center; font-family: var(--display); font-weight: 600; font-size: clamp(1.2rem, 4.2vw, 1.7rem); line-height: 1.35; color: #d9fff0; text-shadow: 0 0 14px rgba(90, 255, 205, .6), 0 2px 8px rgba(0, 0, 0, .8); animation: rise .9s .7s ease both; }
.holo-actions { display: flex; gap: 12px; animation: rise .9s 1s ease both; }
.holo-btn { min-height: 46px; padding: 0 22px; font-family: var(--display); font-weight: 700; font-size: 1.1rem; letter-spacing: .14em; text-transform: uppercase; color: #d9fff0; background: rgba(0, 30, 24, .55); border: 1px solid rgba(120, 255, 220, .7); border-radius: 999px; box-shadow: 0 0 18px rgba(120, 255, 220, .25); }
.holo-btn:hover { background: rgba(60, 200, 170, .3); }
.holo-btn[aria-pressed="true"] { background: rgba(120, 255, 220, .3); }
@keyframes holoIn { from { opacity: 0; transform: translateY(70px) scale(.35); filter: blur(14px) brightness(2); } 60% { filter: blur(0) brightness(1.5); } to { opacity: 1; transform: none; filter: none; } }
@keyframes flick { 0%, 100% { opacity: 1; } 41% { opacity: .96; } 43% { opacity: .68; } 45% { opacity: 1; } 78% { opacity: .9; } 80% { opacity: 1; } }
@keyframes scan { to { background-position: 0 40px; } }
@keyframes ring { 0% { opacity: 0; transform: translate(-50%, 50%) scale(.45); } 20% { opacity: .9; } 100% { opacity: 0; transform: translate(-50%, 50%) scale(1.15); } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* ── колелото се върти */
.wheel { position: fixed; inset: 0; z-index: 60; display: grid; place-content: center; justify-items: center; gap: 18px; background: rgba(2, 8, 6, .88); backdrop-filter: blur(6px); animation: fade .3s ease; }
.wheel svg { animation: wheelSpin 1.8s cubic-bezier(.15, .6, .15, 1) forwards; filter: drop-shadow(0 0 24px rgba(217, 178, 106, .6)); }
.wheel p { margin: 0; font-family: var(--display); font-size: 1.4rem; letter-spacing: .18em; color: var(--gold-hi); }
@keyframes wheelSpin { from { transform: rotate(0); } to { transform: rotate(1260deg); } }

/* ── таблет и компютър */
@media (min-width: 768px) {
  .page { padding-left: 32px; padding-right: 32px; }
  .panel { width: min(100%, 940px); grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) auto; align-items: end; gap: 12px 18px; padding: 22px 26px 22px; }
  .field label { text-align: left; padding-left: 4px; }
  .dob input { font-size: clamp(1.2rem, 2.2vw, 1.7rem); letter-spacing: clamp(.04em, .4vw, .18em); }
  .gender-field { align-self: end; }
  .gender { grid-template-columns: 1fr 1fr; }
  .spin { padding: 0 30px; font-size: 1.35rem; letter-spacing: .16em; }
  .err { grid-column: 1 / -1; }
  .cal { left: 0; transform: none; }
}
@media (max-height: 640px) and (orientation: landscape) { .title { font-size: 2.2rem; } .panel { padding: 12px 16px; gap: 10px; } }
/* ниски екрани (телефон легнал): холограмата и бутоните ѝ винаги се събират */
.holo { overflow-y: auto; place-items: safe center; }
@media (max-height: 560px) {
  .holo-stage { gap: 10px; }
  .holo-fig { width: min(220px, 40vw, calc(34svh * .667 + 20px)); }
  .holo-text { font-size: clamp(1rem, 2.6vw, 1.25rem); }
  .holo-btn { min-height: 44px; }
}
@media (max-height: 560px) and (orientation: landscape) {
  .holo-stage { width: min(820px, 100%); grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; align-items: center; column-gap: 28px; }
  .holo-fig { grid-row: 1 / 3; width: min(200px, calc(62svh * .667)); }
  .holo-text { text-align: left; align-self: end; }
  .holo-actions { align-self: start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .hero-bg img { transform: none; }
  .holo-beam, .holo-rings, .holo-scan { display: none; }
  .wheel svg { transform: rotate(40deg); }
}

/* ── 404 */
body.nf { display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 40%, #0f4a3b, var(--ink) 70%); text-align: center; }
.nf-box { max-width: 520px; }
.nf-code { margin: 0; font-family: var(--display); font-size: clamp(4rem, 20vw, 8rem); line-height: 1; color: var(--gold); }
.nf-box h1 { margin: .2em 0 .1em; font-family: var(--display); font-weight: 600; font-size: clamp(1.5rem, 6vw, 2.2rem); color: var(--gold-hi); }
.nf-box p { margin: 0 0 1.4em; color: var(--text); opacity: .85; }
.nf-btn { display: inline-flex; align-items: center; min-height: 48px; padding: 0 24px; border-radius: 14px; text-decoration: none; font-family: var(--display); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #1b1206; background: linear-gradient(135deg, var(--gold-hi), var(--gold) 55%, var(--gold-lo)); }
