:root {
  --bg: #f7f3ea;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --ink: #26231f;
  --muted: #6d675d;
  --line: #dfd7c8;
  --brand: #18655f;
  --brand-dark: #0f4844;
  --accent: #c8563d;
  --accent-soft: #f7d8cb;
  --gold: #b8842f;
  --shadow: 0 18px 50px rgba(64, 48, 28, .12);
  --radius: 8px;
  --max: 1180px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
  line-height: 1.65;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.container {
  width: min(var(--max), calc(100% - 48px));
  margin: 0 auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 253, 248, .94);
  border-bottom: 1px solid rgba(223, 215, 200, .75);
  backdrop-filter: blur(14px);
}

.header-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 154px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 7px;
  color: #fffdf8;
  background: var(--brand);
  font-weight: 800;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .12);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  line-height: 1.15;
  font-size: 18px;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.main-nav a {
  padding: 8px 12px;
  border-radius: 7px;
  color: #4a453d;
  font-size: 15px;
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--brand-dark);
  background: #e8f0ec;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-box input {
  width: 220px;
  height: 38px;
  padding: 0 14px;
  color: var(--ink);
  background: #f5efe5;
  border: 1px solid transparent;
  border-radius: 7px;
  outline: none;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-weight: 700;
  white-space: nowrap;
}

.btn-small {
  min-height: 38px;
  padding-inline: 14px;
  font-size: 14px;
}

.btn-primary {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.btn-primary:hover {
  background: var(--brand-dark);
}

.btn-ghost {
  color: var(--brand-dark);
  background: #eaf2ef;
  border-color: #cbded7;
}

.btn-ghost:hover {
  background: #dcece6;
}

.btn-light {
  color: var(--ink);
  background: #fff9ee;
  border-color: var(--line);
}

.btn-full {
  width: 100%;
}

.text-link {
  color: var(--brand-dark);
  font-weight: 700;
  border-bottom: 1px solid currentColor;
}

.hero-section {
  min-height: calc(100vh - 72px);
  display: flex;
  align-items: center;
  padding: 54px 0 44px;
  background:
    linear-gradient(90deg, rgba(247, 243, 234, .94), rgba(247, 243, 234, .84)),
    url("../img/library-hero.svg") center / cover no-repeat;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 56px;
  align-items: center;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-copy h1,
.page-title h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(40px, 6vw, 70px);
  line-height: 1.08;
  letter-spacing: 0;
}

.hero-copy p:not(.eyebrow),
.page-title p {
  max-width: 650px;
  color: #514c43;
  font-size: 18px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  margin: 30px 0;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  max-width: 540px;
  margin: 0;
}

.hero-metrics div {
  padding-top: 16px;
  border-top: 1px solid rgba(38, 35, 31, .18);
}

.hero-metrics dt {
  font-size: 26px;
  font-weight: 900;
  color: var(--brand-dark);
}

.hero-metrics dd {
  margin: 0;
  color: var(--muted);
}

.featured-panel {
  padding: 18px;
  background: rgba(255, 253, 248, .88);
  border: 1px solid rgba(223, 215, 200, .85);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.book-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  min-height: 170px;
  padding: 14px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.book-card-large {
  grid-template-columns: 150px minmax(0, 1fr);
  min-height: 228px;
}

.book-card img,
.detail-cover {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 16px 30px rgba(40, 31, 20, .18);
}

.book-card h2,
.book-card h3 {
  margin: 8px 0 6px;
  font-size: 22px;
  line-height: 1.25;
}

.book-card p {
  margin: 0 0 12px;
  color: var(--muted);
}

.book-card a {
  color: var(--brand-dark);
  font-weight: 800;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 6px;
  color: #713522;
  background: var(--accent-soft);
  font-size: 13px;
  font-weight: 800;
}

.tag-soft {
  color: var(--brand-dark);
  background: #e1eee9;
}

.chapter-preview {
  margin-top: 14px;
  padding: 16px;
  background: #f7f0e4;
  border-radius: var(--radius);
}

.chapter-preview p {
  margin: 12px 0 0;
  color: var(--muted);
}

.preview-line {
  height: 12px;
  width: 100%;
  margin-bottom: 10px;
  background: #d9cbb7;
  border-radius: 3px;
}

.preview-line.short {
  width: 72%;
}

.section {
  padding: 72px 0;
}

.section-muted {
  background: #eee7db;
}

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

.section-head h2,
.split-layout h2,
.intro-panel h2,
.service-panel h2,
.pricing-card h2,
.checkout-info h2,
.rank-panel h2,
.filter-panel h2,
.help-grid h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
}

.lead {
  color: var(--muted);
  font-size: 17px;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.category-tile {
  min-height: 132px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.category-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.category-tile strong,
.category-tile span {
  display: block;
}

.category-tile strong {
  margin-bottom: 12px;
  font-size: 20px;
}

.category-tile span {
  color: var(--muted);
}

.segmented {
  display: inline-flex;
  padding: 4px;
  background: #fff9ee;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.segmented button,
.filter-options button,
.reader-tools button {
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
}

.segmented button {
  min-height: 34px;
  padding: 0 13px;
}

.segmented button.active,
.filter-options button.active,
.reader-tools button.active {
  color: #fff;
  background: var(--brand);
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 520px;
  gap: 40px;
  align-items: start;
}

.payment-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.payment-strip span {
  padding: 8px 12px;
  color: var(--brand-dark);
  background: #e8f0ec;
  border-radius: 6px;
  font-weight: 700;
}

.price-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.price-list article,
.pricing-card,
.rank-panel,
.help-grid article,
.checkout-info article,
.intro-panel,
.service-panel,
.filter-panel {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.price-list article {
  padding: 24px;
}

.price-list h3 {
  margin: 0;
  font-size: 22px;
}

.price-list p,
.pricing-card p,
.checkout-info p,
.help-grid p {
  color: var(--muted);
}

.price-list strong,
.pricing-card strong {
  display: block;
  margin: 16px 0;
  color: var(--accent);
  font-size: 30px;
}

.site-footer {
  padding: 42px 0 24px;
  color: #eee8dc;
  background: #242821;
}

.site-footer.compact {
  padding: 22px 0;
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 40px;
}

.footer-brand .brand-mark {
  background: var(--accent);
}

.site-footer .brand small,
.site-footer p,
.footer-bottom {
  color: #c7c0b4;
}

.site-footer nav {
  display: grid;
  gap: 8px;
}

.site-footer a:hover {
  color: #fff;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, .12);
  font-size: 13px;
}

.page-title {
  padding: 58px 0 52px;
  background: #efe7da;
  border-bottom: 1px solid var(--line);
}

.pay-title {
  background:
    linear-gradient(90deg, rgba(239, 231, 218, .96), rgba(239, 231, 218, .74)),
    url("../img/payment-hero.svg") center / cover no-repeat;
}

.catalog-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.filter-panel {
  position: sticky;
  top: 96px;
  padding: 20px;
}

.filter-group {
  padding-top: 18px;
}

.filter-group span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-weight: 700;
}

.filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-options button {
  min-height: 34px;
  padding: 0 11px;
  background: #f3ecdf;
}

.catalog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.select-label {
  color: var(--muted);
}

.select-label select {
  height: 38px;
  margin-left: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.book-list {
  display: grid;
  gap: 14px;
}

.book-list-item {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) 150px;
  gap: 18px;
  align-items: center;
  padding: 14px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.book-list-item img {
  width: 104px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 6px;
}

.book-list-item h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.book-list-meta,
.detail-meta,
.muted-text {
  color: var(--muted);
}

.book-list-item p {
  margin: 8px 0;
  color: #514c43;
}

.book-list-actions {
  display: grid;
  gap: 8px;
}

.empty-state {
  padding: 42px;
  text-align: center;
  color: var(--muted);
  background: var(--surface-strong);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.book-detail-hero {
  padding: 58px 0;
  background: #efe7da;
  border-bottom: 1px solid var(--line);
}

.detail-grid {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 34px;
  align-items: center;
}

.detail-copy h1 {
  margin: 0 0 6px;
  font-size: 52px;
  line-height: 1.08;
}

.detail-copy p {
  max-width: 760px;
  color: #514c43;
  font-size: 17px;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 22px;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.price-note {
  display: grid;
  gap: 4px;
  max-width: 720px;
  margin-top: 20px;
  padding: 14px 16px;
  background: #fff9ee;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.price-note span {
  color: var(--muted);
}

.detail-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 20px;
}

.intro-panel,
.service-panel {
  padding: 24px;
}

.intro-panel p,
.service-panel li {
  color: #514c43;
}

.service-panel ul {
  padding-left: 20px;
  margin: 14px 0 0;
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.chapter-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 13px 14px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.chapter-item:hover {
  border-color: var(--brand);
}

.chapter-item small {
  color: var(--muted);
  white-space: nowrap;
}

.reader-body {
  background: #eee5d6;
}

.reader-body.night {
  color: #e8e1d3;
  background: #171916;
}

.reader-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 28px;
  background: rgba(255, 253, 248, .94);
  border-bottom: 1px solid var(--line);
}

.night .reader-header {
  background: rgba(25, 27, 24, .96);
  border-color: rgba(255, 255, 255, .12);
}

.reader-nav {
  display: flex;
  gap: 16px;
  color: var(--muted);
  font-weight: 700;
}

.reader-shell {
  display: grid;
  grid-template-columns: 104px minmax(0, 780px);
  gap: 24px;
  justify-content: center;
  width: min(100%, 1080px);
  margin: 0 auto;
  padding: 38px 24px 70px;
}

.reader-tools {
  position: sticky;
  top: 92px;
  display: grid;
  align-content: start;
  gap: 8px;
}

.reader-tools button {
  min-height: 38px;
  background: #fff8ed;
  border: 1px solid var(--line);
}

.reader-page {
  min-height: 78vh;
  padding: 54px 64px;
  background: #fffaf0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.night .reader-page {
  background: #20231f;
  border-color: rgba(255, 255, 255, .12);
}

.reader-page.large {
  font-size: 20px;
}

.reader-page h1 {
  margin: 0 0 28px;
  font-size: 34px;
}

.reader-page p {
  margin: 0 0 22px;
  font-size: 18px;
  line-height: 2;
}

.reader-paywall {
  display: grid;
  gap: 10px;
  margin-top: 34px;
  padding: 20px;
  background: #f3ecdf;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.night .reader-paywall {
  background: #2a2d28;
  border-color: rgba(255, 255, 255, .12);
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.pricing-card {
  padding: 24px;
}

.pricing-card ul {
  min-height: 120px;
  padding-left: 20px;
  color: #514c43;
}

.checkout-info {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.checkout-info article {
  padding: 22px;
}

.checkout-body {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(24, 101, 95, .92), rgba(36, 40, 33, .88)),
    url("../img/payment-hero.svg") center / cover no-repeat;
}

.checkout-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.checkout-card {
  width: min(100%, 460px);
  padding: 26px;
  background: var(--surface-strong);
  border-radius: var(--radius);
  box-shadow: 0 28px 70px rgba(0, 0, 0, .28);
}

.checkout-brand {
  margin-bottom: 24px;
}

.checkout-title h1,
.result-card h1 {
  margin: 0;
  font-size: 34px;
}

.order-product {
  display: grid;
  gap: 12px;
  margin: 22px 0;
  padding: 16px;
  background: #f7f0e4;
  border-radius: var(--radius);
}

.order-product div,
.result-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.order-product strong {
  text-align: right;
}

.order-price {
  color: var(--accent);
  font-size: 26px;
}

.pay-method {
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.pay-method label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.pay-method small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.checkout-agreement,
.checkout-service {
  color: var(--muted);
  font-size: 13px;
}

.checkout-agreement a {
  color: var(--brand-dark);
  font-weight: 700;
}

.checkout-service {
  display: grid;
  gap: 4px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.result-card {
  text-align: center;
}

.result-icon {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  margin: 0 auto 16px;
  color: #fff;
  background: var(--brand);
  border-radius: 50%;
  font-size: 32px;
  font-weight: 900;
}

.result-list {
  display: grid;
  gap: 10px;
  margin: 20px 0;
  padding: 16px;
  text-align: left;
  background: #f7f0e4;
  border-radius: var(--radius);
}

.result-list dt {
  color: var(--muted);
}

.result-list dd {
  margin: 0;
  font-weight: 800;
}

.result-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.rank-grid,
.help-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.rank-panel,
.help-grid article {
  padding: 22px;
}

.rank-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.rank-item:first-of-type {
  border-top: 0;
}

.rank-index {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: #fff;
  background: var(--brand);
  border-radius: 6px;
  font-weight: 900;
}

.rank-item strong,
.rank-item span {
  display: block;
}

.rank-item span {
  color: var(--muted);
  font-size: 14px;
}

.legal-page {
  min-height: 100vh;
  padding: 42px 0 72px;
  background: var(--bg);
}

.legal-article,
.legal-panel {
  padding: 34px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.legal-article {
  max-width: 860px;
}

.legal-article h1 {
  margin: 20px 0 18px;
  font-size: 42px;
}

.legal-article h2 {
  margin: 28px 0 8px;
  font-size: 22px;
}

.legal-article p {
  color: #514c43;
}

.legal-panel dl,
.contact-article dl {
  display: grid;
  gap: 0;
  margin: 0;
}

.legal-panel div,
.contact-article dl div {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

.legal-panel div:last-child,
.contact-article dl div:last-child {
  border-bottom: 0;
}

.legal-panel dt,
.contact-article dt {
  color: var(--muted);
  font-weight: 800;
}

.legal-panel dd,
.contact-article dd {
  margin: 0;
}

@media (max-width: 980px) {
  .header-inner {
    flex-wrap: wrap;
    padding: 14px 0;
  }

  .main-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
  }

  .header-actions {
    margin-left: auto;
  }

  .hero-section {
    min-height: auto;
    padding-top: 42px;
  }

  .hero-grid,
  .split-layout,
  .catalog-layout,
  .detail-content {
    grid-template-columns: 1fr;
  }

  .featured-panel,
  .filter-panel {
    position: static;
  }

  .category-grid,
  .book-grid,
  .pricing-grid,
  .checkout-info,
  .rank-grid,
  .help-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .book-list-item {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .book-list-actions {
    grid-column: 2;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-grid {
    grid-template-columns: 180px minmax(0, 1fr);
  }

  .chapter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .container {
    width: min(100% - 28px, var(--max));
  }

  .site-header {
    position: static;
  }

  .header-actions,
  .search-box,
  .search-box input,
  .btn-small {
    width: 100%;
  }

  .hero-copy h1,
  .page-title h1 {
    font-size: 40px;
  }

  .hero-actions,
  .result-actions,
  .detail-actions {
    flex-direction: column;
  }

  .hero-metrics,
  .category-grid,
  .book-grid,
  .price-list,
  .pricing-grid,
  .checkout-info,
  .rank-grid,
  .help-grid,
  .chapter-grid,
  .footer-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .book-card,
  .book-card-large {
    grid-template-columns: 96px minmax(0, 1fr);
    min-height: auto;
  }

  .book-list-item {
    grid-template-columns: 78px minmax(0, 1fr);
    align-items: start;
  }

  .book-list-item img {
    width: 78px;
  }

  .book-list-actions {
    grid-column: 1 / -1;
  }

  .detail-copy h1 {
    font-size: 38px;
  }

  .detail-cover {
    max-width: 170px;
  }

  .reader-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
  }

  .reader-shell {
    grid-template-columns: 1fr;
    padding: 20px 14px 48px;
  }

  .reader-tools {
    position: static;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .reader-page {
    padding: 28px 20px;
  }

  .reader-page h1 {
    font-size: 28px;
  }

  .reader-page p {
    font-size: 17px;
  }

  .legal-panel div,
  .contact-article dl div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
