:root {
  --paper: #fbf6e6;
  --paper-deep: #f3ebd5;
  --paper-bright: #fffdf5;
  --ink: #191712;
  --ink-soft: #484236;
  --muted: #7b7160;
  --line: rgba(25, 23, 18, 0.13);
  --line-strong: rgba(25, 23, 18, 0.54);
  --rule: rgba(25, 23, 18, 0.072);
  --rule-red: rgba(217, 88, 77, 0.21);
  --red: #d9584d;
  --red-deep: #b94037;
  --yellow: #f2d95f;
  --yellow-soft: rgba(242, 217, 95, 0.23);
  --green: #426a56;
  --green-soft: rgba(66, 106, 86, 0.11);
  --shadow: 4px 4px 0 rgba(25, 23, 18, 0.09);
  --shadow-soft: 2px 2px 0 rgba(25, 23, 18, 0.08);
  --font-display: "Songti SC", "STSong", "Noto Serif SC", "SimSun", serif;
  --font-body: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-mono: "Courier New", monospace;
  --reading-size: 18px;
  --reading-line: 2.02;
  --mobile-nav-height: 62px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body[data-view="home"] {
  --home-ink: #181a18;
  --home-soft: #898f89;
  --home-line: #eceeec;
  --home-fill: #f5f6f5;
  background: #ffffff;
  color: var(--home-ink);
}

body[data-theme="gray"] {
  --paper: #f3f1eb;
  --paper-deep: #e9e6de;
  --paper-bright: #fcfbf7;
  --ink: #211f1c;
  --ink-soft: #514c44;
  --muted: #777168;
  --line: rgba(33, 31, 28, 0.13);
  --line-strong: rgba(33, 31, 28, 0.5);
  --rule: rgba(33, 31, 28, 0.068);
  --rule-red: rgba(194, 76, 72, 0.18);
  --red: #c24c48;
  --red-deep: #a33a35;
  --yellow: #ead66f;
  --yellow-soft: rgba(234, 214, 111, 0.2);
}

body[data-theme="night"] {
  --paper: #1d1c18;
  --paper-deep: #25231e;
  --paper-bright: #2a2822;
  --ink: #f5efdf;
  --ink-soft: #d7cebb;
  --muted: #aaa18f;
  --line: rgba(245, 239, 223, 0.13);
  --line-strong: rgba(245, 239, 223, 0.46);
  --rule: rgba(245, 239, 223, 0.052);
  --rule-red: rgba(227, 111, 97, 0.16);
  --red: #e36f61;
  --red-deep: #f18a7d;
  --yellow: #d8c15a;
  --yellow-soft: rgba(216, 193, 90, 0.14);
  --green: #81b79d;
  --green-soft: rgba(129, 183, 157, 0.13);
  --shadow: 4px 4px 0 rgba(0, 0, 0, 0.28);
  --shadow-soft: 2px 2px 0 rgba(0, 0, 0, 0.2);
}

button,
input,
textarea {
  font: inherit;
}

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

button {
  color: inherit;
}

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

svg {
  display: block;
  width: 19px;
  height: 19px;
  stroke-width: 1.7;
}

::selection {
  background: var(--yellow);
  color: var(--ink);
}

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

.app-shell {
  min-height: 100vh;
}

.desktop-sidebar {
  position: fixed;
  z-index: 40;
  top: 0;
  right: 0;
  left: 0;
  display: block;
  height: 64px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 95%, transparent);
  backdrop-filter: blur(14px);
}

.sidebar-inner {
  display: flex;
  width: min(100%, 1120px);
  height: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 0 auto;
  padding: 0 32px;
}

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

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
}

.brand-copy strong {
  display: block;
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.sidebar-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.nav-item {
  position: relative;
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.nav-item::after {
  position: absolute;
  right: 0;
  bottom: 3px;
  left: 0;
  height: 2px;
  background: transparent;
  content: "";
}

.nav-item svg {
  width: 16px;
  height: 16px;
}

.nav-item:hover,
.nav-item.is-active {
  color: var(--ink);
}

.nav-item.is-active::after {
  background: var(--red);
}

.sidebar-course,
.sidebar-footer {
  display: none;
}

.main-canvas {
  min-height: 100vh;
}

body:not([data-view="home"]):not([data-view="catalog"]) .main-canvas {
  padding-top: 64px;
}

body[data-view="home"] .desktop-sidebar,
body[data-view="catalog"] .desktop-sidebar,
body[data-view="home"] .mobile-nav,
body[data-view="catalog"] .mobile-nav {
  display: none;
}

body[data-view="home"] .app-view {
  padding-bottom: 0;
}

body[data-view="home"] .page {
  width: min(100%, 760px);
}

.app-view {
  min-height: 100vh;
  padding-bottom: 44px;
}

.page,
.reader-page {
  width: min(100%, 1060px);
  margin: 0 auto;
  padding-right: 30px;
  padding-left: 30px;
}

.page-reading,
.reader-page {
  width: min(100%, 1160px);
}

.page-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 0 12px;
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
}

.mobile-brand .brand-mark {
  width: 30px;
  height: 30px;
  flex-basis: 30px;
  font-size: 8px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--paper-bright);
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--ink);
  background: var(--yellow);
}

.icon-button.is-active {
  border-color: var(--red);
  background: var(--yellow);
  color: var(--ink);
}

.icon-button.is-small {
  width: 32px;
  height: 32px;
  flex-basis: 32px;
}

.icon-button.is-plain {
  border-color: transparent;
  background: transparent;
}

.icon-button.is-plain:hover {
  border-color: var(--line);
  background: var(--yellow-soft);
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.5;
  text-transform: uppercase;
}

.catalog-head {
  padding: 68px 0 52px;
}

body[data-view="home"] .catalog-head {
  padding: 44px 0 0;
}

.catalog-mast {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px 20px;
  margin-bottom: 24px;
}

.catalog-title {
  position: relative;
  display: inline;
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.45;
}

.catalog-title::after {
  position: absolute;
  z-index: -1;
  right: -5px;
  bottom: 1px;
  left: -3px;
  height: 11px;
  background: var(--yellow);
  content: "";
}

.catalog-mast p {
  margin: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
}

body[data-view="home"] .catalog-mast {
  display: block;
  margin-bottom: 24px;
}

body[data-view="home"] .catalog-title {
  display: block;
  font-family: var(--font-body);
  font-size: 24px;
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1.35;
}

body[data-view="home"] .catalog-title::after {
  display: none;
}

body[data-view="home"] .catalog-mast p {
  margin-top: 7px;
  color: var(--home-soft);
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0;
}

.plain-head {
  padding: 52px 0 28px;
}

.plain-head h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(42px, 6vw, 68px);
  font-weight: 700;
  line-height: 1.12;
}

.plain-head p {
  max-width: 660px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.8;
}

.search-launch {
  display: flex;
  width: min(100%, 760px);
  min-height: 60px;
  align-items: center;
  gap: 12px;
  margin: 0 0 22px;
  padding: 0 18px;
  border: 1.5px solid var(--ink);
  background: color-mix(in srgb, var(--paper-bright) 85%, transparent);
  box-shadow: var(--shadow);
  color: var(--muted);
  cursor: text;
}

.search-launch svg {
  flex: 0 0 19px;
  color: var(--red);
}

.search-launch input {
  width: 100%;
  min-width: 0;
  flex: 1;
  padding: 17px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
}

.search-launch input::placeholder {
  color: var(--muted);
  opacity: 0.82;
}

.search-launch:focus-within {
  box-shadow: 4px 4px 0 var(--yellow);
}

body[data-view="home"] .search-launch {
  width: 100%;
  min-height: 46px;
  margin-bottom: 20px;
  padding: 0 14px;
  border: 1px solid var(--home-line);
  border-radius: 12px;
  background: var(--home-fill);
  box-shadow: none;
  color: var(--home-soft);
}

body[data-view="home"] .search-launch svg {
  color: var(--home-soft);
}

body[data-view="home"] .search-launch input {
  padding: 12px 0;
  font-size: 14px;
}

body[data-view="home"] .search-launch input::placeholder {
  color: #a1a6a1;
}

body[data-view="home"] .search-launch:focus-within {
  border-color: #cfd3cf;
  background: #ffffff;
  box-shadow: none;
}

.catalog-quick-index {
  display: flex;
  max-width: 920px;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 9px;
  margin: 0 0 32px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.8;
}

body[data-view="home"] .catalog-quick-index {
  gap: 4px 10px;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--home-line);
  color: var(--home-soft);
  font-size: 10px;
  line-height: 1.85;
}

.catalog-quick-index-label {
  margin-right: 3px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.catalog-index-link {
  display: inline-block;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
  animation:
    quick-index-word-in 560ms cubic-bezier(0.2, 0.78, 0.26, 1) calc(var(--index-order, 0) * 34ms) 1 both,
    quick-index-float 5.6s ease-in-out calc(640ms + var(--index-order, 0) * 120ms) infinite;
  transition:
    color 160ms ease,
    background-color 160ms ease,
    text-decoration-color 160ms ease;
}

.catalog-index-link:hover,
.catalog-index-link:focus-visible {
  background: var(--yellow);
  color: var(--ink);
  text-decoration-color: transparent;
}

.catalog-index-separator {
  color: var(--red);
  animation: quick-index-dot-in 480ms ease 280ms both;
}

body[data-view="home"] .catalog-quick-index-label {
  color: #747a74;
  font-family: var(--font-body);
  font-size: 10px;
  letter-spacing: 0;
}

body[data-view="home"] .catalog-index-link {
  color: var(--home-soft);
  text-decoration: none;
}

body[data-view="home"] .catalog-index-link:hover,
body[data-view="home"] .catalog-index-link:focus-visible {
  background: transparent;
  color: var(--home-ink);
  text-decoration: underline;
  text-decoration-color: #cfd3cf;
}

body[data-view="home"] .catalog-index-separator {
  color: #c9cdc9;
}

.chapter-list {
  display: grid;
  max-width: 920px;
  border-top: 1px solid var(--line-strong);
}

body[data-view="home"] .chapter-list {
  max-width: none;
  border-top: 0;
}

.chapter-item {
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 24px;
}

body[data-view="home"] .chapter-item {
  border-bottom-color: var(--home-line);
}

.chapter-row {
  display: grid;
  width: 100%;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: baseline;
  gap: 10px;
  min-height: 66px;
  padding: 18px 2px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

body[data-view="home"] .chapter-row {
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 6px;
  min-height: 64px;
  padding: 20px 0;
  transition: background-color 140ms ease;
}

body[data-view="home"] .chapter-row:hover {
  background: #fafbfa;
}

body[data-view="home"] .chapter-row[aria-expanded="true"] {
  background: #f8f9f8;
}

.chapter-row-number {
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

body[data-view="home"] .chapter-row-number {
  color: #9aa09a;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.55;
}

.chapter-row-title {
  display: inline;
  margin: 0;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.5;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

body[data-view="home"] .chapter-row-title {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.55;
}

.chapter-row:hover .chapter-row-title,
.chapter-row:focus-visible .chapter-row-title,
.chapter-row[aria-expanded="true"] .chapter-row-title {
  background: linear-gradient(
    transparent 57%,
    var(--yellow) 57%,
    var(--yellow) 94%,
    transparent 94%
  );
}

body[data-view="home"] .chapter-row:hover .chapter-row-title,
body[data-view="home"] .chapter-row:focus-visible .chapter-row-title,
body[data-view="home"] .chapter-row[aria-expanded="true"] .chapter-row-title {
  background: none;
}

body[data-view="home"] .chapter-row[aria-expanded="true"] .chapter-row-title {
  color: #000000;
  font-weight: 650;
}

.chapter-row-copy {
  display: none;
}

.catalog-section-list {
  padding: 2px 0 18px 64px;
  border-top: 1px solid var(--line);
}

body[data-view="home"] .catalog-section-list {
  padding: 4px 0 16px 42px;
  border-top-color: var(--home-line);
  background: #fafbfa;
}

.catalog-section-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.7;
}

body[data-view="home"] .catalog-section-row {
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 6px;
  padding: 14px 0;
  border-bottom-color: #f0f1f0;
  color: #5f655f;
  font-size: 15px;
  line-height: 1.7;
}

.catalog-section-row:last-child {
  border-bottom: 0;
}

.catalog-section-row:hover {
  color: var(--ink);
}

body[data-view="home"] .catalog-section-row:hover {
  color: #111311;
}

.catalog-section-row:hover .catalog-section-title {
  text-decoration: underline;
  text-decoration-color: var(--red);
  text-underline-offset: 4px;
}

.catalog-section-number {
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

body[data-view="home"] .catalog-section-number {
  color: #a1a6a1;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
}

.catalog-section-title {
  min-width: 0;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin: 34px 0 16px;
}

.section-heading h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1.4;
}

.section-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.text-link svg {
  width: 15px;
  height: 15px;
}

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

.category-card {
  display: grid;
  min-height: 154px;
  align-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line-strong);
  background: var(--paper-bright);
  box-shadow: var(--shadow-soft);
}

.category-card:hover {
  box-shadow: var(--shadow);
}

.category-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.category-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.45;
}

.category-index {
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.category-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.category-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
}

.mini-progress,
.progress-track,
.reader-progress-track {
  height: 3px;
  overflow: hidden;
  background: var(--line);
}

.mini-progress {
  width: 72px;
}

.mini-progress span,
.progress-track > span,
.reader-progress-track span {
  display: block;
  height: 100%;
  background: var(--red);
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 17px;
  border: 1.5px solid var(--ink);
  border-radius: 0;
  background: var(--paper-bright);
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.button svg {
  width: 17px;
  height: 17px;
}

.button:hover {
  transform: translate(1px, 1px);
  box-shadow: none;
}

.button-primary {
  background: var(--ink);
  color: var(--paper);
}

.button-secondary {
  background: transparent;
}

.button-danger {
  border-color: var(--red);
  background: transparent;
  color: var(--red-deep);
}

.button-wide {
  width: 100%;
}

.reader-layout {
  display: grid;
  gap: 30px;
}

.reader-main {
  min-width: 0;
}

.reader-topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 -30px;
  padding: 10px 30px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: blur(14px);
}

.reader-topbar-left,
.reader-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.reader-title-small {
  min-width: 0;
}

.reader-title-small strong {
  display: block;
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-title-small span {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 10px;
}

.reader-progress-track {
  margin: 0 -30px;
}

.chapter-hero {
  padding: 62px 0 48px;
  border-bottom: 1px solid var(--line-strong);
}

.chapter-hero h1 {
  max-width: 880px;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(40px, 5.5vw, 64px);
  font-weight: 700;
  line-height: 1.16;
}

.chapter-summary {
  max-width: 780px;
  margin: 20px 0 0;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.9;
}

.chapter-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 22px;
  margin-top: 24px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.chapter-overview {
  padding: 28px 0 8px;
}

.chapter-overview p,
.chapter-overview li {
  color: var(--ink-soft);
  line-height: 1.8;
}

.chapter-overview ol,
.chapter-overview ul {
  padding-left: 1.3em;
}

.section-list {
  margin-top: 22px;
  border-top: 1px solid var(--line-strong);
}

.section-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 28px;
  gap: 14px;
  padding: 24px 2px;
  border-bottom: 1px solid var(--line);
}

.section-row-number {
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.section-row-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.55;
}

.section-row:hover .section-row-title {
  text-decoration: underline;
  text-decoration-color: var(--red);
  text-underline-offset: 5px;
}

.section-row-preview {
  display: -webkit-box;
  margin: 8px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.section-row-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  color: var(--red-deep);
  font-size: 11px;
  font-weight: 700;
}

.section-row-action svg {
  width: 14px;
  height: 14px;
}

.section-row-status {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  align-self: start;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--muted);
}

.section-row-status.is-read {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
}

.section-row-status svg {
  width: 13px;
  height: 13px;
}

.section-rail {
  display: none;
}

.reader-section-head {
  padding: 58px 0 34px;
}

.reader-section-head h1 {
  max-width: 780px;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(36px, 5.2vw, 58px);
  font-weight: 700;
  line-height: 1.2;
}

.reader-section-position {
  margin: 14px 0 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.mobile-section-nav {
  display: flex;
  gap: 8px;
  margin: 0 -30px 20px;
  overflow-x: auto;
  padding: 4px 30px 14px;
  scrollbar-width: none;
}

.mobile-section-nav::-webkit-scrollbar {
  display: none;
}

.section-chip {
  display: inline-flex;
  min-height: 32px;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border-bottom: 1px solid transparent;
  color: var(--muted);
  font-size: 11px;
}

.section-chip.is-active {
  border-color: var(--red);
  color: var(--ink);
}

.section-chip.is-read:not(.is-active) {
  color: var(--green);
}

.reading-flow {
  display: grid;
  max-width: 760px;
  gap: 54px;
  padding-bottom: 52px;
}

.reading-block {
  position: relative;
  scroll-margin-top: 98px;
}

.block-label {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 18px;
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.block-label::after {
  height: 1px;
  flex: 1;
  background: repeating-linear-gradient(
    to right,
    var(--line-strong) 0,
    var(--line-strong) 2px,
    transparent 2px,
    transparent 7px
  );
  content: "";
}

.block-label svg {
  width: 16px;
  height: 16px;
}

.reading-content {
  color: var(--ink-soft);
  font-size: var(--reading-size);
  line-height: var(--reading-line);
}

.reading-content > :first-child {
  margin-top: 0;
}

.reading-content > :last-child {
  margin-bottom: 0;
}

.reading-content p {
  margin: 0 0 1.18em;
}

.reading-content strong {
  color: var(--ink);
  font-weight: 800;
}

.reading-content blockquote {
  margin: 1.4em 0;
  padding: 3px 0 3px 17px;
  border-left: 3px solid var(--yellow);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.03em;
}

.reading-content ol,
.reading-content ul {
  margin: 0 0 1.18em;
  padding-left: 1.45em;
}

.reading-content li {
  margin: 0.52em 0;
  padding-left: 0.2em;
}

.reading-content hr {
  margin: 2em 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.reading-content code {
  padding: 2px 5px;
  border: 1px solid var(--line);
  background: var(--paper-deep);
  font-size: 0.92em;
}

.action-block {
  padding: 27px 26px 24px;
  border: 1px solid var(--ink);
  border-left: 5px solid var(--red);
  background: var(--yellow-soft);
}

.action-block .block-label {
  color: var(--ink);
}

.action-block .block-label svg {
  color: var(--red);
}

.action-block .reading-content {
  color: var(--ink);
}

.action-footer {
  display: grid;
  gap: 9px;
  margin-top: 25px;
  padding-top: 20px;
  border-top: 1px solid var(--line-strong);
}

.section-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 4px 0 34px;
}

.pager-link {
  display: grid;
  min-height: 86px;
  align-content: center;
  gap: 5px;
  padding: 14px 0;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line);
}

.pager-link:hover strong {
  text-decoration: underline;
  text-decoration-color: var(--red);
  text-underline-offset: 4px;
}

.pager-link span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
}

.pager-link strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.pager-link.is-next {
  text-align: right;
}

.rail-panel {
  position: sticky;
  top: 88px;
  padding: 4px 0 4px 20px;
  border-left: 1px solid var(--line);
}

.rail-panel h2 {
  margin: 0 0 14px;
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.rail-list {
  display: grid;
}

.rail-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 15px;
  gap: 6px;
  min-height: 42px;
  align-items: start;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.rail-item:hover {
  color: var(--ink);
}

.rail-item.is-active {
  color: var(--ink);
  font-weight: 700;
}

.rail-item.is-read svg {
  color: var(--green);
}

.rail-item.is-active svg {
  color: var(--red);
}

.rail-item svg {
  width: 13px;
  height: 13px;
  margin-top: 2px;
}

.search-page {
  max-width: 920px;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0 30px;
  padding: 0 4px 14px;
  border-bottom: 2px solid var(--ink);
}

.search-field svg {
  color: var(--red);
}

.search-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 25px;
}

.search-field input::placeholder {
  color: var(--muted);
}

.search-quick-index {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 9px;
  margin: -14px 0 30px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.85;
}

.search-quick-index-label {
  margin-right: 3px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.search-index-link {
  display: inline-block;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
  animation:
    quick-index-word-in 560ms cubic-bezier(0.2, 0.78, 0.26, 1) calc(var(--index-order, 0) * 34ms) 1 both,
    quick-index-float 5.6s ease-in-out calc(640ms + var(--index-order, 0) * 120ms) infinite;
  transition:
    color 160ms ease,
    background-color 160ms ease,
    text-decoration-color 160ms ease;
}

.search-index-link:hover,
.search-index-link:focus-visible {
  background: var(--yellow);
  color: var(--ink);
  text-decoration-color: transparent;
}

.search-index-separator {
  color: var(--red);
  animation: quick-index-dot-in 480ms ease 280ms both;
}

@keyframes quick-index-word-in {
  0% {
    opacity: 0;
    filter: blur(3px);
    translate: 0 5px;
  }
  100% {
    opacity: 1;
    filter: blur(0);
    translate: 0 0;
  }
}

@keyframes quick-index-dot-in {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@keyframes quick-index-float {
  0%,
  100% {
    translate: 0 0;
  }
  32% {
    translate: -1px -2px;
  }
  68% {
    translate: 1px 1px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .catalog-index-link,
  .catalog-index-separator,
  .search-index-link,
  .search-index-separator {
    animation: none;
  }
}

.search-summary {
  margin: 0 0 18px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.search-results {
  border-top: 1px solid var(--line-strong);
}

.search-result {
  display: grid;
  gap: 7px;
  padding: 20px 2px;
  border-bottom: 1px solid var(--line);
}

.search-result:hover .search-result-title {
  background: linear-gradient(
    transparent 57%,
    var(--yellow) 57%,
    var(--yellow) 94%,
    transparent 94%
  );
}

.search-result-context {
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 9px;
}

.search-result-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 19px;
  line-height: 1.55;
}

.search-result-preview {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.empty-state {
  display: grid;
  max-width: 580px;
  justify-items: start;
  gap: 12px;
  padding: 54px 0;
}

.empty-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  color: var(--ink);
}

.empty-state h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 25px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.record-list {
  display: grid;
  margin-top: 14px;
  border-top: 1px solid var(--line-strong);
}

.record-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 24px 2px;
  border-bottom: 1px solid var(--line);
}

.record-item h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 19px;
  line-height: 1.55;
}

.record-context {
  margin: 7px 0 0;
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 9px;
}

.record-note {
  margin: 15px 0 0;
  padding: 12px 14px;
  border-left: 3px solid var(--yellow);
  background: var(--yellow-soft);
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.75;
}

.record-date {
  margin-top: 13px;
  color: var(--muted);
  font-size: 11px;
}

.settings-sections {
  display: grid;
  gap: 36px;
  margin-top: 8px;
}

.settings-group {
  border-top: 1px solid var(--line-strong);
}

.settings-group h2 {
  margin: 0;
  padding: 18px 0 10px;
  font-family: var(--font-display);
  font-size: 23px;
}

.setting-row {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-top: 1px solid var(--line);
}

.setting-copy strong {
  display: block;
  font-size: 14px;
}

.setting-copy span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.segmented {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--line-strong);
  background: var(--paper-deep);
}

.segmented button {
  min-width: 44px;
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.segmented button.is-active {
  background: var(--yellow);
  color: var(--ink);
}

.stat-pair {
  display: flex;
  gap: 34px;
  padding: 24px 0;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line);
}

.stat-pair strong {
  display: block;
  font-family: var(--font-display);
  font-size: 34px;
  line-height: 1;
}

.stat-pair span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.mobile-nav {
  position: fixed;
  z-index: 50;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  height: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
  grid-template-columns: repeat(4, 1fr);
  padding: 6px 8px env(safe-area-inset-bottom);
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 96%, transparent);
  backdrop-filter: blur(15px);
}

.mobile-nav-item {
  display: grid;
  min-width: 0;
  place-items: center;
  align-content: center;
  gap: 3px;
  color: var(--muted);
  font-size: 9px;
}

.mobile-nav-item svg {
  width: 19px;
  height: 19px;
}

.mobile-nav-item.is-active {
  color: var(--red);
  font-weight: 700;
}

.toast {
  position: fixed;
  z-index: 100;
  bottom: calc(var(--mobile-nav-height) + 24px + env(safe-area-inset-bottom));
  left: 50%;
  max-width: min(90vw, 420px);
  padding: 10px 15px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-size: 12px;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.complete-dialog {
  width: min(92vw, 560px);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
}

.complete-dialog::backdrop {
  background: rgba(25, 23, 18, 0.36);
  backdrop-filter: blur(3px);
}

.dialog-panel {
  padding: 24px;
  border: 1px solid var(--ink);
  background: var(--paper-bright);
}

.dialog-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
}

.dialog-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 25px;
}

.dialog-copy {
  margin: 18px 0;
  color: var(--muted);
  line-height: 1.7;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.completion-note {
  width: 100%;
  resize: vertical;
  padding: 12px;
  border: 1px solid var(--line-strong);
  outline: 0;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.65;
}

.completion-note:focus {
  border-color: var(--red);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.loading-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  color: var(--muted);
}

.loading-mark {
  display: grid;
  gap: 12px;
  justify-items: center;
  font-size: 12px;
}

.loading-mark span {
  display: block;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line-strong);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.error-box {
  margin: 48px 0;
  padding: 22px;
  border: 1px solid var(--red);
  background: var(--paper-bright);
}

.error-box h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 23px;
}

.error-box p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.7;
}

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

@media (min-width: 620px) {
  .page,
  .reader-page {
    padding-right: 40px;
    padding-left: 40px;
  }

  .reader-topbar {
    margin-right: -40px;
    margin-left: -40px;
    padding-right: 40px;
    padding-left: 40px;
  }

  .reader-progress-track {
    margin-right: -40px;
    margin-left: -40px;
  }

  .mobile-section-nav {
    margin-right: -40px;
    margin-left: -40px;
    padding-right: 40px;
    padding-left: 40px;
  }

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

@media (max-width: 1039px) {
  .desktop-sidebar {
    display: none;
  }
}

@media (min-width: 1040px) {
  .mobile-nav {
    display: none;
  }

  .reader-layout {
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 50px;
  }

  .section-rail {
    display: block;
  }

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

  body:not([data-view="home"]):not([data-view="catalog"]) .reader-topbar {
    top: 64px;
  }

  .toast {
    bottom: 28px;
  }
}

@media (max-width: 619px) {
  .page,
  .reader-page {
    padding-right: 19px;
    padding-left: 19px;
  }

  .catalog-head {
    padding-top: 38px;
    padding-bottom: 38px;
  }

  body[data-view="home"] .catalog-head {
    padding-top: 30px;
    padding-bottom: 0;
  }

  .catalog-mast {
    margin-bottom: 20px;
  }

  .catalog-title {
    font-size: 18px;
  }

  body[data-view="home"] .catalog-title {
    font-size: 20px;
  }

  .plain-head {
    padding-top: 36px;
  }

  .plain-head h1 {
    font-size: 44px;
  }

  .search-launch {
    min-height: 56px;
  }

  body[data-view="home"] .search-launch {
    min-height: 44px;
  }

  .chapter-row {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 7px;
    min-height: 62px;
    padding: 16px 2px;
  }

  body[data-view="home"] .chapter-row {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 5px;
    min-height: 60px;
    padding: 18px 0;
  }

  .chapter-row-title {
    font-size: 17px;
  }

  body[data-view="home"] .chapter-row-title {
    font-size: 16px;
  }

  .catalog-section-list {
    padding-left: 47px;
  }

  body[data-view="home"] .catalog-section-list {
    padding-left: 36px;
  }

  .catalog-section-row {
    grid-template-columns: 27px minmax(0, 1fr);
    gap: 7px;
    padding: 11px 2px;
    font-size: 12px;
  }

  body[data-view="home"] .catalog-section-row {
    grid-template-columns: 27px minmax(0, 1fr);
    gap: 5px;
  }

  .reader-topbar {
    margin-right: -19px;
    margin-left: -19px;
    padding-right: 19px;
    padding-left: 19px;
  }

  .reader-progress-track {
    margin-right: -19px;
    margin-left: -19px;
  }

  .mobile-section-nav {
    margin-right: -19px;
    margin-left: -19px;
    padding-right: 19px;
    padding-left: 19px;
  }

  .chapter-hero,
  .reader-section-head {
    padding-top: 38px;
  }

  .chapter-hero h1 {
    font-size: 38px;
  }

  .reader-section-head h1 {
    font-size: 36px;
  }

  .chapter-summary {
    font-size: 15px;
  }

  .section-row {
    grid-template-columns: 38px minmax(0, 1fr) 25px;
    gap: 9px;
    padding: 20px 0;
  }

  .section-row-title {
    font-size: 17px;
  }

  .reading-flow {
    gap: 44px;
  }

  .action-block {
    margin-right: -4px;
    padding-right: 17px;
    padding-left: 17px;
  }

  .section-pager {
    grid-template-columns: 1fr;
  }

  .pager-link.is-next {
    text-align: left;
  }

  .setting-row {
    align-items: start;
    flex-direction: column;
    padding: 16px 0;
  }

  .segmented {
    width: 100%;
  }

  .segmented button {
    flex: 1;
  }
}

@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;
  }
}
