/* Reading is a continuous ruled notebook. Management and AI intake keep their
   existing workbench styles; this sheet is deliberately scoped to nb-reader. */
.notebook.nb-reader {
  --nb-rule: 40px;
  --nb-rule-ink: rgba(151, 175, 198, .24);
  --nb-hand: "KaiTi", "STKaiti", "楷体", "Kaiti SC", "Microsoft YaHei", sans-serif;
  --nb-sheet-width: 1180px;
}
.nb-reader .nb-header-title #nb-directory {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: auto;
  min-width: 40px;
  height: 38px;
  padding: 0 11px;
  margin: 0;
  order: 0;
  border: 1px solid #dfe5ec;
  border-radius: 7px;
  background: #fff;
  color: #4e6681;
  font-size: 15px;
  line-height: 1;
  white-space: nowrap;
}
.nb-reader .nb-header-title #nb-directory:hover,
.nb-reader .nb-header-title #nb-directory[aria-expanded=true] {
  background: #f0f4fa;
  border-color: #c9d7e5;
  color: #304e6d;
}
.nb-reader .nb-tree-label #nb-directory-close { display: grid; }
.nb-reader .nb-header { position: relative; z-index: 6; }
.nb-reader .nb-header-actions { align-items: center; }
.nb-reader .nb-header-actions #nb-full { color: #fff; background: #435e7b; border-color: #435e7b; }
.nb-reader .nb-header-actions #nb-full:hover { background: #324e6b; }
.nb-reader .nb-paper { padding: 28px clamp(16px, 2.6vw, 44px) 48px; background: #f2f5f8; }
.nb-reader .nb-chapter { width: 100%; max-width: var(--nb-sheet-width); margin: 0 auto; }
.nb-reader .nb-reading,
.nb-reader .nb-shelf {
  box-sizing: border-box;
  width: 100%;
  max-width: var(--nb-sheet-width) !important;
  padding: 34px clamp(28px, 4vw, 64px) 40px clamp(44px, 5vw, 78px);
  background: #fff;
  background-image: none;
  border: 1px solid #dce4ec;
  border-radius: 3px 8px 8px 3px;
  box-shadow: 3px 4px 0 -1px #fff, 3px 4px 0 #dfe6ee, 0 10px 30px #2b405c05;
}
.nb-reader .nb-reading::before,
.nb-reader .nb-shelf::before { left: 34px; background: #dba9b13d; }
.nb-reader .nb-reading::after,
.nb-reader .nb-shelf::after {
  left: 11px;
  top: 32px;
  bottom: 30px;
  width: 9px;
  background: radial-gradient(ellipse at center, #eef2f6 0 2.5px, #d6dfe8 3px, #fff 4px, transparent 4.5px) center 0 / 9px 64px repeat-y;
}
.nb-reader .nb-cover {
  min-height: 0;
  margin: 0 0 20px;
  padding: 3px 110px 23px 0;
  border: 0;
  border-bottom: 1px solid #dce5ef;
  background: none;
}
.nb-reader .nb-cover::before { display: none; }
.nb-reader .nb-cover h1 {
  margin: 12px 0 14px;
  font-family: var(--nb-hand);
  font-size: clamp(29px, 2.5vw, 38px);
  font-weight: 600;
  letter-spacing: .01em;
  line-height: 1.55;
  color: #2d435c;
}
.nb-reader .nb-cover .nb-book-label { font-size: 14px; letter-spacing: .02em; color: #718297; }
.nb-reader .nb-cover-line { font-size: 14px; color: #7f8fa2; gap: 8px 18px; }
.nb-reader .nb-cover .nb-stickers { width: 88px; height: 96px; top: 8px; right: 0; transform: none; }
.nb-reader .nb-cover .nb-stickers .star { font-size: 24px; top: 0; left: auto; right: 16px; }
.nb-reader .nb-cover .nb-stickers .melon { font-size: 29px; top: 36px; left: 0; }
.nb-reader .nb-cover .nb-stickers .robot { font-size: 23px; top: 53px; right: 0; left: auto; }
.nb-reader .nb-note-tools { margin: 0 0 18px; padding: 0; border: 0; gap: 8px; }
.nb-reader .nb-note-tools .button { font-size: 14px; line-height: 1.55; padding: 7px 11px; }
.nb-reader .nb-toc { display: block; margin: 0 0 24px; padding: 12px 15px; background: #f6f9fc; border: 1px solid #e2e9f1; border-radius: 6px; }
.nb-reader .nb-toc::before { display: none; }
.nb-reader .nb-toc summary { line-height: 1.7; font-size: 14px; }
.nb-reader .nb-toc[open] summary { margin-bottom: 10px; }
.nb-reader .nb-toc nav { margin-top: 0; }

/* A chapter with several entries uses one line per title, never preview cards. */
.nb-reader .nb-note-index { display: flex; flex-direction: column; gap: 0; max-width: var(--nb-sheet-width); margin: 0 auto 22px; border-top: 1px solid #dce4ed; }
.nb-reader .nb-note-index summary { padding: 12px 8px; color: #60748c; font-size: 15px; cursor: pointer; }
.nb-reader .nb-note-index a strong { flex: 1; min-width: 0; }
.nb-reader .nb-note-index a {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 13px 8px;
  border-bottom: 1px solid #dce4ed;
  color: #60748c;
  font-size: 16px;
  line-height: 1.75;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.nb-reader .nb-note-index a > span:first-child { flex-shrink: 0; font-variant-numeric: tabular-nums; color: #8d9bae; }
.nb-reader .nb-note-index a > span:last-child { min-width: 0; }
.nb-reader .nb-note-index a.active { color: #314e6c; background: #eaf0f7; }
.nb-reader .nb-note-index a:hover { color: #314e6c; background: #edf2f8; }
.nb-reader .nb-note-index a strong { font-weight: 550; }

/* Text baselines share a 40px rhythm. Each block owns its horizontal rules so
   code and tables of arbitrary height cannot misalign the following text. */
.nb-reader .nb-reading .nb-prose {
  font-family: var(--nb-hand);
  font-size: 20px;
  line-height: var(--nb-rule);
  font-weight: 400;
  letter-spacing: .015em;
  color: #344b64;
  overflow-wrap: anywhere;
  word-break: normal;
  background: none;
}
.nb-reader .nb-reading .nb-prose p,
.nb-reader .nb-reading .nb-prose li {
  margin: 0;
  padding: 0;
  line-height: var(--nb-rule);
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--nb-rule) - 4px), var(--nb-rule-ink) calc(var(--nb-rule) - 4px), var(--nb-rule-ink) calc(var(--nb-rule) - 3px), transparent calc(var(--nb-rule) - 3px), transparent var(--nb-rule));
  background-size: 100% var(--nb-rule);
}
.nb-reader .nb-reading .nb-prose h2,
.nb-reader .nb-reading .nb-prose h3,
.nb-reader .nb-reading .nb-prose h4 {
  margin: var(--nb-rule) 0 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: #294763;
  line-height: var(--nb-rule);
  font-family: var(--nb-hand);
  font-weight: 600;
  scroll-margin-top: 24px;
}
.nb-reader .nb-reading .nb-prose h2 { font-size: 27px; }
.nb-reader .nb-reading .nb-prose h3 { font-size: 24px; }
.nb-reader .nb-reading .nb-prose h4 { font-size: 21px; }
.nb-reader .nb-reading .nb-prose h3::before { display: none; }
.nb-reader .nb-reading .nb-prose > :first-child { margin-top: 0; }
.nb-reader .nb-reading .nb-prose .nb-gap { height: calc(var(--nb-rule) / 2); }
.nb-reader .nb-reading .nb-prose strong { color: #2d5275; font-weight: 600; background: linear-gradient(transparent 76%, #dcebf794 76%); padding: 0; }
.nb-reader .nb-reading .nb-prose a { color: #416e98; text-decoration-color: #94b0cd; text-underline-offset: 5px; }
.nb-reader .nb-reading .nb-prose ul,
.nb-reader .nb-reading .nb-prose ol { margin: 0; padding-left: 1.4em; }
.nb-reader .nb-reading .nb-prose li::marker { color: #738fae; }
.nb-reader .nb-reading .nb-prose blockquote {
  margin: calc(var(--nb-rule) / 2) 0;
  padding: calc(var(--nb-rule) / 2) 20px;
  border: 0;
  border-left: 3px solid #b2c7dc;
  border-radius: 0 5px 5px 0;
  background: #f3f7fc;
  color: #557089;
  line-height: var(--nb-rule);
}
.nb-reader .nb-reading .nb-prose pre {
  box-sizing: border-box;
  max-width: 100%;
  margin: calc(var(--nb-rule) / 2) 0;
  padding: 20px;
  border: 1px solid #dfe7f0;
  border-left: 3px solid #a5bad0;
  border-radius: 6px;
  background: #f5f8fc;
  font: 15px/1.75 "Cascadia Code", Consolas, monospace;
  letter-spacing: 0;
  overflow-x: auto;
  white-space: pre;
  tab-size: 2;
}
.nb-reader .nb-reading .nb-prose code { font-family: "Cascadia Code", Consolas, monospace; font-size: .84em; color: #4d6b87; background: #edf3f9; padding: 2px 5px; border-radius: 3px; letter-spacing: 0; }
.nb-reader .nb-reading .nb-prose pre code { background: none; font: inherit; padding: 0; }
.nb-reader .nb-reading .nb-prose hr { margin: var(--nb-rule) 0; border: 0; border-top: 1px solid #dce6ef; }
.nb-reader .nb-reading .nb-table-wrap { max-width: 100%; margin: calc(var(--nb-rule) / 2) 0; overflow-x: auto; }
.nb-reader .nb-reading .nb-prose table { width: 100%; min-width: 360px; background: #fff; font-family: "Microsoft YaHei", sans-serif; font-size: 15px; line-height: 1.8; letter-spacing: 0; }
.nb-reader .nb-reading .nb-prose th,
.nb-reader .nb-reading .nb-prose td { padding: 12px 15px; border: 1px solid #dfe7ef; }
.nb-reader .nb-reading .nb-prose th { color: #45607c; background: #f1f6fb; }
.nb-reader .nb-end-mark { margin: var(--nb-rule) 0 0; padding: 18px 0 0; border-top: 1px dashed #d6e1ec; color: #94a6ba; font-size: 14px; letter-spacing: 4px; }
.nb-reader .nb-book-empty { box-shadow: none; border: 0; background: none; }

@media (min-width: 781px) {
  .notebook.nb-reader.nb-directory-hidden .nb-layout { grid-template-columns: minmax(0, 1fr); }
  .notebook.nb-reader.nb-directory-hidden .nb-tree { display: none; }
}

/* Full-screen keeps navigation in view and scrolls the actual notebook sheet. */
body.nb-focus-mode { overflow: hidden; }
body.nb-focus-mode .sidebar { visibility: hidden; }
body.nb-focus-mode #butler-widget,
body.nb-focus-mode .mobile-toggle { display: none !important; }
.notebook.nb-reader.nb-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100dvh;
  min-height: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
}
.nb-reader.nb-fullscreen .nb-header { position: relative; top: 0; flex-shrink: 0; padding: 14px 26px; }
.nb-reader.nb-fullscreen .nb-layout { flex: 1; min-height: 0; overflow: hidden; }
.nb-reader.nb-fullscreen .nb-tree { position: relative; top: 0; max-height: 100%; height: 100%; }
.nb-reader.nb-fullscreen .nb-paper { min-height: 0; height: 100%; overflow: auto; overscroll-behavior: contain; padding-top: 26px; padding-bottom: 60px; }
.nb-reader.nb-fullscreen .nb-reading { min-height: calc(100dvh - 152px); }

@media (max-width: 1100px) {
  .nb-reader .nb-reading, .nb-reader .nb-shelf { padding: 28px 28px 34px 48px; }
  .nb-reader .nb-reading::before, .nb-reader .nb-shelf::before { left: 28px; }
  .nb-reader .nb-reading::after, .nb-reader .nb-shelf::after { left: 9px; }
  .nb-reader .nb-cover { padding-right: 85px; }
  .nb-reader .nb-cover .nb-stickers { transform: scale(.82); transform-origin: top right; }
}
@media (max-width: 780px) {
  .notebook.nb-reader { --nb-rule: 36px; }
  .nb-reader .nb-header { align-items: center; gap: 12px; padding: 16px; }
  .nb-reader .nb-header-title { width: auto; flex: 1; }
  .nb-reader .nb-header-title #nb-directory { order: 0; margin: 0; }
  .nb-reader .nb-header-actions { gap: 6px; justify-content: flex-end; }
  .nb-reader .nb-header-actions .button { font-size: 14px; }
  .nb-reader .nb-paper { padding: 18px 12px 32px; }
  .nb-reader .nb-reading, .nb-reader .nb-shelf { padding: 25px 22px 30px 37px; }
  .nb-reader .nb-reading::before, .nb-reader .nb-shelf::before { left: 21px; }
  .nb-reader .nb-reading::after, .nb-reader .nb-shelf::after { left: 5px; width: 8px; }
  .nb-reader .nb-reading .nb-prose { font-size: 18px; }
  .nb-reader .nb-reading .nb-prose h2 { font-size: 25px; }
  .nb-reader .nb-reading .nb-prose h3 { font-size: 23px; }
  .nb-reader .nb-reading .nb-prose h4 { font-size: 20px; }
  .nb-reader .nb-note-index a { font-size: 15px; gap: 10px; }
  .nb-reader .nb-cover h1 { font-size: 29px; margin: 10px 0 14px; }
  .nb-reader .nb-cover .nb-stickers { right: 0; top: 8px; transform: scale(.72); }
  .nb-reader.nb-fullscreen .nb-header { padding: 12px 16px; }
  .nb-reader.nb-fullscreen .nb-paper { padding: 17px 10px 40px; }
}
@media (max-width: 520px) {
  .nb-reader .nb-header-actions { width: 100%; justify-content: flex-start; }
  .nb-reader .nb-header-actions .button { flex: 1; padding: 8px; }
  .nb-reader .nb-header-title { width: 100%; justify-content: flex-start; }
  .nb-reader .nb-reading, .nb-reader .nb-shelf { padding: 23px 15px 28px 30px; }
  .nb-reader .nb-reading::before, .nb-reader .nb-shelf::before { left: 17px; }
  .nb-reader .nb-reading::after, .nb-reader .nb-shelf::after { left: 4px; width: 6px; background-size: 6px 64px; }
  .nb-reader .nb-cover { padding: 2px 0 20px; }
  .nb-reader .nb-cover .nb-book-label { display: block; padding-right: 58px; font-size: 13px; }
  .nb-reader .nb-cover h1 { padding-right: 0; font-size: 28px; margin-top: 20px; }
  .nb-reader .nb-cover .nb-stickers { width: 150px; height: 45px; top: -3px; right: -4px; transform: scale(.48); }
  .nb-reader .nb-cover .nb-stickers .star { left: 0; right: auto; top: 0; }
  .nb-reader .nb-cover .nb-stickers .melon { left: 49px; top: -2px; }
  .nb-reader .nb-cover .nb-stickers .robot { left: 105px; right: auto; top: 0; }
  .nb-reader .nb-cover-line { font-size: 13px; }
  .nb-reader .nb-note-tools { gap: 5px; }
  .nb-reader .nb-note-tools .button { padding: 6px 8px; font-size: 13px; }
  .nb-reader .nb-reading .nb-prose { letter-spacing: 0; }
  .nb-reader .nb-reading .nb-prose pre { padding: 14px; font-size: 13px; }
  .nb-reader .nb-reading .nb-prose blockquote { padding-right: 12px; padding-left: 14px; }
  .nb-reader .nb-reading .nb-prose table { font-size: 14px; }
  .nb-reader .nb-toc { padding: 11px 12px; }
  .nb-reader .nb-toc nav { grid-template-columns: minmax(0, 1fr); }
}
@media print {
  .nb-reader .nb-note-index { display: none; }
  .notebook.nb-reader.nb-fullscreen { position: static; display: block; height: auto; overflow: visible; }
  .nb-reader.nb-fullscreen .nb-layout, .nb-reader.nb-fullscreen .nb-paper { height: auto; overflow: visible; }
  .nb-reader .nb-reading { min-height: 0; background: #fff; box-shadow: none; border: 0; }
}
