:root {
  color-scheme: light;
  --page: #edf0e7;
  --page-soft: #faf8ef;
  --paper: #fffdf4;
  --paper-deep: #eee8d7;
  --paper-line: rgba(29, 43, 38, 0.1);
  --ink: #17201d;
  --ink-soft: #53615b;
  --muted: #849086;
  --line: rgba(30, 43, 39, 0.16);
  --line-strong: rgba(30, 43, 39, 0.28);
  --cinnabar: #b64b3e;
  --cinnabar-dark: #87382f;
  --bamboo: #4f7661;
  --bamboo-deep: #2f5141;
  --gold: #aa8d48;
  --wood: #28362f;
  --shadow: 0 30px 92px rgba(17, 26, 23, 0.16);
  --control: rgba(255, 253, 245, 0.72);
  --ink-wash: rgba(23, 32, 29, 0.13);
  --ink-wash-deep: rgba(16, 25, 23, 0.24);
}

body.is-eye-care {
  --page: #e8f1e6;
  --page-soft: #f8fff3;
  --paper: #fbfff2;
  --paper-deep: #e2ead8;
  --paper-line: rgba(58, 97, 67, 0.12);
  --ink: #1d2c22;
  --ink-soft: #536958;
  --muted: #748a76;
  --line: rgba(70, 105, 78, 0.18);
  --line-strong: rgba(70, 105, 78, 0.32);
  --cinnabar: #a75b45;
  --cinnabar-dark: #78412f;
  --bamboo: #4d7a59;
  --bamboo-deep: #335c3f;
  --gold: #927f43;
  --wood: #304b37;
  --control: rgba(250, 255, 241, 0.76);
  --ink-wash: rgba(49, 86, 58, 0.12);
  --ink-wash-deep: rgba(43, 75, 51, 0.22);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  position: relative;
  margin: 0;
  background:
    linear-gradient(122deg, rgba(255, 255, 255, 0.62), transparent 42%),
    linear-gradient(90deg, rgba(29, 43, 38, 0.035) 0 1px, transparent 1px 100%),
    linear-gradient(180deg, rgba(29, 43, 38, 0.03) 0 1px, transparent 1px 100%),
    var(--page);
  background-size: auto, 56px 56px, 56px 56px, auto;
  color: var(--ink);
  font-family: ui-serif, "Songti SC", SimSun, "STSong", "Microsoft YaHei", serif;
  user-select: none;
  -webkit-user-select: none;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

body::before {
  background:
    radial-gradient(ellipse at 8% 10%, var(--ink-wash-deep), transparent 34%),
    radial-gradient(ellipse at 94% 12%, rgba(182, 75, 62, 0.12), transparent 28%),
    radial-gradient(ellipse at 82% 92%, var(--ink-wash), transparent 42%),
    linear-gradient(128deg, transparent 14%, rgba(23, 32, 29, 0.1) 15%, transparent 32%),
    linear-gradient(154deg, transparent 62%, rgba(170, 141, 72, 0.16) 63%, transparent 78%);
  filter: saturate(88%);
}

body::after {
  opacity: 0.46;
  background:
    repeating-linear-gradient(102deg, rgba(23, 32, 29, 0.028) 0 1px, transparent 1px 9px),
    repeating-linear-gradient(8deg, rgba(255, 255, 255, 0.18) 0 1px, transparent 1px 11px);
  mix-blend-mode: multiply;
}

button,
a {
  font: inherit;
}

button {
  cursor: pointer;
}

.novel-app {
  position: relative;
  z-index: 1;
  min-height: 100svh;
}

.is-hidden {
  display: none !important;
}

.shelf-view {
  min-height: 100svh;
  padding: 28px clamp(18px, 5vw, 72px) 72px;
}

.shelf-head,
.reader-toolbar,
.reader-controls,
.catalog-head,
.paper-head,
.paper-foot {
  display: flex;
  align-items: center;
}

.shelf-head {
  justify-content: space-between;
  gap: 18px;
  min-height: 64px;
}

.shelf-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
  align-items: center;
}

.shelf-actions .mode-button,
.toolbar-actions .tool-button,
.comment-tools .plain-button {
  max-width: 148px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-link,
.plain-button,
.tool-button,
.mode-button,
.page-button {
  border: 1px solid var(--line);
  background: var(--control);
  color: var(--wood);
  text-decoration: none;
  transition:
    border-color 160ms ease,
    color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.home-link,
.plain-button,
.tool-button,
.mode-button {
  min-height: 38px;
  padding: 0 14px;
}

.home-link,
.plain-button,
.tool-button,
.mode-button,
.page-button,
.book-card,
.chapter-button {
  border-radius: 0;
}

.home-link:hover,
.plain-button:hover,
.tool-button:hover,
.mode-button:hover,
.page-button:hover:not(:disabled),
.book-card:hover,
.chapter-button:hover,
.chapter-button.is-active {
  border-color: rgba(179, 75, 63, 0.38);
  color: var(--cinnabar-dark);
}

.home-link:hover,
.plain-button:hover,
.tool-button:hover,
.mode-button:hover,
.page-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

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

.brand-seal {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border: 2px solid rgba(179, 75, 63, 0.74);
  color: var(--cinnabar-dark);
  font-size: 25px;
  font-weight: 700;
  box-shadow:
    inset 0 0 0 4px rgba(179, 75, 63, 0.06),
    0 12px 28px rgba(82, 57, 31, 0.08);
}

.brand-block p,
.brand-block h1,
.shelf-copy p,
.shelf-copy h2,
.catalog-book p,
.catalog-book h2,
.reader-toolbar p,
.reader-toolbar h1,
.chapter-head h2,
.chapter-head p {
  margin: 0;
}

.brand-block p,
.shelf-copy p,
.catalog-book p,
.reader-toolbar p {
  color: var(--cinnabar);
  font-size: 13px;
  font-weight: 700;
}

.brand-block h1 {
  margin-top: 4px;
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 700;
  letter-spacing: 0;
}

.shelf-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 34vw);
  gap: 28px;
  align-items: end;
  min-height: 250px;
  margin-top: 34px;
  padding: clamp(28px, 5vw, 58px);
  border: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(255, 253, 247, 0.72), rgba(255, 253, 247, 0.42)),
    radial-gradient(circle at 78% 22%, rgba(184, 147, 69, 0.16), transparent 28%),
    linear-gradient(180deg, rgba(255, 253, 247, 0.86), rgba(241, 231, 214, 0.62));
  box-shadow: var(--shadow);
}

.shelf-copy h2 {
  max-width: 780px;
  margin-top: 14px;
  font-size: clamp(42px, 8vw, 92px);
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0;
}

.shelf-copy span {
  display: inline-flex;
  margin-top: 22px;
  padding: 7px 12px;
  border-left: 3px solid var(--cinnabar);
  background: rgba(255, 253, 247, 0.56);
  color: var(--ink-soft);
  font-size: 14px;
}

.shelf-ornament {
  position: relative;
  min-height: 190px;
  border-left: 1px solid var(--line);
}

.shelf-ornament span {
  position: absolute;
  right: 12%;
  display: block;
  width: 46%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  transform: rotate(-18deg);
}

.shelf-ornament span:nth-child(1) {
  top: 26%;
}

.shelf-ornament span:nth-child(2) {
  top: 50%;
  right: 24%;
  width: 62%;
}

.shelf-ornament span:nth-child(3) {
  top: 74%;
  width: 38%;
}

.bookcase {
  margin-top: 28px;
}

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

.book-card {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(86px, 1fr) auto;
  min-height: 300px;
  padding: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(139, 111, 74, 0.12) 0 8px, transparent 8px 100%),
    linear-gradient(180deg, rgba(255, 253, 247, 0.94), rgba(241, 231, 214, 0.68));
  color: var(--ink);
  text-align: left;
  box-shadow: 0 18px 44px rgba(82, 57, 31, 0.1);
}

.book-card::after {
  content: "藏书";
  position: absolute;
  right: 22px;
  top: 22px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 84px;
  border: 1px solid rgba(179, 75, 63, 0.22);
  background:
    linear-gradient(180deg, rgba(179, 75, 63, 0.08), rgba(255, 253, 247, 0.1));
  color: rgba(136, 54, 47, 0.46);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.15;
  writing-mode: vertical-rl;
}

.book-card strong {
  display: block;
  max-width: calc(100% - 62px);
  color: var(--cinnabar);
  font-size: 14px;
}

.book-card h3 {
  margin: 28px 0 14px;
  font-size: clamp(30px, 4vw, 50px);
  line-height: 1.05;
  font-weight: 700;
}

.book-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.78;
}

.book-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.book-card footer span:last-child {
  color: var(--wood);
  font-weight: 700;
}

.reader-view {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(circle at 82% 12%, rgba(184, 147, 69, 0.12), transparent 26%),
    linear-gradient(180deg, var(--page-soft), var(--page));
}

.reader-view.is-catalog-collapsed {
  grid-template-columns: 68px minmax(0, 1fr);
}

.catalog-panel {
  position: relative;
  z-index: 22;
  min-width: 0;
  height: 100svh;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.94), rgba(241, 231, 214, 0.88)),
    radial-gradient(circle at 30% 0%, rgba(179, 75, 63, 0.08), transparent 32%);
  box-shadow: inset -18px 0 44px rgba(82, 57, 31, 0.05);
}

.catalog-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 16px;
  height: 100%;
  padding: 18px;
  transition: opacity 160ms ease;
}

.catalog-panel.is-collapsed .catalog-shell {
  opacity: 0;
  pointer-events: none;
}

.catalog-head {
  justify-content: space-between;
  gap: 10px;
}

.plain-button {
  min-width: 72px;
  background: rgba(255, 253, 247, 0.72);
}

.catalog-book {
  padding: 18px 0 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.catalog-book h2 {
  margin-top: 8px;
  font-size: 34px;
  line-height: 1;
}

.catalog-book span {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.chapter-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  overflow: auto;
  padding-right: 4px;
}

.chapter-button {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 10px 11px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  text-align: left;
}

.chapter-button.is-active {
  background:
    linear-gradient(90deg, rgba(179, 75, 63, 0.08), transparent 82%),
    rgba(255, 253, 247, 0.62);
}

.chapter-button.is-active::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  background: var(--cinnabar);
}

.chapter-index {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(184, 147, 69, 0.42);
  border-radius: 50%;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
}

.chapter-button strong,
.chapter-button span:last-child {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapter-button strong {
  color: inherit;
  font-size: 14px;
  line-height: 1.35;
}

.chapter-button span:last-child {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.catalog-tab {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 38px;
  min-height: 92px;
  border: 1px solid var(--line);
  background: var(--control);
  color: var(--wood);
  writing-mode: vertical-rl;
  letter-spacing: 0;
  opacity: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.catalog-panel.is-collapsed .catalog-tab {
  opacity: 1;
  pointer-events: auto;
}

.reading-room {
  position: relative;
  display: grid;
  grid-template-rows: 92px minmax(0, 1fr) 88px;
  min-width: 0;
  height: 100svh;
  overflow: hidden;
}

.reader-toolbar {
  position: relative;
  z-index: 12;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
  padding: 18px 78px 14px 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.72);
  backdrop-filter: blur(14px);
}

.reader-toolbar h1 {
  margin-top: 4px;
  overflow: hidden;
  font-size: clamp(26px, 3vw, 40px);
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toolbar-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
}

.tool-button {
  min-width: 72px;
}

#mobileCatalog {
  display: none;
}

.reading-body {
  min-width: 0;
  overflow: auto;
  padding: 26px 76px 28px 38px;
  scroll-behavior: auto;
}

.paper-scroll {
  position: relative;
  width: min(840px, 100%);
  min-height: calc(100svh - 236px);
  margin: 0 auto;
  padding: 50px clamp(34px, 5vw, 76px) 58px;
  border: 1px solid var(--line-strong);
  background:
    radial-gradient(circle at 16% 18%, rgba(184, 147, 69, 0.08), transparent 28%),
    linear-gradient(90deg, var(--paper-line) 0 1px, transparent 1px 100%),
    linear-gradient(180deg, var(--paper), var(--paper-deep));
  background-size: auto, 34px 34px, auto;
  box-shadow: var(--shadow);
}

.paper-scroll::before,
.paper-scroll::after {
  content: "";
  position: absolute;
  top: 22px;
  bottom: 22px;
  width: 7px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--bamboo), var(--gold) 55%, var(--cinnabar));
  opacity: 0.54;
}

.paper-scroll::before {
  left: 18px;
}

.paper-scroll::after {
  right: 18px;
  opacity: 0.18;
}

.scroll-knot {
  position: absolute;
  right: 52px;
  top: 40px;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 2px solid rgba(179, 75, 63, 0.36);
  color: rgba(179, 75, 63, 0.72);
  font-size: 24px;
  font-weight: 700;
}

.paper-head {
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  color: var(--gold);
  font-size: 14px;
  font-weight: 700;
}

.paper-head span:last-child {
  color: var(--muted);
  font-weight: 600;
}

.chapter-head {
  margin-top: 28px;
}

.chapter-head h2 {
  max-width: calc(100% - 74px);
  font-size: clamp(34px, 4.4vw, 54px);
  line-height: 1.15;
  font-weight: 700;
}

.chapter-head p {
  max-width: 640px;
  margin-top: 14px;
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1.9;
}

.page-content {
  margin-top: 34px;
  color: var(--ink);
  font-size: 19px;
  line-height: 2.16;
  text-align: justify;
}

.page-content p {
  margin: 0 0 22px;
  text-indent: 2em;
}

.page-content p:first-child {
  text-indent: 0;
}

.page-content p:first-child::first-letter {
  float: left;
  margin: 10px 13px 0 0;
  color: var(--bamboo-deep);
  font-size: 64px;
  line-height: 0.82;
}

.paper-foot {
  justify-content: space-between;
  gap: 16px;
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.side-progress {
  position: absolute;
  right: 26px;
  top: 122px;
  bottom: 116px;
  z-index: 13;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  justify-items: center;
  gap: 10px;
  width: 28px;
  pointer-events: none;
}

.side-progress-track {
  position: relative;
  width: 4px;
  height: 100%;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(139, 111, 74, 0.16);
}

.side-progress-track span {
  position: absolute;
  left: 0;
  bottom: 0;
  display: block;
  width: 100%;
  height: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, var(--cinnabar), var(--gold), var(--bamboo));
  transition: height 180ms ease;
}

.side-progress small {
  color: var(--muted);
  font-size: 11px;
  writing-mode: vertical-rl;
}

.reader-controls {
  position: relative;
  z-index: 12;
  display: grid;
  grid-template-columns: 96px minmax(160px, 460px) 96px;
  gap: 14px;
  align-items: center;
  justify-content: center;
  min-width: 0;
  margin-bottom: 18px;
  padding: 12px 82px 22px 36px;
  border-top: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.74);
  backdrop-filter: blur(16px);
}

.page-button {
  min-height: 44px;
  box-shadow: 0 12px 28px rgba(82, 57, 31, 0.08);
}

.page-button:disabled {
  color: #c5b9a7;
  cursor: default;
  transform: none;
}

.progress-track {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(139, 111, 74, 0.16);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--bamboo), var(--gold), var(--cinnabar));
  transition: width 180ms ease;
}

.site-record {
  position: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  left: 50%;
  bottom: max(3px, env(safe-area-inset-bottom));
  z-index: 40;
  width: max-content;
  max-width: calc(100vw - 24px);
  font-size: 10px;
  line-height: 1;
  text-align: center;
  transform: translateX(-50%);
  pointer-events: none;
}

.site-record span,
.site-record a {
  display: block;
  color: rgba(93, 67, 50, 0.46);
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}

.site-record span {
  pointer-events: none;
}

.site-record a {
  pointer-events: auto;
  text-decoration: none;
  transition: color 160ms ease;
}

.site-record a:hover {
  color: rgba(136, 54, 47, 0.86);
}

.reading-body,
.paper-scroll,
.chapter-head,
.chapter-head *,
.page-content,
.page-content * {
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  -webkit-user-select: none !important;
  user-select: none !important;
}

.page-content {
  cursor: default;
  touch-action: pan-y;
}

.page-content::selection,
.page-content *::selection {
  background: transparent;
  color: inherit;
}

input,
textarea,
[contenteditable="true"] {
  -webkit-touch-callout: default;
  -webkit-user-select: text !important;
  user-select: text !important;
}

/* Ink-wash visual system */
.home-link,
.plain-button,
.tool-button,
.mode-button,
.page-button {
  border-color: rgba(23, 32, 29, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(246, 242, 229, 0.58)),
    rgba(255, 253, 245, 0.42);
  box-shadow:
    0 12px 32px rgba(17, 26, 23, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(18px) saturate(112%);
}

.home-link:hover,
.plain-button:hover,
.tool-button:hover,
.mode-button:hover,
.page-button:hover:not(:disabled) {
  border-color: rgba(182, 75, 62, 0.42);
  background: rgba(255, 253, 245, 0.88);
  color: var(--cinnabar-dark);
}

.brand-seal {
  border-color: rgba(182, 75, 62, 0.72);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.4), rgba(182, 75, 62, 0.08));
  box-shadow:
    inset 0 0 0 5px rgba(182, 75, 62, 0.045),
    0 18px 42px rgba(17, 26, 23, 0.1);
}

.shelf-view {
  position: relative;
  isolation: isolate;
}

.shelf-view::before {
  content: "";
  position: fixed;
  left: -8vw;
  top: 4vh;
  z-index: -1;
  width: min(62vw, 760px);
  height: 44vh;
  background:
    linear-gradient(105deg, rgba(23, 32, 29, 0.18), rgba(23, 32, 29, 0.02) 72%),
    radial-gradient(ellipse at 28% 36%, rgba(23, 32, 29, 0.18), transparent 56%);
  clip-path: polygon(2% 24%, 18% 5%, 51% 0, 84% 14%, 100% 42%, 82% 64%, 48% 82%, 12% 100%, 0 72%);
  filter: blur(0.5px);
  opacity: 0.58;
}

.shelf-hero {
  position: relative;
  overflow: hidden;
  border-color: rgba(23, 32, 29, 0.14);
  background:
    linear-gradient(112deg, rgba(255, 255, 255, 0.88), rgba(247, 243, 232, 0.62) 58%, rgba(222, 229, 220, 0.54)),
    linear-gradient(90deg, rgba(23, 32, 29, 0.04) 0 1px, transparent 1px 100%);
  background-size: auto, 42px 42px;
  box-shadow:
    0 36px 90px rgba(17, 26, 23, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.84);
}

.shelf-hero::before,
.shelf-hero::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.shelf-hero::before {
  right: -9%;
  top: -28%;
  width: 56%;
  height: 112%;
  background:
    radial-gradient(ellipse at 36% 38%, rgba(23, 32, 29, 0.24), transparent 48%),
    radial-gradient(ellipse at 58% 55%, rgba(79, 118, 97, 0.18), transparent 56%),
    linear-gradient(134deg, transparent 18%, rgba(182, 75, 62, 0.1) 19%, transparent 42%);
  clip-path: polygon(18% 8%, 65% 0, 100% 21%, 86% 64%, 56% 100%, 14% 82%, 0 45%);
  opacity: 0.48;
  mix-blend-mode: multiply;
}

.shelf-hero::after {
  right: 9%;
  bottom: 16%;
  width: 24%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(23, 32, 29, 0.36), transparent);
  box-shadow:
    34px -46px 0 rgba(170, 141, 72, 0.34),
    72px -90px 0 rgba(23, 32, 29, 0.18);
  transform: rotate(-17deg);
}

.shelf-copy {
  position: relative;
  z-index: 1;
}

.shelf-copy h2 {
  color: var(--ink);
  text-wrap: balance;
}

.shelf-copy span {
  border-left-color: var(--cinnabar);
  background: rgba(255, 255, 255, 0.52);
  box-shadow: 0 12px 28px rgba(17, 26, 23, 0.06);
}

.shelf-ornament {
  z-index: 1;
  border-left-color: rgba(23, 32, 29, 0.12);
}

.shelf-ornament span {
  background: linear-gradient(90deg, transparent, rgba(23, 32, 29, 0.36), transparent);
}

.book-card {
  isolation: isolate;
  border-color: rgba(23, 32, 29, 0.13);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(246, 242, 229, 0.62)),
    linear-gradient(90deg, rgba(23, 32, 29, 0.1) 0 8px, transparent 8px 100%);
  box-shadow:
    0 24px 60px rgba(17, 26, 23, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.book-card::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 18px;
  bottom: 18px;
  z-index: -1;
  width: 42%;
  background:
    radial-gradient(ellipse at 12% 24%, rgba(23, 32, 29, 0.18), transparent 42%),
    linear-gradient(180deg, rgba(23, 32, 29, 0.09), transparent 64%);
  clip-path: polygon(0 0, 72% 8%, 42% 52%, 88% 100%, 8% 92%);
  opacity: 0.36;
  mix-blend-mode: multiply;
}

.book-card::after {
  border-color: rgba(182, 75, 62, 0.24);
  background:
    linear-gradient(180deg, rgba(182, 75, 62, 0.12), rgba(255, 255, 255, 0.06)),
    rgba(255, 255, 255, 0.2);
  color: rgba(135, 56, 47, 0.58);
}

.book-card:hover {
  border-color: rgba(182, 75, 62, 0.34);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(247, 243, 232, 0.7)),
    linear-gradient(90deg, rgba(182, 75, 62, 0.15) 0 8px, transparent 8px 100%);
  box-shadow:
    0 34px 88px rgba(17, 26, 23, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
  transform: translateY(-2px);
}

.book-card h3 {
  color: var(--ink);
}

.reader-view {
  background:
    radial-gradient(ellipse at 98% 8%, rgba(182, 75, 62, 0.1), transparent 34%),
    linear-gradient(130deg, rgba(23, 32, 29, 0.08), transparent 30%),
    linear-gradient(180deg, var(--page-soft), var(--page));
}

.catalog-panel {
  border-right-color: rgba(23, 32, 29, 0.14);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(238, 232, 215, 0.66)),
    radial-gradient(ellipse at 8% 22%, rgba(23, 32, 29, 0.12), transparent 42%);
  backdrop-filter: blur(18px) saturate(108%);
}

.catalog-book {
  border-color: rgba(23, 32, 29, 0.14);
}

.chapter-button {
  border-color: transparent;
  background: rgba(255, 255, 255, 0.16);
}

.chapter-button:hover,
.chapter-button.is-active {
  border-color: rgba(23, 32, 29, 0.13);
  background:
    linear-gradient(90deg, rgba(182, 75, 62, 0.1), transparent 72%),
    rgba(255, 255, 255, 0.52);
}

.chapter-index {
  border-color: rgba(23, 32, 29, 0.18);
  color: var(--bamboo-deep);
}

.catalog-tab {
  border-color: rgba(23, 32, 29, 0.16);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 20px 46px rgba(17, 26, 23, 0.12);
}

.reading-room::before {
  content: "";
  position: absolute;
  right: -8vw;
  top: 12vh;
  z-index: 0;
  width: min(50vw, 680px);
  height: 68vh;
  background:
    radial-gradient(ellipse at 42% 38%, rgba(23, 32, 29, 0.18), transparent 48%),
    linear-gradient(128deg, rgba(79, 118, 97, 0.16), transparent 64%);
  clip-path: polygon(18% 0, 82% 4%, 100% 28%, 86% 66%, 52% 100%, 16% 88%, 0 42%);
  opacity: 0.42;
  mix-blend-mode: multiply;
  pointer-events: none;
}

.reader-toolbar,
.reader-controls {
  border-color: rgba(23, 32, 29, 0.13);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(246, 242, 229, 0.58));
  box-shadow: 0 12px 42px rgba(17, 26, 23, 0.08);
}

.reading-body,
.reader-toolbar,
.reader-controls {
  position: relative;
  z-index: 1;
}

.side-progress {
  position: absolute;
  z-index: 13;
}

.paper-scroll {
  isolation: isolate;
  border-color: rgba(23, 32, 29, 0.16);
  background:
    linear-gradient(90deg, var(--paper-line) 0 1px, transparent 1px 100%),
    repeating-linear-gradient(105deg, rgba(23, 32, 29, 0.025) 0 1px, transparent 1px 12px),
    linear-gradient(180deg, rgba(255, 253, 244, 0.96), rgba(239, 233, 215, 0.88));
  background-size: 34px 34px, auto, auto;
  box-shadow:
    0 32px 86px rgba(17, 26, 23, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.paper-scroll > * {
  position: relative;
  z-index: 1;
}

.paper-scroll::before {
  left: 18px;
  top: 28px;
  bottom: 28px;
  z-index: 0;
  width: 8px;
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(47, 81, 65, 0.86), rgba(170, 141, 72, 0.56), rgba(182, 75, 62, 0.5));
  opacity: 0.58;
}

.paper-scroll::after {
  right: 28px;
  top: 28px;
  bottom: auto;
  z-index: 0;
  width: min(34%, 280px);
  height: 210px;
  border-radius: 0;
  background:
    radial-gradient(ellipse at 38% 42%, rgba(23, 32, 29, 0.22), transparent 48%),
    radial-gradient(ellipse at 72% 18%, rgba(182, 75, 62, 0.1), transparent 46%),
    linear-gradient(148deg, transparent, rgba(79, 118, 97, 0.18));
  clip-path: polygon(18% 0, 76% 5%, 100% 28%, 92% 74%, 55% 100%, 7% 78%, 0 32%);
  opacity: 0.34;
  mix-blend-mode: multiply;
}

.scroll-knot {
  border-color: rgba(182, 75, 62, 0.42);
  background: rgba(255, 255, 255, 0.22);
  color: rgba(135, 56, 47, 0.72);
  box-shadow: inset 0 0 0 5px rgba(182, 75, 62, 0.045);
}

.paper-head {
  border-bottom-color: rgba(23, 32, 29, 0.12);
}

.chapter-head h2 {
  letter-spacing: 0;
}

.page-content p:first-child::first-letter {
  color: var(--bamboo-deep);
  text-shadow: 0 18px 42px rgba(47, 81, 65, 0.1);
}

.paper-foot {
  border-top-color: rgba(23, 32, 29, 0.12);
}

.progress-track,
.side-progress-track {
  background: rgba(23, 32, 29, 0.1);
}

.progress-track span {
  background: linear-gradient(90deg, var(--bamboo-deep), var(--gold), var(--cinnabar));
}

.side-progress-track span {
  background: linear-gradient(180deg, var(--cinnabar), var(--gold), var(--bamboo-deep));
}

/* Monochrome ink landscape theme */
:root {
  --page: #ebeae5;
  --page-soft: #f8f7f2;
  --paper: #fbfaf4;
  --paper-deep: #e7e4dc;
  --paper-line: rgba(0, 0, 0, 0.065);
  --ink: #101010;
  --ink-soft: #3f3f3c;
  --muted: #73716b;
  --line: rgba(0, 0, 0, 0.15);
  --line-strong: rgba(0, 0, 0, 0.28);
  --cinnabar: #181818;
  --cinnabar-dark: #050505;
  --bamboo: #242424;
  --bamboo-deep: #080808;
  --gold: #68655d;
  --wood: #111111;
  --shadow: 0 32px 96px rgba(0, 0, 0, 0.14);
  --control: rgba(255, 255, 255, 0.72);
  --ink-wash: rgba(0, 0, 0, 0.12);
  --ink-wash-deep: rgba(0, 0, 0, 0.24);
  --novel-landscape: url("./novelBackground.png");
}

body.is-eye-care {
  --page: #ebeae5;
  --page-soft: #f8f7f2;
  --paper: #fbfaf4;
  --paper-deep: #e7e4dc;
  --paper-line: rgba(0, 0, 0, 0.065);
  --ink: #101010;
  --ink-soft: #3f3f3c;
  --muted: #73716b;
  --line: rgba(0, 0, 0, 0.15);
  --line-strong: rgba(0, 0, 0, 0.28);
  --cinnabar: #181818;
  --cinnabar-dark: #050505;
  --bamboo: #242424;
  --bamboo-deep: #080808;
  --gold: #68655d;
  --wood: #111111;
  --control: rgba(255, 255, 255, 0.72);
  --ink-wash: rgba(0, 0, 0, 0.12);
  --ink-wash-deep: rgba(0, 0, 0, 0.24);
}

body {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.2) 42%, rgba(0, 0, 0, 0.025)),
    linear-gradient(90deg, rgba(0, 0, 0, 0.035) 0 1px, transparent 1px 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.028) 0 1px, transparent 1px 100%),
    var(--page);
  background-size: auto, 62px 62px, 62px 62px, auto;
}

body::before {
  opacity: 0.9;
  background:
    linear-gradient(90deg, rgba(235, 234, 229, 0.76), rgba(255, 255, 255, 0.12) 33% 68%, rgba(235, 234, 229, 0.74)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(235, 234, 229, 0.08) 44%, rgba(235, 234, 229, 0.58)),
    var(--novel-landscape) center center / cover no-repeat;
  filter: grayscale(1) saturate(0.35) contrast(0.96) brightness(1.04);
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.84), rgba(0, 0, 0, 0.62) 48%, rgba(0, 0, 0, 0.92));
}

body::after {
  opacity: 0.52;
  background:
    repeating-linear-gradient(98deg, rgba(0, 0, 0, 0.024) 0 1px, transparent 1px 10px),
    repeating-linear-gradient(8deg, rgba(255, 255, 255, 0.2) 0 1px, transparent 1px 12px);
  mix-blend-mode: multiply;
}

.home-link,
.plain-button,
.tool-button,
.mode-button,
.page-button {
  border-color: rgba(0, 0, 0, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(232, 229, 220, 0.58)),
    rgba(255, 255, 255, 0.34);
  color: #161616;
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.home-link:hover,
.plain-button:hover,
.tool-button:hover,
.mode-button:hover,
.page-button:hover:not(:disabled),
.book-card:hover,
.chapter-button:hover,
.chapter-button.is-active {
  border-color: rgba(0, 0, 0, 0.34);
  color: #000000;
}

.brand-seal {
  border-color: rgba(0, 0, 0, 0.68);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(0, 0, 0, 0.055));
  color: #0b0b0b;
  box-shadow:
    inset 0 0 0 5px rgba(0, 0, 0, 0.035),
    0 18px 42px rgba(0, 0, 0, 0.1);
}

.brand-block p,
.shelf-copy p,
.catalog-book p,
.reader-toolbar p,
.book-card strong {
  color: #3b3b38;
}

.shelf-view::before {
  opacity: 0;
}

.shelf-hero {
  border-color: rgba(0, 0, 0, 0.14);
  background:
    linear-gradient(112deg, rgba(255, 255, 255, 0.78), rgba(244, 242, 235, 0.48) 58%, rgba(220, 219, 214, 0.38)),
    linear-gradient(90deg, rgba(0, 0, 0, 0.04) 0 1px, transparent 1px 100%);
  background-size: auto, 42px 42px;
  box-shadow:
    0 36px 90px rgba(0, 0, 0, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.84);
}

.shelf-hero::before {
  opacity: 0;
}

.shelf-hero::after {
  opacity: 0;
}

.shelf-copy span {
  border-left-color: #151515;
  background: rgba(255, 255, 255, 0.56);
  color: #494946;
}

.shelf-ornament {
  border-left-color: rgba(0, 0, 0, 0.14);
}

.shelf-ornament span {
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.38), transparent);
}

.book-card {
  border-color: rgba(0, 0, 0, 0.14);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(237, 235, 227, 0.68)),
    linear-gradient(90deg, rgba(0, 0, 0, 0.12) 0 8px, transparent 8px 100%);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.book-card::before {
  background:
    radial-gradient(ellipse at 12% 24%, rgba(0, 0, 0, 0.22), transparent 42%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.1), transparent 64%);
  opacity: 0.16;
}

.book-card::after {
  border-color: rgba(0, 0, 0, 0.22);
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0.08)),
    rgba(255, 255, 255, 0.18);
  color: rgba(0, 0, 0, 0.52);
}

.book-card:hover {
  border-color: rgba(0, 0, 0, 0.3);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(241, 239, 232, 0.76)),
    linear-gradient(90deg, rgba(0, 0, 0, 0.2) 0 8px, transparent 8px 100%);
}

.reader-view {
  background:
    linear-gradient(135deg, rgba(0, 0, 0, 0.06), transparent 34%),
    radial-gradient(ellipse at 96% 10%, rgba(0, 0, 0, 0.08), transparent 36%),
    linear-gradient(180deg, rgba(248, 247, 242, 0.74), rgba(235, 234, 229, 0.54));
}

.catalog-panel {
  border-right-color: rgba(0, 0, 0, 0.14);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(232, 229, 220, 0.66)),
    radial-gradient(ellipse at 8% 22%, rgba(0, 0, 0, 0.13), transparent 42%);
  backdrop-filter: blur(10px);
}

.catalog-book,
.paper-head,
.paper-foot,
.reader-toolbar,
.reader-controls {
  border-color: rgba(0, 0, 0, 0.13);
}

.chapter-button {
  background: rgba(255, 255, 255, 0.18);
}

.chapter-button:hover,
.chapter-button.is-active {
  border-color: rgba(0, 0, 0, 0.14);
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.1), transparent 72%),
    rgba(255, 255, 255, 0.54);
}

.chapter-button.is-active::before {
  background: #0d0d0d;
}

.chapter-index {
  border-color: rgba(0, 0, 0, 0.2);
  color: #161616;
}

.reading-room::before {
  right: -10vw;
  top: 10vh;
  width: min(58vw, 760px);
  height: 72vh;
  background:
    radial-gradient(ellipse at 46% 42%, rgba(0, 0, 0, 0.21), transparent 50%),
    linear-gradient(128deg, rgba(0, 0, 0, 0.16), transparent 64%);
  clip-path: polygon(4% 70%, 18% 36%, 30% 48%, 43% 12%, 58% 42%, 72% 6%, 91% 38%, 100% 24%, 100% 100%, 0 100%);
  opacity: 0.16;
  filter: grayscale(1);
}

.reader-toolbar,
.reader-controls {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(235, 232, 224, 0.56));
}

.paper-scroll {
  border-color: rgba(0, 0, 0, 0.18);
  background:
    linear-gradient(90deg, var(--paper-line) 0 1px, transparent 1px 100%),
    repeating-linear-gradient(105deg, rgba(0, 0, 0, 0.022) 0 1px, transparent 1px 12px),
    linear-gradient(180deg, rgba(251, 250, 244, 0.97), rgba(231, 228, 220, 0.94));
  box-shadow:
    0 32px 86px rgba(0, 0, 0, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.paper-scroll::before {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.2));
  opacity: 0.42;
}

.paper-scroll::after {
  background:
    radial-gradient(ellipse at 38% 42%, rgba(0, 0, 0, 0.22), transparent 48%),
    linear-gradient(148deg, transparent, rgba(0, 0, 0, 0.16));
  opacity: 0.1;
}

.scroll-knot {
  border-color: rgba(0, 0, 0, 0.32);
  color: rgba(0, 0, 0, 0.66);
}

.chapter-head h2 {
  color: #090909;
}

.chapter-head p,
.page-content {
  color: var(--ink);
}

.page-content {
  font-size: 20px;
  line-height: 2.18;
}

.page-content p:first-child::first-letter {
  color: #060606;
  text-shadow: 0 18px 42px rgba(0, 0, 0, 0.1);
}

.progress-track,
.side-progress-track {
  background: rgba(0, 0, 0, 0.1);
}

.progress-track span,
.side-progress-track span {
  background: linear-gradient(90deg, #0b0b0b, #5f5d56);
}

.side-progress-track span {
  background: linear-gradient(180deg, #0b0b0b, #5f5d56);
}

body.is-eye-care .reader-view {
  --page: #e7ecdf;
  --page-soft: #f2f5ea;
  --paper: #fbf8e8;
  --paper-deep: #ece5cf;
  --paper-line: rgba(69, 82, 48, 0.09);
  --ink: #253022;
  --ink-soft: #53604d;
  --muted: #767d6d;
  --line: rgba(72, 85, 55, 0.18);
  --line-strong: rgba(72, 85, 55, 0.3);
  --cinnabar: #34422c;
  --cinnabar-dark: #1f2b1b;
  --bamboo: #42543a;
  --bamboo-deep: #263620;
  --gold: #7d775d;
  --wood: #253022;
  --control: rgba(250, 250, 236, 0.78);
}

body.is-eye-care .reader-view,
body.is-eye-care .reading-room,
body.is-eye-care .reading-body {
  background:
    linear-gradient(180deg, rgba(242, 245, 234, 0.86), rgba(231, 236, 223, 0.72));
}

body.is-eye-care .catalog-panel,
body.is-eye-care .reader-toolbar,
body.is-eye-care .reader-controls {
  background:
    linear-gradient(180deg, rgba(250, 250, 236, 0.84), rgba(229, 235, 216, 0.68));
}

body.is-eye-care .paper-scroll {
  border-color: rgba(72, 85, 55, 0.2);
  background:
    linear-gradient(90deg, var(--paper-line) 0 1px, transparent 1px 100%),
    linear-gradient(180deg, rgba(251, 248, 232, 0.98), rgba(236, 229, 207, 0.96));
  box-shadow:
    0 26px 70px rgba(42, 54, 32, 0.12),
    inset 0 1px 0 rgba(255, 255, 246, 0.86);
}

body.is-eye-care .chapter-head h2,
body.is-eye-care .page-content {
  color: #253022;
}

body.is-eye-care .page-content {
  font-size: 20px;
  line-height: 2.24;
}

body.is-eye-care .page-content p:first-child::first-letter {
  color: #2c3a27;
}

@media (max-width: 1120px) {
  .bookcase-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .reader-view {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .reader-toolbar {
    padding-right: 64px;
  }
}

@media (max-width: 860px) {
  .shelf-view {
    padding: 18px 14px 58px;
  }

  .shelf-head {
    align-items: flex-start;
  }

  .home-link {
    display: none;
  }

  .brand-block {
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .brand-seal {
    width: 42px;
    height: 42px;
    font-size: 21px;
  }

  .shelf-hero {
    grid-template-columns: 1fr;
    min-height: 210px;
    margin-top: 22px;
    padding: 24px 20px;
  }

  .shelf-ornament {
    display: none;
  }

  .bookcase-grid {
    grid-template-columns: 1fr;
  }

  .book-card {
    min-height: 236px;
  }

  .reader-view,
  .reader-view.is-catalog-collapsed {
    display: block;
    height: 100svh;
  }

  .catalog-panel {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(320px, 88vw);
    transform: translateX(0);
    transition: transform 180ms ease;
  }

  .reader-view.is-catalog-collapsed .catalog-panel {
    transform: translateX(-100%);
  }

  .catalog-panel.is-collapsed .catalog-shell {
    opacity: 1;
    pointer-events: auto;
  }

  .catalog-tab {
    display: none;
  }

  .reading-room {
    grid-template-rows: 82px minmax(0, 1fr) 88px;
  }

  .reader-toolbar {
    padding: 14px 16px;
  }

  .reader-toolbar h1 {
    max-width: 34vw;
  }

  #mobileCatalog {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .tool-button {
    min-width: 50px;
    padding: 0 8px;
    font-size: 13px;
  }

  .toolbar-actions {
    gap: 6px;
  }

  .reading-body {
    padding: 18px 22px 20px;
  }

  .paper-scroll {
    min-height: calc(100svh - 210px);
    padding: 34px 28px 50px;
  }

  .paper-scroll::before {
    left: 10px;
    width: 5px;
  }

  .paper-scroll::after,
  .scroll-knot {
    display: none;
  }

  .chapter-head h2 {
    max-width: 100%;
    font-size: 32px;
  }

  .chapter-head p {
    font-size: 16px;
  }

  .page-content {
    font-size: 17px;
    line-height: 2.02;
  }

  .side-progress {
    right: 6px;
    top: 96px;
    bottom: 104px;
    width: 16px;
  }

  .side-progress small {
    display: none;
  }

  .reader-controls {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
    padding: 10px 14px 20px;
  }

  .reader-controls .progress-track {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .reader-controls .page-button:first-child {
    grid-column: 1;
    grid-row: 2;
  }

  .reader-controls .page-button:last-child {
    grid-column: 2;
    grid-row: 2;
  }

  .paper-foot {
    display: grid;
    gap: 8px;
  }
}

@media (max-width: 520px) {
  .shelf-copy h2 {
    font-size: 42px;
  }

  .book-card {
    padding: 20px;
  }

  .book-card h3 {
    font-size: 34px;
  }

  .reader-toolbar h1 {
    font-size: 25px;
  }

  .paper-scroll {
    padding-inline: 24px;
  }

  .paper-head {
    display: grid;
    gap: 6px;
  }

  .site-record {
    bottom: calc(2px + env(safe-area-inset-bottom));
    gap: 6px;
  }

  .site-record span,
  .site-record a {
    font-size: 9px;
  }
}

/* Article reading refinements */
.book-card > strong,
#catalogMeta,
#bookMeta {
  display: none;
}

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

.catalog-book h2,
.reader-toolbar h1 {
  margin-top: 0;
}

.chapter-head {
  text-align: center;
}

.chapter-head h2 {
  max-width: 100%;
  margin-inline: auto;
}

.chapter-head p {
  margin-inline: auto;
  text-align: center;
}

.page-content {
  width: min(680px, 100%);
  margin-inline: auto;
}

@media (max-width: 860px) {
  .page-content {
    width: min(31em, 100%);
  }
}

/* Hide chapter idea/lead copy */
#chapterLead,
.chapter-button > span:last-child > span {
  display: none;
}

.chapter-button {
  min-height: 48px;
  align-items: center;
}

.chapter-button strong {
  line-height: 1.45;
}

/* Brand copy refinement */
.brand-block {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  text-align: center;
}

.brand-seal,
.brand-block p {
  display: none;
}

.brand-block h1 {
  margin-top: 0;
  font-size: clamp(30px, 3.2vw, 44px);
  line-height: 1.08;
}

/* Longer fixed reading sheets */
.reading-room {
  grid-template-rows: 88px minmax(0, 1fr) 86px;
}

.reading-body {
  padding-block: 18px;
}

.paper-scroll {
  display: flex;
  flex-direction: column;
  width: min(900px, 100%);
  min-height: max(760px, calc(100svh - 216px));
}

.paper-head,
.chapter-head,
.page-content,
.paper-foot {
  flex: 0 0 auto;
}

.page-content {
  flex: 1 0 auto;
  min-height: clamp(520px, calc(100svh - 390px), 760px);
}

.paper-foot {
  margin-top: auto;
}

.reader-controls {
  grid-template-columns: 112px 420px 112px;
  height: 86px;
  min-height: 86px;
  margin-bottom: 0;
  padding-block: 14px;
}

.reader-controls .progress-track {
  width: 420px;
  justify-self: center;
}

.page-button {
  width: 112px;
  min-width: 112px;
  height: 44px;
}

@media (max-width: 1120px) and (min-width: 861px) {
  .reader-controls {
    grid-template-columns: 104px 280px 104px;
    padding-inline: 24px;
  }

  .reader-controls .progress-track {
    width: 280px;
  }

  .reader-controls .page-button {
    width: 104px;
    min-width: 104px;
  }
}

@media (max-width: 860px) {
  body.is-reading-open .site-record {
    display: none;
  }

  .reader-view,
  .reader-view.is-catalog-collapsed,
  .reading-room {
    height: 100dvh;
    min-height: 100dvh;
  }

  .reading-room {
    grid-template-rows: 76px minmax(0, 1fr) calc(104px + env(safe-area-inset-bottom));
  }

  .reading-body {
    min-height: 0;
    padding-block: 14px;
    padding-bottom: calc(22px + env(safe-area-inset-bottom));
  }

  .paper-scroll {
    min-height: max(720px, calc(100svh - 190px));
  }

  .page-content {
    min-height: clamp(500px, calc(100svh - 330px), 680px);
  }

  .reader-controls {
    grid-template-columns: 112px 112px;
    height: calc(104px + env(safe-area-inset-bottom));
    min-height: calc(104px + env(safe-area-inset-bottom));
    justify-content: center;
    padding-block: 10px calc(18px + env(safe-area-inset-bottom));
  }

  .reader-controls .progress-track {
    width: min(300px, calc(100vw - 44px));
  }

  .reader-controls .page-button {
    width: 112px;
    min-width: 112px;
  }
}

@media (max-width: 520px) {
  .paper-scroll {
    min-height: max(680px, calc(100svh - 180px));
  }

  .reader-controls {
    grid-template-columns: 104px 104px;
  }

  .reader-controls .page-button {
    width: 104px;
    min-width: 104px;
  }
}

/* Numeric footer and reader comments */
#chapterMark {
  display: none;
}

.paper-foot {
  justify-content: center;
}

#totalMark {
  color: var(--ink-soft);
  font-size: 14px;
  letter-spacing: 0;
}

.side-progress small {
  display: none;
}

.comment-panel {
  width: min(900px, 100%);
  margin: 22px auto 0;
  padding: 22px clamp(18px, 4vw, 40px) 28px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(235, 232, 224, 0.58));
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.08);
}

.comment-head,
.auth-actions,
.comment-actions,
.comment-item header,
.comment-item footer {
  display: flex;
  align-items: center;
}

.comment-head {
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.comment-tools {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
  align-items: center;
}

.comment-head p,
.comment-head h2,
.message-panel h3 {
  margin: 0;
}

.comment-head p {
  color: var(--muted);
  font-size: 13px;
}

.comment-head h2 {
  margin-top: 4px;
  font-size: 24px;
  line-height: 1.2;
}

.auth-panel,
.message-panel,
.comment-form {
  margin-top: 16px;
}

.auth-grid,
.account-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 120px;
  gap: 10px;
}

.auth-grid label,
.account-grid label,
.comment-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.auth-grid input,
.account-grid input,
.comment-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.64);
  color: var(--ink);
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}

.auth-grid input {
  height: 38px;
  padding: 0 10px;
}

.captcha-field {
  grid-column: span 2;
}

.captcha-row {
  display: grid;
  grid-template-columns: 140px auto;
  gap: 10px;
  align-items: center;
}

.captcha-row img {
  width: 140px;
  height: 52px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.64);
  object-fit: cover;
  user-select: none;
  -webkit-user-select: none;
}

.account-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 104px;
  align-items: end;
}

.account-grid .plain-button {
  min-height: 38px;
}

.comment-form textarea {
  min-height: 112px;
  padding: 12px;
  resize: vertical;
  line-height: 1.8;
}

.comment-form textarea:disabled {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.38);
}

.auth-actions,
.comment-actions {
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

.auth-message {
  min-height: 20px;
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.message-panel {
  padding: 14px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.36);
}

.message-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.message-list article,
.comment-item {
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  padding-top: 14px;
}

.message-list article p,
.message-list article span,
.comment-list > p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.message-list article footer {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.message-list article footer button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.message-list article footer button:hover {
  color: var(--ink);
}

.message-list article strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.account-page {
  position: relative;
  z-index: 1;
  min-height: calc(100vh - 42px);
  padding: clamp(20px, 5vw, 58px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.64), rgba(238, 236, 229, 0.56));
}

.account-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: clamp(16px, 4vw, 34px);
  align-items: center;
  width: min(1080px, 100%);
  margin: 0 auto 18px;
}

.account-head p,
.account-head h1,
.account-section header p,
.account-section header h2,
.account-status,
#accountMessage {
  margin: 0;
}

.account-head p,
.account-section header p {
  color: var(--muted);
  font-size: 13px;
}

.account-head h1 {
  margin-top: 4px;
  color: var(--ink);
  font-size: clamp(32px, 6vw, 60px);
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.05;
}

.account-status,
#accountMessage {
  width: min(1080px, 100%);
  min-height: 24px;
  margin: 0 auto 14px;
  color: var(--ink-soft);
  font-size: 14px;
}

.account-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  width: min(1080px, 100%);
  margin: 0 auto;
}

.account-section {
  display: grid;
  gap: 16px;
  align-content: start;
  min-height: 0;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.07);
}

.account-auth-shell {
  width: min(760px, 100%);
  margin: 0 auto;
}

.account-management {
  width: min(1080px, 100%);
  margin: 0 auto;
}

.account-switch,
.account-management-head {
  display: flex;
  align-items: center;
}

.account-switch {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.42);
}

.account-switch-button,
.account-tab {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
}

.account-switch-button {
  flex: 1 1 0;
  min-height: 42px;
}

.account-switch-button.is-active,
.account-tab.is-active {
  background: rgba(23, 32, 29, 0.08);
  color: var(--ink);
}

.account-pane {
  display: grid;
  gap: 16px;
}

.account-management-head {
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.account-management-head p,
.account-management-head h2 {
  margin: 0;
}

.account-management-head p {
  color: var(--muted);
  font-size: 13px;
}

.account-management-head h2 {
  margin-top: 4px;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.2;
}

.account-console {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.account-sidebar,
.account-panel-stack {
  min-width: 0;
}

.account-sidebar {
  display: grid;
  gap: 14px;
}

.account-avatar-card {
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.72), transparent 58%),
    rgba(255, 255, 255, 0.42);
  text-align: center;
}

.account-avatar-card > img {
  width: 88px;
  height: 88px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  background: rgba(255, 255, 255, 0.72);
  object-fit: cover;
}

.account-avatar-card strong {
  color: var(--ink);
  font-size: 18px;
  font-weight: 500;
}

.account-avatar-card span {
  max-width: 100%;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.avatar-actions {
  display: flex;
  justify-content: center;
  width: 100%;
}

.avatar-upload-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  cursor: pointer;
}

.avatar-upload-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.avatar-preset-list {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  gap: 8px;
  justify-content: center;
  width: 100%;
}

.avatar-preset {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: rgba(255, 255, 255, 0.54);
  padding: 2px;
  cursor: pointer;
}

.avatar-preset:hover,
.avatar-preset:focus-visible {
  border-color: rgba(0, 0, 0, 0.42);
  outline: none;
}

.avatar-preset img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.account-tabs {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.38);
}

.account-tab {
  width: 100%;
  min-height: 46px;
  padding: 0 16px;
  text-align: left;
}

.account-tab + .account-tab {
  border-top: 1px solid var(--line);
}

.account-panel-stack {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.36);
}

.account-tab-panel {
  display: grid;
  gap: 16px;
}

.account-subhead {
  display: grid;
  gap: 4px;
}

.account-subhead p,
.account-subhead h3 {
  margin: 0;
}

.account-subhead p {
  color: var(--muted);
  font-size: 13px;
}

.account-subhead h3 {
  color: var(--ink);
  font-size: 18px;
  font-weight: 500;
}

.account-section header h2 {
  margin-top: 4px;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.2;
}

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

.account-form-grid label,
.account-captcha {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.account-form-grid input,
.account-captcha input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  outline: none;
  padding: 0 11px;
  user-select: text;
  -webkit-user-select: text;
}

.account-form-grid input:focus,
.account-captcha input:focus {
  border-color: rgba(0, 0, 0, 0.38);
  background: rgba(255, 255, 255, 0.9);
}

.account-code-grid {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.account-password-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  align-items: end;
}

.account-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.account-actions .plain-button,
.account-form-grid .plain-button {
  min-height: 40px;
}

.activity-group {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.34);
  padding: 0 12px 12px;
}

.activity-group summary {
  cursor: pointer;
  list-style-position: inside;
  margin: 0 -12px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
}

.activity-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding-top: 12px;
}

.activity-avatar,
.comment-avatar {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: rgba(255, 255, 255, 0.7);
  object-fit: cover;
}

.activity-item > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.activity-item strong,
.activity-item p,
.activity-item span {
  margin: 0;
}

.activity-item strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}

.activity-item p {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.activity-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.comment-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.comment-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin-left: calc(var(--comment-depth, 0) * 22px);
}

.comment-content {
  min-width: 0;
}

.comment-item header {
  justify-content: space-between;
  gap: 12px;
}

.comment-item header strong {
  font-size: 15px;
}

.comment-item header span {
  color: var(--muted);
  font-size: 12px;
}

.comment-item p {
  margin: 8px 0 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.9;
  text-indent: 0;
}

.comment-item footer {
  justify-content: flex-start;
  gap: 10px;
  margin-top: 8px;
}

.comment-item footer button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.comment-item footer button:hover {
  color: var(--ink);
}

.comment-replies {
  grid-column: 2;
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

@media (max-width: 860px) {
  .account-page {
    padding: 18px 14px 34px;
  }

  .account-head,
  .account-layout,
  .account-console,
  .account-form-grid,
  .account-code-grid,
  .account-password-grid {
    grid-template-columns: 1fr;
  }

  .account-management-head,
  .account-switch {
    align-items: stretch;
  }

  .account-management-head {
    display: grid;
  }

  .account-panel-stack {
    padding: 14px;
  }

  .account-tab {
    min-width: 0;
  }

  .account-head {
    align-items: start;
  }

  .account-head .home-link {
    display: inline-flex;
    align-items: center;
    width: fit-content;
  }

  .account-actions {
    justify-content: stretch;
  }

  .account-actions .plain-button,
  .account-form-grid .plain-button {
    width: 100%;
  }

  .comment-panel {
    margin-top: 18px;
  }

  .comment-head {
    align-items: flex-start;
    display: grid;
  }

  .comment-tools,
  .auth-grid,
  .account-grid {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .comment-tools {
    display: grid;
  }

  .captcha-field {
    grid-column: auto;
  }

  .captcha-row {
    grid-template-columns: 140px minmax(0, 1fr);
  }

  .comment-item {
    margin-left: calc(var(--comment-depth, 0) * 12px);
  }

  .comment-replies {
    grid-column: 1 / -1;
  }
}
