:root {
  --bg: #FBF6F2;
  --paper: #FFFFFF;
  --ink: #2E2533;
  --ink-soft: #8A7F8E;
  --line: #EEE4DD;
  --candy: #E2332F;
  --blush: #FCE8EC;
  --lilac: #EFE8FB;
  --butter: #FDF3D9;
  --mint: #E3F4EC;
  --shadow: 0 1px 2px rgba(60, 40, 50, .05), 0 12px 30px -18px rgba(60, 40, 50, .25);
  --shadow-lg: 0 1px 2px rgba(60, 40, 50, .05), 0 24px 50px -24px rgba(60, 40, 50, .3);
  --gutter: clamp(16px, calc(var(--vw, 1vw) * 3), 36px);
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Cormorant Garamond", Georgia, serif;
  /* книга */
  --page: #FFFDF8;
  --cover: #241D27;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
img { display: block; max-width: 100%; -webkit-user-drag: none; }
[hidden] { display: none !important; }

[data-icon] { display: inline-flex; width: 1em; height: 1em; flex: none; }
[data-icon] svg, .btn svg { width: 1em; height: 1em; flex: none; }

/* ---------- Изгледи ---------- */
.view {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  opacity: 0; visibility: hidden;
  transition: opacity .35s ease, visibility 0s linear .35s;
  overflow: hidden;
}
.view.active { opacity: 1; visibility: visible; transition: opacity .35s ease; }

/* ---------- Бутони ---------- */
.icon-btn {
  width: 50px; height: 50px; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: var(--paper); color: var(--ink); box-shadow: var(--shadow);
  font-size: 22px; flex: none;
  transition: transform .15s;
}
.icon-btn:active { transform: scale(.92); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 54px; padding: 0 26px; border-radius: 999px;
  font-weight: 700; font-size: 18px; text-decoration: none;
  transition: transform .15s;
}
.btn:active { transform: scale(.97); }
.btn [data-icon], .btn svg { font-size: 20px; }
.btn-ink { background: var(--ink); color: #fff; }
.btn-candy { background: var(--candy); color: #fff; }
.btn-ghost { background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }

.pill-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 54px; padding: 0 22px; border-radius: 999px;
  background: var(--paper); box-shadow: var(--shadow);
  font-weight: 700; font-size: 18px; white-space: nowrap; flex: none;
  transition: transform .15s;
}
.pill-btn:active { transform: scale(.96); }
.pill-btn [data-icon] { font-size: 21px; color: #8A63E8; }

/* ---------- Начало ---------- */
#home { background: radial-gradient(1100px 520px at 50% -18%, #F9E3E8, transparent 70%), var(--bg); }
.home-inner {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: clamp(10px, calc(var(--vh, 1vh) * 2.5), 36px) var(--gutter); gap: clamp(12px, calc(var(--vh, 1vh) * 5), 72px);
}
.home-logo { width: min(460px, calc(var(--vw, 1vw) * 72), calc(var(--vh, 1vh) * 72)); height: auto; }
.home-actions {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(16px, calc(var(--vw, 1vw) * 2.2), 28px);
  width: min(1080px, 100%);
}
/* карти като корицата на каталога */
.action {
  position: relative; isolation: isolate;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  gap: 4px; padding: clamp(26px, calc(var(--vh, 1vh) * 5), 44px) 26px clamp(14px, calc(var(--vh, 1vh) * 3), 44px);
  min-height: clamp(190px, calc(var(--vh, 1vh) * 46), 380px);
  border-radius: 14px; color: #F4E9DD;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.03) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(255,255,255,.025) 0 1px, transparent 1px 3px),
    radial-gradient(120% 90% at 30% 20%, #33293A, var(--cover));
  box-shadow: 0 2px 4px rgba(30, 20, 30, .18), 0 26px 50px -26px rgba(30, 20, 30, .6);
  transition: transform .2s ease;
}
.action::before { content: ""; position: absolute; inset: 12px; border: 1px solid rgba(232, 208, 176, .45); border-radius: 4px; pointer-events: none; }
.action:active { transform: scale(.98); }
.action-brand { position: absolute; top: 28px; left: 0; right: 0; font-size: 12px; font-weight: 700; letter-spacing: .32em; text-transform: uppercase; color: rgba(232, 201, 166, .7); }
.action-icon { width: clamp(46px, min(calc(var(--vw, 1vw) * 7), calc(var(--vh, 1vh) * 10)), 86px); height: auto; color: #E8C9A6; margin-bottom: clamp(4px, calc(var(--vh, 1vh) * 1.6), 16px); }
.action-rule { width: 42px; height: 1px; background: rgba(232, 208, 176, .55); margin: 4px 0 clamp(6px, calc(var(--vh, 1vh) * 1.8), 18px); }
.action-title { font-family: var(--serif); font-weight: 500; font-size: clamp(30px, min(calc(var(--vw, 1vw) * 4), calc(var(--vh, 1vh) * 7)), 52px); line-height: 1; }
.action-sub { margin-top: 10px; font-size: 13px; font-weight: 700; letter-spacing: .24em; text-transform: uppercase; color: rgba(244, 233, 221, .68); }

.marquee {
  height: clamp(70px, calc(var(--vh, 1vh) * 15), 170px); overflow: hidden; flex: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee-row { display: flex; gap: 18px; width: max-content; height: 100%; padding: 10px 0; animation: drift 90s linear infinite; }
.marquee-row img {
  height: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 16px;
  border: 4px solid #fff; box-shadow: var(--shadow);
}
.marquee-row img:nth-child(odd) { transform: rotate(-3deg); }
.marquee-row img:nth-child(even) { transform: rotate(2.5deg) translateY(6px); }
@keyframes drift { to { transform: translateX(-50%); } }

.home-foot {
  display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 6px 14px;
  padding: clamp(4px, calc(var(--vh, 1vh) * 1.2), 12px) var(--gutter) calc(clamp(6px, calc(var(--vh, 1vh) * 1.8), 18px) + env(safe-area-inset-bottom));
  font-weight: 600; font-size: 16px; color: var(--ink-soft);
}
.home-foot a { color: inherit; text-decoration: none; }
.home-foot .dot { width: 4px; height: 4px; border-radius: 50%; background: #D9CDD3; }

/* ---------- Горна лента ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) var(--gutter) 10px;
  flex: none;
}
.topbar-logo { height: 44px; width: auto; margin: 0 auto; }
.topbar-spacer { width: 50px; }
.topbar-title { margin: 0 auto 0 6px; font-size: clamp(24px, calc(var(--vw, 1vw) * 2.8), 32px); font-weight: 800; letter-spacing: -.01em; }

.mode-switch { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--paper); box-shadow: var(--shadow); flex: none; }
.mode-switch button {
  display: inline-flex; align-items: center; gap: 8px;
  height: 46px; padding: 0 20px; border-radius: 999px; font-weight: 700; font-size: 17px; color: var(--ink-soft);
  transition: background .2s, color .2s;
}
.mode-switch button [data-icon] { font-size: 19px; }
.mode-switch button.on { background: var(--ink); color: #fff; }

/* ---------- Избор за кого ---------- */
#pick { background: radial-gradient(1000px 500px at 50% -15%, #F9E3E8, transparent 70%), var(--bg); }
.pick-title { text-align: center; margin: 6px 0 clamp(14px, calc(var(--vh, 1vh) * 3), 32px); font-size: clamp(26px, calc(var(--vw, 1vw) * 3.2), 38px); font-weight: 800; padding: 0 var(--gutter); }
.pick-grid {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(14px, calc(var(--vw, 1vw) * 2), 26px);
  padding: 0 var(--gutter) calc(var(--gutter) + env(safe-area-inset-bottom));
  width: min(1200px, 100%); margin: 0 auto; max-height: 620px;
}
.pick-card {
  position: relative; overflow: hidden; border-radius: 32px; box-shadow: var(--shadow-lg); background: var(--line);
  display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start;
  padding: clamp(18px, calc(var(--vw, 1vw) * 2.4), 30px); text-align: left; min-height: 220px;
  transition: transform .2s;
}
.pick-card:active { transform: scale(.98); }
.pick-photos { position: absolute; inset: 0; display: block; }
.pick-photos img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 1.2s ease; }
.pick-photos img.on { opacity: 1; }
.pick-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 50%, rgba(30, 18, 30, .62)); }
.pick-name, .pick-count { position: relative; z-index: 1; color: #fff; }
.pick-name { font-size: clamp(30px, calc(var(--vw, 1vw) * 3.4), 42px); font-weight: 800; line-height: 1; }
.pick-count { font-size: 19px; font-weight: 600; opacity: .9; margin-top: 4px; }

/* ---------- Каталог ---------- */
#catalog { background: var(--bg); }
.chips { display: flex; gap: 10px; overflow-x: auto; flex: none; padding: 4px var(--gutter) 14px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 50px; padding: 0 22px; border-radius: 999px;
  background: var(--paper); box-shadow: inset 0 0 0 1.5px var(--line);
  font-weight: 700; font-size: 18px; display: inline-flex; align-items: center; gap: 8px;
  transition: background .2s, color .2s, box-shadow .2s;
}
.chip small { font-size: 15px; color: var(--ink-soft); font-weight: 700; }
.chip.on { background: var(--ink); color: #fff; box-shadow: none; }
.chip.on small { color: rgba(255,255,255,.65); }

.wall {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 2px var(--gutter) calc(30px + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}
.wall-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.card {
  position: relative; border-radius: 20px; overflow: hidden; background: var(--line);
  box-shadow: var(--shadow); width: 100%; display: block;
  animation: pop .45s ease both;
}
.card img { width: 100%; height: auto; aspect-ratio: 3/4; object-fit: cover; transition: transform .3s; }
.card:active img { transform: scale(1.03); }
@keyframes pop { from { opacity: 0; transform: translateY(14px); } }
.card-no {
  position: absolute; left: 10px; bottom: 10px;
  background: rgba(255,255,255,.94); border-radius: 999px; padding: 3px 12px;
  font-weight: 800; font-size: 17px;
}
.card-angles {
  position: absolute; right: 10px; top: 10px;
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  background: rgba(46,37,51,.72); color: #fff; border-radius: 999px; padding: 5px 10px;
  font-weight: 700; font-size: 13px;
}
.card-angles svg { width: 15px; height: 15px; }
.wall-empty { margin: 40px auto; color: var(--ink-soft); font-weight: 700; font-size: 20px; grid-column: 1 / -1; }

/* ---------- Книга ---------- */
.book-wrap {
  flex: 1; min-height: 0; position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: 0 var(--gutter) 64px;
}
.book-stage { position: relative; touch-action: none; }
.book-stage::after { /* сянка върху масата */
  content: ""; position: absolute; left: 6%; right: 6%; bottom: -22px; height: 36px; z-index: -1;
  background: radial-gradient(closest-side, rgba(50,30,40,.32), transparent); filter: blur(6px);
}
/* книгата е плоска (без preserve-3d), за да важи z-index между листите; перспективата е тук */
.book { position: relative; perspective: 2800px; transition: transform .6s cubic-bezier(.3,.7,.2,1); }

/* дебелина на страниците отстрани — расте/намалява според това докъде си стигнал */
.book .edge {
  position: absolute; top: 5px; bottom: 5px; z-index: 0; pointer-events: none;
  background: repeating-linear-gradient(90deg, #E7DED3 0 1px, #FBF7F0 1px 3px);
  transition: width .6s ease;
}
.book .edge.l { right: 100%; width: var(--edge-l, 0px); border-radius: 6px 0 0 6px; box-shadow: -2px 3px 8px -4px rgba(0,0,0,.25); }
.book .edge.r { left: 100%; width: var(--edge-r, 0px); border-radius: 0 6px 6px 0; box-shadow: 2px 3px 8px -4px rgba(0,0,0,.25); }

.leaf {
  position: absolute; top: 0; height: 100%;
  transform-style: preserve-3d; transform-origin: left center;
  transition: transform .9s cubic-bezier(.45,.05,.2,1);
}
.leaf.flipped { transform: rotateY(-180deg); }
.single .leaf.flipped { visibility: hidden; transition: transform .9s cubic-bezier(.45,.05,.2,1), visibility 0s linear .9s; }
.face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: var(--page); overflow: hidden;
}
.face.back { transform: rotateY(180deg); }
.spread .face.front { border-radius: 2px 10px 10px 2px; }
.spread .face.back { border-radius: 10px 2px 2px 10px; }
.single .face { border-radius: 4px 10px 10px 4px; }
/* сянка в средата (подвързията) */
.face::before { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.face.front::before { background: linear-gradient(90deg, rgba(60,40,30,.20), rgba(60,40,30,.06) 4%, transparent 11%); }
.face.back::before { background: linear-gradient(270deg, rgba(60,40,30,.20), rgba(60,40,30,.06) 4%, transparent 11%); }
.single .face.front::before { background: linear-gradient(90deg, rgba(60,40,30,.16), transparent 6%); }
/* сянка докато листът се обръща */
.face::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 4; opacity: 0; }
.face.front::after { background: linear-gradient(90deg, rgba(0,0,0,.28), rgba(0,0,0,.05) 70%); }
.face.back::after { background: linear-gradient(270deg, rgba(0,0,0,.28), rgba(0,0,0,.05) 70%); }
.leaf.turning .face::after { animation: shade .9s ease; }
@keyframes shade { 50% { opacity: 1; } }

.page { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 6% 8% 9%; gap: 2.4%; }
.page-head {
  display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: #B3A7AE;
}
.page-photo { flex: 1; min-height: 0; position: relative; background: #EFE7E1; border-radius: 3px; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.12), 0 8px 18px -10px rgba(0,0,0,.35); }
.page-photo img { width: 100%; height: 100%; object-fit: cover; color: transparent; }
.page-cap { display: flex; align-items: flex-end; gap: 12px; }
.page-cap-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.page-no { font-family: var(--serif); font-style: italic; font-weight: 600; font-size: clamp(26px, calc(var(--vh, 1vh) * 3.4), 38px); line-height: 1; }
.page-cat { font-size: 13px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft); }
.page-angles { display: flex; gap: 6px; margin-left: auto; flex: none; }
.page-angles img { width: 40px; height: 54px; object-fit: cover; border-radius: 2px; box-shadow: 0 1px 2px rgba(0,0,0,.15), 0 4px 10px -6px rgba(0,0,0,.4); background: #EFE7E1; }
.page-more { width: 40px; height: 54px; border-radius: 2px; display: grid; place-items: center; background: #EFE7E1; font-family: var(--serif); font-size: 20px; color: var(--ink-soft); }
.page-folio { position: absolute; bottom: 3%; font-family: var(--serif); font-size: 15px; color: #A99EA5; }
.face.front .page-folio { right: 8%; }
.face.back .page-folio { left: 8%; }
.single .page-folio { right: 8%; left: auto; }

/* твърди корици */
.face.hard {
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.03) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(255,255,255,.025) 0 1px, transparent 1px 3px),
    radial-gradient(120% 90% at 30% 20%, #33293A, var(--cover));
  color: #F4E9DD;
}
.page-cover { align-items: center; justify-content: center; text-align: center; gap: 4%; padding: 12%; }
.page-cover::before { content: ""; position: absolute; inset: 5%; border: 1px solid rgba(232, 208, 176, .45); border-radius: 3px; pointer-events: none; }
.page-cover .cover-logo { width: 88%; }
.page-cover .cover-rule { width: 22%; height: 1px; background: rgba(232, 208, 176, .55); margin: 3% 0; }
.page-cover h3 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: clamp(34px, calc(var(--vh, 1vh) * 5.4), 56px); line-height: 1; letter-spacing: .01em; }
.page-cover p { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .28em; text-transform: uppercase; color: rgba(244, 233, 221, .7); }
.page-cover .cover-hint { position: absolute; bottom: 9%; left: 0; right: 0; letter-spacing: .12em; color: #E8C9A6; animation: nudge 1.8s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateX(8px); } }
.page-back { align-items: center; justify-content: flex-end; padding-bottom: 12%; }
.page-back img { width: 54px; opacity: .9; }
/* форзац — вътрешната страна на кориците */
.page-endpaper { background: #F8E4E9 url("img/brand/candy.png") 0 0 / 46px 46px; }
.page-endpaper::after { content: ""; position: absolute; inset: 0; background: rgba(250, 234, 238, .9); }
.page-book { align-items: center; justify-content: center; text-align: center; gap: 3%; }
.page-book h3 { margin: 0; font-family: var(--serif); font-weight: 600; font-style: italic; font-size: clamp(30px, calc(var(--vh, 1vh) * 4.6), 46px); line-height: 1.05; }
.page-book p { margin: 0; color: var(--ink-soft); font-weight: 600; font-size: 15px; }
.page-book .qr { width: 46%; aspect-ratio: 1; padding: 4%; background: #fff; border-radius: 6px; box-shadow: 0 0 0 1px var(--line); }
.page-blank { background: var(--page); }

.book-nav {
  position: absolute; top: 50%; transform: translateY(-80%); z-index: 5;
  width: 58px; height: 58px; border-radius: 50%; background: var(--paper); box-shadow: var(--shadow);
  display: grid; place-items: center; font-size: 26px;
}
.book-nav.prev { left: var(--gutter); }
.book-nav.next { right: var(--gutter); }
.book-nav:disabled { opacity: .3; }
.book-progress {
  position: absolute; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; width: min(520px, 80%);
  font-weight: 700; color: var(--ink-soft); font-size: 18px;
}
.book-progress input { flex: 1; accent-color: var(--ink); height: 30px; }
.book-progress span { white-space: nowrap; min-width: 80px; text-align: right; }

/* ---------- Overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; } }

/* Преглед */
.viewer { background: #fff; display: flex; }
.v-stage { position: relative; flex: 1; min-width: 0; background: #1C161E; }
.v-track { position: absolute; inset: 0; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior: contain; }
.v-track::-webkit-scrollbar { display: none; }
.v-slide { flex: none; width: 100%; height: 100%; scroll-snap-align: center; position: relative; overflow: hidden; }
.v-slide img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transition: transform .3s ease; transform-origin: var(--ox, 50%) var(--oy, 50%); }
.v-slide.zoom img { transform: scale(2.2); }
.v-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 56px; height: 56px; border-radius: 50%; background: rgba(255,255,255,.92);
  display: grid; place-items: center; font-size: 24px;
}
.v-arrow.prev { left: 16px; }
.v-arrow.next { right: 16px; }
.v-dots { position: absolute; bottom: 18px; left: 0; right: 0; display: flex; justify-content: center; gap: 8px; }
.v-dots i { width: 9px; height: 9px; border-radius: 5px; background: rgba(255,255,255,.45); transition: width .25s, background .25s; }
.v-dots i.on { width: 26px; background: #fff; }
.v-side {
  width: min(360px, calc(var(--vw, 1vw) * 32)); flex: none; position: relative;
  display: flex; flex-direction: column; gap: 14px;
  padding: calc(28px + env(safe-area-inset-top)) 28px calc(28px + env(safe-area-inset-bottom));
  overflow-y: auto;
}
.v-close { position: absolute; top: calc(18px + env(safe-area-inset-top)); right: 18px; }
.v-cat { align-self: flex-start; background: var(--lilac); color: #5A3FB5; font-weight: 700; padding: 8px 16px; border-radius: 999px; font-size: 17px; margin-top: 54px; }
.v-no { margin: 0; font-family: var(--serif); font-style: italic; font-weight: 600; font-size: clamp(44px, calc(var(--vw, 1vw) * 5), 64px); line-height: 1; }
.v-angles-label { margin: 0; font-weight: 700; color: var(--ink-soft); font-size: 18px; }
.v-thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.v-thumbs button { border-radius: 12px; overflow: hidden; aspect-ratio: 3/4; position: relative; }
.v-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.v-thumbs button.on::after { content: ""; position: absolute; inset: 0; border-radius: 12px; box-shadow: inset 0 0 0 3px var(--ink); }
.v-hint { margin: auto 0 0; color: var(--ink-soft); font-weight: 600; font-size: 18px; }
.v-book { width: 100%; }

/* Колело */
.wheel-modal { background: radial-gradient(circle at 50% 40%, #3A2A45, #1C161E 70%); display: grid; place-items: center; color: #fff; overflow: hidden; }
.wheel-close { position: absolute; top: calc(18px + env(safe-area-inset-top)); right: 18px; z-index: 3; }
.wheel-box { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: var(--gutter); }
.wheel-title { margin: 0; font-size: clamp(30px, calc(var(--vw, 1vw) * 4), 46px); font-weight: 800; }
.wheel-sub { margin: 0 0 10px; font-weight: 600; opacity: .8; text-align: center; font-size: 17px; }
.wheel-area { position: relative; width: min(calc(var(--vh, 1vh) * 64), calc(var(--vw, 1vw) * 86)); aspect-ratio: 1; }
.wheel-svg { width: 100%; height: 100%; transition: transform 5.2s cubic-bezier(.12,.75,.08,1); filter: drop-shadow(0 20px 40px rgba(0,0,0,.45)); }
.wheel-pointer {
  position: absolute; left: 50%; top: -14px; transform: translateX(-50%); z-index: 2;
  width: 0; height: 0; border-left: 22px solid transparent; border-right: 22px solid transparent; border-top: 44px solid #FFD66B;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,.4));
}
.wheel-pointer.tick { animation: tick .12s ease; }
@keyframes tick { 50% { transform: translateX(-50%) rotate(-14deg); } }
.wheel-hub {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 27%; aspect-ratio: 1; border-radius: 50%; background: #fff; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  box-shadow: 0 0 0 8px rgba(255,255,255,.25), var(--shadow-lg); font-weight: 800; font-size: clamp(14px, calc(var(--vh, 1vh) * 2), 20px);
  transition: transform .15s;
}
.wheel-hub img { width: 52%; }
.wheel-hub:active { transform: translate(-50%, -50%) scale(.94); }
.wheel-result {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: rgba(28,22,30,.9); animation: fadeIn .35s ease; padding: var(--gutter); z-index: 2;
}
.wr-kicker { margin: 0; font-weight: 700; font-size: 18px; color: #FFD66B; letter-spacing: .08em; text-transform: uppercase; }
.wheel-result img { height: min(calc(var(--vh, 1vh) * 56), 520px); aspect-ratio: 3/4; object-fit: cover; border-radius: 24px; border: 6px solid #fff; animation: popIn .6s cubic-bezier(.2,1.4,.4,1); }
@keyframes popIn { from { transform: scale(.4) rotate(-12deg); opacity: 0; } }
.wheel-result h4 { margin: 0; font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 40px; }
.wr-actions { display: flex; gap: 12px; }

/* Линк / QR */
.link-modal { background: rgba(46,37,51,.45); display: grid; place-items: center; padding: var(--gutter); }
.link-card {
  position: relative; width: min(480px, 100%); background: var(--paper); border-radius: 32px; box-shadow: var(--shadow-lg);
  padding: 40px 34px 32px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
  animation: popIn .4s cubic-bezier(.2,1.2,.4,1);
}
.link-close { position: absolute; top: 16px; right: 16px; box-shadow: none; background: var(--bg); }
.link-card h3 { margin: 4px 0 0; font-size: 30px; font-weight: 800; }
.link-card p { margin: 0; font-weight: 600; color: var(--ink-soft); font-size: 16px; }
.link-qr { width: min(260px, calc(var(--vw, 1vw) * 60)); aspect-ratio: 1; padding: 14px; background: #fff; border-radius: 20px; box-shadow: inset 0 0 0 1.5px var(--line); margin: 12px 0 6px; }
.link-scan { color: var(--ink) !important; font-weight: 700 !important; }
.link-or { display: flex; align-items: center; gap: 12px; width: 100%; color: var(--ink-soft); font-weight: 700; margin: 6px 0; }
.link-or::before, .link-or::after { content: ""; flex: 1; height: 1.5px; background: var(--line); }
.link-card .btn { width: 100%; }

/* Неактивност */
.idle { background: rgba(46,37,51,.5); display: grid; place-items: center; z-index: 90; }
.idle-card { background: var(--paper); border-radius: 32px; padding: 34px 40px; text-align: center; box-shadow: var(--shadow-lg); width: min(420px, calc(var(--vw, 1vw) * 90)); animation: popIn .4s ease; }
.idle-candy { width: 72px; margin: 0 auto 6px; animation: spin 4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.idle-card h3 { margin: 6px 0; font-size: 28px; font-weight: 800; }
.idle-card p { margin: 0 0 20px; font-weight: 600; color: var(--ink-soft); font-size: 17px; }

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 100; }

/* ---------- Таблет вертикално и телефони ---------- */
@media (max-width: 1000px) {
  .pill-btn span:not([data-icon]) { display: none; }
  .pill-btn { padding: 0 14px; }
}
@media (orientation: portrait), (max-width: 760px) {
  .home-actions { grid-template-columns: 1fr; width: min(560px, 100%); gap: 14px; }
  .action { min-height: clamp(170px, calc(var(--vh, 1vh) * 19), 230px); padding: 34px 22px 26px; }
  .action-icon { width: 60px; margin-bottom: 6px; }
  .action-rule { margin: 2px 0 8px; }
  .action-brand { top: 22px; }
  /* една под друга; ако не се събират, страницата се скролва */
  #pick { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
  .pick-grid { grid-template-columns: 1fr; max-height: none; flex: 1 0 auto; min-height: auto; grid-auto-rows: minmax(190px, 1fr); }
  .viewer { flex-direction: column; }
  .v-side { width: 100%; flex: none; max-height: calc(var(--vh, 1vh) * 46); padding: 18px var(--gutter) calc(18px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: 1fr auto; grid-template-areas: "cat cat" "no book" "lab lab" "th th" "hint hint"; align-items: center; gap: 10px 14px; }
  .v-cat { grid-area: cat; margin-top: 0; }
  .v-no { grid-area: no; }
  .v-angles-label { grid-area: lab; }
  .v-thumbs { grid-area: th; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
  .v-book { grid-area: book; width: auto; }
  .v-hint { grid-area: hint; margin: 0; }
  .v-close { position: fixed; top: calc(14px + env(safe-area-inset-top)); right: 14px; z-index: 3; }
}
@media (max-width: 760px) {
  #home { overflow-y: auto; }
  .home-inner { flex: none; min-height: calc(100% - 170px); gap: 28px; }
  .home-logo { width: min(340px, calc(var(--vw, 1vw) * 82)); }
  .marquee { height: 110px; }
  .action-title { font-size: 32px; }
  .topbar { gap: 8px; }
  .topbar-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0 0 0 4px; font-size: 22px; }
  .icon-btn { width: 46px; height: 46px; font-size: 20px; }
  .pill-btn { height: 46px; padding: 0 12px; }
  .mode-switch button span:not([data-icon]) { display: none; }
  .mode-switch button { padding: 0 12px; height: 38px; }
  .chip { height: 40px; font-size: 15px; padding: 0 15px; }
  .wall-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card { border-radius: 16px; }
  .card-no { font-size: 13px; }
  .card-angles span { display: none; }
  .card-no { max-width: calc(100% - 20px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .book-nav { width: 46px; height: 46px; font-size: 20px; }
  .book-nav.prev { left: 6px; } .book-nav.next { right: 6px; }
  .page-head { font-size: 9px; }
  .v-arrow { width: 44px; height: 44px; font-size: 20px; }
  .v-arrow.prev { left: 10px; } .v-arrow.next { right: 10px; }
  .wheel-sub { font-size: 15px; }
  .link-card { padding: 34px 22px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* Книга на цял екран */
.book-full-btn { display: none; }
#catalog.mode-book .book-full-btn { display: inline-flex; }
#catalog.book-full .topbar, #catalog.book-full .chips { display: none; }
#catalog.book-full .book-wrap { padding-top: 16px; }
.book-exit { display: none; position: absolute; top: calc(14px + env(safe-area-inset-top)); right: var(--gutter); z-index: 6; }
#catalog.book-full .book-exit { display: inline-grid; }
