/* ==========================================================================
   Open Shelf — design system
   ========================================================================== */
:root {
  --accent: #f4b860;
  --accent-2: #ff7a59;
  --accent-3: #8fa8ff;
  --good: #5fe0a5;
  --warn: #ffc65c;
  --bad: #ff6b7a;
  --radius: 18px;
  --radius-sm: 12px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --max: 1240px;
  --gutter: clamp(16px, 4vw, 40px);
  --top-h: 72px;
}
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0c13;
  --bg-2: #10131d;
  --bg-3: #161a27;
  --surface: rgba(255, 255, 255, .045);
  --surface-2: rgba(255, 255, 255, .075);
  --surface-solid: #141826;
  --line: rgba(255, 255, 255, .09);
  --line-2: rgba(255, 255, 255, .16);
  --text: #f4efe6;
  --text-2: #c9c6d3;
  --muted: #8e93a7;
  --shadow: 0 30px 80px -20px rgba(0, 0, 0, .65);
  --glow: 0 0 0 1px rgba(255, 255, 255, .06), 0 20px 60px -20px rgba(0, 0, 0, .7);
  --spot: rgba(244, 184, 96, .10);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f2ea;
  --bg-2: #efe9dd;
  --bg-3: #e7e0d1;
  --surface: rgba(255, 255, 255, .6);
  --surface-2: rgba(255, 255, 255, .85);
  --surface-solid: #fffdf8;
  --line: rgba(30, 28, 40, .1);
  --line-2: rgba(30, 28, 40, .18);
  --text: #1b1a22;
  --text-2: #3e3c48;
  --muted: #74717f;
  --shadow: 0 30px 70px -25px rgba(60, 40, 10, .35);
  --glow: 0 0 0 1px rgba(30, 28, 40, .06), 0 20px 50px -25px rgba(60, 40, 10, .35);
  --spot: rgba(244, 140, 60, .10);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top-h) + 20px); }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 500 15px/1.6 var(--font-body); -webkit-font-smoothing: antialiased; overflow-x: hidden;
  transition: background .5s var(--ease), color .5s var(--ease);
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--accent); color: #1b1305; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 600; letter-spacing: -.02em; line-height: 1.05; }
p { margin: 0; }
em, .serif-i { font-family: var(--font-display); font-style: italic; font-weight: 400; }
.grad-text { background: linear-gradient(100deg, var(--accent) 10%, var(--accent-2) 55%, var(--accent-3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.muted { color: var(--muted); }
.wrap { width: min(var(--max), 100% - 2 * var(--gutter)); margin-inline: auto; }

/* ---------- ambient layers ---------- */
#sky { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; opacity: .9; }
.spotlight { position: fixed; inset: 0; z-index: 0; pointer-events: none; background: radial-gradient(600px circle at var(--cx, 50%) var(--cy, 30%), var(--spot), transparent 60%); }
.grain { position: fixed; inset: -50%; z-index: 1; pointer-events: none; opacity: .05; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); animation: grain 8s steps(10) infinite; }
@keyframes grain { 0%, 100% { transform: translate(0, 0); } 30% { transform: translate(-5%, 3%); } 60% { transform: translate(4%, -4%); } 90% { transform: translate(-2%, 5%); } }
#app { position: relative; z-index: 2; min-height: calc(100vh - var(--top-h)); padding-top: var(--top-h); outline: none; }

/* ---------- buttons ---------- */
.btn { --h: 48px; position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: var(--h); padding: 0 22px; border-radius: 999px; font-weight: 700; font-size: 14px; letter-spacing: .01em; white-space: nowrap; transition: transform .35s var(--spring), background .3s, box-shadow .3s, color .3s, border-color .3s; isolation: isolate; }
.btn.sm { --h: 38px; padding: 0 16px; font-size: 13px; }
.btn.lg { --h: 56px; padding: 0 28px; font-size: 15px; }
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-primary { color: #1d1306; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 10px 30px -10px color-mix(in srgb, var(--accent-2) 70%, transparent), inset 0 1px 0 rgba(255, 255, 255, .4); overflow: hidden; }
.btn-primary::after { content: ''; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .55) 50%, transparent 70%); transform: translateX(-120%); transition: transform .8s var(--ease); z-index: -1; }
.btn-primary:hover::after { transform: translateX(120%); }
.btn-primary:hover { box-shadow: 0 18px 40px -12px color-mix(in srgb, var(--accent-2) 80%, transparent), inset 0 1px 0 rgba(255, 255, 255, .4); }
.btn-ghost { border: 1px solid var(--line-2); background: var(--surface); backdrop-filter: blur(10px); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-soft { background: var(--surface-2); border: 1px solid var(--line); }
.btn-soft:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.btn-danger { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); }
.btn .arrow { transition: transform .35s var(--spring); }
.btn:hover .arrow { transform: translate(3px, -3px); }
.icon-btn { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); transition: border-color .3s, transform .3s var(--spring); }
.icon-btn:hover { border-color: var(--accent); transform: rotate(-8deg); }
.icon-btn svg, .shelf-target svg, .tabbar svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.link { color: var(--accent); font-weight: 700; }
.link:hover { text-decoration: underline; }

/* ---------- top bar ---------- */
.topbar { position: fixed; inset: 0 0 auto; z-index: 50; height: var(--top-h); display: flex; align-items: center; gap: 36px; padding: 0 max(var(--gutter), calc((100vw - var(--max)) / 2)); transition: background .4s, border-color .4s, backdrop-filter .4s; border-bottom: 1px solid transparent; }
.topbar.scrolled { background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(18px) saturate(1.4); border-bottom-color: var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; letter-spacing: -.04em; }
.brand-mark { display: flex; align-items: flex-end; gap: 2px; height: 26px; }
.brand-mark span { display: block; width: 6px; border-radius: 2px; background: var(--accent); transform-origin: bottom; animation: shelfBounce 3.2s var(--ease) infinite; }
.brand-mark span:nth-child(1) { height: 22px; }
.brand-mark span:nth-child(2) { height: 26px; background: var(--accent-2); animation-delay: .15s; }
.brand-mark span:nth-child(3) { height: 18px; background: var(--accent-3); transform: rotate(14deg); animation-delay: .3s; }
@keyframes shelfBounce { 0%, 70%, 100% { translate: 0 0; } 80% { translate: 0 -5px; } 90% { translate: 0 1px; } }
.nav { display: flex; gap: 4px; }
.nav a { position: relative; padding: 8px 14px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: 14px; transition: color .25s, background .25s; }
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--text); background: var(--surface-2); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; position: relative; }
.badge { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent-2); color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center; animation: pop .5s var(--spring); }
@keyframes pop { from { transform: scale(0); } }
.credit-pill { display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px 0 6px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 14%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); font-size: 13px; }
.credit-pill b { font-size: 15px; }
.credit-pill .pill-label { color: var(--muted); }
.coin { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(135deg, #ffe2a6, var(--accent) 50%, #c9822c); color: #3d2604; font-size: 13px; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .2); animation: coinSpin 6s var(--ease) infinite; }
@keyframes coinSpin { 0%, 85%, 100% { transform: rotateY(0); } 92% { transform: rotateY(180deg); } }
.credit-pill.bump, .shelf-target.bump { animation: bump .6s var(--spring); }
@keyframes bump { 30% { transform: scale(1.25); } 60% { transform: scale(.92); } }
.shelf-target { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--accent-3), var(--accent-2)); color: #fff; font-weight: 800; border: 2px solid var(--line-2); transition: transform .3s var(--spring); }
.avatar:hover { transform: scale(1.08); }
#themeToggle .moon { display: none; }
:root[data-theme="light"] #themeToggle .sun { display: none; }
:root[data-theme="light"] #themeToggle .moon { display: block; }
.popover { position: absolute; top: calc(100% + 12px); right: 0; width: min(380px, calc(100vw - 32px)); max-height: 70vh; overflow: auto; background: var(--surface-solid); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px; opacity: 0; transform: translateY(-8px) scale(.98); transform-origin: top right; pointer-events: none; transition: opacity .25s, transform .3s var(--spring); z-index: 60; }
.popover.open { opacity: 1; transform: none; pointer-events: auto; }
.popover.menu { width: 240px; }
.bell-wrap { position: relative; }
.menu-head { padding: 12px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-head b { display: block; }
.menu-head small { color: var(--muted); }
.menu-item { display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; font-weight: 600; font-size: 14px; text-align: left; }
.menu-item:hover { background: var(--surface-2); }
.notif { display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding: 10px; border-radius: 12px; }
.notif:hover { background: var(--surface); }
.notif.unread { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.notif-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); font-size: 16px; }
.notif b { display: block; font-size: 13.5px; line-height: 1.35; }
.notif p { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.notif small { font-size: 11px; color: var(--muted); }
.pop-title { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px 10px; font-weight: 800; }
.pop-title button { font-size: 12px; color: var(--accent); font-weight: 700; }

/* ---------- mobile tab bar ---------- */
.tabbar { display: none; }
@media (max-width: 860px) {
  .nav, .pill-label, #signInBtn { display: none; }
  .topbar { gap: 12px; }
  .top-actions { gap: 6px; }
  .credit-pill { padding-right: 10px; }
}
@media (max-width: 480px) {
  #themeToggle { display: none; }
  .brand { font-size: 17px; }
  .hero { padding-top: 10px; gap: 10px; }
  .hero .scene { height: 300px; }
  .hero .book3d { --w: 84px; --h: 126px; --d: 18px; }
  .hero .float-card { display: none; }
  .hero h1 { font-size: 46px; }
}
@media (max-width: 860px) {
  .tabbar { position: fixed; z-index: 50; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); display: flex; justify-content: space-around; padding: 8px; border-radius: 22px; background: color-mix(in srgb, var(--bg-2) 85%, transparent); backdrop-filter: blur(20px); border: 1px solid var(--line); box-shadow: var(--shadow); }
  .tabbar a { display: grid; justify-items: center; gap: 2px; padding: 6px 14px; border-radius: 14px; color: var(--muted); font-size: 11px; font-weight: 700; transition: color .3s, background .3s; }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a.active { color: var(--accent); background: var(--surface-2); }
  #app { padding-bottom: 100px; }
  .shelf-target { display: none; }
}

/* ---------- reveal & motion ---------- */
[data-reveal] { opacity: 0; transform: translateY(40px); transition: opacity 1s var(--ease), transform 1s var(--ease); transition-delay: calc(var(--i, 0) * 90ms); }
[data-reveal="left"] { transform: translateX(-40px); }
[data-reveal="right"] { transform: translateX(40px); }
[data-reveal="zoom"] { transform: scale(.92); }
[data-reveal].in { opacity: 1; transform: none; }
.split-word { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .08em; margin-bottom: -.08em; }
.split-word > span { display: inline-block; transform: translateY(110%) rotate(6deg); animation: wordUp 1s var(--ease) forwards; animation-delay: calc(var(--w) * 70ms + 150ms); }
@keyframes wordUp { to { transform: none; } }
.view-enter { animation: viewIn .7s var(--ease) backwards; }
@keyframes viewIn { from { opacity: 0; transform: translateY(18px); } }

/* ---------- common bits ---------- */
.eyebrow { display: inline-flex; align-items: center; gap: 10px; padding: 7px 14px 7px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); backdrop-filter: blur(10px); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 var(--good); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.section { position: relative; padding: clamp(80px, 12vw, 150px) 0; }
.section-head { display: grid; gap: 18px; max-width: 760px; margin-bottom: 56px; }
.section-head .eyebrow, .page-head .eyebrow, .cta-band .eyebrow { justify-self: start; }
.cta-band .eyebrow { justify-self: center; }
.section-head h2 { font-size: clamp(36px, 5.5vw, 68px); }
.section-head p { color: var(--muted); font-size: 17px; max-width: 600px; }
.card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); backdrop-filter: blur(14px); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 13px; color: var(--text-2); transition: all .3s var(--ease); white-space: nowrap; }
.chip:hover { border-color: var(--line-2); color: var(--text); }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip small { opacity: .6; font-weight: 700; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 800; letter-spacing: .02em; }
.tag-good { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.tag-warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.tag-bad { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.tag-info { background: color-mix(in srgb, var(--accent-3) 16%, transparent); color: var(--accent-3); }
.tag-mute { background: var(--surface-2); color: var(--muted); }
:root[data-theme="light"] .tag-good { color: #0f8a55; }
:root[data-theme="light"] .tag-warn { color: #a06800; }
.stars { display: inline-flex; gap: 1px; color: var(--accent); font-size: 13px; letter-spacing: 1px; }
.stars .off { color: var(--line-2); }

/* ---------- book covers ---------- */
.cover { position: relative; aspect-ratio: 2 / 3; border-radius: 4px 10px 10px 4px; overflow: hidden; background: var(--c1, #33405e); box-shadow: inset 4px 0 6px -2px rgba(0, 0, 0, .35), 0 18px 30px -12px rgba(0, 0, 0, .55); isolation: isolate; }
.cover::before { content: ''; position: absolute; inset: 0; z-index: 2; background: linear-gradient(90deg, rgba(0, 0, 0, .28) 0, rgba(255, 255, 255, .14) 3%, transparent 7%, transparent 92%, rgba(0, 0, 0, .12)); pointer-events: none; }
.cover .gen { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; padding: 14% 12%; background: radial-gradient(circle at 80% 10%, rgba(255, 255, 255, .18), transparent 40%), linear-gradient(160deg, var(--c1), var(--c2)); color: #fff8ec; }
.cover .gen b { font-family: var(--font-display); font-weight: 600; font-size: clamp(13px, 1.4vw, 19px); line-height: 1.1; text-wrap: balance; }
.cover .gen small { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; opacity: .8; }
.cover .gen i { position: absolute; right: 10%; bottom: 30%; font-style: normal; font-size: 28px; opacity: .35; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; opacity: 0; transition: opacity .6s; }
.cover img.loaded { opacity: 1; }

/* ---------- HERO ---------- */
.hero { position: relative; min-height: calc(100vh - var(--top-h)); display: grid; grid-template-columns: 1.05fr 1fr; align-items: center; gap: 40px; padding-block: 40px 80px; }
.hero-copy { display: grid; gap: 28px; position: relative; z-index: 3; }
.hero h1 { font-size: clamp(48px, 7.4vw, 104px); line-height: .98; letter-spacing: -.035em; }
.hero h1 em { color: var(--accent); }
.hero-sub { font-size: clamp(16px, 1.4vw, 19px); color: var(--text-2); max-width: 520px; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 12px; }
.hero { overflow-x: clip; }
.hero-stats { display: flex; gap: clamp(20px, 4vw, 44px); padding-top: 10px; }
.hero-stats div { display: grid; }
.hero-stats b { font: 600 clamp(28px, 3vw, 38px)/1 var(--font-display); }
.hero-stats span { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-top: 6px; }
.scene { position: relative; height: min(680px, 80vh); perspective: 1400px; transform-style: preserve-3d; }
.scene-inner { position: absolute; inset: 0; transform-style: preserve-3d; transform: rotateX(calc(var(--my, 0) * -10deg)) rotateY(calc(var(--mx, 0) * 14deg)); transition: transform .9s var(--ease); }
.orb { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; animation: orb 14s ease-in-out infinite alternate; }
.orb.a { width: 340px; height: 340px; background: var(--accent); top: 10%; left: 18%; }
.orb.b { width: 280px; height: 280px; background: var(--accent-3); bottom: 8%; right: 6%; animation-delay: -5s; }
.orb.c { width: 200px; height: 200px; background: var(--accent-2); top: 48%; left: 48%; animation-delay: -9s; opacity: .35; }
@keyframes orb { to { transform: translate(40px, -30px) scale(1.15); } }
.ring { position: absolute; left: 50%; top: 50%; width: 520px; height: 520px; margin: -260px 0 0 -260px; border-radius: 50%; border: 1px dashed var(--line-2); transform: rotateX(72deg) translateZ(-40px); animation: ringSpin 40s linear infinite; }
.ring.r2 { width: 700px; height: 700px; margin: -350px 0 0 -350px; animation-duration: 70s; animation-direction: reverse; opacity: .6; }
@keyframes ringSpin { to { transform: rotateX(72deg) translateZ(-40px) rotateZ(360deg); } }

.flyer { position: absolute; left: var(--x); top: var(--y); transform-style: preserve-3d; animation: fly var(--dur, 9s) ease-in-out infinite; animation-delay: var(--delay, 0s); will-change: transform; }
@keyframes fly {
  0%, 100% { transform: translate3d(0, 0, var(--z, 0)) rotateZ(var(--rz, 0deg)); }
  33% { transform: translate3d(14px, -26px, calc(var(--z, 0px) + 40px)) rotateZ(calc(var(--rz, 0deg) + 4deg)); }
  66% { transform: translate3d(-12px, 12px, calc(var(--z, 0px) - 20px)) rotateZ(calc(var(--rz, 0deg) - 3deg)); }
}
.book3d { --w: 150px; --h: 225px; --d: 30px; position: relative; width: var(--w); height: var(--h); transform-style: preserve-3d; transform: rotateY(var(--ry, -28deg)) rotateX(var(--rx, 8deg)); transition: transform 1s var(--ease); }
.flyer:hover .book3d { transform: rotateY(calc(var(--ry, -28deg) + 25deg)) rotateX(0) scale(1.06); }
.book3d > * { position: absolute; }
.book3d .front, .book3d .back { inset: 0; border-radius: 3px 8px 8px 3px; overflow: hidden; }
.book3d .front { transform: translateZ(calc(var(--d) / 2)); }
.book3d .front .cover { position: absolute; inset: 0; border-radius: inherit; aspect-ratio: auto; }
.book3d .back { transform: rotateY(180deg) translateZ(calc(var(--d) / 2)); background: linear-gradient(160deg, var(--c2), var(--c1)); }
.book3d .spine { top: 0; left: calc(50% - var(--d) / 2); width: var(--d); height: 100%; transform: rotateY(-90deg) translateZ(calc(var(--w) / 2)); background: linear-gradient(90deg, rgba(0, 0, 0, .35), rgba(255, 255, 255, .08) 40%, rgba(0, 0, 0, .3)), var(--c1); border-radius: 3px; }
.book3d .pages { top: 3px; left: calc(50% - var(--d) / 2); width: calc(var(--d) - 2px); height: calc(100% - 6px); transform: rotateY(90deg) translateZ(calc(var(--w) / 2 - 3px)); background: repeating-linear-gradient(90deg, #f5ecd8 0 2px, #e3d6bb 2px 3px); }
.book3d .top { left: 0; top: calc(50% - var(--d) / 2); width: calc(100% - 3px); height: calc(var(--d) - 2px); transform: rotateX(90deg) translateZ(calc(var(--h) / 2 - 3px)); background: repeating-linear-gradient(0deg, #f5ecd8 0 2px, #e3d6bb 2px 3px); }
.book3d .shadow { left: 10%; bottom: -60px; width: 80%; height: 30px; border-radius: 50%; background: rgba(0, 0, 0, .45); filter: blur(14px); transform: rotateX(90deg); }
.page-fly { position: absolute; width: 46px; height: 60px; background: linear-gradient(135deg, #fffaf0, #eadfc6); border-radius: 2px 10px 2px 2px; box-shadow: 0 10px 20px rgba(0, 0, 0, .25); opacity: 0; animation: pageFly var(--dur, 12s) linear infinite; animation-delay: var(--delay, 0s); }
.page-fly::before { content: ''; position: absolute; inset: 10px 8px; background: repeating-linear-gradient(0deg, rgba(60, 50, 30, .25) 0 1px, transparent 1px 6px); }
@keyframes pageFly {
  0% { opacity: 0; transform: translate3d(-120px, 120px, -100px) rotateX(40deg) rotateZ(-30deg); }
  10% { opacity: .9; }
  50% { transform: translate3d(200px, -120px, 100px) rotateX(-40deg) rotateZ(120deg) rotateY(180deg); }
  90% { opacity: .8; }
  100% { opacity: 0; transform: translate3d(520px, -320px, -60px) rotateX(60deg) rotateZ(260deg) rotateY(360deg); }
}
.float-card { position: absolute; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 10px 14px 10px 10px; border-radius: 16px; background: color-mix(in srgb, var(--surface-solid) 80%, transparent); backdrop-filter: blur(16px); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 12.5px; animation: bob 6s ease-in-out infinite; }
.float-card b { display: block; font-size: 13.5px; }
.float-card small { color: var(--muted); }
.float-card .fc-ico { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; font-size: 17px; background: color-mix(in srgb, var(--accent) 18%, transparent); }
@keyframes bob { 50% { transform: translateY(-12px); } }
.scroll-hint { position: absolute; left: 50%; bottom: 18px; translate: -50% 0; display: grid; justify-items: center; gap: 8px; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.scroll-hint i { width: 22px; height: 34px; border: 1.5px solid var(--line-2); border-radius: 12px; position: relative; }
.scroll-hint i::after { content: ''; position: absolute; left: 50%; top: 7px; width: 3px; height: 7px; margin-left: -1.5px; border-radius: 2px; background: var(--accent); animation: wheel 1.8s infinite; }
@keyframes wheel { 60% { transform: translateY(10px); opacity: 0; } 100% { opacity: 0; } }
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; min-height: auto; padding-top: 30px; }
  .scene { height: 440px; order: -1; margin-inline: calc(-1 * var(--gutter)); }
  .book3d { --w: 110px; --h: 165px; --d: 22px; }
  .ring { width: 360px; height: 360px; margin: -180px 0 0 -180px; }
  .ring.r2 { width: 480px; height: 480px; margin: -240px 0 0 -240px; }
  .scroll-hint { display: none; }
}

/* ---------- marquee ---------- */
.marquee { position: relative; padding: 28px 0; overflow: hidden; mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); border-block: 1px solid var(--line); }
.marquee-track { display: flex; gap: 18px; width: max-content; animation: marquee 60s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee .cover { width: 104px; flex: none; transition: transform .5s var(--spring); }
.marquee .cover:hover { transform: translateY(-10px) rotate(-3deg) scale(1.05); }
.marquee.reverse .marquee-track { animation-direction: reverse; animation-duration: 75s; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- how it works ---------- */
.steps { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.step { padding: 32px 28px; overflow: hidden; transition: transform .5s var(--spring), border-color .3s; }
.step:hover { transform: translateY(-8px); border-color: var(--line-2); }
.step-num { font: italic 400 82px/1 var(--font-display); color: transparent; -webkit-text-stroke: 1px var(--line-2); position: absolute; right: 18px; top: 10px; }
.step-ico { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; font-size: 26px; margin-bottom: 26px; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 30%, transparent), color-mix(in srgb, var(--accent-2) 20%, transparent)); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.step h3 { font-size: 26px; margin-bottom: 10px; }
.step p { color: var(--muted); }
.steps-line { position: absolute; top: 61px; left: 12%; right: 12%; height: 2px; z-index: -1; }
.steps-line path { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 6 8; fill: none; }

/* ---------- bento ---------- */
.bento { display: grid; grid-template-columns: repeat(6, 1fr); grid-auto-rows: minmax(270px, auto); gap: 18px; }
.tile { padding: 28px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; transition: border-color .3s, transform .5s var(--spring); }
.tile:hover { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.tile h3 { font-size: 24px; }
.tile p { color: var(--muted); font-size: 14.5px; }
.tile .tile-art { position: absolute; inset: 0 0 auto; height: 56%; display: grid; place-items: center; pointer-events: none; }
.tile.w2 { grid-column: span 2; } .tile.w3 { grid-column: span 3; } .tile.w4 { grid-column: span 4; }
.tile.tall { grid-row: span 2; }
.tile::after { content: ''; position: absolute; inset: 0; background: radial-gradient(400px circle at var(--px, 50%) var(--py, 50%), color-mix(in srgb, var(--accent) 12%, transparent), transparent 50%); opacity: 0; transition: opacity .4s; pointer-events: none; }
.tile:hover::after { opacity: 1; }
.mini-queue { display: flex; gap: 8px; align-items: center; }
.mini-queue span { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; border: 2px solid var(--bg); margin-left: -12px; animation: queue 4s var(--ease) infinite; animation-delay: calc(var(--i) * .2s); }
@keyframes queue { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(8px); } }
.mini-chart { display: flex; align-items: flex-end; gap: 6px; height: 80px; }
.mini-chart i { width: 14px; border-radius: 4px 4px 0 0; background: linear-gradient(var(--accent), var(--accent-2)); transform-origin: bottom; animation: grow 2.4s var(--ease) infinite alternate; animation-delay: calc(var(--i) * .12s); }
@keyframes grow { from { transform: scaleY(.3); } }
.phone { width: 92px; height: 140px; border-radius: 22px; border: 2px solid var(--line-2); background: linear-gradient(var(--bg-3), var(--bg-2)); padding: 14px 10px; display: grid; gap: 8px; align-content: start; transform: rotate(-8deg); animation: bob 5s ease-in-out infinite; }
.phone i { display: block; height: 22px; border-radius: 8px; background: var(--surface-2); }
.phone i:first-child { height: 40px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
@media (max-width: 960px) {
  .steps { grid-template-columns: 1fr; }
  .steps-line { display: none; }
  .bento { grid-template-columns: 1fr 1fr; }
  .tile.w2, .tile.w3, .tile.w4 { grid-column: span 2; }
  .tile.tall { grid-row: auto; }
}

/* ---------- platforms (B2B) ---------- */
.platforms { position: relative; }
.platform-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 50px; align-items: center; }
.feature-list { display: grid; gap: 14px; }
.feature { display: grid; grid-template-columns: 46px 1fr; gap: 16px; padding: 18px; border-radius: var(--radius); border: 1px solid transparent; transition: background .3s, border-color .3s; }
.feature:hover { background: var(--surface); border-color: var(--line); }
.feature .f-ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 20px; background: var(--surface-2); border: 1px solid var(--line); }
.feature b { font-size: 16px; }
.feature p { color: var(--muted); font-size: 14px; }
.terminal { border-radius: 20px; overflow: hidden; background: #0d0f17; border: 1px solid rgba(255, 255, 255, .1); box-shadow: var(--shadow), 0 0 80px -20px color-mix(in srgb, var(--accent) 35%, transparent); transform: perspective(1200px) rotateY(-8deg) rotateX(4deg); transition: transform .8s var(--ease); }
.terminal:hover { transform: none; }
.term-bar { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid rgba(255, 255, 255, .08); color: #8e93a7; font-size: 12px; }
.term-bar i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.term-bar i:nth-child(2) { background: #febc2e; } .term-bar i:nth-child(3) { background: #28c840; }
.term-bar span { margin-left: 8px; }
.term-body { padding: 20px 22px 26px; font: 500 13px/1.75 ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace; color: #d8d6e2; min-height: 340px; white-space: pre-wrap; word-break: break-word; }
.term-body .c { color: #6b7086; } .term-body .k { color: #ffb86b; } .term-body .s { color: #9be9a8; } .term-body .p { color: #8fa8ff; }
.caret { display: inline-block; width: 8px; height: 16px; background: var(--accent); vertical-align: -3px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.logos { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.logos span { padding: 10px 16px; border-radius: 12px; border: 1px dashed var(--line-2); color: var(--muted); font-weight: 700; font-size: 13px; }
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 80px; }
.plan { padding: 32px; display: grid; gap: 18px; align-content: start; transition: transform .5s var(--spring); }
.plan:hover { transform: translateY(-6px); }
.plan.featured { background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 18%, var(--surface-solid)), var(--surface-solid)); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.plan h3 { font-size: 28px; }
.plan .price { font: 600 40px/1 var(--font-display); }
.plan .price small { font: 600 13px var(--font-body); color: var(--muted); }
.plan ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; color: var(--text-2); font-size: 14px; }
.plan li::before { content: '✓'; color: var(--good); font-weight: 800; margin-right: 10px; }
@media (max-width: 960px) { .platform-grid, .plans { grid-template-columns: 1fr; } .terminal { transform: none; } }

.cta-band { position: relative; overflow: hidden; padding: clamp(50px, 8vw, 90px); border-radius: 32px; text-align: center; display: grid; justify-items: center; gap: 22px; background: radial-gradient(circle at 20% 0%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 50%), radial-gradient(circle at 90% 100%, color-mix(in srgb, var(--accent-3) 35%, transparent), transparent 50%), var(--surface-solid); border: 1px solid var(--line); }
.cta-band h2 { font-size: clamp(36px, 5vw, 64px); max-width: 800px; }
.footer { padding: 50px 0 60px; color: var(--muted); font-size: 13.5px; display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); margin-top: 80px; }
.footer nav { display: flex; gap: 22px; }
.footer a:hover { color: var(--text); }

/* ---------- browse ---------- */
.page-head { padding: 50px 0 30px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 24px; }
.page-head h1 { font-size: clamp(40px, 6vw, 76px); }
.page-head p { color: var(--muted); margin-top: 12px; }
.filters { position: sticky; top: var(--top-h); z-index: 20; display: grid; gap: 14px; padding: 14px 0; margin-bottom: 26px; background: linear-gradient(var(--bg) 70%, transparent); }
.filter-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.search { flex: 1; min-width: 240px; display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); backdrop-filter: blur(12px); transition: border-color .3s, box-shadow .3s; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 15%, transparent); }
.search input { flex: 1; border: 0; background: none; outline: none; font-size: 15px; min-width: 0; }
.search kbd { font: 700 11px var(--font-body); padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line-2); color: var(--muted); }
.select { height: 52px; padding: 0 40px 0 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%238e93a7' stroke-width='2'%3E%3Cpath d='m1 1 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 18px center; appearance: none; font-weight: 600; font-size: 14px; cursor: pointer; }
.select option { background: var(--surface-solid); color: var(--text); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.toggle { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; cursor: pointer; user-select: none; }
.toggle input { appearance: none; width: 44px; height: 26px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--line-2); position: relative; cursor: pointer; transition: background .3s; }
.toggle input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--text); transition: transform .35s var(--spring); }
.toggle input:checked { background: var(--good); border-color: var(--good); }
.toggle input:checked::after { transform: translateX(18px); background: #fff; }
.result-count { color: var(--muted); font-size: 13px; font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 34px 22px; }
.book-card { position: relative; display: grid; gap: 14px; cursor: pointer; perspective: 900px; animation: cardIn .7s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms); }
@keyframes cardIn { from { opacity: 0; transform: translateY(30px) scale(.96); } }
.book-card .tilt { position: relative; transform-style: preserve-3d; transform: rotateX(var(--rx, 0)) rotateY(var(--ry, 0)); transition: transform .5s var(--ease); }
.book-card:hover .tilt { transition: transform .1s linear; }
.book-card .cover { transition: box-shadow .5s, transform .5s var(--ease); }
.book-card:hover .cover { box-shadow: inset 4px 0 6px -2px rgba(0, 0, 0, .35), 0 35px 50px -18px rgba(0, 0, 0, .7); transform: translateZ(30px); }
.glare { position: absolute; inset: 0; z-index: 3; border-radius: 4px 10px 10px 4px; background: radial-gradient(circle at var(--gx, 50%) var(--gy, 0%), rgba(255, 255, 255, .35), transparent 50%); opacity: 0; transition: opacity .4s; pointer-events: none; transform: translateZ(31px); mix-blend-mode: overlay; }
.book-card:hover .glare { opacity: 1; }
.card-badges { position: absolute; z-index: 4; top: 10px; left: 10px; right: 10px; display: flex; justify-content: space-between; transform: translateZ(40px); pointer-events: none; }
.card-badges .tag { backdrop-filter: blur(10px); background: color-mix(in srgb, #0a0c13 65%, transparent); }
.card-meta h3 { font-size: 18px; line-height: 1.2; margin-bottom: 4px; text-wrap: balance; }
.card-meta .by { color: var(--muted); font-size: 13.5px; }
.card-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; gap: 8px; }
.quick { height: 34px; padding: 0 14px; border-radius: 999px; font-size: 12.5px; font-weight: 800; background: var(--surface-2); border: 1px solid var(--line); transition: all .3s var(--spring); }
.quick:hover { background: var(--accent); color: #1d1306; border-color: var(--accent); transform: scale(1.05); }
.quick.on { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); border-color: transparent; }
.skeleton { border-radius: 10px; background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%); background-size: 300% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.empty { text-align: center; padding: 80px 20px; display: grid; justify-items: center; gap: 12px; color: var(--muted); }
.empty .big { font-size: 56px; animation: bob 4s ease-in-out infinite; }
.empty h3 { color: var(--text); font-size: 26px; }
@media (max-width: 560px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 26px 14px; } .card-meta h3 { font-size: 15.5px; } .quick { display: none; } }

/* ---------- modal ---------- */
.modal-root { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(5, 6, 12, .6); backdrop-filter: blur(8px); opacity: 0; transition: opacity .35s; pointer-events: auto; }
.modal-backdrop.open { opacity: 1; }
.modal { position: absolute; left: 50%; top: 50%; width: min(var(--mw, 560px), calc(100vw - 24px)); max-height: calc(100vh - 40px); overflow: auto; translate: -50% -50%; background: var(--surface-solid); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow); padding: clamp(24px, 4vw, 40px); pointer-events: auto; opacity: 0; transform: translateY(30px) scale(.96); transition: opacity .35s, transform .5s var(--spring); }
.modal.open { opacity: 1; transform: none; }
.modal.wide { --mw: 940px; }
.modal-close { position: absolute; top: 16px; right: 16px; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font-size: 20px; color: var(--muted); transition: all .3s var(--spring); z-index: 3; background: var(--surface-solid); }
.modal-close:hover { color: var(--text); transform: rotate(90deg); }
.modal h2 { font-size: clamp(28px, 4vw, 40px); margin-bottom: 8px; }
.modal .lead { color: var(--muted); margin-bottom: 24px; }
@media (max-width: 640px) {
  .modal { top: auto; bottom: 0; translate: -50% 0; border-radius: 26px 26px 0 0; max-height: 92vh; transform: translateY(100%); }
  .modal.open { transform: none; }
}

/* ---------- forms ---------- */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 7px; font-size: 13px; font-weight: 700; color: var(--text-2); }
.field input, .field select, .field textarea { width: 100%; height: 50px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font-size: 15px; font-weight: 500; color: var(--text); outline: none; transition: border-color .3s, box-shadow .3s; }
.field textarea { height: auto; padding: 14px 16px; resize: vertical; min-height: 90px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent); }
.field input[type="color"] { padding: 4px; cursor: pointer; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-error { min-height: 20px; color: var(--bad); font-size: 13.5px; font-weight: 600; }
.form-error:empty { min-height: 0; }
.seg { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 24px; }
.seg button { position: relative; z-index: 1; height: 40px; font-weight: 700; font-size: 14px; color: var(--muted); transition: color .3s; }
.seg button.active { color: #1d1306; }
.seg .seg-pill { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 999px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); transition: transform .45s var(--spring); }
.seg[data-mode="register"] .seg-pill { transform: translateX(100%); }
.pw-meter { height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.pw-meter i { display: block; height: 100%; width: var(--p, 0%); background: var(--c, var(--bad)); transition: width .4s var(--ease), background .4s; }
.star-input { display: flex; gap: 4px; flex-direction: row-reverse; justify-content: flex-end; }
.star-input input { display: none; }
.star-input label { font-size: 28px; color: var(--line-2); cursor: pointer; transition: transform .25s var(--spring), color .2s; }
.star-input label:hover, .star-input label:hover ~ label, .star-input input:checked ~ label { color: var(--accent); }
.star-input label:hover { transform: scale(1.2) rotate(-8deg); }

/* ---------- book detail ---------- */
.detail { display: grid; grid-template-columns: 300px 1fr; gap: 40px; }
.detail-stage { position: relative; display: grid; place-items: center; padding: 30px 0; perspective: 1200px; }
.detail-stage .book3d { --w: 210px; --h: 315px; --d: 40px; animation: detailSpin 10s ease-in-out infinite; }
@keyframes detailSpin { 0%, 100% { transform: rotateY(-30deg) rotateX(6deg); } 50% { transform: rotateY(-8deg) rotateX(-2deg); } }
.detail-stage::before { content: ''; position: absolute; width: 260px; height: 260px; border-radius: 50%; background: var(--c1, var(--accent)); filter: blur(70px); opacity: .45; }
.detail-info { display: grid; gap: 16px; align-content: start; padding-top: 10px; }
.detail-info h2 { font-size: clamp(30px, 4vw, 46px); margin: 0; }
.detail-info .by { color: var(--muted); font-size: 16px; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.copies { display: grid; gap: 8px; padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.copies-bar { display: flex; gap: 5px; }
.copies-bar i { flex: 1; height: 8px; border-radius: 4px; background: var(--good); animation: grow .8s var(--spring) both; transform-origin: left; animation-iteration-count: 1; animation-direction: normal; }
.copies-bar i.out { background: var(--surface-2); }
.copies small { color: var(--muted); font-size: 13px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.reviews { margin-top: 30px; border-top: 1px solid var(--line); padding-top: 26px; display: grid; gap: 14px; }
.reviews h3 { font-size: 24px; }
.review { padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.review-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-weight: 700; font-size: 14px; }
.review p { color: var(--text-2); font-size: 14px; }
@media (max-width: 760px) { .detail { grid-template-columns: 1fr; gap: 10px; } .detail-stage .book3d { --w: 150px; --h: 225px; --d: 30px; } }

/* ---------- shelf ---------- */
.shelf-top { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; margin-bottom: 40px; }
.wallet { padding: 30px; overflow: hidden; display: grid; gap: 18px; background: radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 55%), var(--surface); }
.wallet-amount { display: flex; align-items: center; gap: 18px; }
.wallet-amount .coin { width: 64px; height: 64px; font-size: 30px; }
.wallet-amount b { font: 600 64px/1 var(--font-display); }
.stat-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stat { padding: 20px; display: grid; gap: 4px; align-content: space-between; }
.stat b { font: 600 34px/1 var(--font-display); }
.stat span { color: var(--muted); font-size: 12.5px; font-weight: 700; }
.shelf-section { margin-bottom: 50px; }
.shelf-section > h2 { font-size: 30px; margin-bottom: 20px; display: flex; align-items: center; gap: 12px; }
.loans { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.loan { display: grid; grid-template-columns: 84px 1fr auto; gap: 18px; align-items: center; padding: 16px; transition: transform .4s var(--spring), border-color .3s; }
.loan:hover { transform: translateY(-4px); border-color: var(--line-2); }
.loan .cover { width: 84px; }
.loan h4 { font: 600 18px/1.2 var(--font-display); margin-bottom: 4px; }
.loan .by { color: var(--muted); font-size: 13px; }
.loan-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.ring-prog { --size: 64px; position: relative; width: var(--size); height: var(--size); display: grid; place-items: center; }
.ring-prog svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring-prog circle { fill: none; stroke-width: 5; }
.ring-prog .bg { stroke: var(--surface-2); }
.ring-prog .fg { stroke: var(--c, var(--good)); stroke-linecap: round; stroke-dasharray: 176; stroke-dashoffset: 176; transition: stroke-dashoffset 1.6s var(--ease); }
.ring-prog b { font: 700 17px/1 var(--font-body); }
.ring-prog small { position: absolute; bottom: -18px; font-size: 10.5px; color: var(--muted); font-weight: 700; white-space: nowrap; }
.history { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 18px; }
.history .cover { cursor: pointer; transition: transform .4s var(--spring); }
.history .cover:hover { transform: translateY(-6px) rotate(-2deg); }
.ledger { display: grid; }
.ledger-row { display: grid; grid-template-columns: 1fr auto auto; gap: 18px; padding: 14px 4px; border-bottom: 1px solid var(--line); font-size: 14px; align-items: center; }
.ledger-row b.neg { color: var(--bad); } .ledger-row b.pos { color: var(--good); }
.ledger-row small { color: var(--muted); }
@media (max-width: 860px) { .shelf-top { grid-template-columns: 1fr; } .loans { grid-template-columns: 1fr; } .loan { grid-template-columns: 70px 1fr; } .loan .cover { width: 70px; } .loan .ring-prog { grid-column: 2; grid-row: 1; justify-self: end; align-self: start; --size: 52px; } }

/* ---------- admin console ---------- */
.console { display: grid; grid-template-columns: 230px 1fr; gap: 30px; padding-block: 30px 60px; }
.side { position: sticky; top: calc(var(--top-h) + 20px); align-self: start; display: grid; gap: 4px; }
.side .side-title { padding: 0 14px 14px; font: 600 22px var(--font-display); }
.side button { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; font-weight: 700; font-size: 14px; color: var(--muted); text-align: left; transition: all .25s; }
.side button:hover { color: var(--text); background: var(--surface); }
.side button.active { color: var(--text); background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent); }
.side button i { font-style: normal; width: 20px; text-align: center; }
.console-main { min-width: 0; display: grid; gap: 24px; align-content: start; }
.console-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 16px; }
.console-head h1 { font-size: clamp(32px, 4vw, 48px); }
.console-head p { color: var(--muted); margin-top: 6px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpi { padding: 20px; display: grid; gap: 6px; overflow: hidden; }
.kpi span { color: var(--muted); font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.kpi b { font: 600 38px/1 var(--font-display); }
.kpi small { font-size: 12.5px; font-weight: 700; }
.kpi svg { position: absolute; right: 0; bottom: 0; width: 55%; height: 50px; opacity: .7; }
.panel { padding: 24px; overflow: hidden; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.panel-head h3 { font-size: 22px; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); font-weight: 700; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.chart-wrap { position: relative; }
.chart-wrap svg { width: 100%; height: auto; overflow: visible; }
.chart-wrap .grid-line { stroke: var(--line); stroke-dasharray: 3 5; }
.chart-wrap .axis { fill: var(--muted); font-size: 10.5px; font-weight: 600; }
.chart-wrap .line { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.draw { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 1.8s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.chart-tip { position: absolute; pointer-events: none; padding: 8px 12px; border-radius: 10px; background: var(--surface-solid); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 12px; font-weight: 700; white-space: nowrap; translate: -50% -120%; opacity: 0; transition: opacity .2s; }
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }
.bars { display: grid; gap: 14px; }
.bar-row { display: grid; gap: 6px; font-size: 13.5px; font-weight: 700; }
.bar-row div { display: flex; justify-content: space-between; }
.bar-row span { color: var(--muted); }
.bar { height: 10px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; width: var(--w); border-radius: 5px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); animation: barIn 1.4s var(--ease) both; animation-delay: calc(var(--i) * 80ms); }
@keyframes barIn { from { width: 0; } }
.top-list { display: grid; gap: 10px; }
.top-item { display: grid; grid-template-columns: 26px 44px 1fr auto; gap: 12px; align-items: center; font-size: 14px; }
.top-item .rank { font: italic 600 20px var(--font-display); color: var(--muted); }
.top-item .cover { width: 44px; }
.top-item b { display: block; line-height: 1.25; }
.top-item small { color: var(--muted); }
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; padding: 14px 16px; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 800; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .2s; }
tbody tr:hover { background: var(--surface); }
td .row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
td .mini { height: 30px; padding: 0 12px; border-radius: 999px; font-size: 12px; font-weight: 800; border: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
td .mini:hover { border-color: var(--accent); color: var(--accent); }
td .mini.danger:hover { border-color: var(--bad); color: var(--bad); }
.cell-book { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.cell-book .cover { width: 34px; flex: none; border-radius: 2px 5px 5px 2px; }
.cell-book b { display: block; line-height: 1.25; }
.cell-book small { color: var(--muted); }
code, .mono { font-family: ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace; font-size: 12.5px; }
.secret { display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: 14px; background: #0d0f17; color: #9be9a8; border: 1px solid color-mix(in srgb, var(--good) 35%, transparent); word-break: break-all; }
.secret code { flex: 1; }
.endpoint { display: grid; grid-template-columns: 70px 1fr; gap: 12px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.endpoint:last-child { border-bottom: 0; }
.method { font: 800 11px var(--font-body); padding: 3px 0; border-radius: 6px; text-align: center; letter-spacing: .04em; }
.method.GET { background: color-mix(in srgb, var(--accent-3) 18%, transparent); color: var(--accent-3); }
.method.POST { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.method.PATCH { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.method.DELETE { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }
.endpoint small { display: block; color: var(--muted); font-size: 12.5px; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatches button { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--surface-solid); box-shadow: 0 0 0 1px var(--line-2); transition: transform .3s var(--spring); }
.swatches button:hover, .swatches button.active { transform: scale(1.18); box-shadow: 0 0 0 2px var(--text); }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, 1fr); } .two-col { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .console { grid-template-columns: 1fr; }
  .side { position: static; display: flex; overflow-x: auto; scrollbar-width: none; margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); }
  .side .side-title { display: none; }
  .side button { white-space: nowrap; }
}

/* ---------- toasts ---------- */
.toasts { position: fixed; z-index: 200; left: 50%; bottom: 28px; translate: -50% 0; display: grid; gap: 10px; justify-items: center; pointer-events: none; width: min(460px, calc(100vw - 32px)); }
.toast { display: flex; align-items: center; gap: 12px; padding: 12px 18px 12px 12px; border-radius: 16px; background: var(--surface-solid); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-weight: 600; font-size: 14px; pointer-events: auto; animation: toastIn .5s var(--spring) both; }
.toast.out { animation: toastOut .35s var(--ease) forwards; }
.toast i { width: 30px; height: 30px; flex: none; border-radius: 10px; display: grid; place-items: center; font-style: normal; background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.toast.error i { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }
@keyframes toastIn { from { opacity: 0; transform: translateY(30px) scale(.9); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(20px) scale(.95); } }
@media (max-width: 860px) { .toasts { bottom: 100px; } }

/* ---------- flying cover + confetti ---------- */
.flying { position: fixed; z-index: 300; pointer-events: none; border-radius: 4px 10px 10px 4px; box-shadow: 0 30px 60px rgba(0, 0, 0, .5); }
.confetti { position: fixed; z-index: 299; pointer-events: none; width: 8px; height: 12px; border-radius: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  [data-reveal] { opacity: 1; transform: none; }
  .split-word > span { transform: none; }
}
