/* Зөн Таро — загвар */
:root {
  --bg: #0a0614;
  --bg2: #120a24;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-strong: rgba(24, 14, 46, 0.86);
  --line: rgba(232, 200, 135, 0.18);
  --line-soft: rgba(255, 255, 255, 0.08);
  --gold: #e8c887;
  --gold-hi: #f7e7c1;
  --gold-lo: #b8914a;
  --violet: #9b6cff;
  --violet-lo: #5b2fb8;
  --text: #f0eaf8;
  --muted: #aca2c2;
  --danger: #ff8f9c;
  --ok: #86e3b0;
  --radius: 18px;
  --card-ratio: 300 / 527;
  --display: 'Cormorant Garamond', 'Georgia', 'Times New Roman', serif;
  --body: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; overflow-x: clip; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  overflow-x: clip;
  max-width: 100%;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.12; margin: 0; text-wrap: balance; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 6px; }

#stars { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -2; }
.nebula { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.nebula::before {
  content: ''; position: absolute; inset: -20%;
  background:
    radial-gradient(38% 34% at 18% 22%, rgba(123, 63, 228, 0.30), transparent 70%),
    radial-gradient(34% 30% at 84% 14%, rgba(232, 200, 135, 0.10), transparent 70%),
    radial-gradient(46% 40% at 74% 86%, rgba(86, 40, 170, 0.30), transparent 70%),
    radial-gradient(30% 28% at 10% 90%, rgba(200, 80, 160, 0.10), transparent 70%);
  animation: nebula 26s ease-in-out infinite alternate;
}
@keyframes nebula {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(2%, -3%, 0) scale(1.08); }
}

/* ───── Толгой ───── */
#header {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  background: linear-gradient(rgba(10, 6, 20, 0.82), rgba(10, 6, 20, 0.55));
  border-bottom: 1px solid var(--line-soft);
}
.header-in { max-width: 1160px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-size: 1.45rem; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap; }
.brand-mark { width: 30px; height: 30px; display: grid; place-items: center; color: var(--gold); animation: spin 18s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.brand span.gold { color: var(--gold); }
.nav { display: flex; gap: 4px; margin-left: 12px; }
.nav a { padding: 8px 14px; border-radius: 999px; color: var(--muted); font-size: 0.93rem; font-weight: 500; transition: color 0.2s, background 0.2s; }
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--gold-hi); background: rgba(232, 200, 135, 0.10); }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.credit-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(232, 200, 135, 0.07); color: var(--gold-hi);
  font-weight: 600; font-size: 0.9rem; white-space: nowrap; transition: transform 0.2s, background 0.2s;
}
.credit-pill:hover { background: rgba(232, 200, 135, 0.14); }
.credit-pill.bump { animation: bump 0.6s var(--ease); }
@keyframes bump { 30% { transform: scale(1.18); } }
.avatar-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--violet-lo); overflow: hidden; padding: 0; display: grid; place-items: center; font-weight: 700; }
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; }
.menu { position: absolute; right: 20px; top: 62px; min-width: 220px; padding: 8px; border-radius: 14px; background: var(--panel-strong); border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); animation: pop 0.2s var(--ease); }
.menu .who { padding: 8px 12px 10px; border-bottom: 1px solid var(--line-soft); margin-bottom: 6px; }
.menu .who b { display: block; }
.menu .who small { color: var(--muted); word-break: break-all; }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; background: none; border-radius: 9px; }
.menu a:hover, .menu button:hover { background: rgba(255, 255, 255, 0.07); }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(0.97); } }

#tabbar { display: none; }

/* ───── Товч ───── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 13px 26px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 700; font-size: 0.98rem; white-space: nowrap;
  transition: transform 0.2s var(--ease), box-shadow 0.25s, background 0.25s, opacity 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-gold {
  color: #2a1a05; position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--gold-hi), var(--gold) 45%, var(--gold-lo));
  box-shadow: 0 8px 30px rgba(232, 200, 135, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.btn-gold::after {
  content: ''; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.55) 50%, transparent 70%);
  animation: sheen 3.6s ease-in-out infinite;
}
@keyframes sheen { 0%, 60% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
.btn-gold:hover:not([disabled]) { transform: translateY(-2px); box-shadow: 0 14px 40px rgba(232, 200, 135, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.5); }
.btn-ghost { border-color: var(--line); background: rgba(255, 255, 255, 0.03); color: var(--text); }
.btn-ghost:hover:not([disabled]) { background: rgba(255, 255, 255, 0.08); }
.btn-sm { padding: 7px 14px; font-size: 0.85rem; font-weight: 600; }
.btn-danger { border-color: rgba(255, 143, 156, 0.4); color: var(--danger); background: none; }
.link { color: var(--gold); border-bottom: 1px solid rgba(232, 200, 135, 0.4); }

/* ───── Ерөнхий бүтэц ───── */
#view { min-height: calc(100dvh - 64px); overflow-x: hidden; overflow-x: clip; }
.page { max-width: 1160px; margin: 0 auto; padding: 36px 20px 90px; animation: pageIn 0.55s var(--ease) both; }
.page.narrow { max-width: 780px; }
@keyframes pageIn { from { opacity: 0; transform: translateY(14px); } }
.eyebrow { color: var(--gold); letter-spacing: 0.22em; text-transform: uppercase; font-size: 0.74rem; font-weight: 700; }
.title { font-size: clamp(2rem, 5vw, 3.1rem); margin: 8px 0 10px; }
.lead { color: var(--muted); max-width: 62ch; }
.gold-text { background: linear-gradient(100deg, var(--gold-hi), var(--gold) 50%, var(--gold-lo)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.panel { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 22px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.center { text-align: center; }
.center .lead { margin-inline: auto; }
.muted { color: var(--muted); }
.spacer { height: 28px; }
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); transition-delay: calc(var(--d, 0) * 80ms); }
.reveal.in { opacity: 1; transform: none; }

/* ───── Нүүр ───── */
.hero { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 30px; align-items: center; min-height: min(640px, calc(100dvh - 120px)); padding-top: 10px; }
.hero h1 { font-size: clamp(2.5rem, 6.4vw, 4.5rem); margin: 14px 0 18px; }
.hero h1 em { font-style: italic; }
.ask { margin-top: 28px; display: flex; gap: 10px; padding: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); max-width: 560px; transition: border-color 0.3s, box-shadow 0.3s; }
.ask:focus-within { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(232, 200, 135, 0.10), 0 0 50px rgba(155, 108, 255, 0.25); }
.ask input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; padding: 0 16px; font-size: 1rem; }
.ask input::placeholder { color: #8479a0; }
.hero-note { margin-top: 14px; font-size: 0.86rem; color: var(--muted); }
.hero-cards { position: relative; height: 470px; perspective: 1400px; }
.hero-card {
  position: absolute; left: 50%; top: 50%; width: 210px; aspect-ratio: var(--card-ratio);
  margin: calc(210px * 527 / 300 / -2) 0 0 -105px; border-radius: 14px; overflow: hidden;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(232, 200, 135, 0.25), 0 0 60px rgba(155, 108, 255, 0.22);
  transform: translate3d(calc(var(--x) * var(--k, 1)), var(--y), 0) rotate(var(--r));
  animation: heroIn 1.3s var(--ease) both, float 7s ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.16s), calc(1.3s + var(--i) * 0.5s);
}
.hero-card img { width: 100%; height: 100%; object-fit: cover; }
@keyframes heroIn { from { opacity: 0; transform: translate3d(0, 90px, 0) rotate(0) scale(0.8); } }
@keyframes float { 50% { transform: translate3d(calc(var(--x) * var(--k, 1)), calc(var(--y) - 14px), 0) rotate(calc(var(--r) + 1.2deg)); } }
.hero-glow { position: absolute; left: 50%; top: 50%; width: 420px; height: 420px; margin: -210px; border-radius: 50%; background: radial-gradient(circle, rgba(155, 108, 255, 0.34), transparent 65%); animation: pulse 5s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.12); opacity: 0.7; } }
.orbit { position: absolute; left: 50%; top: 50%; width: 460px; height: 460px; margin: -230px; border-radius: 50%; border: 1px dashed rgba(232, 200, 135, 0.2); animation: spin 60s linear infinite; }
.orbit::before { content: '✦'; position: absolute; top: -11px; left: 50%; color: var(--gold); }

.section { margin-top: 84px; }
.section-head { margin-bottom: 26px; }
.section-head h2 { font-size: clamp(1.7rem, 4vw, 2.4rem); margin-top: 6px; }

.spreads { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.spread {
  position: relative; display: flex; flex-direction: column; gap: 8px; padding: 22px; text-align: left;
  border-radius: var(--radius); border: 1px solid var(--line-soft); background: var(--panel); overflow: hidden;
  transition: transform 0.35s var(--ease), border-color 0.3s, box-shadow 0.35s;
}
.spread::before { content: ''; position: absolute; inset: 0; background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 0%), rgba(232, 200, 135, 0.14), transparent 60%); opacity: 0; transition: opacity 0.3s; }
.spread:hover { transform: translateY(-5px); border-color: var(--line); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4); }
.spread:hover::before { opacity: 1; }
.spread > * { position: relative; }
.spread-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 13px; font-size: 1.3rem; color: var(--gold); background: rgba(232, 200, 135, 0.09); border: 1px solid var(--line); }
.spread h3 { font-size: 1.5rem; margin-top: 6px; }
.spread .tag { color: var(--gold); font-size: 0.84rem; font-weight: 600; }
.spread p { color: var(--muted); font-size: 0.92rem; flex: 1; }
.spread .cost { margin-top: 8px; display: flex; justify-content: space-between; align-items: center; font-size: 0.86rem; color: var(--muted); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 0.76rem; font-weight: 700; background: rgba(232, 200, 135, 0.12); color: var(--gold-hi); border: 1px solid var(--line); }
.badge.free { background: rgba(134, 227, 176, 0.12); color: var(--ok); border-color: rgba(134, 227, 176, 0.3); }
.badge.warn { background: rgba(255, 196, 110, 0.12); color: #ffd28a; border-color: rgba(255, 196, 110, 0.3); }
.badge.bad { background: rgba(255, 143, 156, 0.12); color: var(--danger); border-color: rgba(255, 143, 156, 0.3); }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; counter-reset: step; }
.step { padding: 24px; border-radius: var(--radius); border: 1px solid var(--line-soft); background: var(--panel); }
.step::before { counter-increment: step; content: counter(step, upper-roman); font-family: var(--display); font-size: 2rem; color: var(--gold); }
.step h3 { font-size: 1.35rem; margin: 6px 0; }
.step p { color: var(--muted); font-size: 0.93rem; }

.footer { margin-top: 90px; padding-top: 26px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 0.84rem; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ───── Багц ───── */
.packages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items: stretch; }
.pkg { position: relative; padding: 28px 24px; border-radius: 22px; border: 1px solid var(--line-soft); background: var(--panel); display: flex; flex-direction: column; gap: 6px; text-align: center; transition: transform 0.35s var(--ease), box-shadow 0.35s; }
.pkg:hover { transform: translateY(-6px); box-shadow: 0 22px 60px rgba(0, 0, 0, 0.45); }
.pkg.popular { border-color: var(--gold); background: linear-gradient(180deg, rgba(232, 200, 135, 0.11), rgba(255, 255, 255, 0.03)); }
.pkg .ribbon { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); padding: 3px 14px; border-radius: 999px; background: var(--gold); color: #2a1a05; font-size: 0.74rem; font-weight: 800; white-space: nowrap; }
.pkg h3 { font-size: 1.6rem; }
.pkg .num { font-family: var(--display); font-size: 3.6rem; line-height: 1; margin-top: 8px; }
.pkg .price { font-size: 1.25rem; font-weight: 700; margin: 10px 0 2px; }
.pkg .per { color: var(--muted); font-size: 0.84rem; margin-bottom: 16px; }
.pkg .btn { margin-top: auto; }

/* ───── Уншлага ───── */
.stage { max-width: 1100px; margin: 0 auto; padding: 26px 16px 90px; }
.stage-head { text-align: center; margin-bottom: 20px; animation: pageIn 0.5s var(--ease) both; }
.stage-head h1 { font-size: clamp(1.7rem, 4.6vw, 2.6rem); margin: 6px 0; }
.question-chip { display: inline-block; max-width: 100%; margin-top: 8px; padding: 8px 16px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line-soft); color: var(--gold-hi); font-family: var(--display); font-style: italic; font-size: 1.15rem; overflow-wrap: anywhere; }

.qform { max-width: 620px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; animation: pageIn 0.5s var(--ease) both; }
.qform textarea { width: 100%; min-height: 120px; resize: vertical; padding: 16px 18px; border-radius: 16px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); outline: 0; font-size: 1.05rem; transition: border-color 0.3s, box-shadow 0.3s; }
.qform textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(232, 200, 135, 0.1); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line-soft); background: rgba(255, 255, 255, 0.03); color: var(--muted); font-size: 0.86rem; transition: all 0.2s; }
.chip:hover { color: var(--text); border-color: var(--line); }
.qmeta { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 0.9rem; }
.form-error { color: var(--danger); font-size: 0.92rem; min-height: 1.3em; }

/* Сонгосон картын байрлалууд */
.slots { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 16px; margin: 4px auto 18px; --slot-w: 74px; transition: gap 0.5s; }
.slots:not(.big) .slot-name { display: none; }
.slots.big { --slot-w: clamp(118px, 21vw, 190px); gap: 22px; }
.slots.big.many { --slot-w: clamp(96px, 16vw, 150px); }
.slot { width: var(--slot-w); display: flex; flex-direction: column; align-items: center; gap: 8px; transition: width 0.7s var(--ease); }
.slot-label { font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); font-weight: 700; text-align: center; min-height: 2.3em; display: flex; align-items: flex-end; }
.slot-frame { position: relative; width: 100%; aspect-ratio: var(--card-ratio); border-radius: 9%/5%; border: 1.5px dashed rgba(232, 200, 135, 0.3); }
.slot-frame.next { border-color: var(--gold); animation: slotPulse 1.6s ease-in-out infinite; }
@keyframes slotPulse { 50% { box-shadow: 0 0 26px rgba(232, 200, 135, 0.35); } }
.slot-frame.filled { border-color: transparent; }
.slot-name { text-align: center; min-height: 3em; opacity: 0; transform: translateY(6px); transition: opacity 0.6s 0.5s, transform 0.6s 0.5s; }
.slot-name.show { opacity: 1; transform: none; }
.slot-name b { display: block; font-family: var(--display); font-size: 1.2rem; line-height: 1.15; }
.slot-name small { color: var(--muted); font-size: 0.78rem; }

/* Карт (3D эргэлт) */
.tcard { position: absolute; inset: 0; perspective: 1100px; border: 0; padding: 0; background: none; border-radius: 9%/5%; }
.tcard-in { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform 0.95s var(--ease); border-radius: inherit; }
.tcard.flipped .tcard-in { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: inherit; overflow: hidden; box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(232, 200, 135, 0.22); background: #1a1030; }
.face img { width: 100%; height: 100%; object-fit: cover; }
.face.front { transform: rotateY(180deg); }
.face.front.reversed img { transform: rotate(180deg); }
.tcard.can-flip { cursor: pointer; }
.tcard.can-flip .tcard-in { animation: beckon 2.4s ease-in-out infinite; animation-delay: calc(var(--i, 0) * 0.25s); }
@keyframes beckon { 50% { transform: translateY(-7px) rotateY(8deg); filter: drop-shadow(0 0 16px rgba(232, 200, 135, 0.5)); } }
.tcard.flipped::after { content: ''; position: absolute; inset: -18%; border-radius: 50%; background: radial-gradient(circle, rgba(232, 200, 135, 0.55), transparent 60%); pointer-events: none; opacity: 0; animation: flash 1.1s ease-out; z-index: -1; }
@keyframes flash { 30% { opacity: 1; transform: scale(1.1); } 100% { opacity: 0; transform: scale(1.5); } }

/* Хөзрийн дэлгэц (fan) */
.fan-wrap { position: relative; margin: 0 auto; user-select: none; -webkit-user-select: none; transition: height 0.6s var(--ease), opacity 0.5s; }
.fan-wrap.gone { opacity: 0; pointer-events: none; height: 0 !important; }
.fan-card {
  position: absolute; left: 50%; top: 34px; width: var(--cw); aspect-ratio: var(--card-ratio); margin-left: calc(var(--cw) / -2);
  padding: 0; border: 0; background: none; border-radius: 9%/5%;
  transform-origin: 50% var(--radius-px);
  transform: rotate(var(--a, 0deg));
  transition: transform 0.9s var(--ease), opacity 0.4s;
  transition-delay: calc(var(--i) * 22ms), 0s;
  will-change: transform;
}
.fan-card img { width: 100%; height: 100%; border-radius: inherit; box-shadow: -3px 0 12px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(232, 200, 135, 0.25); pointer-events: none; }
.fan-wrap.ready .fan-card { transition-delay: 0s; transition-duration: 0.28s, 0.4s; }
.fan-wrap.ready .fan-card:hover, .fan-wrap.ready .fan-card:focus-visible { transform: rotate(var(--a)) translateY(-22px); z-index: 2; }
.fan-wrap.ready .fan-card:hover img { box-shadow: 0 0 26px rgba(232, 200, 135, 0.6), 0 0 0 1.5px var(--gold); }
.fan-card.picked { opacity: 0; pointer-events: none; }
.fan-wrap.shuffling .fan-card { animation: riffle 0.62s ease-in-out 3; animation-delay: calc(var(--i) * 9ms); }
@keyframes riffle {
  0%, 100% { transform: translateX(0) rotate(0); }
  35% { transform: translateX(calc(var(--dir) * 78%)) rotate(calc(var(--dir) * 7deg)); }
  70% { transform: translateX(calc(var(--dir) * -12%)) rotate(calc(var(--dir) * -2deg)); }
}
.flyer { position: fixed; z-index: 60; pointer-events: none; border-radius: 9%/5%; overflow: hidden; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(232, 200, 135, 0.5); }
.flyer img { width: 100%; height: 100%; }
.hint { text-align: center; color: var(--muted); margin: 6px 0 2px; min-height: 1.6em; }
.hint b { color: var(--gold-hi); }
.stage-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 18px; }

/* Тайлбар */
.reading-text { max-width: 760px; margin: 30px auto 0; padding: 28px clamp(18px, 4vw, 36px); border-radius: 22px; border: 1px solid var(--line); background: linear-gradient(180deg, rgba(232, 200, 135, 0.06), rgba(255, 255, 255, 0.025)); animation: pageIn 0.7s var(--ease) both; }
.reading-text h3 { font-size: 1.5rem; color: var(--gold-hi); margin: 22px 0 8px; display: flex; gap: 10px; align-items: baseline; }
.reading-text h3::before { content: '✦'; color: var(--gold); font-size: 0.8em; }
.reading-text h3:first-child { margin-top: 0; }
.reading-text p { margin: 0 0 10px; color: #e4dcf1; font-size: 1.02rem; line-height: 1.75; }
.reading-text .caret { display: inline-block; width: 8px; height: 1.1em; margin-left: 3px; vertical-align: text-bottom; background: var(--gold); animation: blink 0.9s steps(2) infinite; border-radius: 2px; }
@keyframes blink { 50% { opacity: 0; } }
.thinking { display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); padding: 10px; }
.orb { width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(232, 200, 135, 0.25); border-top-color: var(--gold); animation: spin 0.9s linear infinite; }
.demo-note { margin: 0 0 16px; padding: 10px 14px; border-radius: 12px; font-size: 0.86rem; background: rgba(255, 196, 110, 0.08); border: 1px solid rgba(255, 196, 110, 0.25); color: #ffd28a; }

/* ───── Картын сан ───── */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0; }
.filter { padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line-soft); background: none; color: var(--muted); font-weight: 600; font-size: 0.9rem; transition: all 0.2s; }
.filter.active { color: #2a1a05; background: var(--gold); border-color: var(--gold); }
.lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 26px 20px; }
.lib-card { padding: 0; border: 0; background: none; text-align: center; animation: cardIn 0.6s var(--ease) both; animation-delay: calc(min(var(--i), 30) * 22ms); }
@keyframes cardIn { from { opacity: 0; transform: translateY(18px) rotate(-2deg); } }
.lib-card .img { border-radius: 9%/5%; overflow: hidden; aspect-ratio: var(--card-ratio); box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(232, 200, 135, 0.18); transition: transform 0.4s var(--ease), box-shadow 0.4s; background: #1a1030; }
.lib-card .img img { width: 100%; height: 100%; object-fit: cover; }
.lib-card:hover .img { transform: translateY(-7px) rotate(1.5deg); box-shadow: 0 20px 40px rgba(0, 0, 0, 0.55), 0 0 30px rgba(155, 108, 255, 0.35), 0 0 0 1px var(--gold); }
.lib-card b { display: block; margin-top: 9px; font-family: var(--display); font-size: 1.08rem; line-height: 1.15; }
.lib-card small { color: var(--muted); font-size: 0.74rem; }

/* ───── Модал ───── */
.modal-back { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 18px; background: rgba(5, 2, 12, 0.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade 0.25s both; overflow-y: auto; }
@keyframes fade { from { opacity: 0; } }
.modal { position: relative; width: min(100%, 460px); padding: 30px 26px; border-radius: 24px; background: var(--panel-strong); border: 1px solid var(--line); box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6); animation: modalIn 0.45s var(--ease) both; }
.modal.wide { width: min(100%, 720px); }
@keyframes modalIn { from { opacity: 0; transform: translateY(24px) scale(0.96); } }
.modal h2 { font-size: 1.9rem; margin-bottom: 8px; }
.modal-x { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.06); font-size: 1.1rem; }
.field { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-soft); background: rgba(255, 255, 255, 0.05); outline: 0; }
.field:focus { border-color: var(--gold); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 0.8rem; margin: 18px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line-soft); }
.gbtn { width: 100%; background: #fff; color: #1f1f1f; }
.gbtn:hover { background: #f1f1f1; }
.card-detail { display: grid; grid-template-columns: 200px 1fr; gap: 24px; align-items: start; }
.card-detail .img { border-radius: 12px; overflow: hidden; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--line); }
.kv { margin-top: 14px; }
.kv h4 { margin: 0 0 3px; font-size: 0.76rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); }
.kv p { color: #ddd4ec; }

/* ───── Түүх ───── */
.hist { display: flex; flex-direction: column; gap: 12px; margin-top: 24px; }
.hist-item { display: flex; align-items: center; gap: 16px; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--line-soft); background: var(--panel); transition: transform 0.3s var(--ease), border-color 0.3s; animation: cardIn 0.5s var(--ease) both; animation-delay: calc(min(var(--i), 20) * 40ms); }
.hist-item:hover { transform: translateX(5px); border-color: var(--line); }
.hist-thumbs { display: flex; flex-shrink: 0; }
.hist-thumbs img { width: 38px; aspect-ratio: var(--card-ratio); border-radius: 4px; margin-left: -14px; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(232, 200, 135, 0.2); object-fit: cover; }
.hist-thumbs img:first-child { margin-left: 0; }
.hist-thumbs img.rev { transform: rotate(180deg); }
.hist-body { min-width: 0; flex: 1; }
.hist-body b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-body small { color: var(--muted); }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .big { font-size: 3rem; color: var(--gold); margin-bottom: 10px; }

/* ───── Төлбөр ───── */
.checkout { max-width: 460px; margin: 0 auto; text-align: center; }
.invoice { margin: 22px 0; padding: 20px; border-radius: 16px; border: 1px dashed var(--line); text-align: left; }
.invoice div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
.invoice div span:first-child { color: var(--muted); }
.invoice .total { border-top: 1px solid var(--line-soft); margin-top: 8px; padding-top: 12px; font-size: 1.25rem; font-weight: 700; }
.success-ring { width: 96px; height: 96px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; font-size: 2.6rem; color: #0a2a18; background: radial-gradient(circle at 30% 30%, #c6ffe0, var(--ok)); box-shadow: 0 0 60px rgba(134, 227, 176, 0.5); animation: ringIn 0.8s var(--ease) both; }
@keyframes ringIn { from { transform: scale(0) rotate(-120deg); opacity: 0; } }

/* ───── Админ ───── */
.tabs { display: flex; gap: 6px; margin: 22px 0; border-bottom: 1px solid var(--line-soft); overflow-x: auto; }
.tab { padding: 10px 16px; border: 0; background: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.active { color: var(--gold-hi); border-bottom-color: var(--gold); }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.tile { padding: 18px; border-radius: 16px; border: 1px solid var(--line-soft); background: var(--panel); }
.tile small { color: var(--muted); font-size: 0.8rem; }
.tile .v { font-family: var(--display); font-size: 2.2rem; line-height: 1.1; margin: 4px 0; }
.tile .s { font-size: 0.8rem; color: var(--ok); }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 150px; margin-top: 14px; }
.bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; height: 100%; min-width: 0; }
.bar i { display: block; width: 100%; max-width: 34px; min-height: 2px; border-radius: 5px 5px 2px 2px; background: linear-gradient(var(--gold), var(--gold-lo)); transform-origin: bottom; animation: grow 0.8s var(--ease) both; }
.bar.v2 i { background: linear-gradient(var(--violet), var(--violet-lo)); }
@keyframes grow { from { transform: scaleY(0); } }
.bar small { font-size: 0.64rem; color: var(--muted); }
.bar .n { font-size: 0.66rem; color: var(--text); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: 16px; background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
th { color: var(--muted); font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .sub { display: block; color: var(--muted); font-size: 0.78rem; }
td.wrap { white-space: normal; min-width: 200px; max-width: 320px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .field { max-width: 300px; }
.row-actions { display: flex; gap: 6px; }

/* ───── Мэдэгдэл ───── */
.toasts { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { padding: 11px 20px; border-radius: 999px; background: var(--panel-strong); border: 1px solid var(--line); box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5); animation: toastIn 0.4s var(--ease) both; max-width: 90vw; text-align: center; }
.toast.err { border-color: rgba(255, 143, 156, 0.5); color: var(--danger); }
.toast.out { animation: toastOut 0.3s both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(0.95); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

/* ───── Гар утас ───── */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; text-align: center; min-height: 0; }
  .hero .lead, .ask { margin-inline: auto; }
  .hero-cards { height: 300px; order: -1; --k: 0.62; }
  .hero-card { width: 140px; margin: calc(140px * 527 / 300 / -2) 0 0 -70px; }
  .hero-glow { width: 300px; height: 300px; margin: -150px; }
  .orbit { width: 320px; height: 320px; margin: -160px; }
  .spreads, .steps { grid-template-columns: repeat(2, 1fr); }
  .packages { grid-template-columns: 1fr; max-width: 420px; margin-inline: auto; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .nav { display: none; }
  .header-in { padding: 10px 14px; }
  .page { padding: 24px 16px 110px; }
  .stage { padding-bottom: 110px; }
  #tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around;
    background: rgba(10, 6, 20, 0.9); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line-soft);
  }
  #tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 2px; font-size: 0.68rem; color: var(--muted); border-radius: 10px; }
  #tabbar a span { font-size: 1.15rem; line-height: 1.2; }
  #tabbar a.active { color: var(--gold-hi); }
  .toasts { bottom: 84px; }
  .ask { flex-direction: column; border-radius: 22px; padding: 10px; }
  .ask input { padding: 10px 12px; text-align: center; }
  .spreads, .steps { grid-template-columns: 1fr; }
  .section { margin-top: 60px; }
  .card-detail { grid-template-columns: 1fr; }
  .card-detail .img { max-width: 170px; margin: 0 auto; }
  .slots { --slot-w: 62px; gap: 8px 10px; }
  .slots.big { gap: 14px 12px; }
  .slot-label { font-size: 0.62rem; }
  .slot-name b { font-size: 1rem; }
  .lib { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 18px 12px; }
  .menu { right: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
