:root {
  --bg: #0c0f1a;
  --surface: #141829;
  --surface-2: #1b2036;
  --paper: #ffffff;
  --paper-soft: #f8fafc;
  --ink: #121626;
  --ink-muted: #5b647a;
  --text-light: #f1f5f9;
  --text-dim: #9aa4bf;
  --accent: #e84158;
  --accent-hover: #d12e45;
  --emerald: #10b981;
  --border-dark: rgba(255, 255, 255, 0.1);
  --border-light: #e2e8f0;
  --radius: 16px;
  --shadow-lg: 0 24px 55px rgba(8, 11, 22, 0.35);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.container { width: min(1180px, 92%); margin: 0 auto; }

.sandbox-banner {
  background: #fef3c7;
  color: #78350f;
  text-align: center;
  font-size: 0.84rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #fde68a;
}
.sandbox-banner code {
  background: rgba(120, 53, 15, 0.1);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(12, 15, 26, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-dark);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
  gap: 1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: #fff;
}
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent);
  display: grid;
  place-items: center;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 1.15rem;
  color: #fff;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 1.05rem; letter-spacing: -0.02em; }
.brand-text small { font-size: 0.72rem; color: var(--text-dim); }

.main-nav { display: flex; align-items: center; gap: 1.5rem; }
.main-nav a, .nav-link-btn {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  transition: color 0.15s;
}
.main-nav a:hover, .nav-link-btn:hover { color: #fff; }

.cart-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface-2);
  color: #fff;
  border: 1px solid var(--border-dark);
  padding: 0.52rem 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.cart-btn:hover { border-color: var(--accent); background: #232944; }
.cart-count {
  background: var(--accent);
  color: #fff;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  padding: 0 6px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  border-radius: 10px;
  padding: 0.68rem 1.2rem;
  font-weight: 600;
  font-size: 0.93rem;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s, background 0.15s, border-color 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn-lg { padding: 0.85rem 1.5rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: #eef2ff; color: #1e293b; }
.btn-secondary:hover { background: #e2e8f0; }
.btn-ghost {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.14); }

/* Hero */
.hero {
  background: radial-gradient(circle at 75% 25%, rgba(232, 65, 88, 0.18), transparent 45%),
              linear-gradient(180deg, #0c0f1a 0%, #141829 100%);
  color: #fff;
  padding: 4.2rem 0 4.8rem;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 3rem;
  align-items: center;
}
.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(232, 65, 88, 0.14);
  border: 1px solid rgba(232, 65, 88, 0.4);
  color: #ff8a9b;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  margin-bottom: 1.2rem;
}
.pill-badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}
.hero h1 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(2.1rem, 4.2vw, 3.2rem);
  line-height: 1.12;
  margin: 0 0 1rem;
  letter-spacing: -0.025em;
}
.accent-text { color: #ff6b81; }
.hero-lead {
  color: #c2cbe0;
  font-size: 1.08rem;
  max-width: 56ch;
  margin: 0 0 1.8rem;
}
.hero-cta-row { display: flex; flex-wrap: wrap; gap: 0.85rem; margin-bottom: 2.2rem; }
.hero-trust {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-dark);
}
.trust-item strong { display: block; font-size: 0.88rem; color: #fff; }
.trust-item span { font-size: 0.8rem; color: var(--text-dim); }

.featured-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.featured-cover-wrap {
  width: 240px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 22px 45px rgba(0, 0, 0, 0.55);
  margin-bottom: 1rem;
}
.featured-cover-wrap img { display: block; width: 100%; height: auto; }
.lock-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  margin-bottom: 0.55rem;
}
.featured-card h3 { margin: 0.2rem 0 0.25rem; font-size: 1.12rem; }
.featured-card p { margin: 0 0 0.9rem; font-size: 0.85rem; color: var(--text-dim); }
.featured-actions { display: flex; gap: 0.6rem; width: 100%; }
.featured-actions .btn { flex: 1; }

/* Security strip */
.security-strip {
  background: var(--paper-soft);
  border-bottom: 1px solid var(--border-light);
  padding: 2.2rem 0;
}
.strip-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
.strip-card {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
}
.step-num {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--accent);
  background: rgba(232, 65, 88, 0.1);
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
}
.strip-card h3 { margin: 0 0 0.2rem; font-size: 1rem; }
.strip-card p { margin: 0; font-size: 0.88rem; color: var(--ink-muted); }

/* Catalog */
.catalog-section { padding: 4.5rem 0; }
.section-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.5rem;
  margin-bottom: 2.2rem;
}
.eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 0.35rem;
}
.eyebrow.light { color: #ff8a9b; }
.section-header h2 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 2rem;
  margin: 0 0 0.3rem;
}
.section-sub { margin: 0; color: var(--ink-muted); font-size: 0.95rem; max-width: 56ch; }

.filter-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.filter-btn {
  background: var(--paper-soft);
  border: 1px solid var(--border-light);
  color: var(--ink-muted);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.filter-btn.active, .filter-btn:hover {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1.75rem;
}
.book-card {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.18s, box-shadow 0.18s;
}
.book-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.09);
}
.book-cover-stage {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  padding: 1.6rem 1.4rem;
  display: flex;
  justify-content: center;
  position: relative;
}
.book-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--ink);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
}
.book-lock-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.92);
  color: #334155;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.24rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.08);
}
.book-cover-img {
  width: 175px;
  border-radius: 8px;
  box-shadow: -8px 14px 28px rgba(15, 23, 42, 0.28);
  display: block;
}
.book-body {
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.book-cat {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.3rem;
}
.book-title {
  margin: 0 0 0.35rem;
  font-size: 1.22rem;
  font-weight: 800;
  line-height: 1.25;
}
.book-desc {
  margin: 0 0 0.9rem;
  color: var(--ink-muted);
  font-size: 0.9rem;
  flex: 1;
}
.book-meta {
  font-size: 0.8rem;
  color: #475569;
  background: var(--paper-soft);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}
.book-price-row {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  margin-bottom: 0.95rem;
}
.book-price { font-size: 1.45rem; font-weight: 800; color: var(--ink); }
.book-old-price { font-size: 0.92rem; color: #94a3b8; text-decoration: line-through; }
.book-actions { display: grid; grid-template-columns: 1fr 1.2fr; gap: 0.6rem; }

/* Bundle */
.bundle-section { padding: 1.5rem 0 4.5rem; }
.bundle-card {
  background: linear-gradient(125deg, #13172b 0%, #1d223f 100%);
  color: #fff;
  border-radius: 22px;
  padding: 2.6rem;
  display: grid;
  grid-template-columns: 1.4fr 0.75fr;
  gap: 2.5rem;
  align-items: center;
  box-shadow: var(--shadow-lg);
}
.bundle-info h2 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  margin: 0.25rem 0 0.7rem;
  font-size: 1.85rem;
}
.bundle-info p { color: #cbd5e1; margin: 0 0 1rem; }
.bundle-perks { margin: 0; padding-left: 1.1rem; color: #e2e8f0; font-size: 0.93rem; }
.bundle-perks li { margin-bottom: 0.35rem; }
.bundle-cta-box {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  padding: 1.5rem;
  text-align: center;
}
.bundle-price-row { display: flex; justify-content: center; align-items: baseline; gap: 0.7rem; }
.old-price { color: #94a3b8; text-decoration: line-through; font-size: 1.15rem; }
.new-price { font-size: 2.4rem; font-weight: 800; color: #fff; }
.bundle-note { margin: 0.2rem 0 1.1rem; font-size: 0.84rem; color: #94a3b8; }

/* Author */
.author-section {
  background: var(--paper-soft);
  border-top: 1px solid var(--border-light);
  padding: 4rem 0;
}
.author-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.35fr;
  gap: 2.5rem;
  align-items: center;
}
.author-badge-card {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.8rem;
  display: flex;
  align-items: center;
  gap: 1.1rem;
}
.author-monogram {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--ink);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 1.45rem;
  flex-shrink: 0;
  border-bottom: 4px solid var(--accent);
}
.author-badge-card h3 { margin: 0 0 0.2rem; }
.author-role { margin: 0; font-size: 0.88rem; color: var(--ink-muted); }
.author-bio h2 { font-family: 'Plus Jakarta Sans', sans-serif; margin: 0 0 0.7rem; font-size: 1.7rem; }
.author-bio p { margin: 0 0 1.1rem; color: #334155; }
.ownership-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.ownership-tags span {
  background: #fff;
  border: 1px solid var(--border-light);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
}

/* Footer */
.site-footer {
  background: #0c0f1a;
  color: #94a3b8;
  padding: 2.2rem 0;
  font-size: 0.88rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.footer-inner strong { color: #fff; font-size: 1rem; }
.footer-inner p { margin: 0.25rem 0 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: center; }
.footer-links a, .footer-btn {
  color: #cbd5e1;
  text-decoration: none;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  padding: 0;
}
.footer-links a:hover, .footer-btn:hover { color: #fff; }

/* Modals & Drawers */
.modal-backdrop, .drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(10, 13, 24, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.drawer-backdrop { justify-content: flex-end; padding: 0; }
.modal-card {
  background: #fff;
  border-radius: 20px;
  width: min(520px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  position: relative;
  box-shadow: var(--shadow-lg);
}
.modal-card.modal-lg { width: min(860px, 100%); }
.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  background: #fff;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink);
}
.modal-close.static { position: static; }
.modal-sub { color: var(--ink-muted); font-size: 0.92rem; margin: 0.3rem 0 1.2rem; }

.modal-book-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2rem;
  align-items: start;
}
.modal-cover {
  width: 100%;
  border-radius: 10px;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.25);
}
.modal-toc-box {
  background: var(--paper-soft);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  margin: 1rem 0;
  max-height: 220px;
  overflow-y: auto;
}
.modal-toc-box h4 { margin: 0 0 0.5rem; font-size: 0.92rem; }
.modal-toc-box ul {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.85rem;
  color: #334155;
  columns: 2;
  column-gap: 1.5rem;
}
.modal-toc-box li { margin-bottom: 0.25rem; break-inside: avoid; }
.locked-notice {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #9f1239;
  border-radius: 10px;
  padding: 0.7rem 0.95rem;
  font-size: 0.84rem;
  font-weight: 500;
  margin-bottom: 1rem;
}

/* Cart Drawer */
.drawer-panel {
  background: #fff;
  width: min(420px, 100%);
  height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.25);
}
.drawer-head {
  padding: 1.2rem 1.4rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.drawer-head h3 { margin: 0; }
.drawer-body { flex: 1; overflow-y: auto; padding: 1.2rem 1.4rem; }
.drawer-foot {
  padding: 1.2rem 1.4rem;
  border-top: 1px solid var(--border-light);
  background: var(--paper-soft);
}
.cart-item {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border-light);
}
.cart-item img { width: 52px; border-radius: 6px; }
.cart-item-info { flex: 1; }
.cart-item-info strong { display: block; font-size: 0.92rem; }
.cart-item-info span { font-size: 0.84rem; color: var(--ink-muted); }
.remove-btn {
  background: none;
  border: none;
  color: #dc2626;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
}
.cart-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 1.15rem;
  margin-bottom: 0.9rem;
}

/* Forms & Checkout */
.checkout-summary {
  background: var(--paper-soft);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.checkout-form label {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  margin-bottom: 0.9rem;
}
.checkout-form input[type="text"],
.checkout-form input[type="email"] {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.68rem 0.85rem;
  border-radius: 9px;
  border: 1px solid #cbd5e1;
  font-size: 0.95rem;
  font-family: inherit;
}
.payment-box {
  background: var(--paper-soft);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}
.pay-option {
  display: flex !important;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.45rem !important;
  font-weight: 500 !important;
  cursor: pointer;
}
.pay-hint { margin: 0.4rem 0 0; font-size: 0.8rem; color: var(--ink-muted); }
.form-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.86rem;
  margin-bottom: 0.9rem;
}

/* Unlocked Library */
.success-pill {
  display: inline-block;
  background: #d1fae5;
  color: #065f46;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 0.5rem;
}
.unlocked-list { display: grid; gap: 0.85rem; margin: 1rem 0; }
.unlocked-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--paper-soft);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 0.85rem 1rem;
}
.unlocked-row img { width: 54px; border-radius: 6px; }
.unlocked-row-info { flex: 1; }
.unlocked-row-info strong { display: block; font-size: 0.98rem; }
.unlocked-row-info span { font-size: 0.82rem; color: var(--ink-muted); }
.unlocked-footer-note {
  font-size: 0.84rem;
  color: var(--ink-muted);
  background: #f8fafc;
  padding: 0.75rem 1rem;
  border-radius: 8px;
}

@media (max-width: 900px) {
  .hero-grid, .bundle-card, .author-grid, .modal-book-layout { grid-template-columns: 1fr; }
  .strip-grid, .hero-trust { grid-template-columns: 1fr; }
  .main-nav { display: none; }
  .modal-toc-box ul { columns: 1; }
}
