:root {
  --ink: #18211f;
  --muted: #6f6b60;
  --paper: #f7f2e8;
  --paper-deep: #eee4d3;
  --accent: #a52d24;
  --gold: #d4a853;
  --green: #26724b;
  --red: #a4382e;
  --shadow: 0 24px 60px rgba(31, 19, 8, .28);
  --book-gap: 36px;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body {
  color: var(--ink);
  background: #3f2819;
  user-select: none;
}
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid rgba(255, 204, 95, .85);
  outline-offset: 2px;
}

.app-shell {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: 72px minmax(0, 1fr) 58px;
  background-color: #9d8850;
  background-image:
    linear-gradient(180deg, rgba(40, 34, 18, .05), rgba(40, 34, 18, .16)),
    url("assets/background-brass.jpg");
  background-position: center, center;
  background-size: cover, cover;
  background-repeat: no-repeat, no-repeat;
}
.app-shell.has-user-background {
  background-color: #665b3f;
  background-image: none;
}
.user-background {
  position: absolute;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  background: #665b3f;
}
.user-background[hidden] { display: none; }
.user-background img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
#userBackgroundBlur {
  filter: blur(24px) brightness(.82) saturate(.9);
  transform: scale(1.12);
}
#userBackgroundImage {
  transform: scale(var(--user-bg-scale, 1));
  transition: transform .22s ease;
}
.app-shell::before,
.app-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.app-shell::before {
  z-index: 1;
  opacity: .72;
  background:
    linear-gradient(90deg, rgba(38, 31, 15, .16), transparent 16%, transparent 84%, rgba(38, 31, 15, .14)),
    linear-gradient(180deg, rgba(255, 249, 227, .04), transparent 35%, rgba(48, 38, 17, .08));
  mix-blend-mode: multiply;
}
.app-shell::after {
  z-index: 4;
  box-shadow: inset 0 0 130px rgba(45, 35, 14, .28);
}

.topbar {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: 150px 1fr 540px;
  align-items: center;
  padding: 0 22px;
  border-bottom: 1px solid rgba(86, 68, 33, .36);
  background:
    linear-gradient(180deg, rgba(255, 250, 233, .64), rgba(209, 190, 135, .38));
  box-shadow: 0 8px 22px rgba(53, 43, 18, .15), inset 0 1px rgba(255, 255, 255, .58);
  backdrop-filter: blur(5px) saturate(.9);
}
.app-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  pointer-events: none;
  color: #342316;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: clamp(22px, 2.2vw, 31px);
  font-weight: 700;
  letter-spacing: .24em;
  text-shadow: 0 1px rgba(255, 245, 224, .6);
}
.icon-button {
  width: 46px;
  height: 42px;
  border: 1px solid rgba(86, 46, 23, .32);
  border-radius: 50%;
  background: rgba(242, 218, 184, .48);
  box-shadow: inset 0 1px rgba(255, 255, 255, .45), 0 2px 5px rgba(70, 38, 16, .15);
  cursor: pointer;
}
.icon-button:hover { background: rgba(255, 236, 208, .7); }
.menu-lines,
.menu-lines::before,
.menu-lines::after {
  display: block;
  width: 21px;
  height: 2px;
  margin: auto;
  border-radius: 3px;
  background: #684226;
}
.menu-lines { position: relative; }
.menu-lines::before, .menu-lines::after { content: ""; position: absolute; left: 0; }
.menu-lines::before { top: -7px; }
.menu-lines::after { top: 7px; }
.top-actions {
  grid-column: 3;
  justify-self: end;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.top-chip {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  border: 1px solid rgba(92, 50, 26, .38);
  border-radius: 20px;
  color: #52351f;
  background: rgba(245, 222, 191, .58);
  box-shadow: inset 0 1px rgba(255, 255, 255, .42);
  cursor: pointer;
  white-space: nowrap;
}
.top-chip:hover { background: rgba(255, 235, 206, .8); }
.chip-icon { font-size: 15px; }
#backgroundButton { min-width: 82px; justify-content: center; }
.spacing-control {
  width: 176px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid rgba(91, 72, 34, .34);
  border-radius: 20px;
  color: #4b2d1a;
  background: rgba(244, 232, 197, .7);
  box-shadow: 0 7px 18px rgba(56, 46, 20, .18), inset 0 1px rgba(255,255,255,.65);
  backdrop-filter: blur(5px);
}
.spacing-title {
  flex: 0 0 auto;
  font: 700 11px/1 "STKaiti", "KaiTi", serif;
  letter-spacing: .12em;
}
.spacing-control input {
  width: 94px;
  height: 22px;
  margin: 0;
  writing-mode: horizontal-tb;
  direction: ltr;
  accent-color: #8f3c2b;
  cursor: pointer;
}
.spacing-control output {
  min-width: 30px;
  padding: 3px 0;
  border-radius: 9px;
  color: #f7e6c8;
  background: rgba(66, 39, 22, .82);
  font: 11px/1.2 Georgia, serif;
  text-align: center;
}

.book-index-panel {
  position: absolute;
  z-index: 3;
  top: 84px;
  bottom: 70px;
  left: 12px;
  width: 220px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(86, 67, 33, .3);
  border-radius: 12px;
  background: rgba(247, 239, 220, .82);
  box-shadow: 0 14px 32px rgba(53, 40, 16, .18), inset 0 1px rgba(255,255,255,.58);
  backdrop-filter: blur(7px);
}
.book-index-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 14px;
  border-bottom: 1px solid rgba(96, 74, 38, .2);
  color: #4c3a24;
  background: rgba(220, 197, 151, .28);
}
.book-index-head strong { font: 700 17px/1 "STSong", serif; letter-spacing: .12em; }
.book-index-head span { color: #83745e; font-size: 11px; }
.book-index-head b { color: var(--accent); font-size: 14px; }
.book-index {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 7px;
  scrollbar-width: thin;
}
.index-item {
  width: 100%;
  min-height: 42px;
  display: grid;
  grid-template-columns: 31px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: 0 0 3px;
  padding: 6px 7px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #40362a;
  background: transparent;
  text-align: left;
  cursor: grab;
}
.index-item:hover { border-color: rgba(115, 86, 42, .2); background: rgba(255, 252, 243, .7); }
.index-item:active { cursor: grabbing; }
.index-number {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border-radius: 50%;
  color: #f8edda;
  background: #785f38;
  font: 11px/1 Georgia, serif;
}
.index-title {
  min-width: 0;
  overflow: hidden;
  font: 500 13px/1.25 "Microsoft YaHei", sans-serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.index-item.is-dragging { opacity: .28; }
.index-item.drag-before { border-top: 2px solid #3bbfb0; }
.index-item.drag-after { border-bottom: 2px solid #3bbfb0; }

.library {
  position: relative;
  z-index: 2;
  min-height: 0;
  overflow: auto;
  padding: 24px 38px 92px 248px;
  scrollbar-width: thin;
  scrollbar-color: #754828 transparent;
}
.shelf {
  width: min(1440px, 100%);
  margin: 0 auto 23px;
  padding: 0 8px 16px;
  filter: drop-shadow(0 15px 11px rgba(43, 20, 7, .18));
}
.books-row {
  display: grid;
  grid-template-columns: repeat(8, minmax(76px, 1fr));
  align-items: end;
  column-gap: var(--book-gap);
  row-gap: 26px;
  min-height: 146px;
  padding: 0 clamp(12px, 1.5vw, 26px);
}
.book {
  --cover-a: #e7e0d2;
  --cover-b: #b7aa95;
  --cover-ink: #30332f;
  position: relative;
  width: 100%;
  max-width: 122px;
  aspect-ratio: .72;
  justify-self: center;
  border: 0;
  padding: 0 0 10px;
  border-radius: 2px 4px 4px 2px;
  color: var(--cover-ink);
  background: linear-gradient(105deg, var(--cover-a), var(--cover-b));
  box-shadow:
    -3px 4px 0 #d1b792,
    -6px 6px 0 #86643d,
    0 12px 18px rgba(39, 19, 5, .3);
  transform: perspective(600px) rotateY(-2deg);
  transform-origin: left center;
  transition: transform .24s ease, box-shadow .24s ease;
  cursor: grab;
  overflow: hidden;
}
.book:active { cursor: grabbing; }
.book.is-dragging {
  opacity: .28;
  transform: perspective(600px) rotateY(-2deg) scale(.94);
}
.book.drag-before,
.book.drag-before:hover {
  transform: perspective(600px) rotateY(-2deg) translateX(-7px);
  outline: 3px solid rgba(68, 196, 181, .78);
  outline-offset: 4px;
}
.book.drag-after,
.book.drag-after:hover {
  transform: perspective(600px) rotateY(-2deg) translateX(7px);
  outline: 3px solid rgba(68, 196, 181, .78);
  outline-offset: 4px;
}
.book::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .34;
  background:
    radial-gradient(circle at 77% 22%, rgba(255,255,255,.8) 0 3%, transparent 3.5%),
    linear-gradient(135deg, transparent 46%, rgba(255,255,255,.24) 47% 52%, transparent 53%),
    repeating-linear-gradient(12deg, transparent 0 12px, rgba(0,0,0,.04) 13px 14px);
  pointer-events: none;
}
.book::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 7px;
  background: linear-gradient(90deg, rgba(39,21,10,.4), rgba(255,255,255,.28), transparent);
}
.book:hover, .book:focus-visible {
  transform: perspective(600px) rotateY(-8deg) translateY(-10px) scale(1.035);
  box-shadow:
    -3px 4px 0 #d1b792,
    -7px 7px 0 #86643d,
    0 22px 30px rgba(39, 19, 5, .37);
  z-index: 2;
}
.cover-design {
  position: absolute;
  inset: 0 0 31px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 15% 11% 9%;
  overflow: hidden;
}
.cover-design img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cover-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 32%, rgba(0,0,0,.18));
}
.cover-rule {
  width: 24%;
  height: 2px;
  margin: 8px 0;
  background: currentColor;
  opacity: .6;
}
.cover-title {
  position: relative;
  z-index: 1;
  max-width: 100%;
  font-family: "STSong", "Songti SC", "SimSun", serif;
  font-size: clamp(16px, 1.55vw, 25px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: .08em;
  text-align: center;
  overflow-wrap: anywhere;
}
.cover-subtitle {
  position: relative;
  z-index: 1;
  margin-top: 8px;
  font-family: Georgia, serif;
  font-size: clamp(7px, .65vw, 10px);
  letter-spacing: .17em;
  opacity: .7;
  text-align: center;
}
.cover-issue {
  position: absolute;
  z-index: 1;
  top: 10px;
  right: 9px;
  font: 8px/1 Georgia, serif;
  letter-spacing: .08em;
  opacity: .65;
}
.book-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 31px;
  display: grid;
  place-items: center;
  padding: 5px 7px;
  color: #f8f5ec;
  background: rgba(17, 17, 16, .88);
  font-size: clamp(9px, .82vw, 12px);
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.book-edit-dot {
  position: absolute;
  z-index: 4;
  top: 7px;
  left: 8px;
  width: 22px;
  height: 22px;
  display: none;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.9);
  color: #332218;
  box-shadow: 0 3px 9px rgba(0,0,0,.22);
  cursor: pointer;
}
.app-shell.is-editing .book-edit-dot { display: grid; }
.shelf-board {
  height: 18px;
  margin: -4px -2px 0;
  border-top: 1px solid rgba(93, 71, 31, .42);
  border-radius: 2px;
  background:
    linear-gradient(180deg, rgba(255, 250, 226, .32), transparent 38%),
    linear-gradient(180deg, #d7bd7d, #97753a 70%, #735426);
  box-shadow: 0 10px 14px rgba(45, 34, 12, .28), inset 0 2px rgba(255, 249, 224, .65);
}
.empty-shelf {
  display: grid;
  place-items: center;
  width: min(680px, 90%);
  min-height: 210px;
  margin: 12vh auto;
  padding: 40px;
  border: 1px dashed rgba(255,255,255,.45);
  color: rgba(255,248,235,.9);
  text-align: center;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 20px;
}
.shelf-footer {
  position: absolute;
  z-index: 8;
  right: 0;
  bottom: 0;
  left: 0;
  height: 58px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 22px;
  border-top: 1px solid rgba(87, 68, 31, .4);
  background:
    linear-gradient(180deg, rgba(252, 241, 211, .7), rgba(180, 157, 99, .72));
  box-shadow: 0 -8px 20px rgba(49, 38, 15, .17), inset 0 1px rgba(255, 250, 235, .67);
  backdrop-filter: blur(5px);
}
.brand-mark {
  font: 700 25px/1 Georgia, "Times New Roman", serif;
  letter-spacing: -.09em;
  color: #3f2919;
  text-shadow: 0 1px rgba(255,239,217,.5);
}
.collection-count {
  min-width: 118px;
  padding: 9px 20px;
  border-radius: 24px;
  color: #f3d9a5;
  background: rgba(58, 35, 19, .86);
  text-align: center;
  box-shadow: inset 0 1px 6px rgba(0,0,0,.25);
  font-family: "STKaiti", "KaiTi", serif;
}
.collection-count strong { color: #ffd891; font-size: 18px; }
.round-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(76, 40, 19, .4);
  border-radius: 50%;
  background: rgba(240, 218, 188, .58);
  cursor: pointer;
}
.add-issue-button {
  justify-self: end;
  font-size: 25px;
  line-height: 1;
}

.reader {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr) 50px;
  color: #2b2b28;
  background:
    radial-gradient(ellipse at center, rgba(72, 55, 37, .35), transparent 55%),
    linear-gradient(120deg, #1d2623, #28322e 50%, #171f1d);
}
.reader[hidden] { display: none; }
.reader-topbar {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: 1fr minmax(200px, auto) 1fr;
  align-items: center;
  gap: 18px;
  padding: 0 22px;
  color: #f6f1e7;
  background: rgba(12, 17, 15, .66);
  border-bottom: 1px solid rgba(255,255,255,.08);
  backdrop-filter: blur(12px);
}
.reader-icon-button {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 50%;
  color: #f5f1e8;
  background: rgba(255,255,255,.07);
  cursor: pointer;
}
.reader-icon-button:hover { background: rgba(255,255,255,.14); }
.reader-title-wrap {
  display: grid;
  justify-items: center;
  line-height: 1.15;
}
.reader-title-wrap strong { font-family: "STKaiti", "KaiTi", serif; font-size: 20px; letter-spacing: .12em; }
.reader-title-wrap span { color: rgba(255,255,255,.55); font-size: 10px; letter-spacing: .12em; margin-top: 4px; }
.reader-actions { justify-self: end; display: flex; gap: 8px; }
.reader-stage {
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-columns: 78px minmax(0, 850px) 78px;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 24px 34px;
}
.page-arrow {
  width: 64px;
  height: 124px;
  border: 0;
  border-radius: 28px;
  color: rgba(255,255,255,.78);
  background: transparent;
  font: 68px/1 Georgia, serif;
  cursor: pointer;
  transition: background .2s, transform .2s;
}
.page-arrow:hover:not(:disabled) { color: #fff; background: rgba(255,255,255,.055); transform: scale(1.05); }
.page-arrow:disabled { opacity: .18; cursor: default; }
.paper {
  position: relative;
  width: 100%;
  height: 100%;
  max-height: 820px;
  min-height: 420px;
  overflow: auto;
  padding: clamp(34px, 5vw, 78px);
  background:
    radial-gradient(circle at 100% 0, rgba(167, 128, 74, .08), transparent 35%),
    repeating-linear-gradient(0deg, transparent 0 29px, rgba(84, 64, 36, .025) 30px),
    var(--paper);
  box-shadow: 0 35px 90px rgba(0,0,0,.46), 0 2px 0 #fff inset, 0 -5px 18px rgba(95, 62, 28, .08) inset;
  scrollbar-width: thin;
  touch-action: pan-y;
}
.paper.slide-next { animation: page-slide-next .32s cubic-bezier(.22,.8,.28,1); }
.paper.slide-prev { animation: page-slide-prev .32s cubic-bezier(.22,.8,.28,1); }
@keyframes page-slide-next {
  from { opacity: .55; transform: translateX(9%); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes page-slide-prev {
  from { opacity: .55; transform: translateX(-9%); }
  to { opacity: 1; transform: translateX(0); }
}
.paper::after {
  content: "";
  position: absolute;
  inset: 13px;
  border: 1px solid rgba(111, 83, 45, .16);
  pointer-events: none;
}
.paper.page-cover {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 11%;
  color: var(--cover-ink, #252925);
  background:
    linear-gradient(155deg, rgba(255,255,255,.3), transparent 40%),
    linear-gradient(135deg, var(--cover-a, #e6decf), var(--cover-b, #b3a78f));
  text-align: center;
}
.paper.page-cover::before {
  content: "";
  position: absolute;
  top: 18px;
  right: 18px;
  bottom: 18px;
  left: 18px;
  border: 2px solid currentColor;
  opacity: .13;
}
.reader-cover-kicker { font: 12px/1.4 Georgia, serif; letter-spacing: .28em; opacity: .7; }
.reader-cover-title {
  margin: 22px 0 12px;
  font-family: "STSong", "Songti SC", "SimSun", serif;
  font-size: clamp(38px, 7vw, 86px);
  letter-spacing: .08em;
  line-height: 1.04;
}
.reader-cover-subtitle {
  max-width: 680px;
  font-family: Georgia, "STSong", serif;
  font-size: clamp(13px, 1.6vw, 18px);
  letter-spacing: .14em;
  opacity: .72;
}
.reader-cover-line { width: 80px; height: 2px; margin: 32px 0 22px; background: currentColor; opacity: .45; }
.reader-cover-meta { font-size: 12px; letter-spacing: .2em; opacity: .68; }
.reader-cover-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .9; }
.reader-cover-image + .reader-cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.08), rgba(0,0,0,.55));
}
.reader-cover-overlay + * { position: relative; z-index: 1; color: #fff; }
.content-page {
  max-width: 780px;
  margin: 0 auto;
}
.content-page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(72, 62, 42, .22);
}
.content-type {
  color: var(--accent);
  font: 700 11px/1 Georgia, serif;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.content-page h2 {
  margin: 0;
  font-family: "STSong", "Songti SC", "SimSun", serif;
  font-size: clamp(26px, 3.3vw, 44px);
  line-height: 1.25;
  letter-spacing: .04em;
}
.content-page .page-index { color: #9a8f7e; font: 12px Georgia, serif; }
.text-body {
  white-space: pre-wrap;
  font-family: "STSong", "Songti SC", "SimSun", serif;
  font-size: clamp(17px, 2vw, 22px);
  line-height: 1.95;
  text-align: justify;
}
.media-stage {
  width: 100%;
  min-height: 260px;
  display: grid;
  place-items: center;
  margin-bottom: 22px;
  background: #171c1a;
  overflow: hidden;
}
.media-stage img { display: block; max-width: 100%; max-height: 58vh; object-fit: contain; }
.media-stage video { display: block; width: 100%; max-height: 58vh; }
.audio-card {
  width: min(560px, 100%);
  padding: 34px;
  color: #f5efe2;
  background: linear-gradient(135deg, #2c3933, #17221e);
  box-shadow: 0 18px 30px rgba(0,0,0,.2);
}
.audio-mark {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: 0 auto 24px;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 50%;
  font-size: 26px;
}
.audio-card audio { width: 100%; accent-color: #d7af68; }
.capture-caption { margin-top: 18px; color: var(--muted); font-size: 14px; line-height: 1.7; text-align: center; }
.link-card {
  display: grid;
  gap: 18px;
  padding: 34px;
  border: 1px solid rgba(86, 64, 35, .18);
  background: rgba(255,255,255,.42);
  box-shadow: 0 15px 35px rgba(85,61,30,.08);
}
.link-icon { font-size: 34px; color: var(--accent); }
.link-title { font: 700 clamp(22px, 2.5vw, 34px)/1.3 "STSong", serif; }
.link-address { color: #716855; line-height: 1.7; word-break: break-all; }
.link-open {
  justify-self: start;
  padding: 11px 20px;
  border: 0;
  border-radius: 2px;
  color: #fff8ec;
  background: var(--accent);
  text-decoration: none;
  cursor: pointer;
}
.document-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  padding: 32px;
  border: 1px solid rgba(86, 64, 35, .18);
  background: rgba(255, 255, 255, .46);
  box-shadow: 0 15px 35px rgba(85,61,30,.08);
}
.document-icon {
  width: 86px;
  height: 108px;
  display: grid;
  place-items: center;
  padding: 10px;
  color: #fff8ec;
  background: linear-gradient(145deg, #b33a2f, #7c211a);
  font: 700 13px/1.2 Georgia, serif;
  letter-spacing: .05em;
  text-align: center;
  box-shadow: 0 12px 22px rgba(91, 36, 27, .22);
}
.document-copy { min-width: 0; }
.document-copy strong {
  display: block;
  margin: 5px 0 9px;
  font: 700 clamp(20px, 2.4vw, 31px)/1.35 "STSong", "SimSun", serif;
  overflow-wrap: anywhere;
}
.document-copy span { color: #8b7e69; font-size: 12px; }
.document-copy p { margin: 22px 0 0; color: #675f52; line-height: 1.8; }
.document-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 5px;
}
.document-actions button:disabled { cursor: wait; opacity: .68; }
.pdf-preview {
  position: relative;
  width: 100%;
  height: min(58vh, 540px);
  min-height: 390px;
  margin-top: 20px;
  overflow: hidden;
  border: 1px solid rgba(86, 64, 35, .2);
  background: #e9e5dc;
  box-shadow: 0 12px 30px rgba(64, 48, 22, .1);
}
.pdf-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
.pdf-loading {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: #746b5d;
  font-size: 13px;
}
.pdf-loading.is-error { color: var(--red); }
.missing-media {
  min-height: 220px;
  display: grid;
  place-items: center;
  padding: 30px;
  color: #7a6d59;
  border: 1px dashed #b7a990;
  text-align: center;
  line-height: 1.8;
}
.reader-footer {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 24px;
  color: rgba(255,255,255,.6);
  background: rgba(12, 17, 15, .68);
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: 11px;
}
.page-status { color: #e7d9bd; font: 13px Georgia, serif; letter-spacing: .08em; }
.page-status i { padding: 0 9px; font-style: normal; opacity: .45; }
.reader-nav { display: flex; align-items: center; gap: 5px; }
.reader-nav-button {
  min-width: 32px;
  height: 30px;
  padding: 0 7px;
  border: 0;
  border-radius: 6px;
  color: rgba(255,255,255,.78);
  background: transparent;
  font: 18px/1 Georgia, serif;
  cursor: pointer;
}
.reader-nav-button:hover:not(:disabled) { color: #fff; background: rgba(255,255,255,.08); }
.reader-nav-button:disabled { opacity: .22; cursor: default; }
.issue-date { justify-self: end; letter-spacing: .08em; }

.content-drawer {
  position: absolute;
  z-index: 20;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 92vw);
  display: flex;
  flex-direction: column;
  padding: 27px;
  color: var(--ink);
  background: #f5efe4;
  box-shadow: -25px 0 60px rgba(0,0,0,.34);
  animation: drawer-in .25s ease both;
}
.content-drawer[hidden] { display: none; }
@keyframes drawer-in { from { transform: translateX(45px); opacity: 0; } }
.drawer-head { display: flex; justify-content: space-between; align-items: center; }
.drawer-head h2 { margin: 4px 0 0; font: 700 26px/1.2 "STSong", serif; }
.close-drawer, .modal-close {
  width: 38px;
  height: 38px;
  border: 1px solid #d2c5b3;
  border-radius: 50%;
  background: transparent;
  font-size: 26px;
  cursor: pointer;
}
.section-kicker { color: var(--accent); font: 700 9px/1.3 Georgia, serif; letter-spacing: .2em; }
.drawer-note { margin: 20px 0 17px; color: #766c5b; font-size: 12px; line-height: 1.7; }
.content-list { flex: 1; min-height: 0; overflow: auto; padding-right: 4px; }
.content-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 11px;
  align-items: center;
  padding: 13px 0;
  border-bottom: 1px solid #ddd2c1;
}
.type-dot {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fbf6ec;
  background: #37433d;
  font: 700 13px Georgia, serif;
}
.content-row-copy { min-width: 0; }
.content-row-title { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.content-row-type { display: block; margin-top: 3px; color: #978a76; font-size: 10px; letter-spacing: .12em; }
.content-row-actions { display: flex; gap: 5px; }
.mini-button {
  min-height: 31px;
  padding: 0 9px;
  border: 1px solid #d2c4b0;
  border-radius: 16px;
  background: #fffaf2;
  font-size: 11px;
  cursor: pointer;
}
.mini-button.visible { color: var(--green); border-color: #9bc0a8; background: #eef7f0; }
.mini-button.hidden { color: var(--red); border-color: #d8aaa3; background: #fbefed; }
.mini-button.icon-only { width: 32px; padding: 0; }
.drawer-add { width: 100%; margin-top: 16px; }
.primary-button, .secondary-button, .danger-button {
  min-height: 40px;
  padding: 0 18px;
  border-radius: 3px;
  cursor: pointer;
}
.primary-button { border: 1px solid #8b281f; color: #fff9ef; background: var(--accent); }
.primary-button:hover { background: #8c241c; }
.secondary-button { border: 1px solid #cbbca8; color: #3e382e; background: #fbf7f0; }
.danger-button { margin-right: auto; border: 1px solid #b9665c; color: #a42d23; background: #fbefec; }

.modal-layer {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal-layer[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(13, 19, 17, .72);
  backdrop-filter: blur(8px);
}
.modal {
  position: relative;
  z-index: 1;
  width: min(620px, 100%);
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f8f3ea;
  box-shadow: var(--shadow);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 25px 18px;
  border-bottom: 1px solid #ded3c1;
}
.modal-head h2 { margin: 4px 0 0; font: 700 25px/1.2 "STSong", serif; }
#editForm { display: flex; flex-direction: column; min-height: 0; }
.modal-body { padding: 22px 25px; overflow: auto; }
.modal-foot {
  display: flex;
  align-items: center;
  padding: 15px 25px 20px;
  border-top: 1px solid #ded3c1;
}
.modal-foot-right { display: flex; gap: 10px; margin-left: auto; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: grid; gap: 7px; margin-bottom: 16px; }
.field.full { grid-column: 1 / -1; }
.field label { color: #776c5a; font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.field input, .field textarea, .field select {
  width: 100%;
  border: 1px solid #cfc2ae;
  border-radius: 3px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fffdf8;
  user-select: text;
}
.field textarea { min-height: 136px; resize: vertical; line-height: 1.7; }
.field input[type="range"] {
  padding: 7px 0;
  accent-color: #8f3c2b;
}
.range-caption {
  display: flex;
  justify-content: space-between;
  color: #756a58;
  font-size: 12px;
}
.range-caption output {
  color: var(--accent);
  font-weight: 700;
}
.color-row { display: flex; align-items: center; gap: 11px; }
.color-row input[type="color"] { width: 48px; height: 38px; padding: 3px; }
.file-note { color: #8a7f6d; font-size: 11px; line-height: 1.5; }
.help-box { line-height: 1.85; color: #514a3f; font-size: 14px; }
.help-box strong { color: var(--ink); }

.app-menu {
  position: fixed;
  z-index: 80;
  inset: 0;
}
.app-menu[hidden] { display: none; }
.menu-panel {
  position: absolute;
  z-index: 2;
  inset: 0 auto 0 0;
  width: min(330px, 88vw);
  display: flex;
  flex-direction: column;
  padding: 26px;
  overflow-y: auto;
  background: #f6f0e5;
  box-shadow: 22px 0 60px rgba(0,0,0,.3);
}
.menu-head { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.menu-head h2 { margin: 2px 0 0; font: 700 26px/1.1 "STSong", serif; }
.menu-logo {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  color: #f8ead2;
  background: #8e2e25;
  font: 700 26px/1 "STKaiti", serif;
}
.menu-item {
  width: 100%;
  display: flex;
  gap: 13px;
  align-items: center;
  padding: 14px 12px;
  border: 0;
  border-bottom: 1px solid #ddd2c1;
  color: #554d40;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.menu-item:hover { color: var(--accent); background: #fffaf1; }
.share-card {
  display: grid;
  justify-items: center;
  gap: 9px;
  margin-top: 14px;
  padding: 15px 13px 13px;
  border: 1px solid #d8cbb8;
  background: rgba(255, 252, 244, .72);
  text-align: center;
}
.share-head { display: flex; align-items: baseline; gap: 9px; }
.share-head strong { font: 700 16px/1.2 "STSong", serif; }
.share-qr {
  width: 148px;
  height: 148px;
  display: block;
  padding: 7px;
  background: #fff;
  object-fit: contain;
}
.share-card p { margin: 0; color: #776d5e; font-size: 11px; line-height: 1.55; }
.share-card code {
  width: 100%;
  padding: 6px 7px;
  color: #675b47;
  background: #eee4d3;
  font-size: 10px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  user-select: text;
}
.share-copy {
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid #cbbca8;
  border-radius: 16px;
  color: #614a32;
  background: #faf5eb;
  font-size: 11px;
  cursor: pointer;
}
.menu-foot { margin-top: auto; color: #978b79; font-size: 11px; line-height: 1.6; }
.menu-mask { position: absolute; inset: 0; background: rgba(20,18,14,.52); backdrop-filter: blur(3px); }

.toast {
  position: fixed;
  z-index: 200;
  right: 24px;
  bottom: 24px;
  max-width: 360px;
  padding: 12px 17px;
  border-radius: 4px;
  color: #fff8ed;
  background: rgba(33, 45, 40, .95);
  box-shadow: 0 12px 30px rgba(0,0,0,.25);
  font-size: 13px;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateY(0); }

.reader:fullscreen { background: #17201d; }
.reader:fullscreen .reader-stage { padding: 18px; }
.reader.reader-is-editing .paper::after { border-color: rgba(165,45,36,.65); }
.public-mode #addIssueButton,
.public-mode #editShelfButton,
.public-mode #backgroundButton,
.public-mode #manageButton,
.public-mode #readerEditButton,
.public-mode #menuAdd,
.public-mode #menuReset,
.public-mode .book-edit-dot {
  display: none !important;
}
.public-mode .book,
.public-mode .index-item { cursor: pointer; }

@media (max-width: 1050px) {
  .books-row { grid-template-columns: repeat(6, minmax(72px, 1fr)); row-gap: 25px; }
  .topbar { grid-template-columns: 80px 1fr auto; }
  .top-chip { padding: 0 10px; }
  .top-chip .chip-icon { display: none; }
  .spacing-control { width: 140px; }
  .spacing-control input { width: 64px; }
  .book-index-panel { width: 188px; }
  .library { padding-left: 210px; }
}
@media (max-width: 760px) {
  .app-shell { grid-template-rows: 62px minmax(0,1fr) 52px; }
  .topbar { grid-template-columns: 54px 1fr auto; padding: 0 12px; }
  .top-chip span:last-child { display: none; }
  .top-chip { width: 38px; padding: 0; justify-content: center; }
  .spacing-control { width: 100px; height: 34px; padding: 0 6px; gap: 4px; }
  .spacing-control input { width: 52px; height: 20px; }
  .spacing-title { display: none; }
  .spacing-control output { min-width: 24px; font-size: 9px; }
  .book-index-panel { top: 74px; bottom: 62px; left: 5px; width: 54px; border-radius: 9px; }
  .book-index-head { min-height: 38px; justify-content: center; padding: 0 4px; }
  .book-index-head strong { display: none; }
  .book-index-head span { font-size: 9px; white-space: nowrap; }
  .book-index-head span b { font-size: 11px; }
  .book-index { padding: 4px; }
  .index-item { grid-template-columns: 1fr; min-height: 36px; padding: 3px; justify-items: center; }
  .index-title { display: none; }
  .index-number { width: 27px; height: 27px; }
  .library { padding: 16px 12px 76px 66px; }
  .books-row { grid-template-columns: repeat(3, minmax(74px, 1fr)); row-gap: 24px; }
  .shelf { margin-bottom: 16px; }
  .shelf-board { height: 14px; }
  .reader-stage { grid-template-columns: 1fr; padding: 12px 14px 62px; }
  .page-arrow { position: absolute; bottom: 9px; z-index: 3; width: 42px; height: 40px; font-size: 30px; }
  .page-arrow-left { left: calc(50% - 92px); }
  .page-arrow-right { right: calc(50% - 92px); }
  .paper { min-height: 100%; padding: 34px 27px; }
  .reader-topbar { grid-template-columns: auto 1fr auto; padding: 0 10px; gap: 6px; }
  .reader-title-wrap { justify-items: start; overflow: hidden; }
  .reader-title-wrap strong { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .reader-actions .reader-icon-button:nth-child(3) { display: none; }
  .reader-footer { grid-template-columns: 1fr auto; padding: 0 14px; }
  .reader-hint { display: none; }
  .reader-nav { justify-self: start; }
  .reader-nav-button { min-width: 27px; padding: 0 4px; }
  .issue-date { justify-self: start; }
  .collection-count { min-width: 94px; }
  .brand-mark { font-size: 20px; }
  .field-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .document-card { grid-template-columns: 1fr; padding: 24px; }
  .document-icon { width: 66px; height: 82px; }
  .pdf-preview { height: 52vh; min-height: 330px; }
}
@media (max-width: 440px) {
  .book-index-panel { width: 47px; }
  .library { padding-left: 58px; }
  .spacing-control { width: 82px; padding: 0 4px; gap: 2px; }
  .spacing-control input { width: 44px; }
  .books-row { grid-template-columns: repeat(2, minmax(94px, 1fr)); }
  .app-title { letter-spacing: .12em; }
  .reader-stage { padding-left: 5px; padding-right: 5px; }
  .paper { padding: 30px 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
