[hidden] { display: none !important; }

:root {
  /* Шкала шрифтів: 6 розмірів на весь сайт (дрібний, допоміжний, основний, підзаголовок, заголовок, великий). */
  --fs-xs: .75rem;      /* 12px — підписи під картами, мітки рядів */
  --fs-sm: .875rem;     /* 14px — підказки, примітки */
  --fs-base: 1.0625rem; /* 17px — звичайний текст */
  --fs-md: 1.25rem;     /* 20px — підзаголовки, назви в підказках */
  --fs-lg: 1.625rem;    /* 26px — заголовки блоків, назва сайту */
  --fs-xl: clamp(2.2rem, 6vw, 3.4rem); /* заголовок сторінки */
  --space-1: #07041a;
  --space-2: #140b33;
  --space-3: #24124f;
  --nebula-violet: rgba(124, 77, 255, .35);
  --nebula-rose: rgba(214, 92, 180, .22);
  --nebula-teal: rgba(56, 189, 208, .16);
  --gold: #eac77a;
  --gold-soft: rgba(234, 199, 122, .35);
  --text: #efe9ff;
  --muted: #b5a8d9;
  --glass: rgba(255, 255, 255, .06);
  --glass-border: rgba(234, 199, 122, .22);
  --card-w: min(22vw, 118px);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font: var(--fs-base)/1.65 "Nunito Sans", "Noto Sans Symbols", system-ui, sans-serif;
  background:
    radial-gradient(ellipse 60% 45% at 15% 10%, var(--nebula-violet), transparent 70%),
    radial-gradient(ellipse 50% 40% at 85% 25%, var(--nebula-rose), transparent 70%),
    radial-gradient(ellipse 70% 50% at 50% 95%, var(--nebula-teal), transparent 70%),
    linear-gradient(180deg, var(--space-1), var(--space-2) 45%, var(--space-3));
  background-attachment: fixed;
  overflow-x: hidden;
}

/* зоряне небо */
.stars, .stars::before, .stars::after {
  position: fixed; inset: 0; pointer-events: none; content: "";
  background-image:
    radial-gradient(1px 1px at 12% 18%, #fff, transparent),
    radial-gradient(1px 1px at 28% 72%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 44% 34%, #ffe9b8, transparent),
    radial-gradient(1px 1px at 63% 81%, #fff, transparent),
    radial-gradient(1px 1px at 77% 12%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 88% 58%, #cfe3ff, transparent),
    radial-gradient(1px 1px at 6% 90%, #fff, transparent),
    radial-gradient(1px 1px at 53% 6%, #fff, transparent),
    radial-gradient(1px 1px at 36% 50%, #fff, transparent),
    radial-gradient(1px 1px at 93% 88%, #fff, transparent);
  background-size: 420px 420px;
  animation: twinkle 6s ease-in-out infinite alternate;
  z-index: 0;
}
.stars::before { background-size: 300px 300px; opacity: .6; animation-delay: -2s; }
.stars::after  { background-size: 560px 560px; opacity: .8; animation-delay: -4s; }
@keyframes twinkle { from { opacity: .35; } to { opacity: 1; } }

header, main, footer { position: relative; z-index: 1; max-width: 880px; margin: 0 auto; padding: 18px 16px; }
/* Шапка: назва, меню і службове праворуч — в один рядок; вузько — меню окремим рядком, що гортається вбік. */
header { display: flex; flex-wrap: nowrap; gap: 20px; align-items: center; }
header .brand { flex: none; }
header nav { flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; }
@media (max-width: 860px) {
  header { flex-wrap: wrap; row-gap: 8px; }
  header nav { order: 3; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  header nav::-webkit-scrollbar { display: none; }
  /* ледь згасає праворуч — видно, що меню гортається */
  header nav { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
}
.brand {
  font: 600 var(--fs-lg) "Cormorant Garamond", "Noto Sans Symbols", serif; color: var(--gold); text-decoration: none;
  letter-spacing: .04em; text-shadow: 0 0 18px var(--gold-soft);
  display: inline-flex; align-items: center; gap: .4em;
}
/* знак біля назви — чорна діра зі світним акреційним диском */
.blackhole {
  display: inline-block; vertical-align: middle; position: relative; flex: none;
  width: .8em; height: .8em; border-radius: 50%; background: #05020f;
  box-shadow: 0 0 0 .07em #fff1c9, 0 0 .18em .1em var(--gold), 0 0 .5em .18em rgba(234, 160, 90, .55),
    0 0 1em .2em rgba(214, 92, 180, .3);
}
.blackhole::before {
  content: ""; position: absolute; left: -55%; right: -55%; top: 42%; height: 16%; border-radius: 50%;
  background: linear-gradient(90deg, transparent, var(--gold) 25%, #fff3d0 50%, var(--gold) 75%, transparent);
  filter: blur(.5px); opacity: .9;
}
/* верхня половина діри перекриває диск — він ніби проходить позаду */
.blackhole::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: #05020f; clip-path: inset(0 0 52% 0); }
nav a { color: var(--muted); text-decoration: none; font-size: var(--fs-base); white-space: nowrap; }
nav a:hover, nav a:focus { color: var(--gold); }
nav a.nav-main { color: var(--gold); }   /* головна дія — гадання */
/* Службове праворуч (layout.html): мова, ✉ і «Увійти» для гостя, кружечок-меню для акаунта — тихіше за меню */
.header-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none; }
.tool-feedback, .tool-login { color: var(--muted); text-decoration: none; font-size: var(--fs-sm); opacity: .8; }
.tool-feedback { font-size: var(--fs-base); }
.tool-feedback:hover, .tool-login:hover, .tool-feedback:focus-visible, .tool-login:focus-visible { color: var(--gold); opacity: 1; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; cursor: pointer; }
.user-menu summary::-webkit-details-marker { display: none; }
.avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-size: var(--fs-sm);
  color: var(--muted); border: 1px solid var(--glass-border); background: rgba(255, 255, 255, .04); }
.user-menu summary:hover .avatar, .user-menu[open] .avatar { color: var(--gold); border-color: var(--gold); }
.header-tools .lang-list { left: auto; right: 0; }
.user-menu .who { padding: 4px 10px 6px; color: var(--muted); font-size: var(--fs-xs); white-space: nowrap;
  border-bottom: 1px solid var(--glass-border); margin-bottom: 2px; }
.user-menu .logout { margin: 0; }
.user-menu .logout button { width: 100%; text-align: left; background: none; border: 0; padding: 7px 10px; border-radius: 8px;
  font: inherit; font-size: var(--fs-sm); color: var(--text); cursor: pointer; }
.user-menu .logout button:hover, .user-menu .logout button:focus-visible { background: rgba(234, 199, 122, .14); color: var(--gold); }
.auth form { display: flex; flex-direction: column; gap: 12px; max-width: 420px; }
.auth label { display: flex; flex-direction: column; gap: 4px; }
.auth input { font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--glass-border); background: rgba(255,255,255,.06); color: inherit; }
.auth .hint { color: var(--muted); font-size: var(--fs-sm); }

h1, h2, h3 { font-family: "Cormorant Garamond", "Noto Sans Symbols", serif; font-weight: 600; color: var(--gold); letter-spacing: .02em; }
h1 { font-size: var(--fs-xl); line-height: 1.1; margin: .4em 0 .2em; text-shadow: 0 0 30px var(--gold-soft); }
h2 { font-size: var(--fs-lg); margin: 0 0 .4em; }
h3 { font-size: var(--fs-md); margin: 0 0 .3em; }
.lead { color: var(--muted); font-size: var(--fs-base); max-width: 34em; }

a { color: var(--gold); }

.btn {
  display: inline-block; padding: 14px 26px; border-radius: 999px; font: 600 var(--fs-base) "Nunito Sans", "Noto Sans Symbols", sans-serif;
  text-decoration: none; cursor: pointer; border: 1px solid var(--gold); transition: .25s;
}
.btn.primary { background: linear-gradient(135deg, #f3d68f, #c99a3c); color: #1a0f33; box-shadow: 0 0 24px var(--gold-soft); }
.btn.primary:hover, .btn.primary:focus { box-shadow: 0 0 40px rgba(234, 199, 122, .6); transform: translateY(-1px); }
.btn.ghost { color: var(--gold); background: rgba(234, 199, 122, .06); }
.btn.ghost:hover, .btn.ghost:focus { background: rgba(234, 199, 122, .14); }

.glass {
  background: var(--glass); border: 1px solid var(--glass-border); border-radius: 18px; padding: 20px 22px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); margin: 16px 0;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
}

.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 22px; }
.actions form { display: contents; }
.actions .extra-option { flex-basis: 100%; color: var(--muted); font-size: var(--fs-sm); }

/* ---------- ГОЛОВНА ---------- */
.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 28px; align-items: center; padding: 30px 0 10px; }
.daycard { text-align: center; }
.daycard .label { color: var(--muted); font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .2em; }
.daycard .flip { display: block; width: 170px; margin: 12px auto; aspect-ratio: 500 / 850; perspective: 1000px; cursor: pointer; }
.daycard .flip:hover .inner, .daycard .flip:focus .inner { transform: rotateY(180deg); }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 26px 0; }
.features .glass { margin: 0; text-align: center; }
.features .icon { font-size: 1.8rem; color: var(--gold); text-shadow: 0 0 14px var(--gold-soft); }

/* карта з сорочкою */
.card3d { width: var(--card-w); aspect-ratio: 500 / 850; perspective: 1000px; margin: 0 auto; }
.inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .9s cubic-bezier(.2,.7,.2,1); }
.face, .back {
  position: absolute; inset: 0; border-radius: 10px; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden;
  box-shadow: 0 6px 24px rgba(0,0,0,.45), 0 0 0 1px rgba(234,199,122,.35);
}
.back {
  background:
    radial-gradient(circle at 50% 50%, rgba(234,199,122,.35) 0 8%, transparent 9%),
    radial-gradient(circle at 50% 50%, transparent 0 22%, rgba(234,199,122,.25) 23% 24%, transparent 25%),
    repeating-conic-gradient(from 0deg, rgba(234,199,122,.12) 0 6deg, transparent 6deg 30deg),
    linear-gradient(160deg, #2b1760, #120833);
  border: 2px solid rgba(234,199,122,.5);
}
.back::after { content: "✦"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--gold); font-size: var(--fs-lg); text-shadow: 0 0 12px var(--gold); }
.face { transform: rotateY(180deg); }
.face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.reversed .face img { transform: rotate(180deg); }
.revealed .inner { transform: rotateY(180deg); }
.card-placeholder { width: 100%; height: 100%; display: grid; place-items: center; text-align: center;
  background: rgba(234,199,122,.08); color: var(--muted); font-size: var(--fs-xs); padding: 6px; }

/* ---------- РОЗКЛАД ---------- */
.table {
  position: relative; margin: 26px 0; padding: 26px 16px 18px; border-radius: 22px;
  background: radial-gradient(ellipse at center, rgba(124,77,255,.18), transparent 70%), rgba(10, 5, 30, .45);
  border: 1px solid var(--glass-border);
}
.spread { display: grid; grid-template-columns: repeat(3, 1fr) 24px 1fr; gap: 14px 10px; align-items: center; }
.colhead { text-align: center; color: var(--gold); font: italic 500 var(--fs-base) "Cormorant Garamond", "Noto Sans Symbols", serif; }
.colhead small { display: block; color: var(--muted); font: var(--fs-xs) "Nunito Sans"; letter-spacing: .15em; text-transform: uppercase; }
.divider { grid-row: 2 / span 3; grid-column: 4; justify-self: center; width: 1px; height: 100%;
  background: linear-gradient(transparent, var(--gold), transparent); box-shadow: 0 0 10px var(--gold); }
.result { grid-column: 5; grid-row: 2 / span 3; text-align: center; }
.result .card3d { --card-w: min(24vw, 140px); }
.caption { margin-top: 6px; font-size: var(--fs-xs); color: var(--muted); text-align: center; line-height: 1.3; }
.caption b { color: var(--text); font-weight: 600; }
.rowlabel { font-size: var(--fs-xs); color: var(--muted); }

.dealt { opacity: 0; transform: translateY(-30px) scale(.9); animation: deal .6s forwards; }
@keyframes deal { to { opacity: 1; transform: none; } }

.direction { display: flex; gap: 16px; align-items: center; }
.direction .sigil { font-size: 2.4rem; color: var(--gold); text-shadow: 0 0 18px var(--gold-soft); }
.reading-block h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.reading-block .tag { font: 600 var(--fs-xs) "Nunito Sans"; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 .6em; }
.reading-block p { margin: .3em 0 1em; }
.rev { color: #f2a6c9; font-size: var(--fs-sm); }

.ai .question { font-style: italic; color: var(--muted); }
textarea, select {
  width: 100%; border-radius: 12px; border: 1px solid var(--glass-border); background: rgba(0,0,0,.25);
  color: var(--text); padding: 12px; font: inherit;
}
select option { background: var(--space-2); color: var(--text); }

footer { color: var(--muted); font-size: var(--fs-xs); text-align: center; opacity: .8; padding-bottom: 40px; }
footer p { margin: .3em 0; }
.section-title { text-align: center; margin-top: 50px; }
.sep { text-align: center; color: var(--gold); letter-spacing: 1em; opacity: .6; margin: 40px 0 10px; }

/* ---------- КАРТА ДНЯ ---------- */
main.day { text-align: center; }
main.day .card3d { --card-w: min(50vw, 240px); margin: 20px auto; }
main.day .card3d .inner { animation: dayflip 1.2s cubic-bezier(.2,.7,.2,1) both; }
@keyframes dayflip { from { transform: rotateY(0); } to { transform: rotateY(180deg); } }
.advice { font: italic 500 var(--fs-md) "Cormorant Garamond", "Noto Sans Symbols", serif; color: var(--gold); text-shadow: 0 0 14px var(--gold-soft); }

/* ---------- ДОВІДНИК ---------- */
.card-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 16px; }
.card-list a { display: block; text-decoration: none; color: var(--text); text-align: center; }
.card-list .frame {
  display: block; border-radius: 12px; overflow: hidden; border: 1px solid var(--glass-border);
  box-shadow: 0 0 0 rgba(234,199,122,0); transition: box-shadow .3s, transform .3s;
}
.card-list a:hover .frame, .card-list a:focus .frame { box-shadow: 0 0 22px var(--gold-soft); transform: translateY(-2px); }
.card-list img { width: 100%; display: block; }
.card-list span { display: block; margin-top: 6px; font-size: var(--fs-sm); color: var(--muted); }

/* ---------- СТОРІНКА КАРТИ ---------- */
.card-page { display: grid; grid-template-columns: minmax(180px, 260px) 1fr; gap: 28px; align-items: start; margin-top: 16px; }
.card-page img { width: 100%; border-radius: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.4), 0 0 0 1px var(--glass-border); }

/* ---------- ФОРМА РУЧНОГО РОЗКЛАДУ ---------- */
fieldset { border: 1px solid var(--glass-border); border-radius: 14px; margin: 10px 0; padding: 12px 14px; }
legend { padding: 0 8px; color: var(--muted); font-size: var(--fs-sm); }
.error, .notice { color: #f2a6c9; }

@media (max-width: 640px) {
  .hero { grid-template-columns: 1fr; text-align: center; }
  .actions { justify-content: center; }
  .actions .extra-option { text-align: center; }
  .actions .btn { padding: 12px 14px; font-size: var(--fs-sm); }   /* обидві кнопки в один рядок на телефоні */
  .features { grid-template-columns: 1fr; }
  .spread { grid-template-columns: repeat(3, 1fr); }
  .divider { display: none; }
  .spread > .spacer { display: none; }
  .result-head, .result { order: 1; }
  .result-head { grid-column: 1 / -1; margin-top: 18px; }
  .result { grid-column: 1 / -1; grid-row: auto; margin-top: 4px; }
  .result .card3d, .manual .result .slot-card { --card-w: 120px; }
  .card-page { grid-template-columns: 1fr; }
  :root { --card-w: 27vw; }
}
@media (prefers-reduced-motion: reduce) {
  .stars, .stars::before, .stars::after { animation: none; }
  .dealt { animation: none; opacity: 1; transform: none; }
  .inner { transition: none; }
  main.day .card3d .inner { animation: none; }
}

/* ---------- РУЧНИЙ РОЗКЛАД: вибір карт картинками ---------- */
.manual .slot { text-align: center; }
.slot-card {
  display: block; width: var(--card-w); aspect-ratio: 500 / 850; margin: 0 auto; padding: 0; cursor: pointer;
  border-radius: 10px; overflow: hidden; border: 2px dashed rgba(234,199,122,.45);
  background:
    radial-gradient(circle at 50% 50%, rgba(234,199,122,.25) 0 8%, transparent 9%),
    linear-gradient(160deg, #2b1760, #120833);
  color: var(--gold); transition: box-shadow .25s, transform .25s;
}
.slot:not(.filled) .slot-card::after { content: "+"; font-size: 1.8rem; text-shadow: 0 0 12px var(--gold); }
.slot-card:hover, .slot-card:focus-visible { box-shadow: 0 0 22px var(--gold-soft); transform: translateY(-2px); }
.slot.filled .slot-card { border: 0; box-shadow: 0 6px 24px rgba(0,0,0,.45), 0 0 0 1px rgba(234,199,122,.35); }
.slot-card img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s; }
.slot-card.reversed img { transform: rotate(180deg); }
.manual .result .slot-card { --card-w: min(24vw, 140px); }
.flip { display: inline-block; margin-top: 4px; font-size: var(--fs-xs); color: var(--muted); cursor: pointer; }
.flip input { position: absolute; opacity: 0; pointer-events: none; }
.flip span { padding: 2px 8px; border-radius: 999px; border: 1px solid var(--glass-border); }
.flip input:checked + span { color: #f2a6c9; border-color: #f2a6c9; }
.flip input:focus-visible + span { outline: 2px solid var(--gold); }
.slot:not(.filled) .flip { visibility: hidden; }
.manual-submit { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.manual-submit .btn:disabled { opacity: .5; cursor: wait; box-shadow: none; }
.manual-submit .alert { color: #f2a6c9; font-size: var(--fs-base); font-weight: 600; }
.slot.missing .slot-card { border-color: #f2a6c9; box-shadow: 0 0 18px rgba(242,166,201,.55); animation: pulse 1.2s ease-in-out 2; }
@keyframes pulse { 50% { transform: scale(1.04); } }
.muted { color: var(--muted); }

.picker {
  width: min(920px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0;
  border-radius: 18px; border: 1px solid var(--glass-border); color: var(--text);
  background: linear-gradient(160deg, #1d1046, #0d0626);
  box-shadow: 0 20px 80px rgba(0,0,0,.6), 0 0 40px rgba(124,77,255,.25);
}
.picker::backdrop { background: rgba(5, 2, 18, .75); backdrop-filter: blur(3px); }
.picker [hidden] { display: none !important; }
.picker header {
  max-width: none; margin: 0;
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  background: rgba(13, 6, 38, .95); border-bottom: 1px solid var(--glass-border);
}
.picker header h2 { margin: 0; flex: 1; font-size: var(--fs-lg); }
.picker header .btn { padding: 6px 14px; }
.picker-close { background: none; border: 0; color: var(--muted); font-size: var(--fs-md); cursor: pointer; }
.picker-close:hover, .picker-close:focus { color: var(--gold); }
.picker .step { padding: 18px 16px 22px; }
.picker .step[hidden] { display: none; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 190px)); justify-content: center; gap: 22px; }
.choice, .tile {
  background: none; border: 0; padding: 0; color: var(--text); cursor: pointer; text-align: center; font: inherit;
}
.choice img, .tile img {
  width: 100%; aspect-ratio: 500 / 850; object-fit: cover; display: block; border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,.45), 0 0 0 1px rgba(234,199,122,.3); transition: box-shadow .2s, transform .2s;
}
.choice span { display: block; margin-top: 8px; font: 600 var(--fs-md) "Cormorant Garamond", "Noto Sans Symbols", serif; color: var(--gold); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 14px; }
.tile span { display: block; margin-top: 5px; font-size: var(--fs-xs); color: var(--muted); line-height: 1.25; }
.choice:hover img, .choice:focus-visible img, .tile:hover img, .tile:focus-visible img {
  box-shadow: 0 0 24px var(--gold-soft), 0 0 0 2px var(--gold); transform: translateY(-2px);
}
.tile.current img { box-shadow: 0 0 0 3px var(--gold), 0 0 24px var(--gold-soft); }
.tile.taken { cursor: not-allowed; }
.tile.taken img { filter: grayscale(1) brightness(.35); box-shadow: none; transform: none; }
.tile.taken span::after { content: " · уже в розкладі"; color: #f2a6c9; }
@media (max-width: 640px) {
  .tiles { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 10px; }
  .choices { grid-template-columns: repeat(2, 1fr); }
  .picker { max-height: calc(100vh - 24px); }
}

/* ---------- РИТУАЛ: віяло колоди, карти злітають на стіл і відкриваються ---------- */
.ritual .slot { text-align: center; }
.ritual-slot { position: relative; }
.ritual-slot .slot-empty {
  width: var(--card-w); aspect-ratio: 500 / 850; margin: 0 auto; border-radius: 10px;
  border: 2px dashed rgba(234,199,122,.3); background: rgba(234,199,122,.03);
}
.ritual-slot .card3d { position: absolute; inset: 0 0 auto 0; visibility: hidden; }
.ritual .result .slot-empty, .ritual .result .card3d { --card-w: min(24vw, 140px); }
.ritual-slot.placed .card3d { visibility: visible; cursor: pointer; }
.ritual-slot.placed:not(.open) .card3d:hover .back { box-shadow: 0 0 26px var(--gold-soft), 0 0 0 1px var(--gold); }
.ritual-slot.placed .slot-empty { visibility: hidden; }
.ritual-slot .caption { min-height: 2.6em; }
.ritual-status { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; min-height: 48px; }
.ritual-status #ritual-hint { color: var(--muted); }

/* Віяло прилипає до низу екрана: колода завжди під рукою, стіл прокручується над нею. */
.fan-dock {
  position: sticky; bottom: 0; z-index: 50; margin: 8px -16px 0; padding: 26px 16px 4px;
  background: linear-gradient(transparent, rgba(10, 5, 30, .9) 34%);
}
.fan-dock.done { display: none; }
.fan-wrap { position: relative; display: flex; align-items: flex-end; gap: 6px; }
.fan {
  --fan-card: 84px;
  position: relative; flex: 1; height: calc(var(--fan-card) * 1.7 + 70px); overflow: hidden;
  touch-action: pan-y; user-select: none; outline: none; cursor: grab;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.fan.dragging { cursor: grabbing; }
.fan.dragging .fan-card { transition-duration: .08s; }
.fan-card {
  position: absolute; left: 50%; bottom: 8px; width: var(--fan-card); aspect-ratio: 500 / 850;
  margin-left: calc(var(--fan-card) / -2); padding: 0; border: 0; background: none; cursor: pointer;
  transform-origin: 50% 460%;
  transform: rotate(var(--a, 0deg)) translateY(var(--lift, 0px));
  transition: transform .45s cubic-bezier(.2,.7,.2,1), opacity .35s;
}
.fan-card .back { border-radius: 8px; }
.fan-card:hover, .fan-card:focus-visible { --lift: -26px; }
.fan-card:hover .back, .fan-card:focus-visible .back { box-shadow: 0 0 24px var(--gold-soft), 0 0 0 1px var(--gold); }
.fan.done { opacity: .35; pointer-events: none; transition: opacity .6s; }
.fan-nav {
  flex: none; width: 40px; height: 40px; margin-bottom: 40px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--glass-border); background: rgba(234,199,122,.08); color: var(--gold); font-size: var(--fs-lg);
}
.fan-nav:hover, .fan-nav:focus-visible { background: rgba(234,199,122,.18); }
.fan-help { text-align: center; color: var(--muted); font-size: var(--fs-xs); margin-top: 4px; }
.fly-card {
  position: fixed; z-index: 2000; pointer-events: none; transform-origin: 0 0;
  transition: transform .7s cubic-bezier(.3,.7,.2,1);
}
.fly-card .back { border-radius: 8px; }
@media (max-width: 640px) {
  .fan { --fan-card: 54px; height: calc(var(--fan-card) * 1.7 + 46px); }
  .fan-dock { padding-top: 18px; }
  .fan-nav { width: 32px; height: 32px; font-size: var(--fs-base); }
  .ritual .result .slot-empty, .ritual .result .card3d { --card-w: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  .fan-card, .fly-card { transition-duration: .01s; }
}
.flip-btn {
  margin-top: 4px; padding: 2px 10px; border-radius: 999px; cursor: pointer; font: inherit; font-size: var(--fs-xs);
  color: var(--muted); background: none; border: 1px solid var(--glass-border);
}
.flip-btn:hover, .flip-btn:focus-visible { color: var(--gold); border-color: var(--gold); }
/* «Розвернути» закриту карту: поворот на 180° у площині стола (сорочка симетрична). */
@keyframes spin180 { from { transform: rotate(0deg); } to { transform: rotate(180deg); } }
.ritual-slot .card3d.spin { animation: spin180 .6s cubic-bezier(.3,.7,.2,1); }

/* ---------- Підказка з текстом карти при наведенні (на телефоні — дотиком) ---------- */
.spread .dealt { position: relative; cursor: help; outline: none; }
.card-tip {
  display: none; position: absolute; z-index: 30; top: 0; left: calc(100% + 12px); width: 300px;
  padding: 14px 16px; border-radius: 14px; text-align: left; cursor: default;
  background: rgba(16, 9, 40, .97); border: 1px solid var(--glass-border);
  box-shadow: 0 12px 40px rgba(0,0,0,.55), 0 0 24px rgba(124,77,255,.2);
}
.card-tip.tip-left { left: auto; right: calc(100% + 12px); }
.card-tip b { display: block; font: 600 var(--fs-md) "Cormorant Garamond", "Noto Sans Symbols", serif; color: var(--gold); }
.card-tip .tag { display: block; margin: 2px 0 8px; font: 600 var(--fs-xs) "Nunito Sans"; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); }
.card-tip p { margin: 0; font-size: var(--fs-sm); line-height: 1.5; }
.spread .dealt.tip-open, .spread .dealt:focus-visible { z-index: 30; }
.spread .dealt.tip-open .card-tip, .spread .dealt:focus-visible .card-tip { display: block; }
@media (hover: hover) {
  .spread .dealt:hover { z-index: 30; }
  .spread .dealt:hover .card-tip { display: block; }
}
.tip-sheet {
  position: fixed; z-index: 60; left: 12px; right: 12px; bottom: 12px; max-height: 55vh; overflow: auto;
  padding: 16px 18px; border-radius: 16px; background: rgba(16, 9, 40, .97); border: 1px solid var(--glass-border);
  box-shadow: 0 -8px 40px rgba(0,0,0,.6);
}
.tip-sheet b { display: block; font: 600 var(--fs-md) "Cormorant Garamond", "Noto Sans Symbols", serif; color: var(--gold); }
.tip-sheet .tag { display: block; margin: 2px 0 8px; font: 600 var(--fs-xs) "Nunito Sans"; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); }
.tip-sheet p { margin: 0; font-size: var(--fs-base); line-height: 1.55; }
@media (max-width: 640px) {
  .spread .dealt.tip-open .card-tip { display: none; }      /* на телефоні — лише панель знизу */
}
.reading-all summary {
  cursor: pointer; list-style: none; font: 600 var(--fs-md) "Cormorant Garamond", "Noto Sans Symbols", serif; color: var(--gold);
}
.reading-all summary::-webkit-details-marker { display: none; }
.reading-all summary::before { content: "▸ "; display: inline-block; transition: transform .2s; }
.reading-all[open] summary::before { transform: rotate(90deg); }
.reading-all .reading-block { margin-top: 18px; }
.ritual-question { display: block; margin: 8px 0 4px; color: var(--muted); }
.ritual-question textarea { display: block; width: 100%; margin-top: 8px; }
.share ~ .btn { margin: 4px 8px 4px 0; }
/* Поле пароля з кнопкою-оком (static/js/password.js) */
.pw-field { position: relative; display: block; }
.pw-field input { width: 100%; box-sizing: border-box; padding-right: 44px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px;
  display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.pw-toggle:hover, .pw-toggle:focus-visible { color: var(--gold); }
.pw-toggle[aria-pressed="true"] { color: var(--gold); }
.pw-toggle[aria-pressed="true"] .slash { display: none; }
/* Плашка «Твоє тлумачення готове» (layout.html, static/js/ai-ready.js) — м'яко пульсує золотом */
.ai-ready { max-width: 1100px; margin: 0 auto 12px; padding: 0 16px; display: grid; gap: 8px; }
.ai-ready a { display: block; padding: 12px 18px; border-radius: 14px; text-decoration: none; color: var(--text);
  background: rgba(234, 199, 122, .14); border: 1px solid var(--gold); animation: ai-ready-pulse 2.4s ease-in-out infinite; }
.ai-ready a span { color: var(--gold); }
.ai-ready a b { color: var(--gold); white-space: nowrap; }
@keyframes ai-ready-pulse {
  0%, 100% { box-shadow: 0 0 0 rgba(234, 199, 122, 0); }
  50% { box-shadow: 0 0 22px rgba(234, 199, 122, .55); }
}
@media (prefers-reduced-motion: reduce) { .ai-ready a { animation: none; } }
.my-readings .fresh { color: var(--gold); font-weight: 600; font-size: var(--fs-sm); }
/* Вибір мови в шапці (layout.html): прапорець поточної мови, список інших — випадним меню */
.lang-switch { position: relative; flex: none; }
.lang-switch summary { list-style: none; display: flex; align-items: center; gap: 4px; cursor: pointer; padding: 4px 6px;
  border-radius: 8px; border: 1px solid var(--glass-border); color: var(--muted); font-size: var(--fs-xs); }
.lang-switch summary::-webkit-details-marker { display: none; }
.lang-switch summary:hover, .lang-switch[open] summary { border-color: var(--gold); color: var(--gold); }
.lang-switch img { width: 24px; height: 16px; object-fit: cover; border-radius: 3px; display: block; }
.lang-list { position: absolute; left: 0; top: calc(100% + 6px); z-index: 30; min-width: 150px; padding: 6px;
  display: grid; gap: 2px; border-radius: 12px; background: rgba(16, 9, 40, .97); border: 1px solid var(--glass-border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45); }
.lang-list a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--text);
  text-decoration: none; font-size: var(--fs-sm); white-space: nowrap; }
.lang-list a:hover, .lang-list a:focus-visible { background: rgba(234, 199, 122, .14); color: var(--gold); }
/* Шапка над вмістом сторінки: відкритий список мов не має ховатися під заголовком */
header { position: relative; z-index: 50; }
/* Тлумачення, що друкується на очах (reading.html, static/js/live.js) */
.ai-live-text { white-space: pre-line; margin: 12px 0 0; }
.ai-live-text::after { content: "▍"; color: var(--gold); animation: ai-live-cursor 1s steps(1) infinite; margin-left: 2px; }
@keyframes ai-live-cursor { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ai-live-text::after { animation: none; } }
/* Профіль: вибір мови в один рядок (me.html) */
.auth form.inline-form { flex-direction: row; align-items: center; flex-wrap: nowrap; gap: 10px; }
.auth form.inline-form select { width: auto; flex: 1 1 auto; min-width: 0; }
.auth form.inline-form .btn { flex: none; }
.auth select { font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--glass-border);
  background: rgba(255,255,255,.06); color: inherit; }
.auth select option { background: #140b33; }
/* Завантаження, поки AI ще не написав перших слів (reading.html): чорна діра з двома орбітами */
.ai-loader { position: relative; width: 76px; height: 76px; margin: 18px auto; }
.ai-loader .orbit, .ai-loader .core { position: absolute; left: 50%; top: 50%; border-radius: 50%; box-sizing: border-box; }
.ai-loader .orbit { width: 76px; height: 76px; margin: -38px 0 0 -38px; border: 1px solid rgba(234, 199, 122, .22);
  animation: ai-loader-spin 2.6s linear infinite; }
.ai-loader .orbit.inner { width: 50px; height: 50px; margin: -25px 0 0 -25px; animation-duration: 1.7s; animation-direction: reverse; }
.ai-loader .core { width: 22px; height: 22px; margin: -11px 0 0 -11px; background: #05030f;
  box-shadow: 0 0 0 2px var(--gold), 0 0 22px var(--gold-soft); animation: ai-loader-pulse 2.4s ease-in-out infinite; }
.ai-loader .orbit::after { content: ""; position: absolute; top: -4px; left: 50%; width: 8px; height: 8px; margin-left: -4px;
  border-radius: 50%; background: var(--gold); box-shadow: 0 0 12px var(--gold); }
.ai-loader .orbit.inner::after { width: 6px; height: 6px; margin-left: -3px; top: -3px; background: #f6e7c1; }
@keyframes ai-loader-spin { to { transform: rotate(360deg); } }
@keyframes ai-loader-pulse { 50% { box-shadow: 0 0 0 2px var(--gold), 0 0 36px var(--gold-soft); } }
@media (prefers-reduced-motion: reduce) { .ai-loader .orbit, .ai-loader .core { animation: none; } }
/* Карта дня: значення — підказкою при наведенні чи дотику (day.html) */
main.day .day-card { position: relative; display: inline-block; outline: none; cursor: help; }
main.day .day-tip { display: none; position: absolute; left: 50%; top: calc(100% - 14px); transform: translateX(-50%);
  width: min(360px, 88vw); z-index: 20; padding: 14px 16px; text-align: left; border-radius: 14px;
  background: rgba(16, 9, 40, .97); border: 1px solid var(--glass-border); box-shadow: 0 12px 34px rgba(0, 0, 0, .55); }
main.day .day-tip b { display: block; color: var(--gold); font: 600 var(--fs-md) "Cormorant Garamond", "Noto Sans Symbols", serif; }
main.day .day-tip p { margin: 6px 0 0; }
main.day .day-card:focus-visible .day-tip, main.day .day-card.open .day-tip { display: block; }
@media (hover: hover) { main.day .day-card:hover .day-tip { display: block; } }
main.day .hint { color: var(--muted); font-size: var(--fs-sm); margin: 0 0 10px; }
/* Швидке чи звичайне гадання (fragments :: speedChoice) */
.speed-choice { border: 1px solid var(--glass-border); display: grid; gap: 8px; padding: 12px 16px; margin: 0 0 14px; text-align: left; }
.speed-choice label { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.speed-choice input { accent-color: var(--gold); }
/* Побажання (feedback.html): пастка для ботів прихована від людей */
.feedback .hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
footer a { color: var(--muted); }
footer a:hover { color: var(--gold); }

/* «Як відбувається гадання» над розкладом (draw.html) */
.how-to { margin: 0 auto 12px; max-width: 760px; padding: 8px 16px; text-align: left; }
.how-to summary { cursor: pointer; color: var(--muted); font-size: var(--fs-sm); }
.how-to[open] summary { margin-bottom: 8px; }
.how-to p { margin: 6px 0; line-height: 1.5; }

/* Перевернута карта дня на головній — так само, як на /day */
.daycard.reversed .face img { transform: rotate(180deg); }

/* Конфіденційність (privacy.html) */
.privacy section { margin: 14px 0; }
.privacy h2 { margin: 0 0 6px; font-size: var(--fs-md); }
.privacy p { margin: 0; line-height: 1.6; }
