:root {
  --paper: #f1ede2;
  --paper-light: #fbf8f0;
  --paper-deep: #e3dccd;
  --ink: #153136;
  --ink-soft: #3f575a;
  --ink-muted: #6f7d7c;
  --night: #102d31;
  --cream: #f4efdf;
  --cream-soft: #d8d4c6;
  --coral: #c65d3e;
  --coral-light: #e79a7e;
  --sage: #8eb9a8;
  --gold: #c99a3d;
  --line: rgba(21, 49, 54, 0.14);
  --shadow: 0 25px 70px rgba(25, 42, 42, 0.11);
  --sans: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  --serif: "Songti SC", "STSong", "Noto Serif SC", serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button,
select,
input,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

.page-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.44;
  background-image:
    linear-gradient(rgba(21, 49, 54, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(21, 49, 54, 0.035) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1520px, calc(100% - 64px));
  min-height: 92px;
  margin: 0 auto;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: var(--paper-light);
  background: var(--ink);
  border-radius: 50%;
  font-family: var(--serif);
  font-size: 21px;
}

.brand-copy {
  display: grid;
  gap: 3px;
}

.brand-copy span {
  color: var(--ink-muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.brand-copy strong {
  font-family: var(--serif);
  font-size: 18px;
  letter-spacing: 0.06em;
}

.topbar-meta {
  display: flex;
  gap: 16px;
  align-items: center;
  color: var(--ink-muted);
  font-size: 12px;
}

.status-pill {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--ink);
  font-weight: 700;
}

.status-dot {
  width: 7px;
  height: 7px;
  background: var(--coral);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(198, 93, 62, 0.12);
}

.topbar-rule {
  width: 1px;
  height: 18px;
  background: var(--line);
}

.library-main {
  width: min(1520px, calc(100% - 64px));
  margin: 0 auto;
}

.library-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(440px, 0.65fr);
  gap: 60px;
  align-items: end;
  padding: 72px 0 58px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--coral);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.intro-copy h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(46px, 5vw, 76px);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.08;
}

.intro-copy h1 em {
  color: var(--coral);
  font-style: normal;
}

.intro-note {
  max-width: 640px;
  margin: 24px 0 0;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.9;
}

.library-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.library-stats div {
  min-width: 0;
  padding: 20px 16px 18px;
}

.library-stats div + div {
  border-left: 1px solid var(--line);
}

.library-stats dt {
  color: var(--ink-muted);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.library-stats dd {
  min-height: 42px;
  margin: 9px 0 0;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.3;
}

.library-stats small {
  color: var(--ink-muted);
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 500;
}

.shelf {
  padding: 46px 0 30px;
}

.shelf-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 26px;
}

.shelf-heading h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 30px;
}

.shelf-heading > p {
  margin: 0 0 4px;
  color: var(--ink-muted);
  font-size: 10px;
}

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

.loading-note {
  grid-column: 1 / -1;
  color: var(--ink-muted);
}

.book-card {
  display: grid;
  min-width: 0;
  overflow: hidden;
  background: rgba(251, 248, 240, 0.84);
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: 0 12px 32px rgba(25, 42, 42, 0.06);
  transition: transform 260ms ease, box-shadow 260ms ease, border-color 260ms ease;
}

.book-card:hover {
  border-color: rgba(21, 49, 54, 0.28);
  box-shadow: var(--shadow);
  transform: translateY(-5px);
}

.cover-link {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--paper-deep);
  aspect-ratio: 1.34;
}

.cover-link::after {
  position: absolute;
  inset: 42% 0 0;
  content: "";
  background: linear-gradient(to bottom, transparent, rgba(16, 45, 49, 0.88));
}

.cover-link img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 24%;
  transition: transform 480ms cubic-bezier(0.22, 0.76, 0.32, 1);
}

.book-card:hover .cover-link img {
  transform: scale(1.025);
}

.book-order {
  position: absolute;
  top: 13px;
  left: 13px;
  z-index: 1;
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  color: var(--cream);
  background: rgba(16, 45, 49, 0.78);
  border: 1px solid rgba(244, 239, 223, 0.22);
  border-radius: 50%;
  font-family: var(--serif);
  font-size: 10px;
}

.cover-action {
  position: absolute;
  right: 15px;
  bottom: 14px;
  z-index: 1;
  display: inline-flex;
  gap: 7px;
  align-items: center;
  color: var(--cream);
  font-size: 11px;
  font-weight: 700;
}

.cover-action svg {
  width: 15px;
  height: 15px;
}

.book-card-body {
  display: flex;
  flex-direction: column;
  min-height: 258px;
  padding: 18px 18px 16px;
}

.book-card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink-muted);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.book-card-topline span:last-child {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

.book-card-topline span:last-child::before {
  width: 5px;
  height: 5px;
  content: "";
  background: var(--gold);
  border-radius: 50%;
}

.book-card-topline span.is-ready::before {
  background: #5f927e;
}

.book-card h3 {
  margin: 13px 0 0;
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1.4;
}

.book-card h3 a {
  text-decoration: none;
}

.book-card h3 a:hover {
  color: var(--coral);
}

.book-author {
  margin: 7px 0 0;
  color: var(--ink-muted);
  font-size: 10px;
}

.book-thesis {
  display: -webkit-box;
  margin: 16px 0 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.7;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.book-meta {
  display: flex;
  gap: 17px;
  align-items: center;
  margin-top: auto;
  padding-top: 16px;
  color: var(--ink-muted);
  border-top: 1px solid var(--line);
  font-size: 9px;
}

.book-meta strong {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 700;
}

.reading-progress {
  width: 100%;
  height: 2px;
  margin-top: 11px;
  overflow: hidden;
  background: var(--paper-deep);
}

.reading-progress span {
  display: block;
  height: 100%;
  background: var(--coral);
}

.library-method {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(0, 1.6fr);
  gap: 42px;
  align-items: center;
  padding: 34px 0 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.library-method h2 {
  max-width: 420px;
  margin: 0;
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1.48;
}

.library-method ol {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.library-method li {
  min-height: 106px;
  padding: 0 20px;
  border-left: 1px solid var(--line);
}

.library-method li > span {
  color: var(--coral);
  font-family: var(--serif);
  font-size: 11px;
}

.library-method li strong {
  display: block;
  margin-top: 15px;
  font-family: var(--serif);
  font-size: 16px;
}

.library-method li small {
  display: block;
  margin-top: 7px;
  color: var(--ink-muted);
  font-size: 9px;
  line-height: 1.55;
}

.page-footer {
  display: flex;
  justify-content: space-between;
  width: min(1520px, calc(100% - 64px));
  margin: 18px auto 36px;
  color: var(--ink-muted);
  font-size: 9px;
  line-height: 1.7;
}

.page-footer p {
  max-width: 660px;
  margin: 0;
}

.app-error {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 360px;
  padding: 14px 18px;
  color: var(--paper-light);
  background: #8b3523;
  border-radius: 5px;
  box-shadow: var(--shadow);
  font-size: 12px;
}

:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 3px;
}

@media (max-width: 1180px) {
  .library-intro {
    grid-template-columns: 1fr;
    gap: 36px;
    padding-top: 54px;
  }

  .library-stats {
    max-width: 660px;
  }

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

@media (max-width: 860px) {
  .topbar,
  .library-main,
  .page-footer {
    width: min(100% - 40px, 760px);
  }

  .topbar {
    min-height: 74px;
  }

  .topbar-rule,
  .topbar-meta > span:last-child {
    display: none;
  }

  .library-intro {
    padding: 44px 0 40px;
  }

  .intro-copy h1 {
    font-size: clamp(40px, 9vw, 64px);
  }

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

  .library-method {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .library-method ol {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 22px;
  }

  .library-method li:nth-child(3) {
    border-left: 0;
  }

  .page-footer {
    display: grid;
    gap: 6px;
  }
}

@media (max-width: 560px) {
  .topbar,
  .library-main,
  .page-footer {
    width: calc(100% - 24px);
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    font-size: 18px;
  }

  .brand-copy span {
    display: none;
  }

  .brand-copy strong {
    font-size: 16px;
  }

  .topbar-meta {
    display: none;
  }

  .library-intro {
    gap: 28px;
    padding: 36px 2px 32px;
  }

  .intro-copy h1 {
    font-size: 42px;
  }

  .intro-note {
    font-size: 13px;
  }

  .library-stats div {
    padding: 16px 10px 14px;
  }

  .library-stats dd {
    font-size: 22px;
  }

  .shelf {
    padding-top: 34px;
  }

  .shelf-heading {
    align-items: start;
  }

  .shelf-heading > p {
    display: none;
  }

  .book-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .book-card {
    grid-template-columns: 118px minmax(0, 1fr);
  }

  .cover-link {
    min-height: 100%;
    aspect-ratio: auto;
  }

  .cover-link img {
    object-position: center;
  }

  .cover-action {
    right: 10px;
    bottom: 10px;
    font-size: 0;
  }

  .book-card-body {
    min-height: 190px;
    padding: 14px;
  }

  .book-card h3 {
    margin-top: 10px;
    font-size: 17px;
  }

  .book-thesis {
    margin-top: 10px;
    font-size: 11px;
    -webkit-line-clamp: 2;
  }

  .book-meta {
    gap: 10px;
    padding-top: 11px;
    font-size: 8px;
  }

  .library-method {
    padding-top: 28px;
  }

  .library-method li {
    padding: 0 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
