/* Kings Books: дизайн токени */
:root {
  --bg: #0b0a12;
  --bg-2: #13111d;
  --card: rgba(255, 255, 255, .045);
  --card-2: rgba(255, 255, 255, .08);
  --line: rgba(255, 255, 255, .09);
  --text: #f4f1ea;
  --muted: #a39fb3;
  --gold: #f5c451;
  --gold-2: #ffdf8a;
  --violet: #9b6bff;
  --pink: #ff6fa8;
  --ok: #4ade80;
  --danger: #ff6b6b;
  --radius: 18px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --head: "Unbounded", system-ui, "PingFang SC", "Hiragino Sans", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --body: "Manrope", system-ui, "PingFang SC", "Hiragino Sans", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body {
  margin: 0;
  font-family: var(--body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body.locked { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-family: var(--head); line-height: 1.1; margin: 0; letter-spacing: -.01em; }
::selection { background: var(--gold); color: #1a1405; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 8px; }

/* Фон: звезди + светещи кълба */
#stars { position: fixed; inset: 0; z-index: -2; width: 100%; height: 100%; }
.orb { position: fixed; z-index: -1; border-radius: 50%; filter: blur(90px); opacity: .45; pointer-events: none; }
.orb-a { width: 520px; height: 520px; background: radial-gradient(circle, var(--violet), transparent 70%); top: -160px; right: -120px; animation: drift 18s ease-in-out infinite alternate; }
.orb-b { width: 460px; height: 460px; background: radial-gradient(circle, #f59e0b, transparent 70%); bottom: -200px; left: -160px; opacity: .25; animation: drift 22s ease-in-out infinite alternate-reverse; }
@keyframes drift { to { transform: translate(-80px, 120px) scale(1.15); } }

/* Навигация */
.nav {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 24px;
  padding: 14px clamp(16px, 4vw, 48px);
  transition: background .3s, border-color .3s, backdrop-filter .3s;
  border-bottom: 1px solid transparent;
}
.nav.scrolled { background: rgba(11, 10, 18, .72); backdrop-filter: blur(16px) saturate(1.4); border-color: var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--head); font-weight: 700; font-size: 18px; }
.brand b { color: var(--gold); font-weight: 700; }
.brand-mark {
  display: block; width: 36px; height: 36px; border-radius: 11px;
  box-shadow: 0 6px 24px -6px rgba(155, 107, 255, .8);
  transition: transform .5s var(--spring);
}
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.08); }
.nav-links { display: flex; gap: 6px; margin-left: auto; }

/* Превключвател на езика */
.lang {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 13px;
  border: 1px solid var(--line); background: var(--card);
}
.lang button {
  position: relative; z-index: 1; border: 0; background: none; padding: 7px 11px; border-radius: 9px;
  font-size: 13px; font-weight: 800; letter-spacing: .04em; color: var(--muted); transition: color .3s;
}
.lang button[aria-pressed="true"] { color: #1c1203; }
.lang button:not([aria-pressed="true"]):hover { color: var(--text); }
.lang-thumb {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 9px;
  background: linear-gradient(135deg, var(--gold-2), var(--gold)); box-shadow: 0 4px 14px -4px rgba(245, 196, 81, .8);
  transition: transform .45s var(--spring);
}
.lang[data-active="en"] .lang-thumb { transform: translateX(100%); }
/* Плавна смяна на текста при смяна на езика */
main, .nav-links, .footer, .drawer-head, .drawer-body, .drawer-foot { transition: opacity .2s, filter .2s; }
body.switching main, body.switching .nav-links, body.switching .footer,
body.switching .drawer-head, body.switching .drawer-body, body.switching .drawer-foot { opacity: 0; filter: blur(6px); }
.nav-links a { padding: 8px 14px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: 15px; transition: color .2s, background .2s; }
.nav-links a:hover { color: var(--text); background: var(--card-2); }
.cart-btn {
  position: relative; display: grid; place-items: center; width: 46px; height: 46px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--card);
  transition: transform .25s var(--spring), background .2s;
}
.cart-btn:hover { background: var(--card-2); transform: translateY(-2px); }
.cart-btn.bump { animation: bump .5s var(--spring); }
@keyframes bump { 40% { transform: scale(1.25) rotate(-8deg); } }
.cart-count {
  position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px; padding: 0 6px;
  display: grid; place-items: center; border-radius: 999px; font-size: 12px; font-weight: 800;
  background: var(--gold); color: #1c1203; box-shadow: 0 0 0 3px var(--bg);
  transform: scale(0); transition: transform .3s var(--spring);
}
.cart-count.on { transform: scale(1); }

/* Бутони */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 24px; border-radius: 14px; border: 1px solid transparent;
  font-weight: 700; font-size: 15px; white-space: nowrap;
  transition: transform .25s var(--spring), box-shadow .25s, background .2s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--gold-2), var(--gold) 50%, #e59a1a);
  color: #1c1203; box-shadow: 0 10px 30px -10px rgba(245, 196, 81, .8);
  position: relative; overflow: hidden;
}
.btn-primary::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .55) 50%, transparent 70%);
  transform: translateX(-120%); transition: transform .7s var(--ease);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 40px -12px rgba(245, 196, 81, .9); }
.btn-primary:hover::after { transform: translateX(120%); }
.btn-ghost { background: var(--card); border-color: var(--line); }
.btn-ghost:hover { background: var(--card-2); transform: translateY(-2px); }
.btn-sm { padding: 10px 14px; font-size: 14px; border-radius: 11px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); font-size: 16px;
  transition: background .2s, transform .2s var(--spring);
}
.icon-btn:hover { background: var(--card-2); transform: scale(1.06); }

/* Hero */
.hero {
  display: grid; grid-template-columns: 1.05fr 1fr; align-items: center; gap: 40px;
  max-width: 1240px; margin: 0 auto; padding: clamp(40px, 7vw, 90px) clamp(16px, 4vw, 48px) 60px;
  min-height: min(86vh, 760px);
}
.pill {
  display: inline-flex; align-items: center; gap: 10px; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--muted); font-size: 14px; font-weight: 600;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(74, 222, 128, .6); animation: ping 2s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 10px rgba(74, 222, 128, 0); } 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); } }
.hero h1 { font-size: clamp(38px, 6vw, 74px); font-weight: 800; margin: 22px 0 18px; }
.grad {
  background: linear-gradient(90deg, var(--gold-2), var(--gold), var(--pink), var(--violet), var(--gold-2));
  background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 8s linear infinite;
}
@keyframes shimmer { to { background-position: 300% 0; } }
.hero p { color: var(--muted); font-size: clamp(16px, 1.6vw, 19px); max-width: 520px; margin: 0 0 30px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }
.stats { display: flex; gap: clamp(20px, 4vw, 44px); margin: 44px 0 0; }
.stats div { display: flex; flex-direction: column-reverse; }
.stats dt { font-family: var(--head); font-size: 28px; font-weight: 700; }
.stats .plus { color: var(--gold); }
.stats dd { margin: 0; color: var(--muted); font-size: 14px; }

.hero-art { position: relative; height: 520px; perspective: 1400px; }
.hero-art .book3d { position: absolute; width: 220px; animation: float 6s ease-in-out infinite; }
.hero-art .book3d:nth-child(1) { left: 6%; top: 18%; --r: -14deg; animation-delay: -1s; z-index: 1; }
.hero-art .book3d:nth-child(2) { left: 34%; top: 2%; --r: 6deg; width: 250px; z-index: 3; animation-delay: -3s; }
.hero-art .book3d:nth-child(3) { left: 58%; top: 26%; --r: 16deg; z-index: 2; animation-delay: -4.5s; }
.hero-art .book3d:nth-child(4) { left: 26%; top: 52%; --r: -6deg; width: 190px; z-index: 4; animation-delay: -2s; }
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(var(--r)) rotateY(-14deg); }
  50% { transform: translateY(-18px) rotate(calc(var(--r) * .7)) rotateY(-4deg); }
}
.parallax { transition: transform .4s var(--ease); height: 100%; perspective: 1400px; }

/* Корица на книга */
.book3d { position: relative; aspect-ratio: 2 / 3; transform-style: preserve-3d; }
.cover {
  position: absolute; inset: 0; border-radius: 6px 12px 12px 6px; overflow: hidden;
  padding: 10% 10% 12% 14%; display: flex; flex-direction: column;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, .45) 0, rgba(255, 255, 255, .12) 2.5%, rgba(0, 0, 0, .25) 5%, transparent 9%),
    var(--pat, none),
    linear-gradient(155deg, var(--c2), var(--c1) 75%);
  box-shadow: 0 30px 50px -20px rgba(0, 0, 0, .8), inset 0 0 0 1px rgba(255, 255, 255, .08);
  color: #fff; container-type: inline-size;
}
.cover::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .22) 48%, transparent 60%);
  transform: translateX(-100%); transition: transform .9s var(--ease);
}
.p1 { --pat: radial-gradient(circle at 80% 18%, rgba(255, 255, 255, .22) 0 14%, transparent 15%), radial-gradient(circle at 80% 18%, transparent 0 22%, rgba(255, 255, 255, .1) 23% 24%, transparent 25%); }
.p2 { --pat: repeating-linear-gradient(135deg, rgba(255, 255, 255, .07) 0 2px, transparent 2px 14px); }
.p3 { --pat: linear-gradient(transparent 62%, rgba(0, 0, 0, .35) 62%), radial-gradient(ellipse at 50% 120%, rgba(255, 255, 255, .25), transparent 55%); }
.p4 { --pat: radial-gradient(rgba(255, 255, 255, .16) 1.5px, transparent 1.6px) 0 0 / 14px 14px; }
.cover-genre { font-size: 7cqw; text-transform: uppercase; letter-spacing: .14em; font-weight: 700; opacity: .75; }
.cover h4 { font-family: var(--head); font-size: 11.5cqw; line-height: 1.08; margin: 8% 0 0; font-weight: 700; text-wrap: balance; text-shadow: 0 2px 12px rgba(0, 0, 0, .35); }
.cover-mark { margin-top: auto; font-size: 22cqw; line-height: 1; opacity: .9; filter: drop-shadow(0 4px 12px rgba(0, 0, 0, .4)); }
.cover-author { font-size: 7.5cqw; font-weight: 600; opacity: .9; margin-top: 6%; }
.book3d::before { /* страници отстрани */
  content: ""; position: absolute; top: 2%; bottom: 2%; right: -6px; width: 8px; border-radius: 0 3px 3px 0;
  background: repeating-linear-gradient(180deg, #f3ecdc 0 1px, #d9cfb8 1px 2px);
  transform: translateZ(-1px); box-shadow: 2px 0 6px rgba(0, 0, 0, .4);
}

/* Лента с жанрове */
.marquee { overflow: hidden; border-block: 1px solid var(--line); background: rgba(255, 255, 255, .02); mask: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); }
.marquee-track { display: flex; gap: 48px; width: max-content; padding: 18px 0; animation: scroll-x 40s linear infinite; }
.marquee-track span { font-family: var(--head); font-size: 22px; font-weight: 700; color: transparent; -webkit-text-stroke: 1px rgba(255, 255, 255, .35); white-space: nowrap; }
.marquee-track span:nth-child(3n) { color: var(--gold); -webkit-text-stroke: 0; }
@keyframes scroll-x { to { transform: translateX(-50%); } }

/* Секции */
.section { max-width: 1240px; margin: 0 auto; padding: 80px clamp(16px, 4vw, 48px) 20px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.section-head h2 { font-size: clamp(26px, 3.4vw, 40px); }
.scroller-btns { display: flex; gap: 8px; }

/* Хоризонтален списък */
.scroller {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 230px); gap: 22px;
  overflow-x: auto; scroll-snap-type: x mandatory; padding: 20px 4px 30px; scrollbar-width: none;
}
.scroller::-webkit-scrollbar { display: none; }
.scroller > * { scroll-snap-align: start; }
.pick { cursor: pointer; perspective: 900px; }
.pick .book3d { transition: transform .5s var(--ease); transform: rotateY(-18deg); }
.pick:hover .book3d { transform: rotateY(0) translateY(-10px) scale(1.03); }
.pick:hover .cover::after { transform: translateX(100%); }
.pick-rank { font-family: var(--head); font-size: 56px; font-weight: 800; line-height: 1; color: transparent; -webkit-text-stroke: 1.5px var(--gold); margin-bottom: -18px; position: relative; z-index: 2; text-shadow: 0 6px 20px rgba(0, 0, 0, .6); }
.pick-meta { margin-top: 16px; }
.pick-meta strong { display: block; font-size: 15px; line-height: 1.3; }
.pick-meta span { color: var(--muted); font-size: 14px; }

/* Инструменти */
.tools { display: flex; gap: 10px; flex-wrap: wrap; }
.search {
  display: flex; align-items: center; gap: 8px; padding: 0 14px; height: 46px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--card); color: var(--muted); transition: border-color .2s, box-shadow .2s;
}
.search:focus-within { border-color: rgba(245, 196, 81, .6); box-shadow: 0 0 0 4px rgba(245, 196, 81, .12); }
.search input { border: 0; background: none; outline: none; width: min(240px, 50vw); color: var(--text); }
select {
  height: 46px; padding: 0 38px 0 14px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23a39fb3' stroke-width='2'%3E%3Cpath d='m1 1 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 14px center;
  appearance: none; cursor: pointer;
}
select option { background: var(--bg-2); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 30px; }
.chip {
  padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--card);
  font-weight: 600; font-size: 14px; color: var(--muted); transition: all .25s var(--ease);
}
.chip:hover { color: var(--text); border-color: rgba(255, 255, 255, .2); }
.chip[aria-selected="true"] { background: var(--text); color: var(--bg); border-color: var(--text); transform: scale(1.04); }
.chip small { opacity: .6; margin-left: 4px; }

/* Мрежа с книги */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 22px; }
.card {
  position: relative; display: flex; flex-direction: column; padding: 16px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line);
  transition: transform .4s var(--ease), border-color .3s, background .3s, box-shadow .4s;
  transform-style: preserve-3d; will-change: transform;
}
.card::before { /* светлина, която следва мишката */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 50%), rgba(245, 196, 81, .13), transparent 45%);
}
.card:hover { border-color: rgba(245, 196, 81, .35); background: var(--card-2); box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .9); }
.card:hover::before { opacity: 1; }
.card:hover .cover::after { transform: translateX(100%); }
.card-cover { display: block; padding: 10px 26px 4px; border: 0; background: none; cursor: pointer; perspective: 800px; }
.card-cover .book3d { transition: transform .5s var(--ease); transform: translateZ(30px); }
.card:hover .card-cover .book3d { transform: translateZ(50px) rotateY(-10deg); }
.badge {
  position: absolute; top: 14px; left: 14px; z-index: 3; padding: 5px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 800; background: var(--gold); color: #1c1203; transform: translateZ(60px);
}
.badge.new { background: var(--ok); }
.badge.sale { background: var(--pink); color: #2a0614; }
.card-body { display: flex; flex-direction: column; gap: 4px; margin-top: 16px; flex: 1; }
.card-genre { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--gold); font-weight: 700; }
.card h3 { font-family: var(--body); font-size: 17px; font-weight: 800; line-height: 1.3; }
.card-author { color: var(--muted); font-size: 14px; }
.stars { color: var(--gold); font-size: 13px; letter-spacing: 1px; }
.stars span { color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; }
.price { font-family: var(--head); font-size: 20px; font-weight: 700; }
.price s { font-family: var(--body); font-size: 13px; color: var(--muted); margin-left: 6px; font-weight: 500; }
.add-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: 12px;
  border: 0; background: var(--text); color: var(--bg); font-weight: 800; font-size: 14px;
  transition: transform .25s var(--spring), background .25s, color .25s;
}
.add-btn:hover { transform: scale(1.06); background: var(--gold); }
.add-btn.in { background: rgba(74, 222, 128, .15); color: var(--ok); }
.add-btn.in:hover { background: rgba(255, 107, 107, .15); color: var(--danger); }
.card.hide { display: none; }
.card.enter { animation: card-in .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes card-in { from { opacity: 0; transform: translateY(30px) scale(.96); } }
.empty { text-align: center; color: var(--muted); padding: 60px 0; font-size: 18px; }

/* Как работи */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.step { padding: 30px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); position: relative; overflow: hidden; }
.step::after { content: ""; position: absolute; width: 180px; height: 180px; right: -60px; top: -60px; border-radius: 50%; background: radial-gradient(circle, rgba(155, 107, 255, .25), transparent 70%); }
.step-n { font-family: var(--head); font-size: 15px; color: var(--gold); font-weight: 700; }
.step h3 { font-size: 22px; margin: 18px 0 8px; }
.step p { margin: 0; color: var(--muted); }

/* Бюлетин */
.news {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 30px; padding: clamp(28px, 5vw, 56px);
  border-radius: 28px; border: 1px solid rgba(245, 196, 81, .25);
  background: radial-gradient(600px circle at 0% 0%, rgba(245, 196, 81, .16), transparent 60%), radial-gradient(600px circle at 100% 100%, rgba(155, 107, 255, .2), transparent 60%), var(--bg-2);
}
.news h2 { font-size: clamp(24px, 3vw, 34px); }
.news p { color: var(--muted); margin: 10px 0 0; }
.news-row { display: flex; gap: 10px; }
.news input, .promo input, .checkout input {
  height: 50px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--line); background: rgba(0, 0, 0, .3);
  outline: none; min-width: 0; transition: border-color .2s, box-shadow .2s;
}
.news input { width: 280px; }
.news input:focus, .promo input:focus, .checkout input:focus { border-color: rgba(245, 196, 81, .6); box-shadow: 0 0 0 4px rgba(245, 196, 81, .12); }

.footer {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 1240px; margin: 80px auto 0; padding: 30px clamp(16px, 4vw, 48px) 40px;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 14px;
}

/* Кошница */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(5, 4, 10, .6); backdrop-filter: blur(4px); opacity: 0; pointer-events: none; transition: opacity .35s; }
.scrim.on { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 60; width: min(440px, 100vw);
  display: flex; flex-direction: column; background: rgba(19, 17, 29, .96); backdrop-filter: blur(20px);
  border-left: 1px solid var(--line); transform: translateX(105%); transition: transform .5s var(--ease);
}
.drawer.on { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 22px 16px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 22px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 12px 22px; }
.drawer-foot { padding: 18px 22px 24px; border-top: 1px solid var(--line); display: grid; gap: 16px; }
.line { display: grid; grid-template-columns: 54px 1fr auto; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); animation: line-in .4s var(--ease) both; }
.line.out { animation: line-out .35s var(--ease) forwards; }
@keyframes line-in { from { opacity: 0; transform: translateX(30px); } }
@keyframes line-out { to { opacity: 0; transform: translateX(60px); height: 0; padding: 0; } }
.line .book3d { width: 54px; }
.line .book3d::before { display: none; }
.line strong { display: block; font-size: 14px; line-height: 1.3; }
.line span { color: var(--muted); font-size: 13px; }
.line-right { text-align: right; display: grid; gap: 4px; justify-items: end; }
.line-right b { font-family: var(--head); font-size: 15px; }
.remove { border: 0; background: none; color: var(--muted); font-size: 13px; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
.remove:hover { color: var(--danger); }
.cart-empty { text-align: center; padding: 60px 10px; color: var(--muted); }
.cart-empty .big { font-size: 60px; display: block; animation: float-s 3s ease-in-out infinite; }
@keyframes float-s { 50% { transform: translateY(-10px) rotate(-6deg); } }
.promo { display: flex; gap: 8px; }
.promo input { flex: 1; height: 42px; text-transform: uppercase; }
.promo-msg { font-size: 13px; margin-top: -8px; }
.promo-msg.ok { color: var(--ok); }
.promo-msg.err { color: var(--danger); }
.totals { display: grid; gap: 6px; font-size: 15px; }
.totals > div { display: flex; justify-content: space-between; color: var(--muted); }
.totals .discount { color: var(--ok); }
.totals .total { color: var(--text); font-size: 20px; font-weight: 800; padding-top: 8px; border-top: 1px dashed var(--line); margin-top: 4px; }
.totals .total span:last-child { font-family: var(--head); }

/* Модали */
.modal {
  width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 40px); padding: 0; border: 1px solid var(--line);
  border-radius: 24px; background: var(--bg-2); color: var(--text); overflow: auto;
}
.modal-sm { width: min(460px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(5, 4, 10, .7); backdrop-filter: blur(6px); }
.modal[open] { animation: pop .45s var(--spring); }
.modal[open]::backdrop { animation: fade .3s; }
@keyframes pop { from { opacity: 0; transform: translateY(20px) scale(.94); } }
@keyframes fade { from { opacity: 0; } }
.modal-close { position: absolute; top: 14px; right: 14px; z-index: 2; }
.modal-body { padding: clamp(22px, 4vw, 40px); }
.detail { display: grid; grid-template-columns: 260px 1fr; gap: 36px; align-items: start; }
.detail .book3d { animation: float 6s ease-in-out infinite; --r: -3deg; }
.detail h2 { font-size: clamp(24px, 3vw, 32px); margin: 8px 0 6px; }
.detail .card-author { font-size: 16px; }
.detail p { color: #d4d0de; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 24px; padding: 0; list-style: none; }
.facts li { padding: 6px 12px; border-radius: 999px; background: var(--card-2); font-size: 13px; color: var(--muted); }
.facts b { color: var(--text); }
.detail-buy { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.detail-buy .price { font-size: 30px; }

.checkout h2 { font-size: 24px; margin-bottom: 6px; }
.checkout p { color: var(--muted); margin: 0 0 20px; }
.checkout form { display: grid; gap: 12px; }
.checkout label { font-size: 14px; font-weight: 700; }
.checkout .note { font-size: 13px; padding: 12px 14px; border-radius: 12px; background: rgba(245, 196, 81, .1); border: 1px solid rgba(245, 196, 81, .3); color: var(--gold-2); }
.checkout .err { color: var(--danger); font-size: 14px; min-height: 1em; }
.success { text-align: center; }
.success .check {
  width: 84px; height: 84px; margin: 6px auto 18px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(74, 222, 128, .15); color: var(--ok); font-size: 40px; animation: pop .6s var(--spring);
}
.success code { font-family: var(--head); color: var(--gold); font-size: 18px; }

/* Тостове */
.toasts { position: fixed; left: 50%; bottom: 24px; z-index: 90; display: grid; gap: 10px; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 14px;
  background: rgba(30, 27, 44, .95); border: 1px solid var(--line); backdrop-filter: blur(10px);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, .7); font-weight: 600; font-size: 14px;
  animation: toast-in .45s var(--spring);
}
.toast.out { animation: toast-out .3s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(20px) scale(.9); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px) scale(.95); } }

/* Летяща книга към кошницата */
.flyer { position: fixed; z-index: 80; pointer-events: none; }
#confetti { position: fixed; inset: 0; z-index: 100; pointer-events: none; width: 100%; height: 100%; }

/* Появяване при скрол */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .8s var(--ease), transform .8s var(--ease); transition-delay: var(--d, 0s); }
.reveal.in { opacity: 1; transform: none; }

/* Мобилни */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; min-height: 0; }
  .hero-art { height: 380px; order: -1; margin: -10px -16px 0; }
  .hero-art .book3d { width: 150px; }
  .hero-art .book3d:nth-child(2) { width: 170px; }
  .hero-art .book3d:nth-child(4) { width: 130px; }
  .steps { grid-template-columns: 1fr; }
  .news { grid-template-columns: 1fr; }
  .news input { width: 100%; }
  .detail { grid-template-columns: 1fr; }
  .detail .book3d { width: 200px; margin: 0 auto; }
}
@media (max-width: 600px) {
  .nav-links { display: none; }
  .nav { gap: 10px; }
  .lang { margin-left: auto; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .card { padding: 10px; }
  .card-cover { padding: 6px 12px 0; }
  .card h3 { font-size: 15px; }
  .card-foot { flex-direction: column; align-items: stretch; }
  .add-btn { justify-content: center; }
  .price { font-size: 18px; }
  .tools, .search { width: 100%; }
  .search input { width: 100%; }
  .news-row { flex-direction: column; }
  .stats dt { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}

/* Поръчка: проверка на плащането и изтегляне */
.spinner { width: 54px; height: 54px; margin: 10px auto 18px; border-radius: 50%; border: 4px solid var(--card-2); border-top-color: var(--gold); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.success .check.wait { background: rgba(245, 196, 81, .15); color: var(--gold); }
.success .check.bad { background: rgba(255, 107, 107, .15); color: var(--danger); }
.dl-list { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 10px; }
.dl-list li { display: grid; grid-template-columns: 44px 1fr; gap: 6px 14px; align-items: center; padding: 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); animation: line-in .5s var(--ease) both; }
.dl-cover .book3d { width: 44px; }
.dl-cover .book3d::before { display: none; }
.dl-info strong { display: block; font-size: 14px; line-height: 1.3; }
.dl-info span { color: var(--muted); font-size: 13px; }
.dl-btns { grid-column: 1 / -1; display: flex; gap: 8px; }
.dl-btns .btn { flex: 1; }
.dl-btns { flex-wrap: wrap; align-items: center; }
.keep { font-size: 13px; color: var(--muted); text-align: center; margin: 16px 0 0 !important; }
.card-author b { color: var(--text); font-weight: 700; }

/* Акаунт в менюто */
.account-btn {
  position: relative; display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 12px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--card); transition: background .2s, transform .25s var(--spring);
}
.account-btn:hover { background: var(--card-2); transform: translateY(-2px); }
.account-btn.on { border-color: rgba(245, 196, 81, .4); }
.balance-chip { font: 700 14px var(--head); color: var(--gold); white-space: nowrap; }

/* Общи */
.muted { color: var(--muted); }
.small { font-size: 13px; }
.spinner.small { width: 28px; height: 28px; border-width: 3px; margin: 8px 0; }

/* Вход / регистрация */
.auth form, .account form { display: grid; gap: 10px; }
.auth label { font-size: 14px; font-weight: 700; }
.auth input, .account input {
  height: 48px; padding: 0 14px; border-radius: 13px; border: 1px solid var(--line); background: rgba(0, 0, 0, .3);
  outline: none; width: 100%; transition: border-color .2s, box-shadow .2s;
}
.auth input:focus, .account input:focus { border-color: rgba(245, 196, 81, .6); box-shadow: 0 0 0 4px rgba(245, 196, 81, .12); }
.pass-row { position: relative; }
.pass-toggle { position: absolute; right: 6px; top: 6px; height: 36px; width: 40px; border: 0; border-radius: 10px; background: none; opacity: .7; }
.pass-toggle:hover { opacity: 1; background: var(--card-2); }
.hint { margin: -4px 0 0; font-size: 13px; color: var(--muted); }
.err { color: var(--danger); font-size: 14px; min-height: 1em; }
.tabs { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 4px; margin: 6px 0 22px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.tabs button { position: relative; z-index: 1; border: 0; background: none; padding: 10px; border-radius: 10px; font-weight: 800; color: var(--muted); transition: color .3s; }
.tabs button[aria-selected="true"] { color: #1c1203; }
.tabs-thumb { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 10px; background: linear-gradient(135deg, var(--gold-2), var(--gold)); transition: transform .45s var(--spring); }
.tabs[data-active="register"] .tabs-thumb { transform: translateX(100%); }

/* Kings Shield */
.shield-wrap { margin: 6px 0 2px; }
.shield {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border-radius: 14px;
  border: 1px solid var(--line); background: linear-gradient(135deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .02));
  text-align: left; font-weight: 700; transition: border-color .3s, box-shadow .3s;
}
.shield:hover { border-color: rgba(245, 196, 81, .4); }
.shield-box {
  position: relative; display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, .35); color: transparent; transition: all .35s var(--spring);
}
.shield-box svg { transform: scale(.4); transition: transform .4s var(--spring); }
.shield-label { flex: 1; }
.shield-brand { font: 600 11px var(--body); color: var(--muted); letter-spacing: .04em; text-align: right; line-height: 1.2; }
.shield-brand b { color: var(--gold); }
.shield[data-state="checking"] .shield-box { border-color: transparent; border-top-color: var(--gold); border-right-color: var(--gold); border-radius: 50%; animation: spin .7s linear infinite; }
.shield[data-state="ok"] { border-color: rgba(74, 222, 128, .5); box-shadow: 0 0 0 4px rgba(74, 222, 128, .08); }
.shield[data-state="ok"] .shield-box { background: var(--ok); border-color: var(--ok); color: #06240f; }
.shield[data-state="ok"] .shield-box svg { transform: scale(1); }
.shield[data-state="fail"] { border-color: rgba(255, 107, 107, .5); animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
.shield-msg { font-size: 13px; color: var(--danger); margin-top: 6px; min-height: 0; }

/* Акаунт */
.account { display: grid; gap: 22px; }
.acc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-right: 44px; }
.acc-balance { display: grid; margin-top: 6px; }
.acc-balance small { color: var(--muted); font-weight: 600; }
.acc-balance b { font: 800 40px/1.1 var(--head); background: linear-gradient(90deg, var(--gold-2), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.acc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.acc-sec { padding: 18px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); }
.acc-sec h3 { font-size: 16px; margin-bottom: 6px; }
.acc-sec > p { margin: 0 0 12px; font-size: 14px; }
.topup-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.topup-opt {
  height: 48px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0, 0, 0, .25);
  font: 700 15px var(--head); transition: all .25s var(--spring);
}
.topup-opt:hover { border-color: var(--gold); color: var(--gold); transform: translateY(-2px); }
.topup-custom { display: flex; gap: 8px; margin-top: 8px; }
.topup-custom input { height: 42px; }
.ledger { list-style: none; margin: 0; padding: 0; }
.ledger li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.ledger li:last-child { border: 0; }
.ledger small { display: block; color: var(--muted); font-size: 12px; }
.ledger .pos { color: var(--ok); }
.ledger .neg { color: var(--text); }
.pay-opts { display: grid; gap: 10px; margin: 6px 0 14px; }
.pay-opts a { color: var(--gold); }

@media (max-width: 700px) {
  .acc-grid { grid-template-columns: 1fr; }
  .topup-grid { grid-template-columns: repeat(2, 1fr); }
  .account-btn { padding: 0 10px; }
}
@media (max-width: 600px) {
  .balance-chip { font-size: 12px; }
  .lang button { padding: 7px 8px; }
}

/* Digiseller */
.link-btn { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-btn:hover, .link-btn:focus-visible { color: var(--text, #fff); }
#dsModal h3 { margin: 0 0 6px; }

/* Меню за езика (<details>, работи и без JavaScript) */
.lang-menu { position: relative; }
.nav-links + .lang-menu { margin-left: 0; }
.lang-menu summary {
  list-style: none; display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none;
  padding: 8px 12px; border-radius: 13px; border: 1px solid var(--line); background: var(--card);
  font-size: 13px; font-weight: 800; letter-spacing: .04em; color: var(--text); transition: border-color .2s, background .2s;
}
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary:hover, .lang-menu[open] summary { border-color: rgba(245, 196, 81, .5); background: var(--card-2); }
.lang-menu ul {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; margin: 0; padding: 6px; list-style: none;
  display: grid; grid-template-columns: repeat(2, minmax(120px, 1fr)); gap: 2px; min-width: 270px;
  background: rgba(19, 17, 29, .97); backdrop-filter: blur(18px); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .8); animation: menu-in .2s var(--ease);
}
.lang-menu a { display: block; padding: 8px 12px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: 14px; }
.lang-menu a:hover, .lang-menu a:focus-visible { color: var(--text); background: var(--card-2); }
.lang-menu a[aria-current] { color: #1c1203; background: linear-gradient(135deg, var(--gold-2), var(--gold)); }
@keyframes menu-in { from { opacity: 0; transform: translateY(-6px); } }
.lang-suggest {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 70; display: flex; align-items: center; gap: 6px;
  max-width: calc(100vw - 32px); padding: 6px 6px 6px 16px; border-radius: 999px; background: rgba(19, 17, 29, .96);
  border: 1px solid rgba(245, 196, 81, .4); box-shadow: 0 18px 50px -12px rgba(0, 0, 0, .8); animation: menu-in .3s var(--ease);
}
.lang-suggest a { color: var(--gold-2); font-weight: 700; font-size: 14px; }
.lang-suggest button { border: 0; background: var(--card-2); color: var(--muted); width: 30px; height: 30px; border-radius: 50%; cursor: pointer; }
@media (max-width: 600px) { .lang-menu { margin-left: auto; } .lang-menu summary { padding: 8px 10px; } }

/* Каталогът от сървъра (преди JavaScript) и линкове към страниците на книгите */
.ssr-card { padding: 18px; }
.card h3 a { color: inherit; }
.card h3 a:hover { color: var(--gold-2); }
.more-link { display: inline-block; margin-top: 16px; color: var(--gold-2); font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.dl-more { position: relative; }
.dl-more summary { cursor: pointer; padding: 7px 12px; border-radius: 10px; border: 1px solid var(--line); font-size: 13px; font-weight: 700; color: var(--muted); list-style: none; }
.dl-more summary::-webkit-details-marker { display: none; }
.dl-more div { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.dl-more a { padding: 5px 10px; border-radius: 8px; background: var(--card-2); font-size: 13px; font-weight: 600; }
.dl-more a:hover { color: var(--gold-2); }
.news-shield { grid-column: 1 / -1; margin-top: 12px; }
#newsErr { grid-column: 1 / -1; }

/* Отделни страници: книга, 404, отписване */
.page-main { max-width: 1120px; margin: 0 auto; padding: 24px clamp(16px, 4vw, 48px) 0; position: relative; z-index: 1; }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 14px; color: var(--muted); margin: 8px 0 26px; }
.crumbs a:hover { color: var(--text); }
.bp-hero { display: grid; grid-template-columns: minmax(220px, 360px) 1fr; gap: clamp(24px, 5vw, 60px); align-items: start; }
.bp-cover img { width: 100%; height: auto; border-radius: 6px 16px 16px 6px; box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .9), 0 0 0 1px rgba(255, 255, 255, .06); display: block; }
.bp-info h1 { font-size: clamp(28px, 4.2vw, 46px); margin: 10px 0 16px; text-wrap: balance; }
.bp-desc { font-size: 18px; color: var(--muted); margin: 0; max-width: 60ch; }
.bp-buy { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.bp-buy .price { font-size: 32px; }
.bp-langs { display: flex; flex-wrap: wrap; gap: 6px; margin: 22px 0 0; }
.bp-langs a { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.bp-langs a:hover { color: var(--text); }
.bp-langs a[aria-current] { color: var(--gold-2); border-color: rgba(245, 196, 81, .5); }
.bp-sec { margin-top: 64px; }
.bp-sec h2 { font-size: clamp(22px, 2.6vw, 30px); margin-bottom: 20px; }
.bp-toc { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.bp-toc li { display: flex; gap: 12px; align-items: baseline; padding: 14px 16px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); font-weight: 600; }
.bp-toc span { font-family: var(--head); color: var(--gold); min-width: 18px; }
.bp-text { max-width: 70ch; padding: clamp(18px, 3vw, 32px); border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); font-size: 17px; line-height: 1.7; }
.bp-text h1 { font-size: 22px; margin: 0 0 14px; }
.bp-text .ch-num { display: none; }
.bp-text .tip { margin: 16px 0; padding: 12px 16px; border-left: 3px solid var(--gold); background: rgba(245, 196, 81, .08); border-radius: 10px; }
.bp-text .tip p { margin: 0; }
.bp-text li { margin-bottom: 6px; }
.bp-more { color: var(--muted); margin: 18px 0; }
.bp-faq { display: grid; gap: 10px; max-width: 820px; }
.bp-faq details { padding: 16px 18px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.bp-faq summary { cursor: pointer; font-weight: 700; }
.bp-faq p { color: var(--muted); margin: 10px 0 0; }
.bp-related { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.bp-related a { display: grid; gap: 8px; padding: 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); transition: transform .3s var(--ease), border-color .3s; }
.bp-related a:hover { transform: translateY(-4px); border-color: rgba(245, 196, 81, .4); }
.bp-related img { width: 100%; height: auto; border-radius: 4px 10px 10px 4px; }
.bp-related span { color: var(--gold-2); font-family: var(--head); font-size: 15px; }
.simple { max-width: 640px; margin: 60px auto; text-align: center; }
.simple h1 { font-size: clamp(26px, 4vw, 40px); margin-bottom: 14px; }
.simple p { color: var(--muted); margin-bottom: 24px; }
body.page .footer { margin-top: 90px; }
@media (max-width: 760px) {
  .bp-hero { grid-template-columns: 1fr; }
  .bp-cover { max-width: 260px; }
}
.modal-links { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.vf-code { margin: 0 auto 26px; max-width: 360px; padding: 18px; border: 2px dashed var(--gold); border-radius: 14px; font: 800 26px/1 "Courier New", monospace; letter-spacing: 3px; color: var(--gold-2); }
.err.ok { color: var(--ok); font-weight: 600; }
