/* ---------- My Library (inside the site shell) ---------- */
.lb { color: #1F2937; }
.lb h2 { font-family: "IBM Plex Serif", Georgia, serif; font-weight: 500; color: #14254D; font-size: 1.5rem; margin: 1.6rem 0 .8rem; }
.lb-sub { color: #4B5563; margin: 0 0 1rem; }
.lb-note { background: #FFF4E5; border: 1px solid #F6C987; color: #6B3A00; border-radius: 12px; padding: .75rem 1rem; }
.lb-note a { color: #9A3412; }
.lb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1.2rem; }
.lb-book { display: flex; flex-direction: column; gap: .35rem; text-decoration: none; color: inherit; }
.lb-cover { display: block; aspect-ratio: 2 / 3; border-radius: 6px 10px 10px 6px; overflow: hidden; background: #E5E7EB;
  box-shadow: 0 10px 24px rgba(20,37,77,.22), inset 6px 0 10px rgba(0,0,0,.25); transition: transform .2s, box-shadow .2s; }
.lb-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lb-book:hover .lb-cover { transform: translateY(-4px); box-shadow: 0 16px 34px rgba(20,37,77,.28); }
.lb-book b { color: #14254D; font-size: .98rem; line-height: 1.3; margin-top: .3rem; }
.lb-book small { color: #4B5563; }
.lb-price { display: flex; gap: .4rem; align-items: baseline; }
.lb-price s { color: #6B7280; font-size: .85rem; }
.lb-btn { align-self: flex-start; margin-top: .25rem; background: #14254D; color: #fff; border-radius: 999px; padding: .4rem .95rem; font-weight: 600; font-size: .88rem; }
.lb-btn.is-buy { background: #E8650A; }

/* ---------- The reader (a page of its own) ---------- */
.rd-body { margin: 0; height: 100%; overflow: hidden; font-family: "IBM Plex Sans", system-ui, sans-serif;
  --bg: #FFFFFF; --ink: #1F2328; --muted: #5B6475; --bar: #FFFFFF; --line: #E5E7EB; --accent: #C2410C; --fs: 19px; --font: "Literata", Georgia, serif; }
html:has(.rd-body) { height: 100%; }
.rd-body[data-theme="sepia"] { --bg: #F6EEDC; --ink: #3B2F22; --muted: #6E5D48; --bar: #F1E7D0; --line: #E2D5B8; }
.rd-body[data-theme="night"] { --bg: #121417; --ink: #D6D3CC; --muted: #9AA0A8; --bar: #1A1D21; --line: #2A2E34; --accent: #F59E5B; }
.rd-body[data-font="sans"] { --font: "IBM Plex Sans", system-ui, sans-serif; }
.rd { position: fixed; inset: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); background: var(--bg); color: var(--ink);
  -webkit-user-select: none; user-select: none; }
.rd-top, .rd-foot { display: flex; align-items: center; gap: .4rem; padding: .45rem .7rem; background: var(--bar); border-bottom: 1px solid var(--line);
  padding-top: max(.45rem, env(safe-area-inset-top)); }
.rd-foot { border-bottom: 0; border-top: 1px solid var(--line); padding-bottom: max(.45rem, env(safe-area-inset-bottom)); }
.rd-ic { width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; color: var(--ink); display: grid; place-items: center; cursor: pointer; flex: 0 0 auto; text-decoration: none; }
.rd-ic:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.rd-ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rd-ic.is-on svg { fill: var(--accent); stroke: var(--accent); }
.rd-aa { font-weight: 600; font-size: 1rem; }
.rd-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.rd-title b { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-title span { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.rd-stage { position: relative; overflow: hidden; min-width: 0; min-height: 0; }
.rd-flow { position: absolute; top: 2.2rem; bottom: 1.6rem; left: 0; right: 0; padding: 0 var(--side, 2rem); box-sizing: border-box;
  font-family: var(--font); font-size: var(--fs); line-height: 1.62; color: var(--ink);
  column-gap: calc(var(--side, 2rem) * 2); column-fill: auto; transition: transform .28s ease; will-change: transform; }
.rd[data-mode="scroll"] .rd-flow { position: absolute; inset: 0; overflow-y: auto; columns: auto !important; transform: none !important; padding: 1.6rem max(1.2rem, calc((100% - 44rem) / 2)) 3rem; }
.rd[data-mode="scroll"] .rd-tap { display: none; }
.rd-flow h1 { font-size: 1.55em; line-height: 1.25; margin: 0 0 1.2em; font-weight: 600; break-after: avoid; }
.rd-flow h1 small { display: block; font-size: .55em; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-bottom: .4em; font-family: "IBM Plex Sans", sans-serif; }
.rd-flow h2 { font-size: 1.12em; margin: 1.3em 0 .5em; font-weight: 600; break-after: avoid; }
.rd-flow p { margin: 0 0 .8em; text-align: justify; hyphens: auto; orphans: 2; widows: 2; }
.rd-flow img { display: block; max-width: 100%; max-height: calc(var(--pageh, 70vh) - 2rem); height: auto; margin: .6em auto; break-inside: avoid; border-radius: 4px; }
.rd-body[data-theme="night"] .rd-flow img { filter: brightness(.88); }
.rd-flow table { width: 100%; border-collapse: collapse; font-family: "IBM Plex Sans", sans-serif; font-size: .78em; line-height: 1.35; margin: .6em 0 1em; break-inside: avoid; }
.rd-flow td, .rd-flow th { border: 1px solid var(--line); padding: .3em .45em; vertical-align: top; }
.rd-flow ul, .rd-flow ol { padding-left: 1.3em; margin: 0 0 .8em; }
.rd-flow blockquote { margin: .6em 0; padding-left: .9em; border-left: 3px solid var(--line); color: var(--muted); }
.rd-loading { color: var(--muted); }
.rd-end { margin-top: 2em; text-align: center; break-inside: avoid; }
.rd-end button { font: inherit; font-family: "IBM Plex Sans", sans-serif; font-size: .9em; padding: .6em 1.2em; border-radius: 999px; border: 0; background: var(--accent); color: #fff; cursor: pointer; }

/* the buyer's name across the page, faint */
.rd-mark { position: absolute; inset: 0; pointer-events: none; z-index: 2; opacity: .06; background-repeat: repeat; }
.rd-body[data-theme="night"] .rd-mark { opacity: .08; filter: invert(1); }

.rd-tap { position: absolute; top: 0; bottom: 0; width: 18%; border: 0; background: transparent; cursor: pointer; z-index: 3; -webkit-tap-highlight-color: transparent; }
.rd-tap.is-prev { left: 0; } .rd-tap.is-next { right: 0; }
.rd-nav { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--ink); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.rd-prog { flex: 1; display: flex; align-items: center; gap: .7rem; min-width: 0; }
.rd-prog input { flex: 1; accent-color: var(--accent); min-width: 0; }
.rd-prog span { font-size: .8rem; color: var(--muted); white-space: nowrap; }

.rd-panel { position: absolute; top: 58px; right: .6rem; bottom: 70px; width: min(380px, calc(100% - 1.2rem)); z-index: 10; overflow-y: auto;
  background: var(--bar); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 40px rgba(0,0,0,.2); }
.rd-panel.is-small { bottom: auto; }
.rd-panel[hidden] { display: none; }
.rd-panel-head { display: flex; align-items: center; justify-content: space-between; padding: .8rem 1rem .4rem; }
.rd-panel-head.is-sub { border-top: 1px solid var(--line); margin-top: .4rem; }
.rd-x { border: 0; background: transparent; color: var(--muted); font-size: 1.4rem; cursor: pointer; }
.rd-toc { list-style: none; margin: 0; padding: 0 .5rem .5rem; }
.rd-toc button, .rd-bms button { width: 100%; text-align: left; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: .92rem; padding: .55rem .6rem; border-radius: 8px; cursor: pointer; }
.rd-toc button:hover, .rd-bms button:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.rd-toc button.is-on { color: var(--accent); font-weight: 600; }
.rd-bms { list-style: none; margin: 0; padding: 0 .5rem .8rem; }
.rd-bms .rd-empty { color: var(--muted); font-size: .88rem; padding: .3rem .6rem; }
.rd-row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .55rem 1rem; }
.rd-row > span { font-size: .9rem; color: var(--muted); }
.rd-seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.rd-seg button { border: 0; background: transparent; color: var(--ink); font: inherit; font-size: .86rem; padding: .45rem .75rem; cursor: pointer; }
.rd-seg button.is-on { background: var(--accent); color: #fff; }
.rd-toast { position: absolute; left: 50%; bottom: 80px; transform: translateX(-50%); background: #111827; color: #fff; padding: .5rem .9rem; border-radius: 999px; font-size: .86rem; z-index: 20; }
.rd-toast[hidden] { display: none; }
.rd-noprint { display: none; }
@media print { .rd { display: none !important; } .rd-noprint { display: block; padding: 2rem; font: 16px sans-serif; } }
@media (max-width: 640px) {
  .rd-flow { top: 1.2rem; bottom: 1rem; }
  .rd-body { --fs: 17px; }
  .rd-title b { font-size: .85rem; }
}
