/* base.css */
:root {
  --gold: #c9a24a;
  --bg: #0b0d0f;
  --fg: #e6e2d8;
  --accent: var(--gold);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, sans-serif;
  line-height: 1.6;
}
a { color: var(--accent); }
img { max-width: 100%; height: auto; display: block; }

.lang-switch {
  position: fixed;
  top: .75rem;
  right: .75rem;
  font-size: .85rem;
}

/* Dòng bản quyền cuối mọi trang. Trang không cuộn (cổng, lật trang) tự đặt chỗ riêng. */
.site-copy {
  position: relative; z-index: 1;
  padding: 0 1rem calc(1.4rem + env(safe-area-inset-bottom, 0px));
  text-align: center;
  font: 11px/1.4 system-ui, sans-serif; letter-spacing: .03em;
  opacity: .45;
}

@view-transition { navigation: auto; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  @view-transition { navigation: none; }
}

/* archive.css */
/* Mục lục một thế giới (Era 00): kho lưu trữ. Mỗi thế giới cất tư liệu theo cách riêng. */
body.page-archive { overflow-x: clip; min-height: 100dvh; }
/* nền body cùng tông với nền kho, phòng khi trình duyệt vẽ chậm lớp nền */
body.page-archive.world-cultivation { background: #4f564a; }

/* Nền toàn màn hình: quả cầu ở trang cổng phình ra thành chính lớp này (view-transition-name) */
/* cao theo màn hình lớn nhất (khi thanh địa chỉ của Chrome thu lại khi cuộn), để mép dưới không lộ nền body */
.archive-bg { position: fixed; top: 0; left: 0; right: 0; height: 100vh; height: 100lvh; z-index: 0; }
.archive-bg-cultivation { view-transition-name: world-cultivation; }
.archive-bg-magic { view-transition-name: world-magic; }
.archive-bg-science { view-transition-name: world-science; }

.archive {
  font-family: "Noto Serif", serif;
  position: relative; z-index: 1;
  max-width: 34rem;
  margin: 0 auto;
  padding: 4.5rem 1.4rem 3rem;
}
.archive-head { margin-bottom: 2.6rem; }
.archive-kicker { margin: 0 0 .4rem; font: .78rem/1.4 "Noto Serif", serif; letter-spacing: .08em; opacity: .7; }
.archive-head h1 { margin: 0; font-weight: 400; line-height: 1.15; }
.archive-list { list-style: none; margin: 0; padding: 0; }
.archive .archive-item a { display: flex; gap: 1rem; align-items: center; color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.item-text { display: grid; gap: .2rem; min-width: 0; }
.item-blurb { font: .92rem/1.5 "Noto Serif", serif; opacity: .8; }
.archive-empty { font: italic .95rem/1.6 "Noto Serif", serif; opacity: .7; }

.archive-nav {
  position: relative; z-index: 1;
  display: flex; justify-content: center; gap: 1.5rem;
  padding: 1rem 1rem .8rem;
  font: .8rem/1.4 system-ui, sans-serif;
}
body .archive-nav a { color: inherit; opacity: .55; text-decoration: none; }

/* ---------------- Tu Tiên: Tàng Kinh Các ----------------
   Tấm lụa xám ngọc đã cũ (vân mây mực, rạn ô lưới), viền bồi gỗ tối.
   Tên kho viết dọc bên phải. Mỗi tư liệu là một thẻ gỗ treo hai sợi dây dưới thanh gỗ. */
.archive-bg-cultivation {
  background-color: #6f776a;
  background-image:
    radial-gradient(ellipse 55% 18% at 30% 22%, #d8dacd55, transparent 70%),
    radial-gradient(ellipse 45% 14% at 75% 58%, #d8dacd40, transparent 70%),
    radial-gradient(ellipse 70% 20% at 40% 88%, #e2e3d74d, transparent 70%),
    radial-gradient(ellipse 35% 30% at 85% 15%, #2e352c40, transparent 70%),
    radial-gradient(ellipse 40% 35% at 10% 65%, #2e352c38, transparent 70%),
    url("/theme/img/wear/fox-blotch.webp"),
    repeating-linear-gradient(87deg, transparent 0 37px, #2a2f2722 37px 38px),
    repeating-linear-gradient(-2deg, transparent 0 53px, #2a2f271c 53px 54px),
    radial-gradient(ellipse at 50% 45%, #8b9284 0%, #747c6e 55%, #4f564a 100%);
  background-size: auto, auto, auto, auto, auto, 512px, auto, auto, auto;
  box-shadow: inset 0 0 0 14px #2b2117, inset 0 0 0 16px #6a5536, inset 0 0 0 18px #2b2117, inset 0 0 70px 24px #1d1b14aa;
}
/* Bố cục hai cột: danh sách bên trái, tên kho + tên thế giới bên phải. Không cột nào đè lên cột kia. */
.archive-cultivation {
  color: #1d211c;
  padding: 2.6rem 1.5rem 3rem 1.9rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto 1fr;
  column-gap: 1.1rem;
}
.archive-cultivation .archive-head {
  grid-column: 2; grid-row: 1 / span 3;
  margin: 0;
  display: flex; flex-direction: row-reverse; align-items: flex-start; gap: .55rem;
}
/* Tên kho: mỗi chữ một dòng, chữ đứng thẳng */
.archive-cultivation h1 {
  margin: 0;
  display: flex; flex-direction: column; align-items: center;
  font: 400 clamp(2.3rem, 10vw, 3rem)/.95 "Kolker Brush", "Noto Serif", serif;
  color: #141813; text-shadow: 0 0 18px #c9cdbf66;
}
.archive-cultivation h1 span { display: block; }
/* tên thế giới: chữ đứng thẳng, mỗi chữ một dòng (bản cũ xoay dọc thì chữ Latin nằm nghiêng) */
.archive-cultivation .archive-kicker {
  display: flex; flex-direction: column; align-items: center; gap: .3em; margin: .45rem 0 0; line-height: 1.1;
  font-size: .72rem; letter-spacing: .18em; text-transform: uppercase;
  color: #2a3028; opacity: .8;
}
.archive-cultivation .rod, .archive-cultivation .archive-list, .archive-cultivation .archive-empty { grid-column: 1; }
.archive-cultivation .rod {
  height: 8px; margin-top: 1.9rem; border-radius: 4px;
  background: linear-gradient(#8a6a3e, #4a3520);
  box-shadow: 0 2px 3px #0006;
}
.archive-cultivation .archive-item { position: relative; padding-top: 2.1rem; }
.archive-cultivation .archive-item::before,
.archive-cultivation .archive-item::after {
  content: ""; position: absolute; top: 0; width: 1.5px; height: 2.3rem; background: #3b2a1a;
}
.archive-cultivation .archive-item::before { left: 30%; }
.archive-cultivation .archive-item::after { right: 30%; }
.archive-cultivation .archive-item a { display: block; text-align: center; }
.archive-cultivation .tag {
  position: relative; display: block;
  padding: 1rem .7rem .9rem;
  background:
    repeating-linear-gradient(91deg, #0000 0 6px, #ffffff08 6px 7px, #0000 7px 15px, #00000014 15px 16px),
    linear-gradient(#4a321d, #2f1f12);
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%, 0 8px);
  box-shadow: 0 4px 8px #0006;
  transition: translate .25s;
}
.archive-cultivation a:hover .tag,
.archive-cultivation a:focus-visible .tag { translate: 0 2px; }
.archive-cultivation .item-label { display: block; font: 400 1.75rem/1.05 "Kolker Brush", "Noto Serif", serif; color: #eadfc4; }
.archive-cultivation .item-kind { display: block; margin-top: .4rem; font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: #c9b88f99; }
.archive-cultivation .item-blurb { display: block; margin: .5rem .25rem 0; font-size: .82rem; line-height: 1.45; color: #1d211ccc; opacity: 1; }
.archive-cultivation .archive-empty { margin-top: 2rem; }

/* Kệ (mỗi kệ một câu chuyện). Tiền tố ac- = archive cultivation.
   Bản chính: thẻ gỗ, chữ Kolker như cũ. Bản sao lục: thẻ giấy ngà, nét người thủ thư (Alex Brush).
   Mỗi kệ một hàng vuốt ngang; chữ Latin không xoay dọc: mỗi chữ một dòng, chữ đứng thẳng.
   Màu thẻ viết kèm .archive để thắng luật .world-cultivation a (màu son của link). */
/* Có kệ thì bỏ lưới hai cột: tên kho thả nổi bên phải, các kệ cạnh nó hẹp lại
   (hàng vuốt ngang tự co bên cạnh khối nổi), qua khỏi tên kho thì kệ rộng hết bề ngang.
   Bản tiếng Anh tên kho dài, nếu giữ lưới thì cột kệ chỉ còn chừng 130px. */
.archive-cultivation.archive-shelved { display: flow-root; }
.archive-shelved .archive-head { float: right; margin: 0 0 .8rem .9rem; }
.archive-cultivation .ac-shelves { margin-top: .6rem; }
.ac-shelf + .ac-shelf { margin-top: 1.7rem; }
.ac-name {
  margin: 0 0 .35rem .1rem;
  font: 400 1.9rem/1.05 "Alex Brush", "Noto Serif", serif;
  color: #1d211c; text-shadow: 0 0 14px #c9cdbf55;
}
.ac-row {
  list-style: none; margin: 0; padding: .4rem .2rem 0;
  display: flex; gap: .55rem; align-items: stretch;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.ac-row::-webkit-scrollbar { display: none; }
.ac-slot { flex: none; display: flex; scroll-snap-align: start; }
.archive .ac-card {
  width: 5.4rem; min-height: 9.2rem;
  display: flex; flex-direction: column; justify-content: space-between; align-items: center; gap: .5rem;
  padding: .75rem .3rem .55rem;
  text-align: center; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  clip-path: polygon(7px 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 0 100%, 0 7px);
  transition: translate .25s;
}
.ac-card:hover, .ac-card:focus-visible { translate: 0 -3px; }
.ac-label { display: flex; flex-direction: column; align-items: center; overflow-wrap: anywhere; }
.ac-label > span { display: block; }
.ac-kind { display: block; }
.archive .ac-main {
  background:
    repeating-linear-gradient(91deg, #0000 0 6px, #ffffff08 6px 7px, #0000 7px 15px, #00000014 15px 16px),
    linear-gradient(#4a321d, #2f1f12);
  color: #eadfc4;
}
.ac-main .ac-label { font: 400 1.5rem/1 "Kolker Brush", "Noto Serif", serif; }
.ac-main .ac-kind { font-size: .56rem; line-height: 1.25; letter-spacing: .1em; text-transform: uppercase; color: #c9b88f99; }
.archive .ac-copy {
  background:
    radial-gradient(ellipse at 30% 20%, #f1e9d455, transparent 60%),
    linear-gradient(#e9dfc6, #d9cba9);
  color: #3a2717;
  box-shadow: inset 0 0 0 1px #8a7a5555;
}
.ac-copy .ac-label { font: 400 1.32rem/1.02 "Alex Brush", "Noto Serif", serif; }
.ac-copy .ac-kind { font: 400 1.05rem/1 "Alex Brush", "Noto Serif", serif; color: #a8322a; }
.ac-plank {
  height: 10px; border-radius: 2px;
  background: linear-gradient(#8a6a3e, #4a3520);
  box-shadow: 0 3px 4px #0006;
}
.archive-cultivation ~ :is(.archive-nav, .site-copy) { color: #1d211c; }
.archive-cultivation ~ .site-copy { padding-bottom: 2.4rem; }

/* ---------------- Ma Pháp: sổ đăng ký thư viện tháp ----------------
   Trang giấy da, khung kép vàng và xanh lapis. Chữ cái đầu viết bút lông ngỗng (Great Vibes)
   tràn ra khỏi ô mạ vàng viền đỏ, kiểu sách chép tay phương Tây. Mỗi dòng: số kệ đỏ, tên, dấu sáp. */
.archive-bg-magic {
  background:
    url("/theme/img/wear/fox-blotch.webp") 120px 40px / 512px,
    linear-gradient(100deg, transparent 30%, #fffaeb30 45%, transparent 60%),
    radial-gradient(ellipse at 50% 45%, #ecdcb6 0%, #e2cfa6 60%, #bfa475 100%);
}
.archive-bg-magic::after {
  content: ""; position: absolute; inset: 12px;
  border: 2px solid #b8913f;
  box-shadow: inset 0 0 0 5px #e2cfa6, inset 0 0 0 7px #2f3f8f, inset 0 0 0 9px #e2cfa6, inset 0 0 0 10px #b8913f;
}

.archive-bg-magic::before {
  content: ""; position: absolute; inset: 5px; z-index: 1;
  /* bốn góc khung: nút vàng nhân lapis */
  background:
    radial-gradient(circle, #2f3f8f 0 2px, #b8913f 2.5px 5px, transparent 5.5px) 0 0 / 14px 14px no-repeat,
    radial-gradient(circle, #2f3f8f 0 2px, #b8913f 2.5px 5px, transparent 5.5px) 100% 0 / 14px 14px no-repeat,
    radial-gradient(circle, #2f3f8f 0 2px, #b8913f 2.5px 5px, transparent 5.5px) 0 100% / 14px 14px no-repeat,
    radial-gradient(circle, #2f3f8f 0 2px, #b8913f 2.5px 5px, transparent 5.5px) 100% 100% / 14px 14px no-repeat;
}
.archive-magic { color: #2b1d10; padding: 3.4rem 2.2rem 2rem 2.4rem; }
.archive-magic .archive-head { margin-bottom: 0; }
.archive-magic .archive-kicker { margin-bottom: 1rem; font-size: .66rem; letter-spacing: .22em; text-transform: uppercase; color: #8a2a1f; opacity: 1; }
.archive-magic h1 { min-height: 5.4rem; font-weight: 400; }
.archive-magic .initial {
  float: left; position: relative;
  width: 4.4rem; height: 4.4rem; margin: 0 .5rem .2rem 0;
  border: 1px solid #8a2a1f; outline: 1px solid #8a2a1f; outline-offset: 3px;
  background:
    radial-gradient(circle at 30% 25%, #f3dc8a, #c9a24a 55%, #9a7428),
    repeating-linear-gradient(45deg, #0000 0 5px, #8a2a1f22 5px 6px);
  background-blend-mode: multiply;
}
.archive-magic .initial span {
  position: absolute; left: .55rem; bottom: .35rem;
  font: 400 4.6rem/1 "Great Vibes", serif; color: #2f3f8f;
}
.archive-magic .title-rest { display: block; padding-top: .35rem; font: 400 2.1rem/1.05 "Great Vibes", serif; }
.archive-magic .title-rest small { display: block; font-size: 1.55rem; }
.archive-magic .archive-head::after {
  content: ""; display: block; clear: both;
  height: 4px; margin: .9rem 0 .4rem;
  border-top: 1px solid #8a2a1f; border-bottom: 1px solid #8a2a1f;
}
.archive-magic .archive-item a { display: flex; align-items: center; gap: .8rem; padding: .4rem 0 .55rem; border-top: 1px solid #5a321e40; }
.archive-magic .item-shelf { flex: none; width: 2.4rem; font-size: .72rem; letter-spacing: .08em; color: #8a2a1f; }
.archive-magic .item-text { flex: 1; gap: 0; }
.archive-magic .item-label { font: 400 1.6rem/1.15 "Great Vibes", serif; }
.archive-magic .item-blurb { font-size: .74rem; line-height: 1.35; color: #2b1d10a8; opacity: 1; }
.archive-magic a:hover .item-label, .archive-magic a:focus-visible .item-label { color: #2f3f8f; }
.seal {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #8f6bc4, var(--seal, #5b3a8a) 55%, #2e1a4a);
  box-shadow: 0 1px 2px rgb(0 0 0 / .4), inset 0 0 0 3px rgb(255 255 255 / .08);
}
.archive-magic ~ :is(.archive-nav, .site-copy) { color: #2b1d10; }
.archive-magic ~ .site-copy { padding-bottom: 2.6rem; }

/* ---------------- Khoa Học: danh mục tập tin khôi phục ----------------
   Màn hình đọc kho dữ liệu hỏng. */
.archive-bg-science {
  background:
    repeating-linear-gradient(transparent 0 2px, rgb(79 195 232 / .05) 2px 3px),
    radial-gradient(ellipse at 50% 30%, rgb(79 195 232 / .14), transparent 65%),
    var(--screen, #03090c);
}
.archive-science { color: var(--screen-ink, #8fe3f5); font-family: "Times New Roman", "Noto Serif", serif; }
.archive-science .archive-kicker { font-family: inherit; }
.archive-science h1 { font-family: inherit; font-size: 1.35rem; letter-spacing: .14em; text-transform: uppercase; }
.archive-science .archive-item a { padding: .8rem .2rem; border-top: 1px solid var(--screen-dim, #4fc3e880); }
.archive-science .archive-item:last-child a { border-bottom: 1px solid var(--screen-dim, #4fc3e880); }
.archive-science .item-file { font-size: .78rem; opacity: .6; letter-spacing: .04em; }
.archive-science .item-label { font-size: 1.2rem; }
.archive-science .item-blurb { font-family: inherit; }
.archive-science .item-status { display: flex; align-items: center; gap: .6rem; font-size: .78rem; opacity: .8; }
.archive-science .bar {
  width: 6rem; height: 4px;
  background: linear-gradient(90deg, var(--screen-ink, #8fe3f5) var(--p), rgb(79 195 232 / .2) var(--p));
}
.archive-science .archive-empty { font-family: inherit; font-style: normal; letter-spacing: .06em; }
.archive-science .archive-empty::before { content: "> "; }
.archive-science ~ :is(.archive-nav, .site-copy) { color: var(--screen-ink, #8fe3f5); }

/* brushnotes.css */
/* Lưu ý: file này đứng trước cultivation.css khi gộp (xếp theo tên), nên các luật trùng độ ưu tiên với
   .world-cultivation sẽ bị đè. Vì vậy body và link ở đây được viết cụ thể hơn một bậc. */
/* Khuôn brushnotes: sách chép tay đóng chỉ của một thư sinh, đã nằm lâu trên kệ.
   Một người viết: phông Waterfall, viền thêm nét mảnh cùng màu mực cho dày lên (Waterfall chỉ có một độ đậm).
   Dấu thời gian: mọt ăn xuyên nhiều trang liền, vết ẩm loang ở góc, góc lật trang sờn, mực phai theo năm.
   Biến riêng của khuôn mang tiền tố --bk-. */

html body.page-brushnotes {
  color-scheme: dark;
  background-color: #1c1814;
  background-image: radial-gradient(ellipse at 50% 35%, #2a241d, #17130f 75%);
  background-attachment: fixed;
  color: #d9cdb2;
  overflow-x: clip;
}

/* ======================================================================
   Bản gốc (không có script): trang sách trải dài
   ====================================================================== */
.bk { max-width: 32rem; margin: 0 auto; padding: 2rem .7rem 4rem; }
.bk-source { background: #dccaa0; color: #33251a; padding: 1.6rem 1.3rem; }
.bk-title { margin: 0 0 1.2rem; text-align: center; font: 400 2.6rem/1.1 "Waterfall", "Noto Serif", serif; }
.bk-source .bk-part { font: 1.45rem/1.38 "Waterfall", "Noto Serif", serif; }
.bk-source .bk-part + .bk-part { margin-top: 1.6rem; }
.bk-nav { display: flex; justify-content: center; gap: 1.4rem; padding: 2rem 0 0; font: .8rem/1.4 system-ui, sans-serif; }
.bk .bk-nav a { color: rgb(217 205 178 / .55); text-decoration: none; }

/* Chữ: dùng chung */
.bk p { margin: 0 0 .35em; text-indent: 1.1em; }
.bk h2 { margin: .1em 0 .1em; font: 400 1.3em/1.15 "Waterfall", "Noto Serif", serif; text-align: center; }
.bk .bk-src { text-indent: 0; text-align: center; font-size: .8em; line-height: 1.25; margin-bottom: .7em; opacity: .85; }
.bk .bk-binh { margin: .6em 0 0 1.2em; text-indent: 0; }
.bk blockquote { margin: .3em .8em .5em; padding: 0; }
.bk blockquote p { text-indent: 0; }
.bk blockquote em { font-style: normal; }
.bk .bk-cont { text-indent: 0; }
.bk-seal { margin: .2em 0 0 2.4em; height: 46px; }
.bk-seal svg { height: 46px; width: 46px; }

/* ======================================================================
   Bản lật trang (script đã chạy: html.bk-paged)
   ====================================================================== */
html.bk-paged, html.bk-paged body { height: 100%; overflow: hidden; }
html.bk-paged .bk { max-width: none; padding: 0; }
html.bk-paged .bk-source { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
html.bk-paged .bk > .bk-nav { display: none; }

.bk-desk { position: fixed; inset: 0; touch-action: pinch-zoom; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
/* khổ cố định: cả cuốn thu/phóng theo --bk-k (brushnotes.js), quanh mép trên ở giữa */
.bk-book { position: absolute; left: 50%; top: max(8px, calc((100dvh - var(--bk-sh, var(--bk-ph)) - 40px) / 2)); width: var(--bk-pw); height: var(--bk-ph); margin-left: calc(var(--bk-pw) / -2); perspective: 2400px; scale: var(--bk-k, 1); transform-origin: 50% 0; transition: transform .9s cubic-bezier(.45, .05, .2, 1); }
.bk-desk.two .bk-book { width: calc(var(--bk-pw) * 2); margin-left: calc(var(--bk-pw) * -1); }
.bk-leaf { position: absolute; top: 0; left: 0; width: var(--bk-pw); height: var(--bk-ph); transform-origin: left center; transform-style: preserve-3d; transition: transform .9s cubic-bezier(.45, .05, .2, 1); }
.bk-desk.two .bk-leaf { left: var(--bk-pw); }
.bk-leaf.flipped { transform: rotateY(-180deg); }
.bk-leaf.no-anim, .bk-book.no-anim { transition: none; }
.bk-leaf[hidden] { display: none; }
.bk-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.bk-face.back { transform: rotateY(180deg); }
/* mặt úp không nhận chạm (bài học từ khuôn notebook) */
.bk-leaf:not(.flipped) > .back, .bk-leaf.flipped > .front { pointer-events: none; }

/* ---- Trang giấy ---- */
.bk-pg { position: absolute; inset: 0; filter: drop-shadow(0 5px 10px rgb(0 0 0 / .45)); }
.bk-pg-in { position: absolute; inset: 0; overflow: hidden; }
.bk-paper { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 45%, transparent 50%, rgb(120 80 30 / .26) 100%), #dccaa0; }
/* góc lật trang: chỗ ngón tay lật nhiều năm, sờn và sẫm */
.bk-paper::after { content: ""; position: absolute; width: 90px; height: 90px; bottom: 0; right: 0; background: radial-gradient(circle at 100% 100%, rgb(90 60 28 / .32), rgb(90 60 28 / .12) 45%, transparent 72%); }
.side-l .bk-paper::after { right: auto; left: 0; background: radial-gradient(circle at 0 100%, rgb(90 60 28 / .32), rgb(90 60 28 / .12) 45%, transparent 72%); }
/* bóng gáy */
.bk-paper::before { content: ""; position: absolute; inset: 0; background: linear-gradient(to right, rgb(70 48 24 / .3), transparent 34px); }
.side-l .bk-paper::before { background: linear-gradient(to left, rgb(70 48 24 / .3), transparent 34px); }
.bk-fox { position: absolute; inset: 0; mix-blend-mode: multiply; opacity: .2; background-image: url("/theme/img/wear/fox-spots.webp"), url("/theme/img/wear/fox-blotch.webp"); background-size: 384px 384px, 512px 512px; }
.bk-age { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.bk-spine { position: absolute; top: 0; bottom: 0; left: 0; width: 22px; background-repeat: no-repeat; }
.side-l .bk-spine { left: auto; right: 0; transform: scaleX(-1); }
/* khung kẻ lề mờ */
.bk-rule { position: absolute; top: 26px; bottom: 24px; left: 30px; right: 20px; border: 1px solid rgb(110 70 40 / .16); outline: 1px solid rgb(110 70 40 / .08); outline-offset: 3px; pointer-events: none; }
.side-l .bk-rule { left: 20px; right: 30px; }
.bk-body {
  position: absolute; top: 34px; bottom: 30px; left: 38px; right: 28px; overflow: hidden;
  font: var(--bk-fs) / 1.38 "Waterfall", "Noto Serif", serif; color: var(--fx-ink);
  -webkit-text-stroke: calc(var(--bk-fs) * .018) currentColor; paint-order: stroke fill;
}
.side-l .bk-body { left: 28px; right: 38px; }
.bk-body .bk-seal svg { -webkit-text-stroke: 0; }

/* bìa */
.bk-cover .bk-paper { background: radial-gradient(ellipse at 35% 30%, #5b4430, #3a2a1c 80%); }
.bk-cover .bk-paper::after, .bk-cover .bk-rule { display: none; }
.bk-slip { position: absolute; top: 9%; left: 44px; width: 70px; padding: 14px 0 16px; display: flex; flex-direction: column; align-items: center; background: #d9c69b; box-shadow: 0 1px 3px rgb(0 0 0 / .4); color: #2a1d10; font: 400 30px/1.05 "Waterfall", "Noto Serif", serif; -webkit-text-stroke: .8px currentColor; rotate: -.5deg; }
.bk-slip span { display: block; }
.bk-endpaper .bk-body { display: none; }

/* Đầu và cuối sách: link nhỏ dưới mặt bàn */
.bk-end { position: fixed; left: 0; right: 0; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); opacity: 0; pointer-events: none; transition: opacity .6s .3s; }
.bk-desk.at-start .bk-end, .bk-desk.at-end .bk-end { opacity: 1; pointer-events: auto; }
.bk-end .bk-nav { padding: 0; }

/* Bản quyền: chỉ hiện khi đã gấp sách lại ở cuối */
.page-brushnotes .site-copy { color: rgb(217 205 178); }
html.bk-paged .page-brushnotes .site-copy { display: none; }
html.bk-paged .page-brushnotes:has(.bk-desk.at-end) .site-copy {
  display: block; position: fixed; left: 0; right: 0;
  bottom: calc(30px + env(safe-area-inset-bottom, 0px)); padding: 0; opacity: .3;
}

@media (prefers-reduced-motion: reduce) {
  .bk-leaf, .bk-book, .bk-end { transition: none; }
}

/* chest.css */
/* Khuôn hòm sắc (chest): hòm ở đình làng, mở nắp, chạm từng món giấy. Không script.
   Mở nắp: ô đánh dấu #ch-open. Mở giấy: thuộc tính popover. Lật mặt sau lá đơn: ô đánh dấu #ch-flip.
   Mọi lớp có tiền tố ch- (CSS các khuôn gộp chung một file). */

html body.page-chest {
  background: #140e0a radial-gradient(90% 60% at 50% 30%, #3a2416 0%, #1a110b 60%, #0f0a07 100%) fixed;
  color: #e7d6b3;
}
.page-chest .site-copy { color: rgb(217 205 178); opacity: .3; }

.ch { max-width: 440px; margin: 0 auto; padding: 1.6rem 1rem 1rem; }
.ch-title {
  margin: 0 0 .4rem; text-align: center; font: 400 1.9rem/1.2 "Kolker Brush", serif;
  color: #d9c79f; letter-spacing: .02em;
}
.ch-openbox, .ch-flipbox { position: absolute; opacity: 0; pointer-events: none; }

/* ---- sân khấu: hòm và các món bên trong ---- */
.ch-stage { position: relative; height: 380px; perspective: 900px; }
.ch-chest { position: absolute; left: 50%; bottom: 40px; width: 300px; height: 230px; translate: -50% 0; }

/* lòng hòm: mặt trên nhìn chéo xuống, lót vải đỏ sẫm (chỉ thấy khi mở nắp) */
.ch-inside {
  position: absolute; left: 0; right: 0; bottom: 140px; height: 74px;
  background: #2a0f0b; clip-path: polygon(6% 0, 94% 0, 100% 100%, 0 100%);
}
.ch-cloth {
  position: absolute; inset: 8px 22px 6px;
  background: radial-gradient(120% 90% at 50% 0%, #7c1d17 0%, #5a130f 60%, #3d0c09 100%);
  clip-path: polygon(4% 0, 96% 0, 100% 100%, 0 100%);
  box-shadow: inset 0 6px 14px rgb(0 0 0 / .55);
}

/* thành trước: gỗ sơn son đã bong, viền thếp vàng mòn, khóa đồng */
.ch-front-wall {
  position: absolute; left: 0; right: 0; bottom: 0; height: 140px; border-radius: 3px;
  background:
    radial-gradient(14px 9px at 18% 72%, #6a4a2c 60%, transparent 70%),
    radial-gradient(22px 7px at 76% 30%, #6e4d2e 55%, transparent 70%),
    radial-gradient(9px 12px at 61% 84%, #5e4127 60%, transparent 72%),
    radial-gradient(40px 14px at 36% 12%, rgb(255 210 160 / .08), transparent 70%),
    linear-gradient(180deg, #8c2418 0%, #74190f 45%, #5b130c 100%);
  box-shadow: inset 0 0 0 5px #5a120b, inset 0 0 0 7px rgb(201 162 74 / .55), inset 0 0 0 12px #6d170e,
              inset 0 -18px 30px rgb(0 0 0 / .45), 0 18px 28px rgb(0 0 0 / .6);
}
.ch-front-wall::after {
  content: ""; position: absolute; inset: 22px 30px; border: 1.5px solid rgb(201 162 74 / .45); border-radius: 2px;
}
.ch-lock {
  position: absolute; left: 50%; top: 10px; width: 34px; height: 40px; translate: -50% 0; z-index: 1; border-radius: 4px 4px 14px 14px;
  background: radial-gradient(circle at 50% 56%, #2b1d0e 0 4px, transparent 5px),
    linear-gradient(160deg, #d8b25c, #9a742f 55%, #6e5020);
  box-shadow: 0 2px 3px rgb(0 0 0 / .5), inset 0 1px 0 rgb(255 240 200 / .5);
}

/* nắp hòm: mặt trên (hình thang) + mép trước. Mở: lật ra sau và lên trên */
.ch-lid {
  position: absolute; left: -4px; right: -4px; bottom: 132px; height: 92px; cursor: pointer; z-index: 3;
  transform-origin: 50% 0%; transition: transform .9s cubic-bezier(.5, 0, .2, 1), filter .9s;
  -webkit-tap-highlight-color: transparent;
}
.ch-lid-top {
  position: absolute; left: 0; right: 0; top: 0; height: 60px;
  background: linear-gradient(180deg, #6b170f, #8a2417 70%, #962a1b);
  clip-path: polygon(7% 0, 93% 0, 100% 100%, 0 100%);
  box-shadow: inset 0 0 0 4px rgb(201 162 74 / .35);
}
.ch-lid-face {
  position: absolute; left: 0; right: 0; top: 58px; height: 34px; border-radius: 2px;
  background: radial-gradient(18px 6px at 70% 50%, #6a4a2c 55%, transparent 70%), linear-gradient(180deg, #8f2618, #6a160d);
  box-shadow: inset 0 0 0 3px rgb(201 162 74 / .5), 0 4px 8px rgb(0 0 0 / .5);
}
.ch-openbox:checked ~ .ch-stage .ch-lid { transform: translateY(-58px) rotateX(78deg); filter: brightness(.55); pointer-events: none; }

/* các món trong hòm: ẩn khi nắp đóng, nhô lên khi mở */
.ch-items { position: absolute; left: 50%; bottom: 166px; width: 280px; height: 120px; translate: -50% 0; z-index: 2; pointer-events: none; }
.ch-item {
  position: absolute; border: 0; padding: 0; background: none; cursor: pointer; opacity: 0; translate: 0 30px;
  transition: opacity .6s .5s, translate .8s .5s cubic-bezier(.2, .7, .2, 1);
  -webkit-tap-highlight-color: transparent;
}
.ch-openbox:checked ~ .ch-stage .ch-items { pointer-events: auto; }
.ch-openbox:checked ~ .ch-stage .ch-item { opacity: 1; translate: 0 0; }
.ch-item:focus-visible { outline: 2px solid #c9a24a; outline-offset: 4px; }

/* đạo sắc cuộn tròn, buộc dây đỏ */
.ch-item-sac { left: 14px; top: 34px; width: 220px; height: 36px; rotate: -4deg; }
.ch-roll {
  position: absolute; inset: 0; border-radius: 6px;
  background:
    linear-gradient(90deg, transparent 47%, #8e1b12 47% 53%, transparent 53%),
    linear-gradient(180deg, #f6e29a 0%, #e5c562 30%, #c99a35 62%, #a97a22 80%, #d9b55a 100%);
  box-shadow: 0 6px 10px rgb(0 0 0 / .55);
}
.ch-roll::before, .ch-roll::after {
  content: ""; position: absolute; top: 0; width: 12px; height: 36px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #8a6420 0 3px, #c79b45 4px, #e7cb7b 70%);
}
.ch-roll::before { left: -5px; } .ch-roll::after { right: -5px; }

/* lá đơn gấp tư, nhét lệch một góc */
.ch-item-don { right: 4px; top: 6px; width: 104px; height: 78px; rotate: 9deg; }
.ch-fold {
  position: absolute; inset: 0; border-radius: 2px;
  background:
    linear-gradient(90deg, transparent 49%, rgb(80 55 25 / .35) 50%, rgb(255 245 220 / .25) 51%, transparent 53%),
    url("/theme/img/wear/fox-blotch.webp") 30% 40% / 180px,
    linear-gradient(160deg, #d9c9a2, #bfa978);
  background-blend-mode: normal, multiply, normal;
  box-shadow: inset 0 0 10px rgb(90 60 25 / .45), 0 5px 9px rgb(0 0 0 / .55);
}

.ch-hint {
  position: absolute; left: 0; right: 0; bottom: 6px; text-align: center; cursor: pointer;
  font: .8rem/1.4 system-ui, sans-serif; color: rgb(217 205 178 / .5);
  animation: ch-breathe 3s ease-in-out infinite;
}
.ch-openbox:checked ~ .ch-stage .ch-hint { opacity: 0; pointer-events: none; animation: none; }
@keyframes ch-breathe { 50% { color: rgb(217 205 178 / .85); } }

/* ---- các tờ giấy mở ra (popover) ---- */
.ch-doc[popover] {
  inset: 0; margin: auto; width: min(94vw, 380px); max-height: 92dvh; overflow: auto; overscroll-behavior: contain;
  border: 0; padding: 0; background: transparent; color: inherit; touch-action: pan-y pinch-zoom;
}
.ch-doc::backdrop { background: rgb(10 6 4 / .8); }
.ch-close {
  position: sticky; top: 0; float: right; z-index: 5; width: 40px; height: 40px; margin: 0 0 -40px;
  border: 0; border-radius: 50%; background: rgb(20 12 8 / .55); color: #e7d6b3; font: 24px/1 system-ui, sans-serif; cursor: pointer;
}
.ch-sheet { position: relative; }
.ch-text p { margin: 0 0 .7em; }

/* trình duyệt không hỗ trợ popover: các tờ hiện sẵn dưới hòm, đọc bình thường */
.ch-docs .ch-doc:not([popover]) { margin: 1.4rem auto; }

/* đạo sắc: giấy nhuộm vàng, vân mây thếp vàng ở viền, vân mây mờ khắp mặt, chữ trang trọng, gần như nguyên vẹn */
.ch-sac-sheet {
  padding: 34px 30px 30px; color: #a52416; /* văn bản Thiên Đình viết bằng mực son chu sa, khác giấy tờ nhân gian */
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='64' viewBox='0 0 44 22'%3E%3Cg fill='none' stroke='%239a6a18' stroke-opacity='.16' stroke-width='1.2' stroke-linecap='round'%3E%3Cpath d='M4 16c-3-4 1-9 6-7 1-5 8-6 10-1 3-3 9-1 8 4 4 0 5 5 1 6H6c-1 0-2-1-2-2z'/%3E%3Cpath d='M12 13c1-2 4-2 4 0s-2 2-3 1M22 12c1-2 4-2 4 0'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 120px 64px,
    radial-gradient(120% 80% at 30% 20%, #f1d983 0%, #e8c766 45%, #d9b14f 100%);
  box-shadow: 0 10px 30px rgb(0 0 0 / .6), inset 0 0 40px rgb(150 100 20 / .25);
}
.ch-band { position: absolute; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='22' viewBox='0 0 44 22'%3E%3Cg fill='none' stroke='%23a8701c' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='M4 16c-3-4 1-9 6-7 1-5 8-6 10-1 3-3 9-1 8 4 4 0 5 5 1 6H6c-1 0-2-1-2-2z'/%3E%3Cpath d='M12 13c1-2 4-2 4 0s-2 2-3 1M22 12c1-2 4-2 4 0'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 44px 22px; opacity: .9; }
.ch-band-t, .ch-band-b { left: 8px; right: 8px; height: 22px; background-repeat: repeat-x; }
.ch-band-t { top: 6px; } .ch-band-b { bottom: 6px; rotate: 180deg; }
.ch-band-l, .ch-band-r { top: 30px; bottom: 30px; width: 22px; background-size: 22px 11px; background-repeat: repeat-y; }
.ch-band-l { left: 6px; } .ch-band-r { right: 6px; }
.ch-sac .ch-text {
  position: relative; border: 3px double #a3301f; padding: 16px 14px 12px;
  font: 600 1.08rem/1.6 "Cormorant SC", serif; letter-spacing: .01em; text-align: justify; hyphens: none;
}
.ch-sac .ch-text p:first-child { text-align: center; font-size: 1.16em; }
.ch-sac .ch-text p.ch-kham { text-align: right; font-size: 1.5em; margin: .5em 0 .2em; }
.ch-sac .ch-text p.ch-date { text-align: right; font-size: .92em; }
.ch-seal { margin: -4.6rem 1rem 0 auto; width: 104px; color: #7e170e; opacity: .85; mix-blend-mode: multiply; }
.ch-seal .stamp { display: block; width: 100%; height: auto; }
.ch-seal .stamp-wear { fill: #e2bf5f; }

/* lá đơn: giấy dó cũ, gấp tư, ố, mọt; lật xem mặt sau */
.ch-card { display: grid; transition: transform .8s cubic-bezier(.4, 0, .2, 1); transform-style: preserve-3d; }
.ch-face { grid-area: 1 / 1; backface-visibility: hidden; }
.ch-back { transform: rotateY(180deg); }
.ch-flipbox:checked ~ .ch-card { transform: rotateY(180deg); }
.ch-don .ch-sheet {
  padding: 30px 26px 26px; color: #2a2016;
  background:
    linear-gradient(90deg, transparent calc(50% - 1px), rgb(70 45 20 / .28) 50%, rgb(255 245 220 / .3) calc(50% + 1px), transparent calc(50% + 3px)),
    linear-gradient(180deg, transparent calc(50% - 1px), rgb(70 45 20 / .28) 50%, rgb(255 245 220 / .3) calc(50% + 1px), transparent calc(50% + 3px)),
    radial-gradient(130% 100% at 50% 50%, transparent 55%, rgb(110 70 25 / .45) 100%),
    url("/theme/img/wear/fox-blotch.webp") 20% 30% / 420px,
    linear-gradient(170deg, #ddcda6, #c9b386 70%, #bba272);
  background-blend-mode: normal, normal, normal, multiply, normal;
  box-shadow: 0 10px 30px rgb(0 0 0 / .6);
  /* mọt và chỗ mục: khoét thủng giấy (thấy nền tối) */
  -webkit-mask: radial-gradient(circle at 12% 7%, transparent 5px, #000 6px), radial-gradient(circle at 14% 8.4%, transparent 3px, #000 4px),
    radial-gradient(circle at 51% 49%, transparent 4px, #000 5px), radial-gradient(circle at 88% 63%, transparent 6px, #000 7px),
    radial-gradient(circle at 90% 64.5%, transparent 3px, #000 4px), radial-gradient(circle at 23% 93%, transparent 5px, #000 6px),
    radial-gradient(14px 10px at 100% 21%, transparent 90%, #000 100%), radial-gradient(18px 12px at 0% 77%, transparent 90%, #000 100%);
  -webkit-mask-composite: source-in; mask-composite: intersect;
}
.ch-front .ch-text { font: 400 1.32rem/1.42 "Moon Dance", cursive; }
.ch-front .ch-text p:first-child { margin-top: .3em; }
.ch-front s { text-decoration-thickness: 1.5px; text-decoration-color: rgb(42 32 22 / .85); }
.ch-front .ch-sign { margin-top: 1em; }
.ch-back.ch-sheet { background-position: 0 0, 0 0, 0 0, 70% 60%, 0 0; filter: brightness(.94) sepia(.15); }
.ch-back .ch-text { padding-top: 30%; font: 400 1.42rem/1.5 "Ole", cursive; color: #2e2418; rotate: -2deg; }
.ch-thumbs { display: flex; flex-wrap: wrap; gap: 2px 6px; margin: .2em 0 .6em; color: #a3261b; }
.ch-thumbs svg { width: 28px; height: 35px; mix-blend-mode: multiply; }
.ch-fliptab {
  display: block; margin: .8rem auto 0; width: max-content; padding: .45rem 1rem; border-radius: 99px; cursor: pointer;
  font: .8rem/1.4 system-ui, sans-serif; color: #e7d6b3; background: rgb(255 240 210 / .1);
}
.ch-to-front, .ch-flipbox:checked ~ .ch-fliptab .ch-to-back { display: none; }
.ch-flipbox:checked ~ .ch-fliptab .ch-to-front { display: inline; }

.ch-nav { display: flex; justify-content: center; gap: 1.4rem; padding: .4rem 0 0; font: .8rem/1.4 system-ui, sans-serif; }
.ch .ch-nav a { color: rgb(217 205 178 / .55); text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  .ch-lid, .ch-item, .ch-card { transition: none; }
  .ch-hint { animation: none; }
}

/* cultivation.css */
/* Tu Tiên: giấy lụa cổ.
   --paper-* là chất liệu của thế giới, dùng cho nền trang thường và cho từng tờ ở khuôn manuscript. */
.world-cultivation {
  --accent: #7fb59a;
  --silk: #e6dbc1;
  --silk-edge: #b9a57e;
  --ink: #2b2219;
  --ink-soft: #5a4a38;
  --seal: #8a3a2b;

  --paper-color: var(--silk);
  --paper-ink: #3a2d20; /* mực nâu đen đã phai */
  --paper-image:
    radial-gradient(ellipse at 30% 20%, rgb(150 110 60 / .10), transparent 45%),
    radial-gradient(ellipse at 75% 85%, rgb(140 100 50 / .12), transparent 50%),
    radial-gradient(ellipse at 50% 45%, transparent 60%, color-mix(in srgb, var(--silk-edge) 45%, transparent) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9 .05' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .27 0 0 0 0 .16 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");

  color-scheme: light;
  color: var(--ink);
  background-color: var(--paper-color);
  background-image: var(--paper-image);
}
.world-cultivation a { color: var(--seal); }

/* dossier.css */
/* Khuôn dossier: tập giấy tờ quan. Bài đầu: Cáo Thị Huyện Bình Giang — các tờ trát huyện viết thừa,
   thư lại già giữ lại, dùi lỗ mép trên xâu lạt; lật tờ lên quanh mép trên.
   Một người viết thì một phông. Phông khai theo bài ở front matter (hands:, xem theme/lib/hands.js), thành biến
   --ds-h-main, --ds-h-margin, --ds-h-phe, --ds-h-petition, --ds-h-note, --ds-h-late. Biến riêng mang tiền tố --ds-.
   Lưu ý: file đứng trước cultivation.css khi gộp, nên body và link viết cụ thể hơn một bậc. */

html body.page-dossier {
  color-scheme: dark;
  background-color: #1d1915;
  background-image: radial-gradient(ellipse at 50% 30%, #2b251e, #16120e 75%);
  background-attachment: fixed;
  color: #d9cdb2;
  overflow-x: clip;
}

/* ======================================================================
   Bản gốc (không có script): các tờ xếp dọc
   ====================================================================== */
.ds { --ds-paper: #ecdfc0; --ds-ink: #1d1610; --ds-son: #b3362a; max-width: 32rem; margin: 0 auto; padding: 2rem .7rem 4rem; }
.ds-title { margin: 0 0 .4rem; text-align: center; font: 400 2.4rem/1.1 var(--ds-h-main, "Carattere"), "Noto Serif", serif; }
.ds-slip { list-style: none; margin: 0 0 1.4rem; padding: 0; text-align: center; font: 400 1.2rem/1.3 var(--ds-h-main, "Carattere"), "Noto Serif", serif; opacity: .8; }
.ds-source .ds-sheet { position: relative; background: var(--ds-paper); color: var(--ds-ink); padding: 1.4rem 1.2rem 1.6rem; margin-bottom: 1.2rem; font-size: 1.6rem; }
.ds-source .ds-sheet.k-petition { background: #d8c9a3; width: 88%; margin-left: auto; margin-right: auto; }
.ds-source .ds-sheet.k-back { background: #c8b287; }
.ds-nav { display: flex; justify-content: center; gap: 1.4rem; padding: 2rem 0 0; font: .8rem/1.4 system-ui, sans-serif; }
.ds .ds-nav a { color: rgb(217 205 178 / .55); text-decoration: none; }

/* ---------- Chữ: dùng chung cho bản gốc và bản lật ---------- */
.ds-sheet { font-family: var(--ds-h-main, "Carattere"), "Noto Serif", serif; line-height: 1.32; }
.ds-sheet .ds-margin { font-family: var(--ds-h-margin, "Carattere"), "Noto Serif", serif; }
.ds-sheet p { margin: 0 0 .28em; text-indent: 1.2em; }
/* chữ trát: căn đều hai bên cho ra giấy quan; ghi chú bên lề và lá đơn để lệch như viết tay */
.ds-sheet.k-notice > p:not(.ds-margin, .ds-label, .ds-late, .ds-phe, .ds-lines, .ds-indent) { text-align: justify; }
.ds-sheet .ds-label { float: right; margin: 0 0 .3em .6em; text-indent: 0; font-size: .62em; line-height: 1.2; opacity: .75; }
/* ghi chú công vụ: lúc mới nhận tờ, viết ngay ngắn, mực đen */
.ds-sheet .ds-m-cong { text-indent: 0; font-size: .66em; line-height: 1.25; color: #2b2622; opacity: .9; margin: 0 0 .7em; }
/* ghi chú riêng: viết sau, nhỏ hơn, mực nâu nhạt, chen vào lề dưới */
.ds-sheet .ds-m-tu, .ds-sheet .ds-m-run { text-indent: 0; font-size: .72em; line-height: 1.24; color: #5e4127; margin: .55em 0 0 1.4em; rotate: -.6deg; }
.ds-sheet .ds-m-run { color: #6a4a2d; rotate: -1.3deg; }
/* "Tuân cứ.": viết to, lùi sang phải, ấn đóng đè lên */
.ds-sheet p:has(+ .ds-seals:not(.at-top)) { text-indent: 0; margin: .4em 0 0 46%; font-size: 1.3em; }
.ds-seals { display: flex; justify-content: flex-end; align-items: center; gap: .5em; margin: -2.4em .2em .2em 0; pointer-events: none; }
.ds-seals.at-top { margin: 0 0 .35em -.1em; justify-content: flex-start; }
.ds-seal { display: block; color: var(--ds-son); mix-blend-mode: multiply; }
/* lớp ấn đặt tên "stamp": tên "seal" đã có ở mục lục Ma Pháp (dấu sáp) */
.ds-seal .stamp { display: block; width: 100%; height: auto; }
.ds-seal .stamp-wear { fill: var(--ds-paper); }
.ds-seal-huyen { width: 3.2em; }
.ds-seal-tu-phu { width: 2.7em; }
.ds-seal-son-phu { width: 2.9em; }
.ds-seal-dia-phu { width: 2.9em; }
.ds-seal-trieu-dinh { width: 3.9em; }
.at-top .ds-seal-son-phu { width: 2.5em; }
/* lá đơn: lý trưởng viết hộ, chữ xấu */
.ds-sheet.k-petition { font-family: var(--ds-h-petition, "Carattere"), "Noto Serif", serif; line-height: 1.18; }
.ds-sheet.k-petition p { font-size: 1.08em; }
.ds-sheet.k-petition .ds-margin { font-size: .7em; }
/* lời phê son của tri huyện */
.ds-sheet .ds-phe { font: 400 3em/1 var(--ds-h-phe, "Carattere"), "Noto Serif", serif; color: var(--ds-son); text-indent: 0; margin: .15em 0 .2em 28%; rotate: -7deg; mix-blend-mode: multiply; }
/* ---- sổ, danh sách (Sổ Vọng Khí) ---- */
.ds-sheet .ds-lines { text-indent: 0; line-height: 1.3; margin-bottom: .5em; }
.ds-sheet .ds-entry { position: relative; text-indent: 0; padding-left: .9em; margin: .3em 0; }
.ds-sheet .ds-indent { text-indent: 0; padding-left: 2.4em; margin-top: -.15em; }
.ds .ink { position: absolute; fill: none; stroke: var(--ds-son); stroke-linecap: round; stroke-linejoin: round; pointer-events: none; mix-blend-mode: multiply; overflow: visible; }
.ds .ink path { vector-effect: non-scaling-stroke; }
.ds .ink.dot { left: .22em; top: .42em; width: .5em; height: .5em; fill: var(--ds-son); stroke: none; }
/* vệt mạt quệt ngang dòng đầu của mục (chỗ có số và tên) */
.ds .ink.strike { left: .2em; top: 0; width: calc(100% - .1em); height: 1.32em; }
.ds-ring { position: relative; white-space: nowrap; }
.ds .ink.ring { left: -.4em; top: -.12em; width: calc(100% + .8em); height: calc(100% + .3em); }
/* nét lạ ghi thêm rất lâu về sau: mực xanh đen, sát lề phải, ngang dòng ghi thêm ở trên */
.ds-sheet .ds-late { font-family: var(--ds-h-late, "Carattere"), "Noto Serif", serif; color: #1f2c55; text-indent: 0; text-align: right;
  font-size: .76em; margin: -1.7em .2em .9em 0; rotate: -3deg; }
/* ghi chú của người thứ hai (thư lại sao gửi…) */
.ds-sheet .ds-m-note { font-family: var(--ds-h-note, "Carattere"), "Noto Serif", serif; text-indent: 0; font-size: .58em; line-height: 1.35; color: #2b2622; margin: .4em 0 0; }
/* lời phê dài: nhỏ lại, nghiêng ít hơn */
.ds-sheet .ds-phe.long { font-size: 1.45em; line-height: 1.15; margin: .5em 0 .45em 3%; rotate: -3deg; }
/* lời phê vừa (ba bốn chữ) */
.ds-sheet .ds-phe.mid { font-size: 2em; line-height: 1.1; margin: .4em 0 .3em 12%; rotate: -5deg; }
/* chấm son trong dòng (đầu một mục) */
.ds-dot { position: relative; display: inline-block; width: .5em; height: .5em; margin-right: .3em; vertical-align: .05em; }
.ds .ds-dot .ink.dot { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
/* giấy kẻ ô sẵn bằng mực nhạt */
.ds.ruled .ds-paper::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .22;
  background-image: repeating-linear-gradient(to bottom, transparent 0 calc(1.32em - 1px), #8c7a5a calc(1.32em - 1px) 1.32em),
                    repeating-linear-gradient(to right, transparent 0 calc(25% - 1px), #8c7a5a calc(25% - 1px) 25%); }

/* ---- Bảng (sổ kê): kẻ ô mực nhạt, số thẳng cột ---- */
.ds-scroll { container-type: inline-size; }
.ds-table { margin: .35em 0 .6em; }
.ds-sheet table { border-collapse: collapse; width: 100%; font-size: .74em; line-height: 1.2; }
.ds-sheet th, .ds-sheet td { border: 1px solid rgb(120 100 70 / .38); padding: .18em .3em; text-align: left; vertical-align: top; font-weight: 400; }
.ds-sheet th { color: #4a3f33; }
.ds-sheet td.num, .ds-sheet th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ds-sheet tr.sub { display: none; }
/* màn hình hẹp: cột chữ dài xuống thành dòng riêng dưới mỗi hàng */
@container (max-width: 520px) {
  .ds-sheet table.has-long .long { display: none; }
  .ds-sheet table.has-long tr.sub { display: table-row; }
  .ds-sheet tr.sub td { border-top: 0; color: #4a3f33; font-size: .92em; padding-left: 1.2em; }
}

/* ấn ở góc trên bên phải */
.ds-seals.at-corner { float: right; margin: -.3em -.3em .2em .5em; }
.at-corner .ds-seal-tu-phu, .at-corner .ds-seal-dia-phu { width: 3em; }
/* tờ có ấn ở góc: số tờ đứng riêng một dòng trên cùng, để ấn và dòng đề không chen nhau */
.ds-sheet:has(.at-corner) .ds-label { float: none; text-align: right; margin: 0 0 .1em; }

/* mặt trong bìa sau */
.ds-sheet .ds-backnote { text-indent: 0; font-size: .8em; color: #3f2b17; }

/* ======================================================================
   Bản lật (script đã chạy: html.ds-paged)
   ====================================================================== */
html.ds-paged, html.ds-paged body { height: 100%; overflow: hidden; }
html.ds-paged .ds { max-width: none; padding: 0; }
html.ds-paged .ds-source, html.ds-paged .ds > .ds-nav { display: none; }

.ds-desk { position: fixed; inset: 0; touch-action: pinch-zoom; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.ds-stack { position: absolute; left: 50%; top: 8px; width: var(--ds-w); height: var(--ds-h); margin-left: calc(var(--ds-w) / -2); perspective: 1600px; }
.ds-leaf {
  position: absolute; inset: 0; transform-origin: 50% 0; backface-visibility: hidden;
  transition: transform .75s cubic-bezier(.45, .05, .3, 1), opacity .2s linear .55s;
  font-size: calc(var(--ds-fs) * var(--ds-scale-main, 1)); color: var(--ds-ink);
}
.ds-leaf.no-anim { transition: none; }
.ds-leaf.up { transform: rotateX(178deg); opacity: 0; }
.ds-leaf.gone { visibility: hidden; }
/* tờ bên dưới ló mép ra một chút */
.ds-leaf.below { transform: translateY(calc(var(--k) * 3px)) rotate(calc(var(--k) * .25deg)); }
.ds-leaf.below .ds-scroll, .ds-leaf.below .ds-more { visibility: hidden; }

.ds-paper { position: absolute; inset: 0; background: var(--ds-paper); overflow: hidden;
  box-shadow: inset 0 0 22px rgb(120 84 40 / .28), inset 0 0 3px rgb(90 60 30 / .35); }
/* lớp đốm ố: tờ càng nằm dưới, càng ố */
.ds-fox { position: absolute; inset: 0; opacity: .18; mix-blend-mode: multiply;
  background-image: url("/theme/img/wear/fox-spots.webp"), url("/theme/img/wear/fox-blotch.webp");
  background-size: 384px, 512px; }
.ds-tint { position: absolute; inset: 0; background: #b08a4a; opacity: calc(var(--age, 0) * .16); mix-blend-mode: multiply; pointer-events: none; }
/* vùng chữ bắt đầu dưới chỗ xâu lạt: cuộn thì chữ không lấn vào lỗ lạt */
.ds-scroll { position: absolute; inset: 38px 0 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y pinch-zoom;
  padding: 6px 20px 34px; scrollbar-width: none; }
.ds-scroll::-webkit-scrollbar { display: none; }
.ds-leaf .ds-sheet { position: relative; }
/* còn chữ bên dưới: mép dưới tối dần (gợi ý cuộn) */
.ds-more { position: absolute; left: 0; right: 0; bottom: 0; height: 46px; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: linear-gradient(to bottom, transparent, rgb(120 90 50 / .3)); }
.ds-leaf.more .ds-more { opacity: 1; }

/* tờ rời không xâu lạt (binding: none): chữ bắt đầu sát mép trên; chừa chỗ dưới cho dòng bản quyền */
.ds-desk.unbound .ds-scroll { inset: 0; padding-top: 26px; }

/* giấy công văn (paper: congvan): dày, trắng, ít ố */
.ds.paper-congvan { --ds-paper: #f3efe3; }
.ds.paper-congvan .ds-paper { box-shadow: inset 0 0 14px rgb(120 100 70 / .16), inset 0 0 2px rgb(90 70 40 / .25); }
.ds.paper-congvan .ds-tint { display: none; }

/* giấy công văn đã cũ (paper: congvan-cu): sáng hơn giấy dó nhưng ngả ngà, mép ngả vàng, mực và son phai.
   Mực mới ghi về sau (nét late) giữ màu tươi, nên nhìn vào là biết dòng nào mới. */
.ds.paper-congvan-cu { --ds-paper: #ece3cb; --ds-ink: #3b2f23; --ds-son: #a8443a; }
.ds.paper-congvan-cu .ds-paper { box-shadow: inset 0 0 34px rgb(150 110 50 / .32), inset 0 0 8px rgb(120 85 40 / .3), inset 0 0 2px rgb(90 65 35 / .35); }
.ds.paper-congvan-cu .ds-tint { opacity: .08; background: radial-gradient(ellipse at 50% 45%, transparent 55%, #9a7640 100%); mix-blend-mode: multiply; }
.ds.paper-congvan-cu .ds-seal, .ds.paper-congvan-cu .ink, .ds.paper-congvan-cu .ds-phe { opacity: .88; }

/* lá đơn: tờ nhỏ hơn, giấy xấu hơn, kẹp sau tờ thứ tư, không xâu lạt */
.ds-leaf.k-petition { inset: 46px 7% 40px; rotate: -1.2deg; }
.ds-leaf.k-petition .ds-paper { background: #d6c59c; box-shadow: inset 0 0 26px rgb(110 75 35 / .35); }
.ds-leaf.k-petition .ds-scroll { inset: 0; padding: 24px 16px 26px; }
.ds-leaf.k-petition .ds-fox { opacity: .3; }

/* bìa trước, mặt trong bìa sau: giấy dó dày */
.ds-leaf.k-cover .ds-paper, .ds-leaf.k-back .ds-paper { background: #b9a175;
  box-shadow: inset 0 0 30px rgb(70 45 20 / .45); }
.ds-leaf.k-back .ds-scroll { display: flex; flex-direction: column; justify-content: flex-end; padding-bottom: 54px; }
/* dải giấy dán dọc trên bìa: hẹp và cao, chữ đứng thẳng, mỗi chữ một dòng (như bìa Bút Ký).
   Dòng giữa (tên tập) viết to; dòng đầu và dòng cuối (huyện, năm) viết nhỏ. */
.ds-slipcard { position: absolute; top: 50px; right: 16%; padding: 14px 6px 16px; min-width: 2.7em; background: #ebdfc2; color: #2a1d10;
  box-shadow: 0 1px 3px rgb(0 0 0 / .35); rotate: .6deg; text-align: center;
  font: 400 var(--ds-fs)/1.05 var(--ds-h-main, "Carattere"), "Noto Serif", serif; }
.ds-slipcard span { display: block; }
.ds-slipcard .sm { font-size: .62em; line-height: 1.1; opacity: .85; }
.ds-slipcard .lg { font-size: 1.25em; }
.ds-slipcard .gap { height: .45em; }

/* lạt tre xâu qua hai lỗ ở mép trên */
.ds-lat { position: absolute; left: 0; top: 0; width: 100%; height: 30px; z-index: 900; pointer-events: none; overflow: visible; }

.ds-end { position: absolute; left: 0; right: 0; bottom: 6px; display: flex; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .6s; }
.ds-desk.at-end .ds-end { opacity: 1; pointer-events: auto; }
.ds-end .ds-nav { padding: 0; }
.ds-end .ds-nav a { color: rgb(217 205 178 / .6); text-decoration: none; }

/* dòng bản quyền: chỉ hiện khi đã lật hết */
.page-dossier .site-copy { color: rgb(217 205 178); }
html.ds-paged .page-dossier .site-copy { display: none; }
html.ds-paged .page-dossier:has(.ds-desk.at-end) .site-copy { display: block; position: fixed; left: 0; right: 0; bottom: 24px; margin: 0; padding: 0; line-height: 1.3; text-align: center; opacity: .45; }

@media (prefers-reduced-motion: reduce) { .ds-leaf { transition: none; } }

/* effects.css */
/* Hiệu ứng dùng chung (theme/js/effects/). Các khuôn tự quyết định lớp đốm ố, lớp vết…;
   ở đây chỉ có phần do chính hiệu ứng sinh ra. */

/* tremor: từng chữ lệch, nghiêng */
.fx-w { display: inline-block; transform: translateY(var(--y, 0)) rotate(var(--a, 0deg)); text-indent: 0; }

/* fonts.css */
/* Phông tự lưu (OFL, giấy phép trong assets/fonts). Trình duyệt chỉ tải khi trang dùng đến. */
@font-face {
  font-family: "Noto Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/theme/fonts/noto-serif-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Noto Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/theme/fonts/noto-serif-vietnamese-400-normal.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Kolker Brush";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/kolker-brush-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Kolker Brush";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/kolker-brush-vietnamese-400-normal.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
/* Alex Brush: nét người thủ thư Tàng Kinh Các (tên kệ, bản sao lục, lời phê) */
@font-face {
  font-family: "Alex Brush";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/alex-brush-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Alex Brush";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/alex-brush-vietnamese-400-normal.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Great Vibes";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/great-vibes-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Great Vibes";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/great-vibes-vietnamese-400-normal.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}

/* Các phông viết tay dùng font-display: block: trình duyệt chờ phông (tối đa ~3 giây) thay vì hiện phông
   dự phòng rồi đổi, vì chữ đổi phông làm nháy cả trang. Noto Serif vẫn dùng swap. */

/* ---- Khuôn sutra (kinh gấp). Ba phông này đã CẮT, chỉ giữ những chữ có trong bài … Kinh
   (content/vi/era-00/cultivation/realm-sutra.md). Thêm chữ mới vào các phần dưới đây thì phải cắt lại phông:
   Comforter Brush = lời kinh (verse) + tên kinh; Water Brush = lời chú "dam"; Hurricane = chữ "Ta." ---- */
@font-face {
  font-family: "Comforter Brush";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/comforter-brush-sutra-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Comforter Brush";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/comforter-brush-sutra-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Water Brush";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/water-brush-sutra-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Water Brush";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/water-brush-sutra-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Hurricane";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/hurricane-sutra-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

/* ---- Khuôn letters (sấp thư): nét chữ ông đồ. Charm, bản đầy đủ (không cắt) vì bài thư còn có thể sửa ---- */
@font-face {
  font-family: "Charm";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/charm-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Charm";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/charm-vietnamese-400-normal.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}

/* ---- Khuôn brushnotes (sách chép tay): nét chữ thư sinh. Waterfall, bản đầy đủ (không cắt) ---- */
@font-face {
  font-family: "Waterfall";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/waterfall-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Waterfall";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/waterfall-vietnamese-400-normal.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}

/* ---- Khuôn dossier (Cáo Thị): Carattere = chữ trát và ghi chú của thư lại già (một người viết);
   Square Peg = lá đơn lý trưởng viết hộ; Licorice (đã cắt chỉ còn chữ "Không chuẩn.") = lời phê son của tri huyện ---- */
@font-face {
  font-family: "Carattere";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/carattere-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Carattere";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/carattere-vietnamese-400-normal.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Square Peg";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/square-peg-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Square Peg";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/square-peg-vietnamese-400-normal.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Licorice";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/licorice-phe-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Licorice";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/licorice-phe-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}

/* ---- Sổ Vọng Khí (khuôn dossier): Italianno = vọng khí sứ; Dancing Script = thư lại Tử Phủ;
   Kings (cắt chỉ còn chữ lời phê) = Đại La phê son; Grape Nuts (cắt chỉ còn "Tán tu. Kim Đan.") = người Tử Phủ tra sổ ---- */
@font-face {
  font-family: "Italianno";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/italianno-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Italianno";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/italianno-vietnamese-400-normal.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Dancing Script";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/dancing-script-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Dancing Script";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/dancing-script-vietnamese-400-normal.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Kings";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/kings-phe-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Kings";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/kings-phe-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Grape Nuts";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/grape-nuts-late-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Grape Nuts";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/grape-nuts-late-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}

/* ---- Tổng Kê Linh Khí (khuôn dossier): Patrick Hand = ty Hộ Tịch Địa Phủ (chữ nhỏ, vuông, số thẳng cột);
   Vujahday Script (cắt chỉ còn "Giao Thái Sơn tự liệu.") = châu phê của Thiên Đình ---- */
@font-face {
  font-family: "Patrick Hand";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/patrick-hand-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Patrick Hand";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/patrick-hand-vietnamese-400-normal.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Vujahday Script";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/vujahday-phe-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Vujahday Script";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/vujahday-phe-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}

/* ---- Gia Phả Phan Thị (khuôn brushnotes, kiểu genealogy): mỗi người viết một phông.
   Cắt chỉ còn chữ của đúng người viết ấy (…-gp-…): sửa chữ của đời nào thì nhờ Claude cắt lại phông đời ấy.
   d2 Fuggles · d3 Mali · d4 Mynerve · d5 Inspiration · d6 Oooh Baby · d7 Pangolin · d8 Yomogi
   d9 Send Flowers · d10 Playpen Sans · c2 Caramel · c3 Sriracha · c4 Grechen Fuemen · nhà sư Itim
   (người Địa Phủ: Patrick Hand bản đầy đủ, cùng ty Hộ Tịch trong Tổng Kê) ---- */
@font-face {
  font-family: "Fuggles";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/fuggles-gp-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Fuggles";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/fuggles-gp-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Mali";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/mali-gp-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Mali";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/mali-gp-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Mynerve";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/mynerve-gp-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Mynerve";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/mynerve-gp-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Inspiration";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/inspiration-gp-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Inspiration";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/inspiration-gp-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Oooh Baby";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/oooh-baby-gp-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Oooh Baby";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/oooh-baby-gp-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Pangolin";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/pangolin-gp-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Pangolin";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/pangolin-gp-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Yomogi";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/yomogi-gp-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Yomogi";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/yomogi-gp-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Send Flowers";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/send-flowers-gp-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Send Flowers";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/send-flowers-gp-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Playpen Sans";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/playpen-sans-gp-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Playpen Sans";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/playpen-sans-gp-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Caramel";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/caramel-gp-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Caramel";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/caramel-gp-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Sriracha";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/sriracha-gp-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Sriracha";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/sriracha-gp-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Grechen Fuemen";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/grechen-fuemen-gp-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Grechen Fuemen";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/grechen-fuemen-gp-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Itim";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/itim-gp-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Itim";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/itim-gp-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}

/* ---- Văn Tế Thái Sơn (khuôn scroll): Ephesis = người chép văn tế của ty Quy Căn, Địa Phủ.
   Đã cắt chỉ còn chữ trong bài (ephesis-scroll-…): sửa lời văn tế thì nhờ Claude cắt lại. ---- */
@font-face {
  font-family: "Ephesis";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/ephesis-scroll-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Ephesis";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/ephesis-scroll-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
/* Sổ Hàng Nhà Lã: người cha (Sedgwick Ave), người con (Mansalva), người viết văn tự ở Ung (Splash). OFL. */
@font-face {
  font-family: "Sedgwick Ave";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/sedgwick-ave-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Sedgwick Ave";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/sedgwick-ave-vietnamese-400-normal.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Mansalva";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/mansalva-gp-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Mansalva";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/mansalva-gp-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Splash";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/splash-gp-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Splash";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/splash-gp-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}

/* Sắc phong núi Lạc Thạch: chữ đạo sắc (Cormorant SC 600), đồ Lương viết đơn (Moon Dance), lý trưởng ghi mặt sau (Ole). OFL, bản đầy đủ. */
@font-face {
  font-family: "Cormorant SC";
  font-style: normal;
  font-weight: 600;
  font-display: block;
  src: url("/theme/fonts/cormorant-sc-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Cormorant SC";
  font-style: normal;
  font-weight: 600;
  font-display: block;
  src: url("/theme/fonts/cormorant-sc-vietnamese-600-normal.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Moon Dance";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/moon-dance-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Moon Dance";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/moon-dance-vietnamese-400-normal.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Ole";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/ole-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Ole";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/theme/fonts/ole-vietnamese-400-normal.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}

/* ---- Lời độc giả (theme/css/notes.css): sáu nét tay của khách, mỗi lời một nét. Bản đầy đủ (không cắt)
   vì người đọc viết chữ bất kỳ. KHÔNG dùng các nét này cho nhân vật. Chỉ tải khi mở tờ giấy. ---- */
@font-face {
  font-family: "Shantell Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/theme/fonts/shantell-sans-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Shantell Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/theme/fonts/shantell-sans-vietnamese-400-normal.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Twinkle Star";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/theme/fonts/twinkle-star-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Twinkle Star";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/theme/fonts/twinkle-star-vietnamese-400-normal.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Charmonman";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/theme/fonts/charmonman-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Charmonman";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/theme/fonts/charmonman-vietnamese-400-normal.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Meow Script";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/theme/fonts/meow-script-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Meow Script";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/theme/fonts/meow-script-vietnamese-400-normal.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Birthstone";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/theme/fonts/birthstone-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Birthstone";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/theme/fonts/birthstone-vietnamese-400-normal.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "My Soul";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/theme/fonts/my-soul-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "My Soul";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/theme/fonts/my-soul-vietnamese-400-normal.woff2") format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}

/* gate.css */
/* Trang cổng (Era 00): ba vũ trụ quay quanh một tâm, cổng khóa ở giữa.
   Chỉ có CSS. Kỹ thuật quỹ đạo đã kiểm chứng trên Chrome Android (xem NOTES mục 7). */

/* Bán kính và góc quay là biến có kiểu, để sau này chuỗi mở cổng (Era 01) thu được về tâm */
/* Tên biến có tiền tố orbit- vì @property đăng ký cho cả trang: tên chung như --r, --x
   sẽ làm hỏng biến cùng tên ở khuôn khác (đã từng làm các tờ giấy không xoay, không dời được). */
@property --orbit-r { syntax: "<length>"; inherits: true; initial-value: 118px; }
@property --orbit-x { syntax: "<angle>"; inherits: true; initial-value: 0deg; }

body.page-gate {
  --T: 32s;        /* một vòng quỹ đạo */
  --tilt: 24deg;   /* độ nghiêng mặt phẳng quỹ đạo */
  --tt: #7fb59a; --mp: #8f7bd6; --kh: #4fc3e8;
  --gold: #c9a24a; --mute: #8c8a95;
  height: 100dvh;
  overflow: hidden;
  background: #0b0d0f;
  color: #e8e1cf;
  font-family: "Noto Serif", serif;
  -webkit-tap-highlight-color: transparent;
}

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

/* ---------- Nền hư không ----------
   Khi có ảnh nền: lưu ở content/img/void.webp rồi thêm url("/img/void.webp") vào đầu background của .void */
.void {
  position: fixed; inset: 0;
  background: radial-gradient(ellipse 75% 50% at 50% 50%, #2c3742 0%, #18202a 42%, #0a0c0f 78%, #060708 100%);
}
.stars, .mist, .grain { position: fixed; pointer-events: none; }
.stars { inset: 0; }
.stars.s1 {
  background-image:
    radial-gradient(1px 1px at 13px 21px, #ffffffb0 50%, transparent 51%),
    radial-gradient(1px 1px at 61px 77px, #ffffff80 50%, transparent 51%),
    radial-gradient(1px 1px at 88px 12px, #ffffff90 50%, transparent 51%);
  background-size: 97px 89px;
  animation: twinkle 7s ease-in-out infinite alternate;
}
.stars.s2 {
  background-image:
    radial-gradient(1.4px 1.4px at 40px 60px, #dfe9ffcc 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 140px 20px, #ffffffaa 50%, transparent 51%);
  background-size: 173px 151px;
  animation: twinkle 11s ease-in-out infinite alternate-reverse;
}
@keyframes twinkle { from { opacity: .25; } to { opacity: .6; } }

.mist { inset: -20%; }
.mist.m1 { background: radial-gradient(ellipse 40% 22% at 30% 40%, #9fb3c41a, transparent 70%); animation: drift 60s linear infinite alternate; }
.mist.m2 { background: radial-gradient(ellipse 35% 18% at 70% 62%, #b9c6d114, transparent 70%); animation: drift 85s linear infinite alternate-reverse; }
.mist.m3 { background: radial-gradient(ellipse 55% 25% at 50% 80%, #8ea2b318, transparent 70%); animation: drift 40s linear infinite alternate; }
@keyframes drift { from { transform: translate(-6%, 2%); } to { transform: translate(6%, -3%); } }

/* Hạt mịn: ảnh nhỏ làm sẵn (không dùng bộ lọc SVG, không hòa trộn màu) */
.grain {
  inset: 0;
  opacity: .05;
  background: url("/theme/img/grain.webp") 0 0 / 160px 160px;
}

/* ---------- Sân khấu 3D ---------- */
.stage {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  perspective: 900px;
}
.tilt {
  /* co giãn theo cạnh ngắn của màn hình (vmin) */
  --orbit-r: clamp(110px, 31vmin, 200px);
  position: relative; width: 0; height: 0;
  transform-style: preserve-3d;
  transform: rotateX(calc(var(--tilt) * -1));
  pointer-events: none;
}

.orb {
  position: absolute; left: 0; top: 0;
  width: var(--d); height: var(--d);
  margin: calc(var(--d) / -2) 0 0 calc(var(--d) / -2);
  border-radius: 50%;
  overflow: hidden;
  pointer-events: auto;
  border: 1px solid color-mix(in srgb, var(--c) 70%, transparent);
  box-shadow: 0 0 26px color-mix(in srgb, var(--c) 40%, transparent);
  background-color: #111;
  background-image: var(--img);
  background-repeat: no-repeat;
  background-size: var(--zoom) auto;  /* phóng ảnh khổ dọc trong quả cầu */
  background-position: 50% var(--py, 50%);
  animation: orbit var(--T) linear infinite;
  animation-delay: calc(var(--T) * var(--a) / -360);
}
/* quay quanh tâm, luôn quay mặt về người xem (không bị dẹt) */
@keyframes orbit {
  from { transform: rotateY(calc(var(--a) * 1deg + var(--orbit-x))) translateZ(var(--orbit-r)) rotateY(calc(var(--a) * -1deg - var(--orbit-x))) rotateX(var(--tilt)); }
  to   { transform: rotateY(calc(var(--a) * 1deg + 360deg + var(--orbit-x))) translateZ(var(--orbit-r)) rotateY(calc(var(--a) * -1deg - 360deg - var(--orbit-x))) rotateX(var(--tilt)); }
}

/* Kích thước: Khoa Học lớn nhất, Tu Tiên vừa, Ma Pháp nhỏ nhất */
.orb-cultivation {
  --c: var(--tt); --a: 0; --d: clamp(104px, 28vmin, 170px);
  --img: url("/img/era-00/cultivation.webp"); --zoom: 130%; --py: 47%;
  view-transition-name: world-cultivation;
}
.orb-magic {
  --c: var(--mp); --a: 120; --d: clamp(84px, 22vmin, 140px);
  --img: url("/img/era-00/magic.webp"); --zoom: 110%;
  view-transition-name: world-magic;
}
.orb-science {
  --c: var(--kh); --a: 240; --d: clamp(124px, 33vmin, 200px);
  --img: url("/img/era-00/science.webp"); --zoom: 115%;
  view-transition-name: world-science;
}
/* orbit dùng góc riêng --a, nên animation-delay chỉ cần 0 */
.orb { animation-delay: 0s; }

/* ---------- Hiệu ứng "cấu trúc ẩn": tự hiện khi quả cầu ra phía trước ---------- */
.fx {
  position: absolute; inset: 0; border-radius: 50%; opacity: 0;
  animation: front var(--T) linear infinite;
  animation-delay: calc(var(--T) * var(--a) / -360);
}
@keyframes front { 0%, 100% { opacity: 1; } 14%, 86% { opacity: 0; } }

.orb-cultivation .fx {
  background:
    radial-gradient(ellipse 60% 30% at 30% 45%, #ffffffb0, transparent 70%),
    radial-gradient(ellipse 55% 26% at 70% 60%, #f4fbf6a0, transparent 70%),
    radial-gradient(ellipse 70% 30% at 50% 85%, #ffffffa0, transparent 70%);
}
.orb-cultivation .fx::after {
  content: ""; position: absolute; inset: -20%;
  background: radial-gradient(ellipse 50% 22% at 50% 50%, #ffffff70, transparent 70%);
  animation: mistMove 6s ease-in-out infinite alternate;
}
@keyframes mistMove { from { transform: translate(-18%, 8%); } to { transform: translate(18%, -10%); } }

.orb-magic .fx {
  background:
    radial-gradient(circle, transparent 40%, #c8b8ffd0 41%, transparent 43.5%),
    radial-gradient(circle, transparent 64%, #c8b8ffa0 65%, transparent 67.5%);
}
.orb-magic .fx::before, .orb-magic .fx::after {
  content: ""; position: absolute; inset: 24%;
  border: 1.5px solid #d6caffd0;
  animation: rot 14s linear infinite;
}
.orb-magic .fx::after { animation-direction: reverse; rotate: 45deg; }
@keyframes rot { to { transform: rotate(360deg); } }

.orb-science .fx {
  background:
    radial-gradient(circle at 66% 30%, #fff 0 2px, transparent 3px),
    radial-gradient(circle at 34% 64%, #fff 0 2px, transparent 3px),
    repeating-radial-gradient(circle, transparent 0 14px, #4fc3e855 15px 16px);
}
.orb-science .fx::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, #4fc3e8b0, transparent 28%);
  animation: rot 3s linear infinite;
}

/* Máy tính: rê chuột vào quả cầu thì quỹ đạo dừng và hiệu ứng quả đó hiện ngay.
   Điện thoại không dừng (dừng sẽ bị kẹt sau khi chạm). */
@media (hover: hover) and (pointer: fine) {
  .tilt:has(.orb:hover) .orb,
  .tilt:has(.orb:hover) .fx { animation-play-state: paused; }
  .orb:hover .fx { opacity: 1; animation: none; }
  .orb:hover .fx::before, .orb:hover .fx::after { animation-play-state: running; }
}

/* ---------- Cổng ở tâm: lớp riêng, luôn trên các quả cầu ---------- */
.gatewrap {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  pointer-events: none; z-index: 2;
}
.gate {
  position: relative;
  width: 64px; height: 64px; padding: 0;
  border-radius: 50%;
  pointer-events: auto; cursor: pointer;
  background: #0b0d0f;
  border: 1.5px solid var(--gold);
  display: grid; place-items: center;
  box-shadow: 0 0 18px #c9a24a40;
}
.gate::before {
  content: ""; position: absolute; inset: -9px; border-radius: 50%;
  border: 1px dashed #c9a24a90;
  animation: rot 40s linear infinite;
}
.gate:focus-visible { outline: 1px solid var(--gold); outline-offset: 14px; }
.lock {
  position: relative; width: 18px; height: 14px; margin-top: 8px;
  border-radius: 2px; background: var(--gold);
}
.lock::before {
  content: ""; position: absolute; left: 3px; top: -10px;
  width: 12px; height: 12px; box-sizing: border-box;
  border: 2.5px solid var(--gold); border-bottom: 0; border-radius: 7px 7px 0 0;
}
/* Cổng khóa: chạm vào thì rung nhẹ (CSS thuần, chạy khi đang chạm) */
.gate:active { animation: nope .35s; }
@keyframes nope { 25% { translate: -5px 0; } 75% { translate: 5px 0; } }

.cap {
  position: fixed; left: 0; right: 0;
  bottom: calc(min(14vh, 50vh - 15vmin - 150px) + env(safe-area-inset-bottom, 0px));
  margin: 0;
  text-align: center;
  font-size: 15px; letter-spacing: .04em;
  color: var(--gold);
  pointer-events: none;
}
.cap small { display: block; margin-top: 4px; font-size: 12px; color: var(--mute); }

.gate-lang {
  position: fixed; left: 0; right: 0;
  bottom: calc(30px + env(safe-area-inset-bottom, 0px));
  display: flex; justify-content: center; gap: .9rem;
  font: 11px/1 system-ui, sans-serif; letter-spacing: .12em;
  color: #e8e1cf40;
}
.gate-lang a { color: inherit; text-decoration: none; }
.gate-lang [aria-current] { color: #e8e1cf70; }

.page-gate .site-copy {
  position: fixed; left: 0; right: 0;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  padding: 0; font-size: 10px; color: #e8e1cf; opacity: .22;
  pointer-events: none;
}

/* Gợi ý: hiện dần sau vài giây cho người chưa biết phải chạm vào đâu */
.hint {
  position: fixed; left: 0; right: 0;
  top: calc(max(6vh, 50vh - 15vmin - 190px) + env(safe-area-inset-top, 0px));
  margin: 0; text-align: center;
  font-size: 13px; letter-spacing: .14em;
  color: #e8e1cf;
  opacity: 0;
  pointer-events: none;
  animation: hint-in 2.4s ease-out 5s forwards, hint-breathe 4s ease-in-out 7.4s infinite;
}
@keyframes hint-in { to { opacity: .5; } }
@keyframes hint-breathe { 0%, 100% { opacity: .5; } 50% { opacity: .25; } }

/* Màn hình thấp (điện thoại cầm ngang): dòng chữ sát đáy hơn */
@media (max-height: 480px) {
  .cap { bottom: calc(10px + env(safe-area-inset-bottom, 0px)); font-size: 13px; }
  .cap small { display: inline; margin: 0 0 0 .6em; }
  .gate-lang { top: 12px; bottom: auto; justify-content: flex-end; padding-right: 16px; }
  .page-gate .site-copy { top: 12px; bottom: auto; text-align: left; padding-left: 16px; }
  .hint { top: 12px; }
}

/* ---------- Chuyển cảnh: quả cầu phình thành nền trang mục lục ---------- */
::view-transition-group(world-cultivation),
::view-transition-group(world-magic),
::view-transition-group(world-science) {
  animation-duration: .9s;
  animation-timing-function: cubic-bezier(.65, 0, .25, 1);
}
::view-transition-old(world-cultivation), ::view-transition-new(world-cultivation),
::view-transition-old(world-magic), ::view-transition-new(world-magic),
::view-transition-old(world-science), ::view-transition-new(world-science) {
  width: 100%; height: 100%; object-fit: cover;
}

@media (prefers-reduced-motion: reduce) {
  .hint { animation: hint-in .01ms 3s forwards !important; }
  .orb, .fx, .stars, .mist, .gate::before, .gate:active,
  .orb-cultivation .fx::after, .orb-magic .fx::before, .orb-magic .fx::after, .orb-science .fx::before {
    animation: none !important;
  }
  .orb { transform: rotateY(calc(var(--a) * 1deg)) translateZ(var(--orbit-r)) rotateY(calc(var(--a) * -1deg)) rotateX(var(--tilt)); }
  .fx { opacity: .6; }
}

/* genealogy.css */
/* Gia phả (khuôn brushnotes, front matter variant: genealogy): quyển phả của một họ nông dân.
   - Mỗi người viết một phông (lệnh {% scribe %}), cỡ chữ chỉnh theo thân chữ của từng phông (--hs),
     mực đời trước phai hơn đời sau. Kiểu phụ: .h-nho (dòng nhỏ), .h-to (chỗ đời sau tô lại cho đậm),
     .h-lem1 / .h-lem2 (mực lem dần).
   - Giấy của phả họ: dó mỏng, xám (paper-do). Xấp phả chi khâu chen: giấy trắng, dày, mặt láng (paper-chen).
   File này đứng sau brushnotes.css khi gộp, các luật viết kèm .bk-genealogy để thắng luật chung. */

/* ---- Chữ ---- */
.bk-genealogy .bk-body { -webkit-text-stroke: 0; }
.bk-genealogy :is(p, li, h2, h3) {
  font-size: calc(var(--bk-fs, 22px) * var(--hs, 1) * var(--hm, 1));
  line-height: 1.42;
  -webkit-text-stroke: 0;
}
.bk-genealogy p { margin: 0; text-indent: 0; }
.bk-genealogy p:has(> strong:first-child) { margin-top: .5em; }
.bk-genealogy strong { font-weight: 400; }
.bk-genealogy h2 { margin: .2em 0 .5em; text-align: center; font-weight: 400; }
.bk-genealogy h3 { margin: .7em 0 .15em; font-weight: 400; font-size: calc(var(--bk-fs, 22px) * var(--hs, 1) * 1.1); }
.bk-genealogy h3:first-child, .bk-genealogy h2:first-child { margin-top: 0; }
.bk-genealogy ol, .bk-genealogy ul { margin: .25em 0 .3em; padding-left: 1.3em; }
.bk-genealogy ul { list-style-type: "– "; }
.bk-genealogy li { margin: 0; }
.bk-genealogy .bk-source :is(p, li, h2, h3) { font-size: calc(1.45rem * var(--hs, 1) * var(--hm, 1)); }

/* Nét chữ: phông, cỡ (theo thân chữ), màu mực */
.bk-genealogy .h-d2  { font-family: "Fuggles", serif;        --hs: 1.5; color: #62563f; }  /* đời 2: to, vụng, mực gần như bạc */
.bk-genealogy .h-d3  { font-family: "Mali", serif;           --hs: .8;   color: #6e5236; }  /* đời 3: nhỏ, cẩn thận, nâu nhạt */
.bk-genealogy .h-d4  { font-family: "Mynerve", serif;        --hs: .92;  color: #584531; }  /* đời 4: thô, đều */
.bk-genealogy .h-d5  { font-family: "Inspiration", serif;    --hs: 1.4;  color: #4d3d2c; }
.bk-genealogy .h-d6  { font-family: "Oooh Baby", serif;      --hs: 1.2; color: #453628; }
.bk-genealogy .h-d7  { font-family: "Pangolin", serif;       --hs: .9;  color: #1d1a17; }  /* đời 7: mực đen, chữ vuông */
.bk-genealogy .h-d8  { font-family: "Yomogi", serif;         --hs: .84;  color: #3a3027; }  /* đời 8: nhỏ, run (tremor) */
.bk-genealogy .h-d9  { font-family: "Send Flowers", serif;   --hs: 1.1; color: #322a21; }
.bk-genealogy .h-d10 { font-family: "Playpen Sans", serif;   --hs: .85;  color: #2a231c; }  /* đời 10: to, vụng, như mới học */
.bk-genealogy .h-c2  { font-family: "Caramel", serif;        --hs: 1.5;  color: #6e4c2f; }  /* chi đời 2: to, ngay, ngả nâu */
.bk-genealogy .h-c3  { font-family: "Sriracha", serif;       --hs: .84;  color: #4b3b2b; }  /* chi đời 3: nhỏ, nghiêng phải */
.bk-genealogy .h-c4  { font-family: "Grechen Fuemen", serif; --hs: 1.1; color: #2b241e; }  /* chi đời 4: thô, đậm, lem dần */
.bk-genealogy .h-su  { font-family: "Itim", serif;           --hs: .86;  color: #2b2723; }  /* nhà sư: chân phương, đều */
.bk-genealogy .h-dp  { font-family: "Patrick Hand", serif;   --hs: .8;   color: #0f0d0c; }  /* Địa Phủ: vuông, nhỏ, mực mới */
.bk-genealogy .h-nho { --hm: .82; }
.bk-genealogy .h-to  { color: #3a281a; -webkit-text-stroke: .028em currentColor; paint-order: stroke fill; }
.bk-genealogy .h-lem1 { text-shadow: 0 0 1px rgb(43 36 30 / .55), .4px .5px 1.5px rgb(43 36 30 / .35); }
.bk-genealogy .h-lem2 { text-shadow: 0 0 1.4px rgb(43 36 30 / .7), .8px 1px 2.6px rgb(43 36 30 / .45); }

/* Ấn Địa Phủ dưới dòng cuối */
.bk-genealogy .bk-stamp { width: 74px; margin: .9em 0 0 1.6em; color: #ad3529; mix-blend-mode: multiply; }
.bk-genealogy .bk-stamp .stamp { display: block; width: 100%; height: auto; }
.bk-genealogy .bk-stamp .stamp-wear { fill: #cec6b1; }
.bk-genealogy .bk-source .bk-stamp .stamp-wear { fill: #dccaa0; }

/* ---- Giấy ---- */
/* phả họ: dó mỏng, xám */
.bk-genealogy .paper-do:not(.bk-cover) .bk-paper {
  background:
    radial-gradient(ellipse at 50% 45%, transparent 40%, rgb(95 70 35 / .42) 100%),
    linear-gradient(to bottom, rgb(110 80 40 / .14), transparent 18%, transparent 82%, rgb(110 80 40 / .18)),
    #c9bea4;
}
/* góc lật trang: tay lật qua mười đời, sẫm rõ */
.bk-genealogy .paper-do .bk-paper::after { width: 120px; height: 120px; background: radial-gradient(circle at 100% 100%, rgb(80 52 22 / .5), rgb(80 52 22 / .18) 45%, transparent 72%); }
.bk-genealogy .side-l.paper-do .bk-paper::after { background: radial-gradient(circle at 0 100%, rgb(80 52 22 / .5), rgb(80 52 22 / .18) 45%, transparent 72%); }
.bk-genealogy .paper-do:not(.bk-cover) .bk-fox { opacity: .26; }
/* phả chi khâu chen: giấy trắng, dày, mặt láng; ít ố, mép ít sẫm hơn */
.bk-genealogy .paper-chen .bk-paper { background: radial-gradient(ellipse at 50% 45%, transparent 60%, rgb(120 100 70 / .16) 100%), linear-gradient(160deg, rgb(255 255 255 / .18), transparent 40%), #e9e3d4; }
.bk-genealogy .paper-chen .bk-fox { opacity: .1; --fx-fox-k: .45; }
.bk-genealogy .paper-chen .bk-paper::after { opacity: .5; }
.bk-genealogy .paper-chen .bk-rule { border-color: rgb(110 90 60 / .12); }

/* bìa: dải giấy viết bằng nét của người lập phả */
.bk-genealogy .bk-slip { font-family: "Fuggles", serif; font-size: 32px; -webkit-text-stroke: 0; color: #3a2c1e; }
.bk-genealogy .bk-title { font-family: "Fuggles", serif; }

/* Phả đồ (theme/lib/phado.js): SVG nét tay, chữ thật theo nét của người viết từng tên */
.bk-genealogy .bk-phado { margin: .1em 0 0; }
.bk-genealogy .bk-phado svg { display: block; width: 100%; height: auto; max-height: 425px; }

/* layouts.css */
.layout-story, .layout-lore, .layout-world {
  max-width: 38rem;
  margin: 0 auto;
  padding: 3rem 1.25rem;
}

/* ---- Trong lúc script dựng sách/sổ/kinh/thư: ẩn bản gốc để khỏi nháy chữ (xem base.njk) ---- */
html.js:not(.ms-paged) .ms,
html.js:not(.nb-paged) .nb,
html.js:not(.su-paged) .su,
html.js:not(.lt-paged) .lt,
html.js:not(.bk-paged) .bk, html.js:not(.ds-paged) .ds, html.js:not(.sc-ready) .sc { visibility: hidden; }

/* Phóng to bằng hai ngón (theme/js/lib/input.js gắn html.is-zoomed khi đang phóng):
   lúc thường, một ngón dùng để lật trang, hai ngón để phóng; lúc đã phóng, một ngón kéo để soi
   (không lật), muốn lật lại thì thu nhỏ về như cũ. */
html.is-zoomed :is(.ms-desk, .nb-desk, .su-desk, .lt-desk, .bk-desk, .ds-desk, .ds-scroll) { touch-action: manipulation; }

/* Gợi ý lật khi đang phóng to (kéo quá mép, theme/js/lib/input.js): mép màn hình tối dần như mép tờ
   đang được nhấc lên. Nằm ở mép trang, cũng là mép khung nhìn lúc ấy. */
.pull-hint {
  position: fixed; top: 0; bottom: 0; right: 0; width: 18%;
  background: linear-gradient(to left, rgb(0 0 0 / .45), transparent);
  opacity: 0; pointer-events: none; z-index: 9999; transition: opacity .2s;
}
.pull-hint.left { right: auto; left: 0; background: linear-gradient(to right, rgb(0 0 0 / .45), transparent); }
/* Hồ sơ: vùng chữ cuộn dọc giữ cú cuộn trong tờ (overscroll contain); lúc phóng thì cho cú kéo ngang
   chuyền ra ngoài để soi được sang hai bên. */
html.is-zoomed .ds-scroll { overscroll-behavior-x: auto; }

/* ledger.css */
/* Sổ hàng (khuôn brushnotes, front matter variant: ledger): sổ của một nhà buôn vải, 17 năm.
   - Dòng bảng (lib/brushnotes.js: dòng có " | "): ô đầu là tên, các ô sau là số, dồn về bên phải; hẹp thì xuống dòng.
   - Nét chữ: .h-cha người cha (Sedgwick Ave, mực phai theo năm qua --fx-ink), .h-con người con (Mansalva, mực xanh đen),
     .h-ung người viết văn tự ở Ung (Splash). Kiểu phụ: .h-nho / .h-nho2 chữ nhỏ dần, .h-chen dòng viết chen vào giữa,
     .h-moi mực mới hơn, .h-lo dòng lộ trình.
   - Hư hao của tờ giấy (reader): .bk-stub cuống, .bk-half xé nửa, .bk-stuck dính trang, .bk-oil vết dầu; .bk-ghost chữ trang bên.
   File này đứng sau brushnotes.css khi gộp, các luật viết kèm .bk-ledger để thắng luật chung. */

/* ---- Chữ ---- */
.bk-ledger .bk-body { -webkit-text-stroke: 0; }
.bk-ledger :is(p, h2, h3, .bk-row) {
  font-size: calc(var(--bk-fs, 22px) * var(--hs, 1) * var(--hm, 1));
  line-height: 1.28;
  -webkit-text-stroke: 0;
}
.bk-ledger p { margin: 0; text-indent: 0; }
.bk-ledger h2 { margin: 0 0 .3em; text-align: center; font-weight: 400; font-size: calc(var(--bk-fs, 22px) * var(--hs, 1) * 1.35); }
.bk-ledger h3 { margin: .45em 0 .05em; font-weight: 400; text-decoration: underline 1px; text-underline-offset: 3px; text-decoration-color: rgb(60 40 20 / .45); }
.bk-ledger h2 + h3, .bk-ledger h3:first-child { margin-top: 0; }
.bk-ledger .bk-source :is(p, h2, h3, .bk-row) { font-size: calc(1.2rem * var(--hs, 1) * var(--hm, 1)); }

/* dòng bảng: lưới cột cố định để số thẳng hàng từ dòng này sang dòng khác.
   2 ô: tên | số. 3 ô: tên | lượng | số. 4 ô: tên một dòng riêng, dòng dưới: lượng | đơn giá | thành tiền. */
.bk-ledger .bk-row { display: grid; align-items: baseline; column-gap: .5em; }
.bk-ledger .bk-row[data-n="2"] { grid-template-columns: 1fr auto; }
.bk-ledger .bk-row[data-n="3"] { grid-template-columns: 1fr auto 4.6em; }
.bk-ledger .bk-row[data-n="4"] { grid-template-columns: 1fr 3.6em 4.4em 4.8em; }
.bk-ledger .bk-row[data-n="4"]:not(.bk-row-head) > span:first-child { grid-column: 1 / -1; }
.bk-ledger .bk-row[data-n="4"]:not(.bk-row-head) > span:nth-child(2) { grid-column: 2; }
.bk-ledger .bk-row > span { min-width: 0; }
.bk-ledger .bk-row > span + span { text-align: right; white-space: nowrap; }
.bk-ledger .bk-row-head { opacity: .8; }
.bk-ledger .bk-row-head > span:first-child { visibility: hidden; }
.bk-ledger .bk-row s, .bk-ledger .bk-row del { text-decoration-thickness: 1.5px; }
/* gạch cả dòng: một nét ngang lệch, cùng màu mực của người gạch */
.bk-ledger .bk-struck { position: relative; }
.bk-ledger .bk-struck::after { content: ""; position: absolute; left: -.2em; right: -.3em; top: 54%; height: 2px; background: currentColor; rotate: -1.4deg; border-radius: 2px; opacity: .9; }

/* Nét chữ */
.bk-ledger .h-cha { font-family: "Sedgwick Ave", serif; --hs: 1;    color: var(--fx-ink, #2c2014); }
.bk-ledger .h-con { font-family: "Mansalva", serif;     --hs: .9;   color: #1f2735; }
.bk-ledger .h-ung { font-family: "Splash", serif;       --hs: 1.3;  color: #3a2416; }
.bk-ledger .h-nho  { --hm: .84; }
.bk-ledger .h-nho2 { --hm: .7; }
.bk-ledger .h-moi  { color: #15110c; }
/* dòng viết chen vào giữa hai dòng (quên rồi ghi thêm): nhỏ, lệch, đè sát dòng trên */
.bk-ledger .h-chen { --hm: .66; margin: -.45em 0 -.15em 2.2em; rotate: -1.6deg; opacity: .88; }
/* lộ trình: một đường kẻ dọc, mỗi chặng một vòng tròn */
.bk-ledger .h-lo.bk-row { margin-left: .35em; padding: 0 0 .55em .75em; border-left: 1.5px solid currentColor; grid-template-columns: auto 1fr; }
.bk-ledger .h-lo.bk-row > span + span { white-space: normal; }
.bk-ledger .h-lo.h-moi.bk-row { margin-left: 2.2em; border-left-style: dashed; }

/* bìa */
.bk-ledger .bk-slip { font-family: "Sedgwick Ave", serif; font-size: 30px; -webkit-text-stroke: 0; color: #2c2014; }
.bk-ledger .bk-title { font-family: "Sedgwick Ave", serif; }

/* ---- Giấy bản: thô, vàng xám, có thớ ---- */
.bk-ledger .bk-pg:not(.bk-cover) .bk-paper {
  background:
    radial-gradient(ellipse at 50% 45%, transparent 42%, rgb(95 70 35 / .38) 100%),
    repeating-linear-gradient(92deg, rgb(120 90 50 / .035) 0 2px, transparent 2px 7px),
    linear-gradient(to bottom, rgb(110 80 40 / .12), transparent 16%, transparent 84%, rgb(110 80 40 / .16)),
    #cfc19c;
}
.bk-ledger .bk-pg:not(.bk-cover) .bk-fox { opacity: .3; }
/* góc lật: tay người buôn, dầu đèn, sẫm */
.bk-ledger .bk-paper::after { width: 130px; height: 130px; background: radial-gradient(circle at 100% 100%, rgb(70 45 18 / .55), rgb(70 45 18 / .2) 45%, transparent 72%); }
.bk-ledger .side-l .bk-paper::after { background: radial-gradient(circle at 0 100%, rgb(70 45 18 / .55), rgb(70 45 18 / .2) 45%, transparent 72%); }
.bk-ledger .bk-cover .bk-paper { background: radial-gradient(ellipse at 35% 30%, #6a4f33, #3e2c1c 80%); }

/* ---- Tờ giấy bị xé ---- */
/* cuống: chỉ còn dải giấy ở gáy, bóng sẫm theo mép */
.bk-ledger .bk-stub { filter: drop-shadow(1px 0 1px rgb(0 0 0 / .5)); }
.bk-ledger .bk-stub .bk-body, .bk-ledger .bk-stub .bk-rule { display: none; }
.bk-ledger .bk-half { filter: drop-shadow(2px 2px 3px rgb(0 0 0 / .45)); }

/* chữ trang bên in sang (dính trang) hoặc thấy qua giấy (vết dầu): lật gương, nhạt */
.bk-ghost { position: absolute; inset: 0; pointer-events: none; }
.bk-ghost-in { position: absolute; inset: 0; transform: scaleX(-1); }
.bk-ghost .bk-body { color: #2c2014; }
.bk-ghost-oil { clip-path: ellipse(27% 16% at 57% 44%); opacity: .24; }
.bk-ghost-stuck { clip-path: polygon(6% 8%, 64% 5%, 72% 18%, 58% 31%, 22% 35%, 8% 26%); opacity: .2; }
.bk-ghost-stuck .bk-body { filter: blur(.3px); }
/* vết dầu: giấy sẫm và trong hơn */
.bk-ledger .bk-oil .bk-pg-in::after {
  content: ""; position: absolute; left: 29%; top: 27%; width: 56%; height: 34%; pointer-events: none; mix-blend-mode: multiply;
  border-radius: 48% 52% 46% 54% / 55% 45% 55% 45%;
  background: radial-gradient(closest-side, rgb(176 130 48 / .3), rgb(176 130 48 / .16) 70%, rgb(150 105 35 / .22) 92%, transparent);
}
/* dính trang: một mảng giấy bị bóc mất lớp mặt, sáng và xơ */
.bk-ledger .bk-stuck .bk-pg-in::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  clip-path: polygon(31% 13%, 37% 11.5%, 44% 12.5%, 51% 11%, 56% 14%, 61% 19%, 58% 22%, 60% 26%, 52% 27.5%, 46% 26%, 40% 28%, 34% 25.5%, 30% 21%, 32% 17%);
  background: repeating-linear-gradient(70deg, rgb(238 226 196 / .3) 0 1.5px, rgb(214 196 158 / .22) 1.5px 3.5px);
}

/* ---- Vật kẹp: ló lên ở mép trên trang, chạm để xem ---- */
.bk-tab {
  position: absolute; top: -17px; z-index: 3; width: 48px; height: 32px; padding: 0; border: 0; cursor: pointer;
  rotate: -4deg;
  background: #e6d9b8 repeating-linear-gradient(transparent 0 7px, rgb(58 36 22 / .16) 7px 8px);
  box-shadow: 0 -1px 3px rgb(0 0 0 / .35);
  -webkit-tap-highlight-color: transparent;
}
.bk-tab::before { content: ""; position: absolute; inset: -14px -10px 0; }
.bk-overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: rgb(10 8 6 / .74); opacity: 0; transition: opacity .35s;
}
.bk-overlay.open { opacity: 1; }
.bk-overlay[hidden] { display: none; }
.bk-item {
  position: relative; width: min(92vw, 420px); max-height: 86dvh; overflow: auto; box-sizing: border-box;
  padding: 26px 24px 22px; background: #e9dcb9; color: #3a2416;
  font: 22px/1.3 "Splash", "Noto Serif", serif;
  box-shadow: 0 10px 30px rgb(0 0 0 / .6); rotate: -.8deg; touch-action: pan-y pinch-zoom;
}
.bk-item p { margin: 0 0 .25em; text-indent: 0; }
.bk-item .bk-thumb { display: block; width: 48px; margin: .2em 1.5em 0 auto; color: #a5302a; mix-blend-mode: multiply; rotate: -9deg; }
.bk-item .bk-thumb svg { display: block; width: 100%; height: auto; }
.bk-close { position: absolute; top: 4px; right: 8px; border: 0; background: none; color: #3a2416; font: 28px/1 system-ui, sans-serif; cursor: pointer; padding: 6px; }
.bk-source .bk-insert { margin: .6rem 0; padding: .6rem .8rem; background: #e9dcb9; font-family: "Splash", serif; }
.bk-source .bk-insert::before { content: attr(data-label); display: block; font: .75rem/1.4 system-ui, sans-serif; opacity: .6; }
.bk-source .bk-thumb { display: block; width: 40px; color: #a5302a; }

@media (prefers-reduced-motion: reduce) {
  .bk-overlay { transition: none; }
}

/* ---- Bản đồ đường buôn: tờ giấy gấp kẹp trong sổ (lệnh routemap). Mở ra thì cuộn dọc, phóng hai ngón để soi ---- */
.bk-item:has(.bk-map) {
  width: min(94vw, 460px); max-height: 90dvh; padding: 0; rotate: .5deg;
  background: #dfcc9f radial-gradient(120% 80% at 50% 50%, transparent 55%, rgb(110 74 34 / .4));
  font-family: "Sedgwick Ave", serif;
}
.bk-item:has(.bk-map) .bk-item-body { padding: 0; }
.bk-map { margin: 0; color: #2c2014; }
.bk-map svg { display: block; width: 100%; height: auto; }
.bk-map text { fill: currentColor; font-family: "Sedgwick Ave", serif; }
.bk-map .m-note { opacity: .85; }
.bk-map .m-moi { color: #15110c; }
.bk-map .m-ink { opacity: .86; }
.bk-source .bk-map { max-width: 360px; }

/* letters.css */
/* Khuôn letters: sấp thư buộc dây gai, giấy gai thô đã phong hoá.
   Cả sấp chỉ một người viết (ông đồ): một phông (Charm), một cỡ, một màu mực.
   Biến riêng của khuôn mang tiền tố --lt-. */

body.page-letters {
  color-scheme: dark;
  background-color: #17130f;
  background-image: radial-gradient(ellipse at 50% 40%, #2b241c, #15110d 78%);
  background-attachment: fixed;
  color: #d9cdb2;
  overflow-x: clip;
}

/* ======================================================================
   Bản gốc (không có script): các lá thư xếp dọc
   ====================================================================== */
.lt { max-width: 30rem; margin: 0 auto; padding: 2rem .8rem 4rem; }
.lt-title { margin: 0 0 1.2rem; text-align: center; font: 400 2rem/1.2 "Charm", "Noto Serif", serif; color: #d9cdb2; }
.lt-source .lt-letter { margin: 0 0 1.4rem; padding: 1.4rem 1.3rem; background: #e2d1a6; color: #2b2016; font: 1.15rem/1.45 "Charm", "Noto Serif", serif; box-shadow: 0 6px 16px rgb(0 0 0 / .45); }
.lt-nav { display: flex; justify-content: center; gap: 1.4rem; padding: 2rem 0 0; font: .8rem/1.4 system-ui, sans-serif; }
.lt-nav a { color: rgb(217 205 178 / .55); text-decoration: none; }

/* Chữ: dùng chung */
.lt p { margin: 0 0 .55em; }
.lt .lt-add { margin-top: 1.3em; }   /* ông đồ tự viết thêm: cùng nét, chỉ cách ra một khoảng */

/* ======================================================================
   Bản bó thư (script đã chạy: html.lt-paged)
   ====================================================================== */
html.lt-paged, html.lt-paged body { height: 100%; overflow: hidden; }
html.lt-paged .lt { max-width: none; padding: 0; }
html.lt-paged .lt-source { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
html.lt-paged .lt > .lt-nav { display: none; }

.lt-desk { position: fixed; inset: 0; touch-action: pan-y pinch-zoom; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }

/* ---- Lá thư ---- */
.lt-sheetwrap {
  position: absolute; left: 50%; top: 50%;
  width: var(--lt-w); height: var(--lt-h);
  margin: calc(var(--lt-h) / -2 - 16px) 0 0 calc(var(--lt-w) / -2);
  transition: transform .8s cubic-bezier(.45, .05, .2, 1), opacity .6s;
  transform-origin: 50% 50%;
  /* bóng đặt ở lớp ngoài vì đường cắt hư hao cắt mất bóng của tờ giấy */
  filter: drop-shadow(0 8px 12px rgb(0 0 0 / .5));
}
.lt-sheet {
  position: absolute; inset: 0; overflow: hidden;
  /* giấy gai thô: ngả vàng theo tuổi lá thư (--lt-age 1 = lá đầu, cũ nhất) */
  background:
    repeating-linear-gradient(83deg, rgb(120 90 50 / .035) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(-7deg, rgb(255 250 235 / .05) 0 2px, transparent 2px 11px),
    radial-gradient(ellipse at 50% 45%, transparent 55%, rgb(120 80 30 / calc(.12 + var(--lt-age) * .18)) 100%),
    color-mix(in srgb, #e6d6b0, #c9a86e calc(var(--lt-age) * 75%));
  color: #2b2016;
  transition: transform .32s ease-in;
}
.lt-sheetwrap.flip .lt-sheet { transform: rotateY(90deg); }
/* nếp gấp làm ba, mòn theo năm */
.lt-sheet::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background:
    linear-gradient(to bottom, transparent calc(33.3% - 8px), rgb(90 55 20 / calc(.16 + var(--lt-age) * .22)) calc(33.3% - 1px), rgb(255 246 225 / .4) 33.3%, rgb(90 55 20 / .08) calc(33.3% + 3px), transparent calc(33.3% + 9px)),
    linear-gradient(to bottom, transparent calc(66.6% - 8px), rgb(90 55 20 / calc(.16 + var(--lt-age) * .22)) calc(66.6% - 1px), rgb(255 246 225 / .4) 66.6%, rgb(90 55 20 / .08) calc(66.6% + 3px), transparent calc(66.6% + 9px));
}
.lt-fibers { position: absolute; inset: 0; background-size: 220px 220px; pointer-events: none; }
.lt-fox {
  position: absolute; inset: 0; pointer-events: none; mix-blend-mode: multiply;
  background-image: url("/theme/img/wear/fox-spots.webp"), url("/theme/img/wear/fox-blotch.webp");
  background-size: 384px 384px, 512px 512px;
  opacity: calc(.05 + var(--lt-age) * .22);
}
.lt-edges { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 calc(10px + var(--lt-age) * 22px) rgb(110 70 25 / calc(.25 + var(--lt-age) * .35)); }
/* chữ mặt kia hằn qua giấy mỏng */
.lt-ghost, .lt-text { position: absolute; inset: 0; padding: 30px 24px 26px; overflow: hidden; font: var(--lt-fs) / 1.45 "Charm", "Noto Serif", serif; }
.lt-ghost { transform: scaleX(-1); opacity: .07; pointer-events: none; color: #1d140b; }
.lt-text { opacity: 0; transition: opacity .5s .45s; }
.lt-sheetwrap.open .lt-text { opacity: 1; }
.lt-rot { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }

/* trạng thái của từng lá */
.lt-sheetwrap.folded { transform: translate(var(--lt-fx), var(--lt-fy)) rotate(var(--lt-fr)) scale(var(--lt-sx), .3); }
.lt-sheetwrap.folded .lt-sheet::before { opacity: 0; }
.lt-sheetwrap.read { transform: translate(calc(var(--lt-w) * -.62), calc(var(--lt-h) * .48)) rotate(-8deg) scale(.32); opacity: .55; }
.lt-sheetwrap.read.r2 { transform: translate(calc(var(--lt-w) * -.6), calc(var(--lt-h) * .46)) rotate(-3deg) scale(.32); }
.lt-sheetwrap.open { transform: none; }
.lt-sheetwrap.away { opacity: 0; pointer-events: none; }

/* dây gai buộc bó thư */
.lt-string { position: absolute; left: 50%; top: 50%; width: calc(var(--lt-w) * 1.05); height: calc(var(--lt-h) * .42); margin: calc(var(--lt-h) * -.21 - 16px) 0 0 calc(var(--lt-w) * -.525); pointer-events: none; z-index: 60; transition: opacity .7s, transform .9s cubic-bezier(.5, 0, .8, .4); }
.lt-string::before, .lt-string::after { content: ""; position: absolute; background: repeating-linear-gradient(60deg, #a68a5b 0 3px, #7c6440 3px 5px); box-shadow: 0 1px 2px rgb(0 0 0 / .5); border-radius: 2px; }
.lt-string::before { left: 0; right: 0; top: 47%; height: 5px; rotate: -2deg; }
.lt-string::after { top: 0; bottom: 0; left: 46%; width: 5px; rotate: 3deg; }
.lt-knot { position: absolute; left: 46%; top: 44%; width: 16px; height: 13px; margin: -2px 0 0 -6px; border-radius: 50%; background: radial-gradient(circle at 40% 40%, #b49a6a, #6e5636); box-shadow: 0 1px 3px rgb(0 0 0 / .5); }
.lt-desk.untied .lt-string { opacity: 0; transform: translateY(40px) rotate(14deg); }

.lt-hint { position: fixed; left: 0; right: 0; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); text-align: center; font: 12px system-ui, sans-serif; opacity: .45; pointer-events: none; }
.lt-end { position: fixed; left: 0; right: 0; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); opacity: 0; pointer-events: none; transition: opacity .6s .4s; }
.lt-desk.at-start .lt-end, .lt-desk.at-end .lt-end { opacity: 1; pointer-events: auto; }
.lt-desk.at-start .lt-end { bottom: calc(34px + env(safe-area-inset-bottom, 0px)); }
.lt-end .lt-nav { padding: 0; }

/* Bản quyền: chỉ hiện khi đã đọc hết, bó thư buộc lại */
.page-letters .site-copy { color: rgb(217 205 178); }
html.lt-paged .page-letters .site-copy { display: none; }
html.lt-paged .page-letters:has(.lt-desk.at-end) .site-copy {
  display: block; position: fixed; left: 0; right: 0;
  bottom: calc(34px + env(safe-area-inset-bottom, 0px)); padding: 0; opacity: .3;
}

@media (prefers-reduced-motion: reduce) {
  .lt-sheetwrap, .lt-sheet, .lt-string, .lt-end, .lt-text { transition: none; }
}

/* magic.css */
/* Ma Pháp: giấy da (vellum). --paper-* dùng cho nền mục lục và cho khuôn manuscript sau này. */
.world-magic {
  --accent: #8f7bd6;
  --paper-color: #e2cfa6;
  --paper-ink: #2b1d10;
  --paper-image:
    radial-gradient(ellipse at 20% 15%, rgb(120 80 40 / .12), transparent 45%),
    radial-gradient(ellipse at 80% 90%, rgb(110 70 30 / .16), transparent 50%),
    linear-gradient(100deg, transparent 30%, rgb(255 250 235 / .18) 45%, transparent 60%),
    radial-gradient(ellipse at 50% 45%, transparent 55%, rgb(90 60 30 / .45) 100%);
  --seal: #5b3a8a;
}

/* manuscript.css */
/* Khuôn manuscript: các tờ giấy rời đặt trên mặt bàn lưu trữ.
   Chất liệu giấy lấy từ bộ giao diện thế giới (--paper-color, --paper-image, --paper-ink). */

body.page-manuscript {
  color-scheme: dark;
  background-color: #1c1814;
  background-image:
    radial-gradient(ellipse at 50% 30%, #2a241d 0%, transparent 70%),
    linear-gradient(#1c1814, #17130f);
  background-attachment: fixed;
  color: #d9cdb2;
  overflow-x: clip;
}

.manuscript, .ms {
  max-width: 36rem;
  margin: 0 auto;
  padding: 4rem .7rem 70vh; /* khoảng trống dài của mặt bàn sau tờ cuối */
}

.manuscript-title {
  margin: 1rem 0 3rem;
  font-family: "Kolker Brush", "Noto Serif", serif;
  font-weight: 400;
  font-size: clamp(2.6rem, 12vw, 3.6rem);
  line-height: 1.1;
  text-align: center;
  color: #d9cdb2;
}

/* ---- Tờ giấy ---- */
.leaf-wrap {
  margin: 0 0 2.6rem;
  /* bóng đổ nằm ở lớp ngoài, vì clip-path của tờ sẽ cắt mất box-shadow */
  filter: drop-shadow(0 8px 10px rgb(0 0 0 / .45)) drop-shadow(0 1px 1px rgb(0 0 0 / .5));
  transform: translateX(var(--x, 0)) rotate(var(--r, 0deg));
}
.tilt-0 { --r: -.35deg; --x: -3px; }
.tilt-1 { --r:  .25deg; --x:  4px; }
.tilt-2 { --r: -.15deg; --x:  1px; }
.tilt-3 { --r:  .40deg; --x: -5px; }
.tilt-4 { --r: -.28deg; --x:  2px; }

.leaf {
  position: relative;
  padding: 2.3rem 1.35rem 2.5rem;
  background-color: var(--paper-color, #e6dbc1);
  background-image: var(--paper-image, none);
  color: var(--paper-ink, #3a2d20);
  font-family: "Kolker Brush", "Noto Serif", serif;
  font-size: 22px;
  line-height: 1.38;
}
.leaf p { margin: 0; text-indent: 1.5em; }
.leaf p:first-child { text-indent: 0; }

/* Mép giấy: 4 kiểu, xoay vòng theo thứ tự tờ (sinh tự động, seed 7). Độ răng cưa tính bằng px để tờ dài không bị méo. */
.leaf.edge-0 { clip-path: polygon(0.0% 1.3px, 6.2% 0.6px, 12.5% 2.6px, 18.8% 0.3px, 25.0% 2.1px, 31.2% 1.5px, 37.5% 0.2px, 43.8% 2.0px, 50.0% 0.1px, 56.2% 1.7px, 62.5% 0.3px, 68.8% 0.4px, 75.0% 1.7px, 81.2% 3.3px, 87.5% 0.5px, 93.8% 0.9px, 100.0% 2.5px, calc(100% - 2.7px) 6.2%, calc(100% - 1.6px) 12.5%, calc(100% - 1.1px) 18.8%, calc(100% - 2.7px) 25.0%, calc(100% - 0.1px) 31.2%, calc(100% - 2.4px) 37.5%, calc(100% - 0.8px) 43.8%, calc(100% - 0.4px) 50.0%, calc(100% - 0.3px) 56.2%, calc(100% - 0.9px) 62.5%, calc(100% - 2.3px) 68.8%, calc(100% - 0.5px) 75.0%, calc(100% - 1.6px) 81.2%, calc(100% - 1.8px) 87.5%, calc(100% - 1.0px) 93.8%, calc(100% - 1.5px) 100.0%, 93.8% calc(100% - 0.3px), 87.5% calc(100% - 0.2px), 81.2% calc(100% - 0.8px), 75.0% calc(100% - 2.7px), 68.8% calc(100% - 1.7px), 62.5% calc(100% - 1.3px), 56.2% calc(100% - 2.3px), 50.0% calc(100% - 1.8px), 43.8% calc(100% - 1.2px), 37.5% calc(100% - 3.2px), 31.2% calc(100% - 2.8px), 25.0% calc(100% - 1.0px), 18.8% calc(100% - 2.3px), 12.5% calc(100% - 2.1px), 6.2% calc(100% - 3.5px), 0.0% calc(100% - 2.9px), 0.8px 93.8%, 2.7px 87.5%, 0.3px 81.2%, 1.2px 75.0%, 2.1px 68.8%, 0.4px 62.5%, 1.4px 56.2%, 0.1px 50.0%, 1.9px 43.8%, 2.1px 37.5%, 1.6px 31.2%, 2.5px 25.0%, 0.9px 18.8%, 1.9px 12.5%, 1.7px 6.2%); }
.leaf.edge-1 { clip-path: polygon(0.0% 2.3px, 6.2% 1.8px, 12.5% 3.4px, 18.8% 3.8px, 25.0% 1.9px, 31.2% 2.7px, 37.5% 0.2px, 43.8% 2.8px, 50.0% 2.6px, 56.2% 4.0px, 62.5% 3.3px, 68.8% 1.1px, 75.0% 1.5px, 81.2% 2.7px, 87.5% 0.1px, 93.8% 1.8px, 100.0% 0.7px, calc(100% - 0.3px) 6.2%, calc(100% - 0.2px) 12.5%, calc(100% - 2.2px) 18.8%, calc(100% - 0.4px) 25.0%, calc(100% - 0.7px) 31.2%, calc(100% - 1.1px) 37.5%, calc(100% - 2.4px) 43.8%, calc(100% - 0.2px) 50.0%, calc(100% - 1.3px) 56.2%, calc(100% - 1.5px) 62.5%, calc(100% - 2.5px) 68.8%, calc(100% - 2.3px) 75.0%, calc(100% - 2.4px) 81.2%, calc(100% - 0.8px) 87.5%, calc(100% - 1.2px) 93.8%, calc(100% - 1.0px) 100.0%, 93.8% calc(100% - 3.5px), 87.5% calc(100% - 3.8px), 81.2% calc(100% - 0.6px), 75.0% calc(100% - 0.7px), 68.8% calc(100% - 0.9px), 62.5% calc(100% - 0.9px), 56.2% calc(100% - 1.9px), 50.0% calc(100% - 2.4px), 43.8% calc(100% - 1.1px), 37.5% calc(100% - 0.0px), 31.2% calc(100% - 1.7px), 25.0% calc(100% - 1.5px), 18.8% calc(100% - 2.3px), 12.5% calc(100% - 3.8px), 6.2% calc(100% - 2.8px), 0.0% calc(100% - 2.1px), 1.7px 93.8%, 1.9px 87.5%, 0.2px 81.2%, 2.5px 75.0%, 2.2px 68.8%, 2.4px 62.5%, 2.2px 56.2%, 1.1px 50.0%, 1.1px 43.8%, 0.3px 37.5%, 1.8px 31.2%, 0.2px 25.0%, 0.2px 18.8%, 0.6px 12.5%, 0.5px 6.2%); }
.leaf.edge-2 { clip-path: polygon(0.0% 1.4px, 6.2% 0.2px, 12.5% 0.0px, 18.8% 0.6px, 25.0% 0.4px, 31.2% 1.5px, 37.5% 0.1px, 43.8% 3.5px, 50.0% 2.5px, 56.2% 0.6px, 62.5% 1.0px, 68.8% 1.4px, 75.0% 1.5px, 81.2% 0.5px, 87.5% 3.4px, 93.8% 4.0px, 100.0% 1.9px, calc(100% - 1.4px) 6.2%, calc(100% - 0.2px) 12.5%, calc(100% - 0.3px) 18.8%, calc(100% - 1.0px) 25.0%, calc(100% - 0.7px) 31.2%, calc(100% - 2.3px) 37.5%, calc(100% - 0.5px) 43.8%, calc(100% - 0.1px) 50.0%, calc(100% - 2.7px) 56.2%, calc(100% - 1.5px) 62.5%, calc(100% - 0.4px) 68.8%, calc(100% - 1.5px) 75.0%, calc(100% - 0.1px) 81.2%, calc(100% - 1.5px) 87.5%, calc(100% - 2.7px) 93.8%, calc(100% - 2.4px) 100.0%, 93.8% calc(100% - 2.8px), 87.5% calc(100% - 1.0px), 81.2% calc(100% - 1.5px), 75.0% calc(100% - 0.7px), 68.8% calc(100% - 3.1px), 62.5% calc(100% - 2.1px), 56.2% calc(100% - 3.1px), 50.0% calc(100% - 1.3px), 43.8% calc(100% - 0.9px), 37.5% calc(100% - 3.2px), 31.2% calc(100% - 3.9px), 25.0% calc(100% - 3.4px), 18.8% calc(100% - 3.2px), 12.5% calc(100% - 3.3px), 6.2% calc(100% - 3.0px), 0.0% calc(100% - 0.9px), 1.4px 93.8%, 1.0px 87.5%, 0.1px 81.2%, 0.1px 75.0%, 0.8px 68.8%, 0.7px 62.5%, 1.9px 56.2%, 2.7px 50.0%, 1.3px 43.8%, 2.6px 37.5%, 2.8px 31.2%, 2.7px 25.0%, 1.0px 18.8%, 0.6px 12.5%, 0.6px 6.2%); }
.leaf.edge-3 { clip-path: polygon(0.0% 0.8px, 6.2% 0.8px, 12.5% 2.5px, 18.8% 3.6px, 25.0% 3.4px, 31.2% 1.9px, 37.5% 2.6px, 43.8% 3.2px, 50.0% 0.3px, 56.2% 2.6px, 62.5% 3.6px, 68.8% 3.1px, 75.0% 3.0px, 81.2% 1.9px, 87.5% 0.7px, 93.8% 3.2px, 100.0% 1.3px, calc(100% - 2.2px) 6.2%, calc(100% - 2.7px) 12.5%, calc(100% - 1.1px) 18.8%, calc(100% - 1.1px) 25.0%, calc(100% - 2.7px) 31.2%, calc(100% - 2.0px) 37.5%, calc(100% - 0.5px) 43.8%, calc(100% - 0.4px) 50.0%, calc(100% - 0.4px) 56.2%, calc(100% - 2.5px) 62.5%, calc(100% - 2.3px) 68.8%, calc(100% - 0.4px) 75.0%, calc(100% - 2.3px) 81.2%, calc(100% - 2.7px) 87.5%, calc(100% - 1.8px) 93.8%, calc(100% - 1.0px) 100.0%, 93.8% calc(100% - 2.2px), 87.5% calc(100% - 0.5px), 81.2% calc(100% - 0.1px), 75.0% calc(100% - 3.9px), 68.8% calc(100% - 2.6px), 62.5% calc(100% - 2.1px), 56.2% calc(100% - 3.7px), 50.0% calc(100% - 1.7px), 43.8% calc(100% - 3.5px), 37.5% calc(100% - 3.3px), 31.2% calc(100% - 0.8px), 25.0% calc(100% - 1.0px), 18.8% calc(100% - 1.2px), 12.5% calc(100% - 1.0px), 6.2% calc(100% - 2.3px), 0.0% calc(100% - 1.0px), 1.2px 93.8%, 0.4px 87.5%, 2.5px 81.2%, 1.0px 75.0%, 1.3px 68.8%, 1.6px 62.5%, 2.5px 56.2%, 1.2px 50.0%, 2.6px 43.8%, 1.4px 37.5%, 1.5px 31.2%, 1.5px 25.0%, 0.1px 18.8%, 1.2px 12.5%, 0.5px 6.2%); }

/* Câu bỏ dở: người viết dừng bút, phần dưới tờ để trống */
.leaf--unfinished { padding-bottom: 9rem; }

/* ---- Nét gạch xóa của người viết: một nét bút lông cho mỗi dòng ---- */
.leaf s, .leaf del {
  text-decoration: none;
  color: color-mix(in srgb, var(--paper-ink, #3a2d20) 55%, transparent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 20' preserveAspectRatio='none'%3E%3Cfilter id='d'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8 .35' numOctaves='2' seed='3'/%3E%3CfeDisplacementMap in='SourceGraphic' scale='2.6'/%3E%3C/filter%3E%3Cpath filter='url%28%23d%29' d='M1 5.5C30 2 72 4.3 114 6.4S177 8.8 199 9.9L199 11.3C173 12.1 133 13.6 97 15.1S31 19 2 18Z' fill='%232a1f14' fill-opacity='.7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 100% .62em;
  background-position: 0 56%;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  padding: 0 .1em;
}

/* ---- Hư hao do thời gian ---- */
/* Phai mực: nhạt dần không đều, đọc được nếu cố */
.damage--fade {
  color: transparent;
  background-image: linear-gradient(97deg,
    color-mix(in srgb, var(--paper-ink) 85%, transparent) 0%,
    color-mix(in srgb, var(--paper-ink) 35%, transparent) 20%,
    color-mix(in srgb, var(--paper-ink) 55%, transparent) 38%,
    color-mix(in srgb, var(--paper-ink) 22%, transparent) 60%,
    color-mix(in srgb, var(--paper-ink) 45%, transparent) 80%,
    color-mix(in srgb, var(--paper-ink) 28%, transparent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* Nhòe: chữ lem, mất nét */
.damage--smudge {
  color: color-mix(in srgb, var(--paper-ink) 60%, transparent);
  filter: blur(1.3px);
  text-shadow:
    .18em .06em .35em color-mix(in srgb, var(--paper-ink) 55%, transparent),
    -.12em -.04em .25em color-mix(in srgb, var(--paper-ink) 35%, transparent);
}

/* Ố nước: tâm vết làm nhạt chữ, viền loang nâu đậm, chữ ở rìa vẫn đọc được */
.damage--stain { position: relative; }
.damage--stain::before,
.damage--stain::after {
  content: "";
  position: absolute;
  inset: -1em -1.4em;
  border-radius: 47% 53% 45% 55% / 55% 45% 58% 42%;
  pointer-events: none;
}
.damage--stain::before {
  background: radial-gradient(closest-side,
    color-mix(in srgb, var(--paper-color) 72%, transparent) 0%,
    color-mix(in srgb, var(--paper-color) 50%, transparent) 45%,
    transparent 75%);
}
.damage--stain::after {
  background: radial-gradient(closest-side,
    rgb(150 105 45 / .12) 0%,
    rgb(150 105 45 / .14) 62%,
    rgb(120 80 30 / .42) 80%,
    rgb(120 80 30 / .12) 88%,
    transparent 93%);
  mix-blend-mode: multiply;
}

/* Cháy mép: cả tờ, phần cuối sẫm dần rồi mất */
.leaf--burn {
  -webkit-mask-image: linear-gradient(#000 0 0), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 40' preserveAspectRatio='none'%3E%3Cfilter id='b'%3E%3CfeGaussianBlur stdDeviation='.6'/%3E%3C/filter%3E%3Cpath filter='url%28%23b%29' d='M0 0H100V14L96 19 91 15 86 24 80 18 74 27 69 21 63 30 57 22 51 28 45 19 39 26 33 17 27 25 21 16 15 23 9 15 4 21 0 16Z'/%3E%3C/svg%3E");
  mask-image: linear-gradient(#000 0 0), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 40' preserveAspectRatio='none'%3E%3Cfilter id='b'%3E%3CfeGaussianBlur stdDeviation='.6'/%3E%3C/filter%3E%3Cpath filter='url%28%23b%29' d='M0 0H100V14L96 19 91 15 86 24 80 18 74 27 69 21 63 30 57 22 51 28 45 19 39 26 33 17 27 25 21 16 15 23 9 15 4 21 0 16Z'/%3E%3C/svg%3E");
  -webkit-mask-size: 100% calc(100% - 4rem + 2px), 100% 4rem;
  mask-size: 100% calc(100% - 4rem + 2px), 100% 4rem;
  -webkit-mask-position: top, bottom;
  mask-position: top, bottom;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}
.leaf--burn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom,
    transparent 55%,
    rgb(120 70 25 / .20) 68%,
    rgb(70 35 12 / .78) 80%,
    #1e140c 88%);
  pointer-events: none;
}

/* ---- Điều hướng ở đáy ---- */
.manuscript-nav {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  padding: 2rem 1rem 3rem;
  font: .8rem/1.4 system-ui, sans-serif;
}
.manuscript-nav a { color: rgb(217 205 178 / .45); text-decoration: none; }

/* ---- Chỗ dành sẵn cho các tài liệu sau (chưa có giao diện) ----
   .leaf .margin-note  lời chú bên lề gắn với một đoạn
   .leaf .hand-N       bàn tay viết thứ N (phông, màu mực riêng)
   .leaf .scraped      vết cạo */

/* ======================================================================
   Chế độ lật trang (script đã chạy: html.ms-paged)
   ====================================================================== */
html.ms-paged, html.ms-paged body { height: 100%; overflow: hidden; }
html.ms-paged .ms { max-width: none; padding: 0; }

/* Bản gốc: ẩn khỏi mắt nhưng trình đọc màn hình vẫn đọc */
html.ms-paged .ms-source {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
html.ms-paged .ms > .manuscript-nav { display: none; }

html.ms-paged .manuscript-title {
  position: fixed;
  inset: 0 0 auto;
  margin: 0;
  height: var(--title-h, 56px);
  display: grid;
  place-items: center;
  font-size: clamp(1.8rem, 7vh, 2.6rem);
  z-index: 1;
  pointer-events: none;
}

.ms-desk {
  position: fixed;
  inset: 0;
  touch-action: pinch-zoom;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Sân khấu: các tờ nằm ở khổ cố định, cả sân khấu thu/phóng theo --k (manuscript.js) */
.ms-stage {
  position: absolute;
  left: 50%;
  top: calc(var(--title-h) + 14px);
  width: 0;
  height: 0;
  transform: scale(var(--k, 1));
  transform-origin: 0 0;
}
.sheet {
  position: absolute;
  left: 0;
  top: 0;
  filter: drop-shadow(0 6px 9px rgb(0 0 0 / .45)) drop-shadow(0 1px 1px rgb(0 0 0 / .5));
  transition: transform .7s cubic-bezier(.45, .05, .2, 1), filter .7s;
  will-change: transform; /* lật mượt; khi phóng to thì bỏ (xem html.is-zoomed bên dưới) */
}
.sheet.no-anim { transition: none; }
.sheet.lifted { filter: drop-shadow(0 18px 22px rgb(0 0 0 / .5)) drop-shadow(0 2px 3px rgb(0 0 0 / .4)); }
.sheet[hidden] { display: none; }
/* Đang phóng to (html.is-zoomed): chỉ vẽ tờ đang đọc, bỏ bóng đổ — đỡ cho máy phải vẽ lại
   mấy tờ chồng bên dưới ở độ nét cao (Ký Sự từng đơ khi phóng). */
html.is-zoomed .sheet:not(.cur) { visibility: hidden; }
html.is-zoomed .sheet { filter: none; will-change: auto; }

.sheet-paper {
  width: 100%;
  height: 100%;
  padding: 1.4rem 1.2rem;
  box-sizing: border-box;
  overflow: hidden;
}
/* Đốm ố: hai ảnh lặp làm sẵn, vị trí lấy mẫu do script bốc thăm */
.sheet-fox,
.sheet-fresh {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.sheet-fox {
  background-image: url("/theme/img/wear/fox-spots.webp"), url("/theme/img/wear/fox-blotch.webp");
  background-size: 384px 384px, 512px 512px;
}
/* Mép sẫm do thời gian. Vẽ bằng dải chuyển màu thay vì box-shadow inset (bóng mờ phải tính lại
   rất lâu khi phóng to bằng hai ngón); nhìn gần như y hệt. */
.sheet-fox::after {
  content: "";
  position: absolute;
  inset: 0;
  --e1: rgb(90 60 24 / .3);
  --e2: rgb(90 60 24 / .28);
  background:
    linear-gradient(to right, var(--e1), transparent 7px), linear-gradient(to left, var(--e1), transparent 7px),
    linear-gradient(to bottom, var(--e1), transparent 7px), linear-gradient(to top, var(--e1), transparent 7px),
    linear-gradient(to right, var(--e2), rgb(90 60 24 / .1) 14px, transparent 36px),
    linear-gradient(to left, var(--e2), rgb(90 60 24 / .1) 14px, transparent 36px),
    linear-gradient(to bottom, var(--e2), rgb(90 60 24 / .1) 14px, transparent 36px),
    linear-gradient(to top, var(--e2), rgb(90 60 24 / .1) 14px, transparent 36px);
}
/* Giấy lúc mới: trắng sáng, che hết dấu thời gian */
.sheet-fresh { background: #f6f1e4; opacity: 0; }

.sheet-body {
  position: relative;
  height: 100%;
  overflow: hidden;
  font-family: "Kolker Brush", "Noto Serif", serif;
  font-size: var(--fs, 22px);
  line-height: 1.38;
}
.sheet-body p { margin: 0; text-indent: 1.4em; }
.sheet-body p.cont,
.sheet.first .sheet-body > p:first-child { text-indent: 0; }
.sheet-wear {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ---- Tờ chưa đọc → hiệu ứng lão hóa → đã đọc ----
   Tổng 2,5 giây (khớp AGE_MS trong manuscript.js):
   0–1,2s giấy cũ đi, 0,3–1,2s hư hao hiện, 0,4–1,2s cháy/rách ăn vào, 1,2–2,5s cả trang chữ hiện dần cùng lúc */
.sheet.fresh .sheet-fresh { opacity: 1; }
.sheet.fresh .sheet-wear { opacity: 0; }
.sheet.fresh .sheet-body { opacity: 0; }

.sheet.aging .sheet-fresh { transition: opacity 1.2s ease-in; }
.sheet.aging .sheet-wear { transition: opacity .9s ease .3s; }
.sheet.aging .sheet-paper { transition: clip-path .8s cubic-bezier(.5, 0, .3, 1) .4s; }
.sheet.aging .sheet-body { transition: opacity 1.3s ease-in-out 1.2s; }

/* Hết tờ: chỉ còn mặt bàn và link nhỏ */
.ms-end {
  position: absolute;
  left: 50%;
  top: calc(var(--title-h) + 14px + var(--sh) / 2);
  translate: -50% -50%;
  opacity: 0;
  pointer-events: none;
  transition: opacity .6s .3s;
}
.ms-desk.two .ms-end { left: calc(50% + var(--sw) / 2 + var(--gap) / 2); }
.ms-desk.at-end .ms-end { opacity: 1; pointer-events: auto; }
.ms-end .manuscript-nav { flex-direction: column; align-items: center; gap: .8rem; padding: 0; }

/* Bản quyền: ở chế độ lật trang chỉ hiện khi đã đến tờ cuối */
.page-manuscript .site-copy { color: rgb(217 205 178); }
html.ms-paged .site-copy { display: none; }
html.ms-paged:has(.ms-desk.at-end) .site-copy {
  display: block; position: fixed; left: 0; right: 0;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  padding: 0; opacity: .3;
}
/* Hai tờ song song: tờ cuối nằm bên trái, dòng bản quyền sang nửa phải (dưới link quay về) */
html.ms-paged:has(.ms-desk.two.at-end) .site-copy { left: 50%; }

@media (prefers-reduced-motion: reduce) {
  .sheet, .ms-end { transition: none; }
}

/* notebook.css */
/* Khuôn notebook: cuốn sổ đóng chỉ đặt trên mặt bàn, lật trang quanh gáy.
   Biến riêng của khuôn mang tiền tố --nb- (bài học @property: không dùng tên chung). */

body.page-notebook {
  color-scheme: dark;
  background-color: #1c1814;
  background-image:
    radial-gradient(ellipse at 50% 35%, #2a241d 0%, transparent 70%),
    linear-gradient(#1c1814, #17130f);
  background-attachment: fixed;
  color: #d9cdb2;
  overflow-x: clip;
  --nb-ink: #2a2118;
  --nb-son: #8a2a1e;
  --nb-paper: #e9dfc6;
  --nb-paper-old: #d3c099;
}

/* ======================================================================
   Bản gốc (không có script, hoặc trình đọc màn hình): sổ trải dài, cuộn được
   ====================================================================== */
.nb { max-width: 34rem; margin: 0 auto; padding: 2rem .7rem 4rem; }
.nb-cover-src { text-align: center; margin: 1rem 0 2rem; }
.nb-cover-title { margin: 0; font: 400 clamp(2.4rem, 11vw, 3.4rem)/1.1 "Kolker Brush", "Noto Serif", serif; }
.nb-cover-volume { margin: .3rem 0 0; font: 1.3rem "Kolker Brush", serif; opacity: .7; }
.nb-source {
  background: var(--nb-paper);
  color: var(--nb-ink);
  padding: 1.6rem 1.2rem;
  font: 1.25rem/1.4 "Kolker Brush", "Noto Serif", serif;
  box-shadow: 0 8px 18px rgb(0 0 0 / .45);
}
.nb-source .nb-entry + .nb-entry { margin-top: 1rem; }
.nb-source .nb-stain, .nb-source .nb-break { display: none; }
.nb-source .nb-insert { margin: .8rem 0; padding: .7rem .9rem; background: #f0e8d4; box-shadow: 0 2px 6px rgb(0 0 0 / .2); font-size: .9em; }
.nb-source .nb-insert::before { content: attr(data-label); display: block; font-size: .8em; opacity: .6; }
.nb-source .nb-ledger { margin-top: 2rem; padding-top: 1rem; border-top: 1px dashed rgb(42 33 24 / .3); }
.nb-nav { display: flex; justify-content: center; gap: 1.4rem; padding: 2rem 0 0; font: .8rem/1.4 system-ui, sans-serif; }
.nb-nav a { color: rgb(217 205 178 / .5); text-decoration: none; }

/* ======================================================================
   Chữ trong sổ (dùng chung cho bản gốc và bản lật trang)
   ====================================================================== */
.nb p { margin: 0; text-indent: 1.2em; }
.nb .nb-date { text-indent: 0; margin-top: .55em; font-size: .9em; opacity: .85; }
.nb .nb-first.nb-date, .nb-body > :first-child { margin-top: 0; }
.nb s, .nb del {
  text-decoration: line-through;
  text-decoration-thickness: .11em;
  text-decoration-color: rgb(30 22 15 / .8);
  opacity: .8;
}
.nb .ink-son { color: var(--nb-son); }
.nb .ink-hand-4 { font-size: 1.45em; letter-spacing: .02em; text-shadow: 0 0 .5px currentColor; }

/* Lời phê đọc lại: mực son, nhỏ, viết vội */
.nb .nb-note {
  margin: .15em 0 .35em 1.4em;
  color: var(--nb-son);
  font-size: .8em;
  line-height: 1.22;
  rotate: -1deg;
}
.nb .nb-note p { text-indent: 0; }

/* Nét chữ theo thời gian: 1 cẩn thận → 4 run nặng */
.nb .hand-1 { color: #2a2118; }
.nb .hand-2 { color: #3a2c1e; font-size: 1.04em; line-height: 1.42; word-spacing: .06em; }
.nb .hand-3 { color: #241a12; font-size: 1.1em; line-height: 1.48; word-spacing: .1em; }
.nb .hand-4 { color: #1c140d; font-size: 1.26em; line-height: 1.56; word-spacing: .14em; text-shadow: 0 0 .5px currentColor; }
/* nét run: xem effects.css (.fx-w) */
.nb .nb-note.hand-1, .nb .nb-note.hand-2, .nb .nb-note.hand-3, .nb .nb-note.hand-4 { color: var(--nb-son); }

/* Hình vẽ phác */
.nb-sketch { margin: .35em 0 .5em; }
.nb-sketch svg { display: block; margin: 0 auto; width: 100%; height: auto; max-height: min(70vh, calc(var(--ph, 100vh) * .56)); }
.nb-sketch text { font-family: "Kolker Brush", "Noto Serif", serif; fill: var(--nb-ink); }

/* Trang kẻ bảng: danh sách ca */
.nb .nb-row { text-indent: -1.3em; padding-left: 1.3em; font-size: .7em; line-height: 1.2; }
.nb .nb-row-head, .nb-source .nb-ledger > p:first-child { text-indent: 0; text-align: center; font-size: .95em; margin-bottom: .25em; }

/* ======================================================================
   Chế độ lật trang (script đã chạy: html.nb-paged)
   ====================================================================== */
html.nb-paged, html.nb-paged body { height: 100%; overflow: hidden; }
html.nb-paged .nb { max-width: none; padding: 0; }
html.nb-paged .nb-source,
html.nb-paged .nb-cover-src {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
html.nb-paged .nb > .nb-nav { display: none; }
html.nb-paged .nb-note { opacity: 0; transition: opacity 1.8s ease-in .3s; }
html.nb-paged .nb-note.on { opacity: 1; }

.nb-desk {
  position: fixed;
  inset: 0;
  touch-action: pinch-zoom;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.nb-book {
  position: absolute;
  left: 50%;
  top: max(10px, calc((100dvh - var(--ph) - 40px) / 2));
  width: var(--pw);
  height: var(--ph);
  margin-left: calc(var(--pw) / -2);
  perspective: 2400px;
  transition: transform .9s cubic-bezier(.45, .05, .2, 1);
}
.nb-desk.two .nb-book { width: calc(var(--pw) * 2); margin-left: calc(var(--pw) * -1); }
.nb-leaf {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--pw);
  height: var(--ph);
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform .9s cubic-bezier(.45, .05, .2, 1);
}
.nb-desk.two .nb-leaf { left: var(--pw); }
.nb-leaf.flipped { transform: rotateY(-180deg); }
.nb-leaf.no-anim, .nb-book.no-anim { transition: none; }
.nb-leaf[hidden] { display: none; }
.nb-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.nb-face.back { transform: rotateY(180deg); }
/* mặt úp không nhận chạm (Chrome vẫn tính chạm cho mặt bị ẩn) */
.nb-leaf:not(.flipped) > .back, .nb-leaf.flipped > .front { pointer-events: none; }

/* ---- Trang giấy ---- */
.nb-page { position: relative; color: var(--nb-ink); }
.nb-paper {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 30px 24px 20px;
  box-sizing: border-box;
  overflow: hidden;
  background-color: color-mix(in srgb, var(--nb-paper), var(--nb-paper-old) calc(var(--age, 0) * 70%));
  box-shadow: 0 6px 14px rgb(0 0 0 / .42), 0 1px 2px rgb(0 0 0 / .4);
}
/* bóng gáy: phía gáy sẫm hơn */
.nb-paper::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(to right, rgb(70 48 24 / .28), transparent 34px);
  box-shadow: inset 0 0 30px rgb(90 60 24 / .3);
}
.side-l .nb-paper::after { background: linear-gradient(to left, rgb(70 48 24 / .28), transparent 34px); }
.nb-fox {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url("/theme/img/wear/fox-spots.webp"), url("/theme/img/wear/fox-blotch.webp");
  background-size: 384px 384px, 512px 512px;
  mix-blend-mode: multiply;
}
/* hạt giấy rất nhẹ (ảnh làm sẵn, không bộ lọc) */
.nb-paper::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: url("/theme/img/grain.webp");
  opacity: .07;
}
.nb-spine { position: absolute; top: 0; bottom: 0; left: 0; width: 22px; background-repeat: no-repeat; pointer-events: none; z-index: 2; }
.side-l .nb-spine { left: auto; right: 0; transform: scaleX(-1); }
.nb-year {
  position: absolute;
  top: 9px;
  right: 22px;
  font: 15px/1 "Kolker Brush", "Noto Serif", serif;
  color: rgb(42 33 24 / .55);
}
.side-l .nb-year { right: auto; left: 22px; }
.nb-body {
  position: relative;
  height: 100%;
  overflow: hidden;
  font-family: "Kolker Brush", "Noto Serif", serif;
  font-size: var(--fs, 18px);
  line-height: 1.34;
}
.nb-marks { position: absolute; top: 30px; left: 24px; right: 24px; bottom: 20px; pointer-events: none; }

/* ---- Vết trên trang (CSS thuần, không bộ lọc) ---- */
.nb-mark { position: absolute; display: block; mix-blend-mode: multiply; transform-origin: center; }
.nb-mark.k-tea {
  width: 92px; height: 92px; margin: -46px 0 0 -20px;
  background: radial-gradient(circle, transparent 53%, rgb(122 82 34 / .3) 56%, rgb(122 82 34 / .14) 61%, transparent 66%);
  border-radius: 50%;
}
.nb-mark.k-blood {
  width: 46px; height: 56px; margin: -20px 0 0 -10px;
  background:
    radial-gradient(ellipse 38% 42% at 50% 58%, rgb(84 20 12 / .78), rgb(84 20 12 / .55) 62%, transparent 74%),
    radial-gradient(circle at 82% 14%, rgb(84 20 12 / .6) 0 4%, transparent 6%),
    radial-gradient(circle at 14% 84%, rgb(84 20 12 / .5) 0 3%, transparent 5%),
    radial-gradient(circle at 70% 92%, rgb(84 20 12 / .45) 0 2.5%, transparent 4.5%);
}
.nb-mark.k-sweat {
  width: 150px; height: 64px; margin: -20px 0 0 -30px;
  background:
    radial-gradient(ellipse 50% 38% at 45% 50%, rgb(28 24 20 / .26), transparent 70%),
    radial-gradient(ellipse 30% 26% at 70% 60%, rgb(28 24 20 / .2), transparent 70%);
}
.nb-mark.k-thumb {
  width: 36px; height: 48px; margin: -10px 0 0 0;
  border-radius: 50%;
  background: repeating-radial-gradient(ellipse 50% 64% at 50% 56%, rgb(30 22 15 / .38) 0 1.1px, transparent 1.1px 3px);
  -webkit-mask: radial-gradient(ellipse 50% 50%, #000 52%, transparent 74%);
  mask: radial-gradient(ellipse 50% 50%, #000 52%, transparent 74%);
}

/* ---- Bìa: giấy chàm cũ, dải tên dán dọc ---- */
.nb-cover .nb-paper {
  padding: 0;
  background-color: #2d3442;
  background-image:
    radial-gradient(ellipse at 30% 25%, rgb(255 255 255 / .06), transparent 55%),
    radial-gradient(ellipse at 80% 85%, rgb(0 0 0 / .25), transparent 55%);
  box-shadow: 0 8px 18px rgb(0 0 0 / .5), inset 0 0 40px rgb(0 0 0 / .45), inset 0 0 0 1px rgb(255 255 255 / .05);
}
.nb-cover .nb-paper::after { background: linear-gradient(to right, rgb(0 0 0 / .35), transparent 30px); box-shadow: none; }
.nb-cover.side-l .nb-paper::after { background: linear-gradient(to left, rgb(0 0 0 / .35), transparent 30px); }
.nb-slip {
  position: absolute;
  top: 9%;
  left: 46px;
  width: 74px;
  padding: 16px 0 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: #e2d5b6;
  box-shadow: 0 1px 3px rgb(0 0 0 / .4);
  color: #2a2118;
  font-family: "Kolker Brush", "Noto Serif", serif;
  rotate: -.6deg;
}
.nb-slip b { display: flex; flex-direction: column; align-items: center; font-weight: 400; font-size: 34px; line-height: 1; }
.nb-slip small { display: flex; flex-direction: column; align-items: center; margin-top: 8px; font-size: 17px; line-height: 1.05; opacity: .75; }

/* ---- Vật kẹp: ló lên ở mép trên trang, chạm để xem ---- */
.nb-tab {
  position: absolute;
  top: -19px;
  z-index: 3;
  padding: 0;
  border: 0;
  cursor: pointer;
  rotate: var(--tr, 0deg);
  -webkit-tap-highlight-color: transparent;
}
/* vùng chạm rộng hơn phần ló ra */
.nb-tab::before { content: ""; position: absolute; inset: -14px -10px 0; }
.nb-tab.k-slip {
  width: 50px; height: 34px;
  background: #efe6cf repeating-linear-gradient(transparent 0 6px, rgb(42 33 24 / .18) 6px 7px);
  box-shadow: 0 -1px 3px rgb(0 0 0 / .3);
}
.nb-tab.k-root {
  width: 36px; height: 24px; top: -15px;
  border-radius: 45% 60% 50% 40%;
  background: radial-gradient(ellipse at 40% 40%, #b8925c, #7d5d35);
  box-shadow: 0 -1px 2px rgb(0 0 0 / .35);
}
.nb-tab.k-fur {
  width: 44px; height: 26px; top: -17px;
  background:
    linear-gradient(100deg, transparent 46%, #a8362a 46% 52%, transparent 52%),
    repeating-linear-gradient(80deg, #8a7d68 0 1px, #bfb39b 1px 2px, transparent 2px 4px);
  border-radius: 40% 40% 20% 20%;
  opacity: .9;
}

.nb-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgb(10 8 6 / .74);
  opacity: 0;
  transition: opacity .35s;
}
.nb-overlay.open { opacity: 1; }
.nb-overlay[hidden] { display: none; }
.nb-item {
  position: relative;
  width: min(92vw, 430px);
  max-height: 86dvh;
  overflow: auto;
  padding: 26px 22px 22px;
  box-sizing: border-box;
  background: #efe6cf;
  color: var(--nb-ink);
  font: 18px/1.36 "Kolker Brush", "Noto Serif", serif;
  box-shadow: 0 10px 30px rgb(0 0 0 / .6);
  touch-action: pan-y pinch-zoom;
  rotate: -.8deg;
}
.nb-item.k-slip { background-image: linear-gradient(transparent calc(50% - 1px), rgb(90 60 24 / .18) 50%, transparent calc(50% + 1px)) ; }
.nb-item p { text-indent: 0; margin: 0 0 .5em; }
.nb-item .nb-sketch svg { max-height: 40dvh; }
.nb-close {
  position: absolute;
  top: 4px;
  right: 8px;
  border: 0;
  background: none;
  color: rgb(42 33 24 / .55);
  font: 26px/1 system-ui, sans-serif;
  cursor: pointer;
}

/* Đầu và cuối sổ: link nhỏ dưới mặt bàn */
.nb-end {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  opacity: 0;
  pointer-events: none;
  transition: opacity .6s .3s;
}
.nb-desk.at-start .nb-end, .nb-desk.at-end .nb-end { opacity: 1; pointer-events: auto; }
.nb-end .nb-nav { padding: 0; }

/* Bản quyền: ở chế độ lật trang chỉ hiện khi đã gấp sổ lại ở cuối */
.page-notebook .site-copy { color: rgb(217 205 178); }
html.nb-paged .page-notebook .site-copy { display: none; }
html.nb-paged .page-notebook:has(.nb-desk.at-end) .site-copy {
  display: block; position: fixed; left: 0; right: 0;
  bottom: calc(30px + env(safe-area-inset-bottom, 0px));
  padding: 0; opacity: .3;
}

@media (prefers-reduced-motion: reduce) {
  .nb-leaf, .nb-book, .nb-end, .nb-overlay { transition: none; }
  html.nb-paged .nb-note { transition: none; }
}

/* notes.css */
/* Tờ giấy đính kèm (theme/js/notes.js). Tiền tố riêng: nt-. Màu theo ba thế giới, không theo khuôn,
   nên thêm khuôn mới không phải vẽ lại. Mặc định (Tu Tiên): giấy dó, mực nâu, dấu son. */
.nt {
  --nt-paper: #ebe1c8;
  --nt-paper-edge: #d6c7a2;
  --nt-ink: #2b2118;
  --nt-ink-soft: #6b5a45;
  --nt-rule: rgb(107 90 69 / .22);
  --nt-accent: #9b2c1f;
  --nt-accent-ink: #f6ecd8;
  --nt-title-font: "Kolker Brush", "Noto Serif", serif;
  --nt-title-size: 2.1rem;
  --nt-font: "Noto Serif", Georgia, serif;
}
.world-magic .nt {
  --nt-paper: #e9d7b1;
  --nt-paper-edge: #cdb486;
  --nt-ink: #2b1d10;
  --nt-ink-soft: #6d5438;
  --nt-rule: rgb(109 84 56 / .25);
  --nt-accent: #5b2a4a;
  --nt-title-font: "Noto Serif", Georgia, serif;
  --nt-title-size: 1.35rem;
}
.world-science .nt {
  --nt-paper: #0d171b;
  --nt-paper-edge: #1f3a43;
  --nt-ink: #9fe6f5;
  --nt-ink-soft: #5f97a4;
  --nt-rule: rgb(143 227 245 / .16);
  --nt-accent: #2fb7d4;
  --nt-accent-ink: #04161b;
  --nt-title-font: ui-monospace, "Cascadia Mono", monospace;
  --nt-title-size: 1.05rem;
  --nt-font: ui-monospace, "Cascadia Mono", monospace;
}

.nt[hidden] { display: none; }

/* ---- Nút: miếng dán đánh dấu ở giữa mép phải ----
   Bình thường chỉ thấy một dải son hẹp (miếng dán) thò ra ở mép màn hình, không che chữ.
   Chạm lần 1 (.nt-out): cả mẩu giấy trượt ra, thấy chữ "Lời khách đề" và số lời. Chạm lần 2: mở tờ giấy.
   Cấu trúc: [dải dán 14px][phần giấy có chữ]. Thu về = đẩy sang phải, chỉ còn dải dán trong màn hình. */
.nt-tab {
  --nt-flag: 14px;
  position: fixed; z-index: 60;
  right: 0; top: 50%;
  display: flex; align-items: stretch;
  height: 54px; padding: 0; margin: 0;
  border: 0; background: none; color: var(--nt-ink);
  translate: calc(100% - var(--nt-flag) - env(safe-area-inset-right, 0px)) -50%;
  cursor: pointer; text-align: left;
  -webkit-tap-highlight-color: transparent;
  transition: translate .35s cubic-bezier(.3, .7, .3, 1);
}
/* Vùng chạm rộng hơn dải dán một chút (trong suốt) cho dễ bấm */
.nt-tab::before { content: ""; position: absolute; top: -10px; bottom: -10px; left: -18px; width: 18px; }
.nt-tab.nt-out { translate: calc(0px - env(safe-area-inset-right, 0px)) -50%; }
.nt-flag {
  flex: none; width: var(--nt-flag);
  background:
    repeating-linear-gradient(to bottom, transparent 0 5px, rgb(255 255 255 / .12) 5px 6px),
    var(--nt-accent);
  border-radius: 2px 0 0 2px;
  box-shadow: -1px 1px 4px rgb(0 0 0 / .45);
  opacity: .92;
}
.nt-slip {
  display: flex; align-items: center; gap: .55rem;
  padding: 0 1rem 0 .75rem;
  background: var(--nt-paper);
  box-shadow: inset 0 0 0 1px var(--nt-paper-edge), 0 2px 10px rgb(0 0 0 / .45);
}
.nt-tab:focus-visible { outline: none; }
.nt-tab:focus-visible .nt-slip { outline: 2px solid var(--nt-accent); outline-offset: -4px; }
.nt-tab-label { white-space: nowrap; font: 400 24px/1 var(--nt-title-font); }
.world-magic .nt-tab-label { font-size: 15px; }
.world-science .nt-tab-label { font-size: 12px; letter-spacing: .04em; }
.nt-count:empty { display: none; }
.nt-count {
  flex: none; min-width: 22px; height: 22px; padding: 0 4px; border-radius: 3px;
  background: var(--nt-accent); color: var(--nt-accent-ink);
  font: 12px/22px var(--nt-font); text-align: center;
  rotate: -6deg;
}
.world-science .nt-count { border-radius: 2px; rotate: 0deg; }
html.is-zoomed .nt-tab { display: none; }

/* ---- Tờ giấy ---- */
.nt-sheet {
  width: min(34rem, calc(100vw - 20px));
  max-height: calc(100dvh - 24px);
  padding: 0; border: 0; background: transparent; color: var(--nt-ink);
  overflow: visible;
}
.nt-sheet::backdrop { background: rgb(5 6 8 / .62); }
.nt-sheet[open] { animation: nt-in .28s ease-out; }
@keyframes nt-in { from { opacity: 0; translate: 0 14px; rotate: -1deg; } }

.nt-paper {
  position: relative;
  max-height: calc(100dvh - 24px);
  overflow-y: auto; overscroll-behavior: contain;
  padding: 1.4rem 1.2rem 1.2rem;
  background: var(--nt-paper);
  border: 1px solid var(--nt-paper-edge);
  border-radius: 2px;
  font: 15px/1.6 var(--nt-font);
  box-shadow: 0 10px 30px rgb(0 0 0 / .45);
}
.nt-close {
  position: absolute; top: .3rem; right: .3rem;
  width: 44px; height: 44px; padding: 0;
  border: 0; background: none; color: var(--nt-ink-soft);
  font: 26px/1 var(--nt-font); cursor: pointer;
}
.nt-title {
  margin: 0 2.4rem .2rem 0;
  font: 400 var(--nt-title-size)/1.15 var(--nt-title-font);
  color: var(--nt-ink);
}
.nt-intro { margin: 0 0 1rem; font-size: 13px; color: var(--nt-ink-soft); }

/* Lời của khách: mỗi lời một nét tay (.nt-hand-0…5), một màu mực (.nt-ink-0…2), nghiêng và lệch
   một chút (--nt-tilt, --nt-shift). Máy chọn theo số thứ tự của lời nên lời nào cũng giữ nguyên nét. */
.nt-list { list-style: none; margin: 0 0 .4rem; padding: 0; }
.nt-item {
  padding: .55rem 0 .65rem;
  margin-left: var(--nt-shift, 0px);
  rotate: var(--nt-tilt, 0deg);
  color: var(--nt-hand-ink, var(--nt-ink));
}
.nt-item + .nt-item { border-top: 1px dashed var(--nt-rule); }
.nt-body { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.nt-hand-0 .nt-body { font: 17px/1.45 "Shantell Sans", var(--nt-font); }
.nt-hand-1 .nt-body { font: 20px/1.4 "Twinkle Star", var(--nt-font); }
.nt-hand-2 .nt-body { font: 21px/1.35 "Charmonman", var(--nt-font); }
.nt-hand-3 .nt-body { font: 23px/1.3 "Meow Script", var(--nt-font); }
.nt-hand-4 .nt-body { font: 24px/1.3 "Birthstone", var(--nt-font); }
.nt-hand-5 .nt-body { font: 22px/1.35 "My Soul", var(--nt-font); }
.nt-ink-0 { --nt-hand-ink: #231a12; } /* mực đen */
.nt-ink-1 { --nt-hand-ink: #5a3d22; } /* mực nâu */
.nt-ink-2 { --nt-hand-ink: #8c3324; } /* son nhạt */
.world-magic .nt-ink-2 { --nt-hand-ink: #4b2a52; } /* Ma Pháp: mực tím */
/* Khoa Học: màn hình, không có nét tay */
.world-science .nt-item { rotate: none; margin-left: 0; --nt-hand-ink: var(--nt-ink); }
.world-science .nt-item .nt-body { font: 15px/1.6 var(--nt-font); }
.nt-status { margin: .6rem 0; font-size: 14px; font-style: italic; color: var(--nt-ink-soft); }
.nt-status:empty, .nt-status[hidden] { display: none; }

/* ---- Ô viết ---- */
.nt-form { margin-top: 1.1rem; display: grid; gap: .7rem; }
.nt-field { display: grid; gap: .2rem; font-size: 12px; color: var(--nt-ink-soft); }
.nt-field input, .nt-field textarea {
  width: 100%; padding: .55rem .6rem;
  border: 1px solid var(--nt-rule); border-radius: 2px;
  background: rgb(255 255 255 / .28); color: var(--nt-ink);
  font: 16px/1.5 var(--nt-font); /* 16px: Chrome điện thoại không tự phóng khi chạm vào ô */
}
.world-science .nt-field input, .world-science .nt-field textarea { background: rgb(143 227 245 / .05); }
.nt-field textarea { resize: vertical; min-height: 5.5em; }
.nt-field input:focus, .nt-field textarea:focus { outline: 2px solid var(--nt-accent); outline-offset: 0; border-color: transparent; }
.nt-field ::placeholder { color: var(--nt-ink-soft); opacity: .7; }
.nt-trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.nt-check:empty { display: none; }
.nt-msg { margin: 0; font-size: 13px; color: var(--nt-accent); }
.nt-msg:empty { display: none; }
.nt-send {
  justify-self: end; min-height: 44px; padding: .5rem 1.3rem;
  border: 0; border-radius: 2px;
  background: var(--nt-accent); color: var(--nt-accent-ink);
  font: 15px/1.2 var(--nt-font); cursor: pointer;
}
.nt-send:disabled { opacity: .6; cursor: wait; }

/* saoluc.css */
/* Khuôn sao lục: bản chép của người thủ thư Tàng Kinh Các. Tiền tố sl-.
   Một tờ giấy ngà, cuộn dọc, không lật. Mọi chữ chép và lời phê cùng một nét: Alex Brush
   (người thủ thư: chữ đẹp, nét thanh nét đậm). Lời phê màu son, có vòng khuyên ở đầu. */
body.page-saoluc.world-cultivation { background: #4f564a; }

.sl { padding: 2.2rem .9rem 1rem; }
.sl-sheet {
  max-width: 36rem; margin: 0 auto;
  padding: 2.2rem 1.45rem 1.7rem;
  color: #2b2117;
  background:
    radial-gradient(ellipse at 25% 15%, #f6efdc66, transparent 55%),
    radial-gradient(ellipse at 50% 50%, transparent 62%, #b9a57e55 100%),
    url("/theme/img/wear/fox-blotch.webp") 0 0 / 512px,
    linear-gradient(#ede4cc, #e0d3b3);
  box-shadow: 0 6px 18px #0007;
}

.sl-head { margin-bottom: 1.3rem; padding-bottom: .9rem; border-bottom: 1px solid #a8322a55; text-align: center; }
.sl-mark { margin: 0; font: 400 1.45rem/1 "Alex Brush", "Noto Serif", serif; color: #a8322a; }
.sl-title { margin: .35rem 0 .3rem; font: 400 2.45rem/1.1 "Alex Brush", "Noto Serif", serif; color: #2b2117; }
.sl-shelf { margin: 0; font: .72rem/1.4 "Noto Serif", serif; letter-spacing: .14em; text-transform: uppercase; color: #6b5a40; }

.sl-body { font: 400 1.55rem/1.5 "Alex Brush", "Noto Serif", serif; overflow-wrap: break-word; }
.sl-body p { margin: .55em 0; }
.sl-body h2 { margin: 1.3em 0 .3em; font: 400 1.95rem/1.15 "Alex Brush", "Noto Serif", serif; color: #3a2717; }
.sl-body h2:first-child { margin-top: .2em; }
/* nét viết tay không có chữ nghiêng và chữ đậm: em = dòng chú của người chép (nguồn, mô tả ấn), strong = chữ in đậm của bản gốc */
.sl-body em { font-style: normal; color: #6b5a40; }
.sl-body strong { font-weight: 400; color: #140f0a; }
.sl-body table { display: block; overflow-x: auto; border-collapse: collapse; font-size: .78em; line-height: 1.3; margin: .7em 0; }
.sl-body :is(th, td) { padding: .2em .45em; border-bottom: 1px solid #8a7a5566; text-align: left; font-weight: 400; }

/* gạch son dưới chữ */
.sl-gach { text-decoration: underline 1.5px #a8322a; text-underline-offset: .16em; text-decoration-skip-ink: none; }
/* chỗ lược */
.sl-body .sl-luoc { margin: .8em 0; text-align: center; font-size: 1.3em; letter-spacing: .5em; color: #8a7a55; }
/* lời phê: lùi vào, màu son, nghiêng nhẹ như viết vội bên lề */
.sl-phe {
  display: flex; gap: .45em; align-items: baseline;
  margin: .1em 0 .9em 1.4rem;
  font-size: .9em; line-height: 1.35; color: #a8322a;
  rotate: -.8deg; transform-origin: left center;
}
.sl-phe p { margin: 0; }
.sl-khuyen { flex: none; width: .55em; height: .55em; border: 1.5px solid currentColor; border-radius: 50%; translate: 0 -.05em; }

.sl-foot { margin-top: 1.6rem; padding-top: .8rem; border-top: 1px solid #a8322a55; text-align: center; }
.sl .sl-foot a { font: 400 1.3rem/1.3 "Alex Brush", "Noto Serif", serif; color: #a8322a; text-decoration: none; -webkit-tap-highlight-color: transparent; }

.sl-nav { color: #e6dbc1; }
.sl-nav ~ .site-copy { color: #e6dbc1; }

/* science.css */
/* Khoa Học: màn hình lưu trữ dữ liệu, chữ Times New Roman (máy không có thì dùng chữ in có chân). */
.world-science {
  --accent: #4fc3e8;
  --screen: #03090c;
  --screen-ink: #8fe3f5;
  --screen-dim: #4fc3e880;
}

/* scroll.css */
/* Khuôn scroll: cuộn giấy vàng sậm, trục gỗ đen, kéo xuống để mở (theme/js/readers/scroll.js).
   Chữ chân phương, to, đều, viết để đọc to giữa lễ (Văn Tế Thái Sơn: phông Ephesis).
   Câu đối dựng hai bên đầu cuộn, mỗi chữ một dòng, chữ đứng thẳng; vế trên bên phải.
   Biến riêng của khuôn mang tiền tố --sc-. */

html body.page-scroll {
  color-scheme: dark;
  background-color: #1b1713;
  background-image: radial-gradient(ellipse at 50% 30%, #29231c, #16120e 75%);
  background-attachment: fixed;
  color: #d9cdb2;
  overflow-x: clip;
}

.sc { padding: 22px 0 3rem; }
.sc-wrap { position: relative; margin: 0 auto; max-width: 100%; }
.sc-stage { width: 340px; margin: 0 auto; }
html.sc-ready .sc-stage { position: absolute; top: 0; left: 0; margin: 0; transform: scale(var(--sc-k, 1)); transform-origin: 0 0; }

/* ---- Trục gỗ ---- */
.sc-rod {
  position: relative; z-index: 2; height: 18px; margin: 0 -10px;
  border-radius: 9px;
  background: linear-gradient(to bottom, #4a3626 0%, #241811 35%, #0f0a07 70%, #2b1e15 100%);
  box-shadow: 0 4px 8px rgb(0 0 0 / .55);
}
.sc-rod::before, .sc-rod::after {
  content: ""; position: absolute; top: -3px; width: 12px; height: 24px; border-radius: 4px;
  background: linear-gradient(to bottom, #6a4c33, #2a1c12 60%, #3d2a1c);
}
.sc-rod::before { left: -8px; }
.sc-rod::after { right: -8px; }
.sc-rod-bottom { will-change: transform; }
/* cuộn giấy còn quấn trên trục dưới: dày hơn trục trên */
.sc-rod-bottom { height: 22px; margin-top: -4px; }

/* ---- Giấy ---- */
.sc-paper {
  position: relative; z-index: 1;
  padding: 26px 24px 34px;
  background:
    radial-gradient(ellipse at 50% 50%, transparent 55%, rgb(110 70 20 / .28) 100%),
    linear-gradient(to right, rgb(120 80 30 / .18), transparent 16px, transparent calc(100% - 16px), rgb(120 80 30 / .18)),
    repeating-linear-gradient(90deg, rgb(255 240 200 / .05) 0 1px, transparent 1px 7px),
    #c9a25a;
  color: #2a1c10; /* mực đã phai, ngả nâu */
  font: 24px/1.38 "Ephesis", "Noto Serif", serif;
  box-shadow: inset 0 0 18px rgb(90 55 15 / .3);
}
.sc-paper p { margin: 0; }

/* dấu thời gian (scroll.js vẽ lớp .sc-age): đốm ố dày ở đầu cuộn, thưa dần về cuối; đầu cuộn sẫm hơn */
.sc-paper::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background-image: url("/theme/img/wear/fox-spots.webp"), url("/theme/img/wear/fox-blotch.webp"), linear-gradient(to bottom, rgb(110 65 15 / .22), transparent 520px);
  background-size: 384px 384px, 512px 512px, 100% 100%;
  background-position: 37px 11px, 140px 260px, 0 0;
  mix-blend-mode: multiply; opacity: .42;
  -webkit-mask-image: linear-gradient(to bottom, #000 0, rgb(0 0 0 / .55) 900px, rgb(0 0 0 / .3) 100%);
  mask-image: linear-gradient(to bottom, #000 0, rgb(0 0 0 / .55) 900px, rgb(0 0 0 / .3) 100%);
}
.sc-paper > * { position: relative; z-index: 1; }
.sc-paper > .sc-age { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }

/* đầu cuộn: lưới ba cột — dải câu đối trái | lời mở | dải câu đối phải (vế trên bên phải);
   các cặp câu sau lời mở trải hết bề ngang, bên dưới hai dải giấy */
.sc-head { display: grid; grid-template-columns: 58px 1fr 58px; column-gap: 12px; align-items: start; margin-bottom: .3em; }
.sc-head > * { grid-column: 1 / -1; }
.sc-dui {
  display: flex; flex-direction: column; align-items: center;
  margin: 0 0 16px; padding: 12px 0 14px; font-size: 21px; line-height: 1.08;
  background: linear-gradient(to bottom, rgb(255 236 190 / .32), rgb(255 236 190 / .2)), #d2ae69;
  border: 1px solid rgb(70 40 12 / .28);
  box-shadow: 0 1px 3px rgb(60 35 10 / .3);
}
.sc-dui span { display: block; }
.sc-head > .sc-dui-r { grid-column: 3; grid-row: 1; rotate: .6deg; }
.sc-head > .sc-dui-l { grid-column: 1; grid-row: 1; rotate: -.5deg; }
.sc-head > .sc-open { grid-column: 2; grid-row: 1; align-self: center; text-align: center; padding: 4px 0 16px; }
.sc-open .sc-lines { margin: 0 0 1em !important; }
.sc-open .sc-ln + .sc-ln { margin-top: .35em; }

/* đoạn nhiều dòng: mỗi dòng một dòng */
.sc-lines { margin: 0 0 .75em !important; }
.sc-ln { display: block; }
/* cặp câu: mỗi vế ngắt ở dấu phẩy đầu, nửa sau lùi vào; dòng tràn thì lùi thêm */
.sc-pair { margin: 0 0 .8em !important; }
.sc-ve { display: block; }
.sc-ve + .sc-ve { margin-top: .12em; }
.sc-h { display: block; padding-left: 1.6em; text-indent: -1.6em; text-wrap: balance; }
.sc-h2 { padding-left: 2.6em; text-indent: -1.6em; }
.sc-s { white-space: nowrap; }
.sc-one { text-align: center; margin: .35em 0 .75em !important; text-wrap: balance; }

/* khối chữ của mỗi phần rộng vừa dòng dài nhất và nằm giữa giấy: lề trái các cặp câu thẳng hàng,
   khoảng trống chia đều hai bên thay vì dồn sang phải */
.sc-body, .sc-part { width: fit-content; max-width: 100%; margin-inline: auto; }

/* ngăn các phần */
.sc-part { padding-top: .5em; }
.sc-part::before { content: "◦  ◦  ◦"; display: block; text-align: center; font: 14px/1 serif; color: rgb(60 35 10 / .5); margin: 0 0 .9em; white-space: pre; }

/* ---- Gợi ý, đường về ---- */
.sc-hint {
  z-index: 3; text-shadow: 0 1px 2px rgb(0 0 0 / .6);
  position: fixed; left: 0; right: 0; bottom: calc(14px + 26px * var(--sc-k, 1) + env(safe-area-inset-bottom, 0px)); margin: 0;
  text-align: center; font: .8rem/1.4 system-ui, sans-serif; color: rgb(217 205 178 / .55);
  transition: opacity .6s; pointer-events: none;
}
.sc-hint.gone { opacity: 0; }
html:not(.sc-ready) .sc-hint { display: none; }
.sc-nav { display: flex; justify-content: center; gap: 1.4rem; padding: 1.6rem 0 0; font: .8rem/1.4 system-ui, sans-serif; }
.sc .sc-nav a { color: rgb(217 205 178 / .55); text-decoration: none; }
.page-scroll .site-copy { color: rgb(217 205 178); opacity: .3; }

/* story.css */
/* Khuôn truyện: trình bày như sách */
.layout-story {
  max-width: 34rem;
  margin: 0 auto;
  padding: 4.5rem 1.4rem 6rem;
}

.story {
  font-family: "Noto Serif", "Times New Roman", serif;
  font-size: 1.125rem;
  line-height: 1.8;
  hyphens: none;
}

.story h1 {
  margin: 0 0 3rem;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 400;
  letter-spacing: .35em;
  text-indent: .35em; /* bù khoảng chữ để căn giữa thật */
}

/* Đoạn văn: thụt đầu dòng, không cách đoạn */
.story p { margin: 0; text-indent: 1.6em; }
.story h1 + p,
.story hr + p { text-indent: 0; }

/* Chữ cái đầu chương */
.story h1 + p::first-letter {
  float: left;
  font-size: 3.5em;
  line-height: .82;
  padding: .06em .12em 0 0;
  color: var(--seal, var(--accent));
}

/* Ngắt cảnh: --- hoặc *** thành họa tiết */
.story hr {
  border: 0;
  margin: 2.4rem 0;
  text-align: center;
  overflow: visible;
}
.story hr::before {
  content: "◆ ◇ ◆";
  font-size: .7rem;
  letter-spacing: 1.2em;
  margin-right: -1.2em;
  color: var(--ink-soft, var(--accent));
}

/* Chữ bị gạch: nét gạch tay, hơi mờ */
.story s, .story del {
  text-decoration-line: line-through;
  text-decoration-thickness: .09em;
  text-decoration-color: var(--ink-soft, currentColor);
  opacity: .7;
}

/* Câu trích đứng riêng */
.story blockquote {
  margin: 2rem 0;
  padding: 0;
  text-align: center;
  font-style: italic;
}
.story blockquote p { text-indent: 0; }

/* Ảnh đứng riêng một dòng: tràn chiều ngang */
.story p:has(> img:only-child) {
  text-indent: 0;
  margin: 2.4rem calc(50% - 50vw);
}
.story p > img:only-child { width: 100%; }

/* sutra.css */
/* Khuôn sutra: kinh gấp, một dải giấy dài gấp chữ chi, mở từng nếp.
   Lời kinh (tổ sư): Comforter Brush, mỗi vế một dòng, căn giữa, chấm câu bằng son.
   Lời chú: mỗi người một nét (su-h-*). Biến riêng của khuôn mang tiền tố --su-. */

body.page-sutra {
  color-scheme: dark;
  background-color: #1c1814;
  background-image: radial-gradient(ellipse at 50% 35%, #2a241d, #17130f 75%);
  background-attachment: fixed;
  color: #d9cdb2;
  overflow-x: clip;
  --su-desk: #1c1814;
  --su-paper: #e2cd98;
  --su-son: #a3301e;
}

/* ======================================================================
   Bản gốc (không có script): dải kinh trải dài, cuộn được
   ====================================================================== */
.su { max-width: 32rem; margin: 0 auto; padding: 2rem .7rem 4rem; }
.su-source { background: var(--su-paper); color: #2a1e12; padding: 1.6rem 1.2rem; font: 1.15rem/1.36 "Kolker Brush", "Noto Serif", serif; }
.su-source .su-part + .su-part { margin-top: 1.4rem; padding-top: 1rem; border-top: 1px solid rgb(120 40 25 / .35); }
.su-source .nb-break, .su-source .su-dot { display: none; }
.su-title { margin: 0 0 1rem; text-align: center; font: 400 3rem/1 "Comforter Brush", "Noto Serif", serif; letter-spacing: .25em; color: #1e140b; }
.su-nav { display: flex; justify-content: center; gap: 1.4rem; padding: 2rem 0 0; font: .8rem/1.4 system-ui, sans-serif; }
.su-nav a { color: rgb(217 205 178 / .5); text-decoration: none; }

/* ======================================================================
   Chữ (dùng chung cho bản gốc và bản gấp)
   ====================================================================== */
.su p { margin: 0 0 .35em; }

/* Lời kinh của tổ sư */
.su-v { font: calc(var(--su-fs, 18px) * 1.22) / 1.4 "Comforter Brush", "Noto Serif", serif; text-align: center; margin: 0 0 .45em; color: #1a110a; }
.su-v.su-v-first { margin-top: .3em; }
.su-v.su-v-last { margin-bottom: .9em; }
.su-vl { display: block; }
/* dấu đậu (giữa câu): chấm son nhỏ; dấu cú (hết câu): vòng son */
.su-dau { display: inline-block; width: .2em; height: .2em; margin: 0 0 0 .12em; background: var(--su-son); border-radius: 50%; vertical-align: .1em; }
.su-ju { display: inline-block; width: .42em; height: .42em; margin: 0 0 0 .1em; border: 1.6px solid var(--su-son); border-radius: 50%; vertical-align: .05em; }

/* Các lớp chú: mỗi người một nét */
.su-c { text-indent: 1em; }
.su-h-de   { color: #5a3a1c; }                                               /* đệ tử trực tiếp: ngay ngắn, mực nâu */
.su-h-le   { color: #1b130b; font-size: .82em; line-height: 1.17; letter-spacing: -.01em; margin-left: .2em; }  /* sát lề, dày đặc */
.su-h-moi  { color: #0f0b07; font-style: italic; }                           /* mực còn mới, nghiêng */
.su-h-dam  { color: #0c0805; font-family: "Water Brush", "Kolker Brush", serif; font-size: 1.1em; line-height: 1.3; position: relative; }  /* ấn mạnh */
.su-h-run  { color: #4b3b2a; font-size: .84em; }                             /* nhỏ và run */
.su-h-run .su-w { display: inline-block; text-indent: 0; transform: translateY(var(--y)) rotate(var(--a)); }
.su-h-chep { color: #6b5638; font-size: .86em; }                             /* người chép */
.su-h-la   { color: #2d2346; font-family: "Hurricane", "Kolker Brush", serif; font-size: 2.6em; line-height: 1; text-indent: 0; margin: .1em 0 .3em 3.2em; rotate: -6deg; }  /* nét lạ */
.su-h-cu   { color: rgb(70 50 30 / .58); text-indent: 0; text-align: center; margin-top: 1.2em; }  /* mực cũ hơn tất cả */

/* lỗ rách do ấn bút: thấy mặt bàn */
.su-h-dam::before, .su-h-dam::after {
  content: ""; position: absolute; width: 9px; height: 6px; background: var(--su-desk);
  border-radius: 40% 60% 45% 55%; box-shadow: 0 0 0 1.5px rgb(90 60 30 / .45);
}
.su-h-dam::before { left: 38%; top: 1.1em; rotate: 20deg; }
.su-h-dam::after  { left: 71%; top: 3.4em; width: 6px; height: 4px; }

/* chỗ giấy mục mất chữ */
.su-hole {
  display: inline-block; width: 3.4em; height: 1.25em; vertical-align: -.25em; margin: 0 .15em;
  background:
    radial-gradient(circle at 30% 45%, var(--su-desk) 0 32%, transparent 34%),
    radial-gradient(circle at 62% 55%, var(--su-desk) 0 30%, transparent 33%),
    radial-gradient(circle at 48% 40%, var(--su-desk) 0 26%, transparent 29%),
    radial-gradient(ellipse at 50% 50%, rgb(110 70 30 / .45) 0 46%, transparent 62%);
}

/* vết cạo */
.su-scraped {
  margin: .5em 0; padding: .35em .5em .35em 2em; min-height: 2.2em; text-indent: 0;
  background:
    repeating-linear-gradient(97deg, rgb(255 248 228 / .45) 0 2px, transparent 2px 5px),
    radial-gradient(ellipse at 50% 50%, rgb(245 232 200 / .9), rgb(245 232 200 / .2) 70%, transparent 80%);
  color: rgb(40 28 16 / .32);
  font-size: .9em;
}
.su-body p.su-sq { font-size: .92em; line-height: 1.15; letter-spacing: -.012em; margin-bottom: .25em; }

/* ======================================================================
   Bản gấp (script đã chạy: html.su-paged)
   ====================================================================== */
html.su-paged, html.su-paged body { height: 100%; overflow: hidden; }
html.su-paged .su { max-width: none; padding: 0; }
html.su-paged .su-source {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
html.su-paged .su > .su-nav { display: none; }

.su-desk {
  position: fixed; inset: 0; perspective: 1500px;
  touch-action: pinch-zoom; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
/* khổ cố định: cả dải thu/phóng theo --su-k (sutra.js), quanh tâm màn hình */
.su-stage { position: absolute; left: 50%; top: 50%; width: 0; height: 0; scale: var(--su-k, 1); perspective: 1500px; transform-style: preserve-3d; }
.su-fold {
  position: absolute; left: 50%; top: 50%;
  width: var(--su-w); height: var(--su-h);
  margin: calc(var(--su-h) / -2 - 14px) 0 0 calc(var(--su-w) / -2);
  transition: transform .85s cubic-bezier(.45, .05, .2, 1), opacity .4s;
  transform-style: preserve-3d;
  will-change: transform;
}
.su-fold.no-anim { transition: none; }
.su-fold.flat { filter: drop-shadow(0 8px 14px rgb(0 0 0 / .5)); }
.su-paper {
  position: absolute; inset: 0;
  padding: 34px 22px 30px;
  overflow: hidden;
  /* giấy kinh nhuộm vàng, đã ngả */
  background:
    radial-gradient(ellipse at 30% 20%, rgb(150 100 40 / .10), transparent 55%),
    radial-gradient(ellipse at 75% 85%, rgb(130 90 40 / .14), transparent 55%),
    var(--su-paper);
  color: #2a1e12;
  box-shadow: inset 0 0 26px rgb(110 70 20 / .32);
}
/* thiên đầu, địa cước: hai đường kẻ son trên và dưới */
.su-paper::before, .su-paper::after {
  content: ""; position: absolute; left: 14px; right: 14px; height: 4px;
  border-top: 1.5px solid rgb(120 40 25 / .55); border-bottom: .8px solid rgb(120 40 25 / .4);
}
.su-paper::before { top: 16px; }
.su-paper::after { bottom: 14px; }
/* nếp còn gấp: mặt nghiêng tối/sáng xen kẽ */
.su-shade { position: absolute; inset: 0; pointer-events: none; transition: opacity .85s; opacity: 0; }
.su-fold.side .su-shade { opacity: 1; }
.su-fold.zig .su-shade { background: linear-gradient(to right, rgb(0 0 0 / .45), rgb(0 0 0 / .2)); }
.su-fold.zag .su-shade { background: linear-gradient(to right, rgb(255 240 210 / .05), rgb(0 0 0 / .35)); }

.su-body { position: relative; height: 100%; overflow: hidden; font: var(--su-fs) / 1.34 "Kolker Brush", "Noto Serif", serif; }

/* nếp đầu cháy mất hơn nửa: phía trên mép cháy sém */
.su-fold.burn .su-paper {
  background:
    linear-gradient(to bottom, #2a1608 0, #6b4520 calc(var(--su-bl) + 4px), #b9975e calc(var(--su-bl) + 22px), transparent calc(var(--su-bl) + 60px)),
    var(--su-paper);
}
.su-fold .su-title { margin: 0 0 1.1rem; font-size: calc(var(--su-fs) * 2.6); }

/* bìa: gấm cũ */
.su-fold.board .su-paper {
  padding: 0;
  background:
    repeating-linear-gradient(45deg, rgb(255 255 255 / .035) 0 3px, transparent 3px 9px),
    repeating-linear-gradient(-45deg, rgb(0 0 0 / .12) 0 3px, transparent 3px 9px),
    radial-gradient(ellipse at 40% 30%, #5a2f26, #34191a 80%);
  box-shadow: inset 0 0 0 5px #2a1410, inset 0 0 30px rgb(0 0 0 / .5);
}
.su-fold.board .su-paper::before, .su-fold.board .su-paper::after { display: none; }

/* chấm mực ở góc nếp cuối */
.su-dotmark { position: absolute; right: 30px; bottom: 44px; width: 8px; height: 8px; border-radius: 50%;
  background: radial-gradient(circle, #120c06 0 45%, rgb(18 12 6 / .5) 60%, transparent 75%); }

/* Đầu và cuối dải: link nhỏ dưới mặt bàn */
.su-end {
  position: fixed; left: 0; right: 0; bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  opacity: 0; pointer-events: none; transition: opacity .6s .3s;
}
.su-desk.at-start .su-end, .su-desk.at-end .su-end { opacity: 1; pointer-events: auto; }
.su-end .su-nav { padding: 0; }
.su-hint { position: fixed; left: 0; right: 0; bottom: calc(34px + env(safe-area-inset-bottom, 0px)); text-align: center; font: 12px system-ui, sans-serif; opacity: 0; transition: opacity .6s; pointer-events: none; }
.su-desk.at-start .su-hint { opacity: .4; }

/* Bản quyền: chỉ hiện khi đã mở đến bìa sau */
.page-sutra .site-copy { color: rgb(217 205 178); }
html.su-paged .page-sutra .site-copy { display: none; }
html.su-paged .page-sutra:has(.su-desk.at-end) .site-copy {
  display: block; position: fixed; left: 0; right: 0;
  bottom: calc(30px + env(safe-area-inset-bottom, 0px)); padding: 0; opacity: .3;
}

@media (prefers-reduced-motion: reduce) {
  .su-fold, .su-end, .su-hint { transition: none; }
}
