:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #475569;
  --subtle: #64748b;
  --border: #e2e8f0;
  --accent: #1d4ed8;
  --accent-hover: #1e40af;
  --accent-soft: #eff6ff;
  --success: #047857;
  --success-soft: #ecfdf5;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.05);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 66px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
  font-size: 1.05rem;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--ink);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.15rem;
  font-weight: 700;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 0.92rem;
}

.nav-links a {
  color: var(--muted);
  font-weight: 500;
}

.nav-links a:hover {
  color: var(--ink);
  text-decoration: none;
}

.lang-toggle {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lang-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Hero */
.hero {
  background-color: #ffffff;
  background-image: linear-gradient(to right, #f1f5f9 1px, transparent 1px),
    linear-gradient(to bottom, #f1f5f9 1px, transparent 1px);
  background-size: 28px 28px;
  border-bottom: 1px solid var(--border);
  padding: 58px 0 48px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid #bfdbfe;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 18px;
}

.hero h1 {
  font-size: clamp(1.85rem, 3.6vw, 2.75rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  max-width: 780px;
  margin-bottom: 16px;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 680px;
  margin-bottom: 26px;
}

.hero-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

.pill-info {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 0.88rem;
  color: var(--ink);
  font-weight: 500;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.03);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.94rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  text-decoration: none;
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border);
}

.btn-secondary:hover {
  border-color: #94a3b8;
  text-decoration: none;
}

/* Delivery Banner */
.delivery-strip {
  padding: 26px 0;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.step-num {
  display: inline-flex;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.84rem;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.step-card h3 {
  font-size: 0.98rem;
  margin-bottom: 4px;
}

.step-card p {
  font-size: 0.88rem;
  color: var(--muted);
}

/* Catalog Section */
.section {
  padding: 36px 0 48px;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.section-head h2 {
  font-size: 1.55rem;
  letter-spacing: -0.01em;
}

.section-desc {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 4px;
}

/* Filters */
.filter-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.filter-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-btn.active {
  background: var(--ink);
  color: #ffffff;
  border-color: var(--ink);
}

.search-box {
  flex: 1;
  min-width: 220px;
  max-width: 320px;
}

.search-box input {
  width: 100%;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
  outline: none;
  background: var(--bg);
}

.search-box input:focus {
  border-color: var(--accent);
  background: #ffffff;
}

.catalog-meta {
  font-size: 0.88rem;
  color: var(--subtle);
  margin-bottom: 16px;
}

/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 20px;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.product-card:hover {
  transform: translateY(-3px);
  border-color: #cbd5e1;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.09);
}

.card-cover-stage {
  background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.book-cover-img {
  width: 162px;
  height: 216px;
  object-fit: cover;
  border-radius: 7px;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.2), 0 2px 6px rgba(15, 23, 42, 0.12);
  display: block;
  transition: transform 0.18s ease;
}

.product-card:hover .book-cover-img,
.product-card:hover .book-cover-auto {
  transform: translateY(-2px) scale(1.015);
}

/* Auto-generated textbook cover fallback when no custom image is set */
.book-cover-auto {
  width: 162px;
  height: 216px;
  border-radius: 7px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.2), 0 2px 6px rgba(15, 23, 42, 0.12);
  transition: transform 0.18s ease;
  text-align: center;
}

.book-cover-top {
  flex: 1.35;
  padding: 14px 10px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #ffffff;
  background: linear-gradient(145deg, #1d3b8b, #2952b3);
  border-bottom: 3px solid #facc15;
  position: relative;
}

.book-cover-auto.theme-Mechanics .book-cover-top {
  background: linear-gradient(145deg, #065f46, #047857);
}

.book-cover-auto.theme-Statistics .book-cover-top {
  background: linear-gradient(145deg, #312e81, #4338ca);
}

.book-cover-auto.theme-Further .book-cover-top {
  background: linear-gradient(145deg, #6b1434, #9f1239);
}

.book-cover-auto.theme-Bundle .book-cover-top {
  background: linear-gradient(145deg, #0f172a, #1e293b);
}

.book-cover-pill {
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.12);
}

.book-cover-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: #facc15;
  line-height: 1.18;
}

.book-cover-sub {
  font-size: 0.64rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.25;
}

.book-cover-bottom {
  flex: 0.9;
  background: #fff8f9;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  color: #1e3a8a;
}

.book-cover-feats {
  font-size: 0.61rem;
  font-weight: 600;
  line-height: 1.45;
  color: #334155;
}

.book-cover-brand {
  font-size: 0.58rem;
  font-weight: 700;
  color: #64748b;
}

.card-body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
}

.modal-hero-row {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.modal-cover-slot {
  flex-shrink: 0;
}

.modal-cover-slot .book-cover-img,
.modal-cover-slot .book-cover-auto {
  width: 112px;
  height: 150px;
}

.modal-cover-slot .book-cover-title {
  font-size: 0.72rem;
}

.modal-cover-slot .book-cover-feats {
  font-size: 0.5rem;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.tag {
  font-size: 0.76rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
}

.tag-neutral {
  background: #f1f5f9;
  color: var(--muted);
}

.tag-cloud {
  background: var(--success-soft);
  color: var(--success);
}

.product-card h3 {
  font-size: 1.05rem;
  line-height: 1.38;
  margin-bottom: 8px;
}

.product-desc {
  font-size: 0.89rem;
  color: var(--muted);
  margin-bottom: 14px;
}

.product-stats {
  display: flex;
  gap: 14px;
  font-size: 0.82rem;
  color: var(--subtle);
  padding: 10px 0;
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
  margin-bottom: 14px;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.price {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--ink);
}

.price-note {
  display: block;
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--subtle);
}

.card-actions {
  display: flex;
  gap: 8px;
}

.btn-sm {
  padding: 8px 13px;
  font-size: 0.84rem;
  border-radius: 9px;
}

/* FAQ */
.faq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.faq-item h3 {
  font-size: 0.98rem;
  margin-bottom: 6px;
}

.faq-item p {
  font-size: 0.89rem;
  color: var(--muted);
}

/* Footer */
.site-footer {
  background: #0f172a;
  color: #cbd5e1;
  padding: 44px 0 32px;
  margin-top: 32px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid #1e293b;
}

.site-footer h4 {
  color: #ffffff;
  font-size: 0.95rem;
  margin-bottom: 10px;
}

.site-footer p,
.site-footer li {
  font-size: 0.86rem;
  color: #94a3b8;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-links a {
  color: #cbd5e1;
}

.footer-links a:hover {
  color: #ffffff;
}

.disclaimer {
  margin-top: 22px;
  font-size: 0.8rem;
  color: #64748b;
  line-height: 1.55;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: var(--surface);
  border-radius: 16px;
  max-width: 580px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 26px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.modal-close {
  border: none;
  background: #f1f5f9;
  color: var(--ink);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 1.15rem;
  cursor: pointer;
}

.modal-list {
  margin: 12px 0 18px 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

.modal-list li {
  margin-bottom: 6px;
}

.modal-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 18px;
}

.modal-box h4 {
  font-size: 0.88rem;
  margin-bottom: 8px;
}

/* Legal pages */
.legal-wrap {
  max-width: 820px;
  margin: 36px auto 56px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
}

.legal-wrap h1 {
  font-size: 1.75rem;
  margin-bottom: 8px;
}

.legal-meta {
  color: var(--subtle);
  font-size: 0.88rem;
  margin-bottom: 24px;
}

.legal-wrap h2 {
  font-size: 1.12rem;
  margin: 22px 0 8px;
}

.legal-wrap p,
.legal-wrap li {
  font-size: 0.94rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.legal-wrap ul {
  margin-left: 20px;
  margin-bottom: 12px;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: var(--subtle);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

@media (max-width: 760px) {
  .nav-links {
    display: none;
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .legal-wrap {
    padding: 24px 18px;
    margin: 20px 12px 40px;
  }
  .modal-hero-row {
    flex-direction: column;
  }
}
