:root {
  color-scheme: light;
  --ink: #171717;
  --muted: #64676d;
  --line: #d8d4cc;
  --paper: #fbfaf7;
  --panel: #ffffff;
  --accent: #0c6b62;
  --accent-2: #a33b24;
  --soft: #eef3ef;
  --shadow: 0 18px 60px rgba(24, 27, 31, 0.10);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid rgba(23, 23, 23, 0.08);
  background: rgba(251, 250, 247, 0.92);
  backdrop-filter: blur(18px);
}

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

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 8px;
  font-weight: 760;
  letter-spacing: 0;
}

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

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

.topbar nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.topbar nav a,
.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid rgba(23, 23, 23, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.52);
  text-decoration: none;
  font-size: 14px;
  font-weight: 650;
}

.topbar nav a[aria-current="page"],
.button.primary {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

main {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
}

.hero {
  min-height: 560px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.hero-copy h1,
.book-cover h1 {
  max-width: 850px;
  margin: 0;
  font-size: clamp(40px, 7vw, 84px);
  line-height: 0.96;
  letter-spacing: 0;
}

.hero-copy p:not(.eyebrow),
.book-cover p:not(.eyebrow) {
  max-width: 680px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.72;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 780;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.hero-panel {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero-panel dl {
  margin: 0;
  display: grid;
  gap: 18px;
}

.hero-panel div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(23, 23, 23, 0.1);
}

.hero-panel div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

dt {
  color: var(--muted);
  font-size: 13px;
}

dd {
  margin: 0;
  font-weight: 760;
}

.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 0 18px;
}

.toolbar label,
.link-form label {
  display: grid;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: white;
  color: var(--ink);
  font: inherit;
}

.toolbar input {
  width: min(420px, 80vw);
}

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

.segment button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.segment button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.shelf {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding-bottom: 56px;
}

.article-card {
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.article-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.article-card a {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  padding: 20px;
  text-decoration: none;
}

.kicker {
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 780;
}

.article-card h3 {
  margin: 18px 0 10px;
  font-size: 23px;
  line-height: 1.18;
  letter-spacing: 0;
}

.article-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.64;
}

.progress-track {
  width: 100%;
  height: 3px;
  margin-top: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(23, 23, 23, 0.08);
}

.progress-track span {
  display: block;
  inline-size: 0;
  block-size: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: inline-size 180ms ease;
}

.article-card.is-read .progress-track span {
  background: var(--accent-2);
}

.article-card footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: auto;
  padding-top: 22px;
  color: var(--muted);
  font-size: 13px;
}

.submit-band {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 36px;
  padding: 42px;
  margin-bottom: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.submit-band h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.04;
  letter-spacing: 0;
}

.submit-band p {
  color: var(--muted);
  line-height: 1.7;
}

.link-form {
  display: grid;
  gap: 14px;
  align-self: start;
}

.form-status {
  min-height: 22px;
  margin: 0;
  color: var(--accent);
}

.reader-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 760px);
  gap: clamp(24px, 5vw, 64px);
  align-items: start;
  padding: 34px 0 90px;
}

.toc {
  position: sticky;
  top: 84px;
  display: grid;
  gap: 6px;
  max-height: calc(100vh - 120px);
  overflow: auto;
  padding-right: 8px;
}

.toc p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
}

.toc a {
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.35;
}

.toc a[aria-current="page"] {
  background: white;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}

.reader,
.book-reader {
  min-width: 0;
}

.back-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}

.reader-header {
  padding: 28px 0 26px;
  border-bottom: 1px solid var(--line);
}

.reader-header h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 62px);
  line-height: 1.04;
  letter-spacing: 0;
}

.reading-status {
  width: max-content;
  max-width: 100%;
  margin: 18px 0 0;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  font-size: 13px;
}

.reader-header dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 24px;
  margin: 28px 0 0;
}

.prose {
  font-size: 17px;
  line-height: 1.88;
}

.prose h2 {
  margin-top: 46px;
  font-size: 30px;
  line-height: 1.18;
  letter-spacing: 0;
}

.prose h3 {
  margin-top: 34px;
  font-size: 22px;
  letter-spacing: 0;
}

.prose p,
.prose li {
  color: #292b2f;
}

.prose a {
  color: var(--accent);
  text-underline-offset: 3px;
}

.prose code {
  padding: 2px 6px;
  border-radius: 6px;
  background: #ece8df;
  font-size: 0.92em;
}

.prose blockquote {
  margin: 28px 0;
  padding: 18px 20px;
  border-left: 3px solid var(--accent);
  background: white;
}

.book-cover {
  min-height: 520px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-bottom: 1px solid var(--line);
}

.book-chapter {
  padding: 56px 0;
  border-bottom: 1px solid var(--line);
}

.chapter-index {
  margin: 0 0 14px;
  color: var(--accent-2);
  font-weight: 780;
}

.book-chapter h2 {
  max-width: 860px;
  margin: 0;
  font-size: clamp(32px, 5vw, 58px);
  line-height: 1.05;
  letter-spacing: 0;
}

.chapter-meta {
  color: var(--muted);
}

@media (max-width: 880px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero,
  .submit-band,
  .reader-layout {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding: 64px 0 42px;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar input {
    width: 100%;
  }

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

  .toc {
    position: static;
    max-height: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  main {
    width: min(100% - 24px, 1180px);
  }

  .topbar nav {
    width: 100%;
  }

  .topbar nav a {
    flex: 1;
  }

  .shelf,
  .toc,
  .reader-header dl {
    grid-template-columns: 1fr;
  }

  .submit-band {
    padding: 24px;
  }

  .article-card,
  .article-card a {
    min-height: 230px;
  }
}

@media print {
  .topbar,
  .toc,
  .back-link,
  .submit-band,
  .toolbar {
    display: none;
  }

  body {
    background: white;
  }

  main {
    width: 100%;
  }

  .book-chapter {
    page-break-before: always;
  }
}
