/* The reading room: warm paper, book cloth, generous editorial measure. */
:root {
  --lib-paper:#fbf6ec;
  --lib-ink:#302d24;
  --lib-muted:#746e60;
  --lib-line:#ded5c4;
  --lib-sage:#58684a;
  --lib-accent:#bc632c;
  --lib-display:'Bricolage Grotesque',system-ui,-apple-system,'PingFang SC',sans-serif;
}
body {
  background:var(--lib-paper);
  color:var(--lib-ink);
  font-family:system-ui,-apple-system,'PingFang SC',sans-serif;
}
.lib-shell {
  display:grid;
  grid-template-columns:190px minmax(0,1fr);
  width:100%;
  max-width:1280px;
  min-height:calc(100dvh - 82px);
  margin:auto;
}
.lib-sidebar {
  position:relative;
  padding:36px 20px;
  border-right:1px solid var(--lib-line);
  background:#f1eadc;
  overflow:auto;
}
.lib-brand-mark {
  margin:0 10px 36px;
  color:#3f4936;
  font-family:'Bricolage Grotesque',sans-serif;
  font-size:27px;
  font-weight:800;
  letter-spacing:-1.2px;
  line-height:1.1;
}
.lib-brand-mark span {
  display:block;
  margin-top:12px;
  color:var(--lib-muted);
  font:10px/1.6 'IBM Plex Mono',monospace;
  letter-spacing:1.2px;
}
.lib-tabs {
  display:flex;
  flex-direction:column;
  gap:6px;
}
.lib-tabs a {
  display:flex;
  align-items:center;
  gap:12px;
  min-height:46px;
  box-sizing:border-box;
  padding:11px 12px;
  border-radius:5px;
  color:#655e50;
  font-size:14px;
  text-decoration:none;
  transition:background .15s,color .15s;
}
.lib-tabs a:hover { background:#e9dfcc; }
.lib-tabs a[aria-current] {
  background:#f5dfb9;
  color:#85451f;
  font-weight:600;
  box-shadow:inset 3px 0 #b76a32;
}
.lib-nav-dot {
  display:flex;
  align-items:center;
  justify-content:center;
  flex:none;
  width:19px;
  height:19px;
}
.lib-nav-dot svg { display:block; width:19px; height:19px; }
#reading-list {
  margin:30px 10px 0;
  padding-top:22px;
  border-top:1px solid var(--lib-line);
}
#reading-list:empty { display:none; }
#reading-list>p { margin:0 0 12px; }
#reading-list>a {
  display:flex;
  align-items:center;
  gap:10px;
  min-height:44px;
  padding:6px 0;
  color:#5d594b;
  font-size:12px;
  line-height:1.6;
  text-decoration:none;
}
#reading-list>a:hover { color:var(--lib-accent); }
.lib-book-spine {
  flex:none;
  width:13px;
  height:23px;
  border-radius:1px 3px 3px 1px;
  border-left:3px solid #3d4d37;
  background:#7a8666;
  box-shadow:1px 2px 2px #34281820;
}
.lib-sidebar-art { display:none; }
.lib-main {
  min-width:0;
  padding:38px 42px 48px;
  overflow:auto;
  line-height:1.6;
  scrollbar-color:#c8bda7 transparent;
  scrollbar-width:thin;
}
.lib-page-title:has(+ .lib-reader) { display:none; }
.lib-page-title {
  margin:0 0 30px;
  padding-bottom:24px;
  border-bottom:1px solid var(--lib-line);
}
.lib-eyebrow {
  color:#896241;
  font-size:11px;
  font-weight:600;
  letter-spacing:1.5px;
  line-height:1.8;
}
.lib-page-title h1 {
  margin:10px 0 0;
  font-family:var(--lib-display);
  font-size:clamp(27px,3vw,40px);
  font-weight:500;
  letter-spacing:-.7px;
  line-height:1.35;
  text-wrap:balance;
}
.lib-meta {
  margin:7px 0;
  color:var(--lib-muted);
  font-size:12px;
  line-height:1.8;
}
.lib-error {
  margin-bottom:20px;
  padding:14px 18px;
  border:1px solid #d8ad86;
  border-radius:6px;
  background:#f8e6d3;
  color:#7c3d24;
  font-size:13px;
}
.lib-error[hidden] { display:none; }
.lib-grid {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:32px 28px;
}
.lib-book { min-width:0; }
.lib-book-info { min-width:0; }
.lib-book h2 {
  margin:6px 0;
  font-family:var(--lib-display);
  font-size:21px;
  font-weight:600;
  line-height:1.45;
  overflow-wrap:anywhere;
}
.lib-book h2 a { color:inherit; text-decoration:none; }
.lib-book h2 a:hover { color:var(--lib-accent); }
.lib-book-note {
  margin:12px 0;
  color:#635d50;
  font-size:13px;
  line-height:1.9;
}
.lib-cover-link {
  display:flex;
  align-items:center;
  justify-content:center;
  min-width:0;
  margin-bottom:20px;
  padding:30px 14px;
  border-bottom:1px solid #cfc1a7;
  background:linear-gradient(145deg,#eee6d6,#e4dac5);
  text-decoration:none;
}
.lib-cover {
  position:relative;
  display:flex;
  flex-direction:column;
  flex:none;
  box-sizing:border-box;
  width:148px;
  height:204px;
  padding:19px 16px 18px 20px;
  overflow:hidden;
  border:1px solid #ffffff26;
  border-left:7px solid #414e37;
  border-radius:1px 4px 4px 1px;
  background:#5c6b4f;
  color:#fff5df;
  box-shadow:3px 0 0 #e7ddc9,5px 1px 0 #bcad90,8px 12px 15px #4b3a242d,inset 2px 0 0 #ffffff12;
  transition:transform .2s;
}
.lib-cover-link:hover .lib-cover { transform:translateY(-4px) rotate(-2deg); }
.lib-cover span { display:none; }
.lib-cover strong {
  z-index:1;
  margin-top:18px;
  font-family:var(--lib-display);
  font-size:21px;
  font-weight:500;
  line-height:1.32;
  overflow-wrap:anywhere;
}
.lib-cover small {
  z-index:1;
  margin-top:auto;
  padding-top:8px;
  font-size:8px;
  line-height:1.4;
}
.lib-cover i {
  position:absolute;
  right:-23px;
  bottom:26px;
  width:112px;
  height:112px;
  border:1px solid #f5ddb84d;
  border-radius:50%;
}
.lib-cover i:after {
  content:'';
  position:absolute;
  inset:12px;
  border:1px solid #f5ddb84d;
  border-radius:50%;
}
.lib-cover[data-book='naval'] { background:#46543f; border-left-color:#2e3b29; }
.lib-cover[data-book='poor-charlie'] { background:#8a5d40; border-left-color:#65402c; }
.lib-cover[data-book='company-of-one'] { background:#887342; border-left-color:#65532d; }
.lib-cover[data-book='rework'] { background:#934d3a; border-left-color:#6e3528; }
.lib-cover[data-book='minimalist-entrepreneur'] { background:#526c70; border-left-color:#354f53; }
.lib-actions {
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:12px;
  margin:16px 0 0;
}
.lib-main .kp-btn {
  min-height:44px;
  box-sizing:border-box;
  padding:11px 18px;
  border-radius:6px;
  font-family:inherit;
  font-size:13px;
  font-weight:500;
  line-height:1.5;
  box-shadow:none;
}
.lib-main .kp-btn-accent { border:1px solid #a95724; background:var(--lib-accent); color:#fffaf0; }
.lib-main .kp-btn-accent:hover { background:#a85123; border-color:#a85123; }
.lib-main .kp-btn-ghost { border:1px solid #c9bfae; background:transparent; color:#595545; }
.lib-main .kp-btn-ghost:hover { background:#eee5d5; }
.lib-main .kp-btn:disabled { opacity:.5; cursor:default; }
.lib-link {
  display:inline-flex;
  align-items:center;
  min-height:44px;
  color:#85502e;
  font-size:12px;
  text-decoration:underline;
  text-decoration-color:#c5a684;
  text-underline-offset:5px;
}
.lib-link:hover { color:#57321b; text-decoration-color:currentColor; }
.lib-badge {
  display:inline-block;
  padding:3px 8px;
  border:1px solid #d7d8c6;
  border-radius:4px;
  background:#edf0e3;
  color:#526043;
  font-size:11px;
  line-height:1.6;
}
.lib-badge.is-warn { border-color:#e6c49a; background:#f8e7cd; color:#875025; }
.lib-badge.is-ok { border-color:#cbd5b7; background:#e6eddc; color:#4b6139; }
.lib-loan {
  display:grid;
  grid-template-columns:90px minmax(0,1fr);
  gap:24px;
  padding:26px 0;
  border-bottom:1px solid var(--lib-line);
}
.lib-loan:first-of-type { padding-top:0; }
.lib-loan h2 { margin:0 0 9px; font:600 23px/1.4 var(--lib-display); }
.lib-loan p { margin:6px 0; }
.lib-loan-cover .lib-cover { width:82px; height:116px; padding:10px 8px; border-left-width:4px; }
.lib-loan-cover .lib-cover strong { margin-top:10px; font-size:12px; }
.lib-loan-cover .lib-cover small { display:none; }
.lib-empty-state {
  max-width:420px;
  margin:40px auto;
  text-align:center;
  color:var(--lib-muted);
  line-height:1.9;
}
.lib-empty-state img { max-width:250px; height:130px; object-fit:contain; margin:10px auto 22px; }
.lib-empty-state h2 { color:var(--lib-ink); font:500 27px/1.5 var(--lib-display); }
.lib-empty-state p { margin-bottom:26px; font-size:14px; }
.lib-reader { max-width:780px; margin:auto; }
.lib-reader-book { display:flex; align-items:center; gap:20px; padding-bottom:22px; border-bottom:1px solid var(--lib-line); }
.lib-reader-book>div:last-child { min-width:0; }
.lib-reader-book h2 { margin:0 0 7px; font:600 28px/1.4 var(--lib-display); overflow-wrap:anywhere; }
.lib-reader-book p { margin:5px 0 0; }
.lib-reader-book .lib-eyebrow { display:none; }
.lib-mini-cover { flex:none; width:49px; height:68px; }
.lib-mini-cover .lib-cover { width:46px; height:65px; padding:6px 4px; border-left-width:3px; box-shadow:2px 0 #e7ddc9,3px 4px 5px #4b3a242d; }
.lib-mini-cover .lib-cover strong,.lib-mini-cover .lib-cover small { display:none; }
.lib-mini-cover .lib-cover i { width:35px; height:35px; right:-10px; bottom:10px; }
.lib-note-tabs { display:flex; gap:24px; overflow-x:auto; padding:16px 0 0; white-space:nowrap; }
.lib-note-tabs a { min-height:44px; box-sizing:border-box; padding:10px 0; border-bottom:2px solid transparent; color:var(--lib-muted); font-size:13px; text-decoration:none; }
.lib-note-tabs a[aria-current] { color:#87502c; border-color:#b76832; }
.lib-editor { padding-top:22px; }
.lib-editor-label { display:block; margin-bottom:13px; color:#625b4c; font-size:18px; line-height:1.7; }
.lib-editor textarea {
  display:block;
  box-sizing:border-box;
  width:100%;
  min-height:250px;
  padding:20px 22px;
  resize:vertical;
  border:1px solid #dcd2c0;
  border-radius:6px;
  background:#fffaf2;
  color:#3d382d;
  font:16px/2 system-ui,-apple-system,'PingFang SC',sans-serif;
  box-shadow:inset 0 2px 5px #57442c04;
}
.lib-editor textarea::placeholder { color:#857c6d; }
.lib-editor textarea:focus-visible { outline:2px solid #a58455; outline-offset:3px; }
.lib-editor-footer {
  position:sticky;
  z-index:1;
  bottom:0;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  margin-top:24px;
  padding:18px 0 max(18px,env(safe-area-inset-bottom));
  border-top:1px solid var(--lib-line);
  background:var(--lib-paper);
  box-shadow:0 -10px 16px var(--lib-paper);
}
.lib-editor-footer .lib-actions { justify-content:flex-end; margin:0; }
.lib-visibility { display:flex; align-items:center; gap:8px; min-height:44px; color:#625c4e; font-size:12px; cursor:pointer; }
.lib-visibility input { flex:none; width:17px; height:17px; margin:0; accent-color:#67794e; }
.lib-editor-footer #save-state { margin:0 0 3px; color:#536547; font-size:12px; line-height:1.6; }
.lib-editor-footer #save-state[data-state=error] { color:#a04429; }
#note-count { color:#7c7566; font:11px/1.6 'IBM Plex Mono',monospace; }
.lib-board { display:grid; gap:24px; margin-top:28px; }
.lib-board-note { padding:22px 26px; border:1px solid var(--lib-line); border-left:3px solid #a6ad89; background:#fffbf3; }
.lib-note-text { color:#494438; white-space:pre-wrap; overflow-wrap:anywhere; font-size:16px; line-height:1.95; }
.lib-board-note footer { display:flex; align-items:center; flex-wrap:wrap; gap:15px; padding-top:14px; border-top:1px solid #e8dfd0; color:var(--lib-muted); font-size:12px; }
.lib-main select { max-width:100%; min-height:44px; padding:10px 14px; border:1px solid #cfc3af; border-radius:5px; background:#fffaf0; color:#514b3e; font:14px system-ui,sans-serif; }
.lib-table-wrap { overflow:auto; }
.lib-table { width:100%; border-collapse:collapse; font-size:13px; }
.lib-table th,.lib-table td { padding:14px 10px; border-bottom:1px solid var(--lib-line); text-align:left; line-height:1.8; }
.lib-table th { color:var(--lib-muted); font-weight:500; }
.lib-loading { padding:60px 0; color:var(--lib-muted); font:20px/1.7 var(--lib-display); }
.lib-shell :focus-visible { outline:2px solid #8a652f; outline-offset:4px; }
html.kp-embed .kp-header { display:none!important; }
html.kp-embed body { display:block; margin:0; }
html.kp-embed .lib-shell { height:100dvh; min-height:0; max-width:none; }
html.kp-embed .lib-main { padding:30px 34px 24px; }
@media(max-width:900px) and (min-width:701px) {
  .lib-shell { grid-template-columns:160px minmax(0,1fr); }
  .lib-sidebar { padding:30px 12px; }
  .lib-main,html.kp-embed .lib-main { padding:28px 24px; }
  .lib-editor-footer { align-items:flex-start; flex-wrap:wrap; }
}
@media(max-width:700px) {
  .lib-shell { display:block; min-height:100dvh; }
  .lib-sidebar { position:sticky; top:0; z-index:2; padding:8px 14px; border-right:0; border-bottom:1px solid var(--lib-line); background:#f1eadc; }
  .lib-brand-mark,#reading-list,.lib-sidebar-art { display:none; }
  .lib-tabs { flex-direction:row; gap:4px; overflow-x:auto; }
  .lib-tabs a { flex:1 0 auto; justify-content:center; padding:11px 13px; font-size:12px; white-space:nowrap; }
  .lib-tabs a[aria-current] { box-shadow:inset 0 -2px #b76a32; }
  .lib-nav-dot { display:none; }
  .lib-main,html.kp-embed .lib-main { padding:26px 22px 32px; overflow:visible; }
  .lib-page-title { margin-bottom:24px; padding-bottom:20px; }
  .lib-page-title h1 { font-size:29px; }
  .lib-book h2 { font-size:19px; }
  .lib-book-note { font-size:13px; }
  .lib-actions { gap:8px; }
  .lib-main .kp-btn { min-height:44px; padding:10px 14px; font-size:13px; }
  .lib-link { font-size:12px; }
  .lib-loan { grid-template-columns:82px minmax(0,1fr); gap:20px; }
  .lib-loan h2 { font-size:21px; }
  .lib-reader-book h2 { font-size:24px; }
  .lib-reader-book { gap:16px; }
  .lib-editor-label { font-size:17px; }
  .lib-editor textarea { min-height:260px; padding:16px; }
  .lib-editor-footer { align-items:stretch; flex-direction:column; gap:10px; padding:14px 0 max(14px,env(safe-area-inset-bottom)); }
  .lib-editor-footer>div:first-child { display:flex; align-items:baseline; justify-content:space-between; gap:12px; }
  .lib-editor-footer .lib-actions { width:100%; gap:10px; justify-content:flex-start; }
  .lib-editor-footer .lib-actions .kp-btn { flex:1; }
  .lib-visibility { flex-basis:100%; min-height:30px; }
  .lib-board-note { padding:18px 20px; }
  .lib-table th,.lib-table td { min-width:100px; }
  html.kp-embed .lib-shell { height:auto; min-height:100dvh; }
}
@media(max-width:420px) {
  .lib-main,html.kp-embed .lib-main { padding-right:18px; padding-left:18px; }
  .lib-book h2 { font-size:18px; }
  .lib-tabs a { padding-right:11px; padding-left:11px; }
}
@media(prefers-reduced-motion:reduce) {
  .lib-cover,.lib-tabs a { transition:none; }
  .lib-cover-link:hover .lib-cover { transform:none; }
}

/* --- Catalogue: bookstore grid, search, continue reading (F3.13-F3.14) ------------- */
.lib-grid { grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:34px 26px; }
.lib-book { display:flex; flex-direction:column; }
.lib-book .lib-cover-link { position:relative; margin-bottom:14px; padding:22px 10px; border-radius:4px 4px 0 0; }
.lib-book .lib-cover { width:118px; height:166px; padding:14px 11px 12px 15px; border-left-width:5px; }
.lib-book .lib-cover strong { margin-top:12px; font-size:16px; }
.lib-book .lib-cover small { font-size:8px; }
.lib-book h2 { margin:4px 0 2px; font-size:16px; line-height:1.45; }
.lib-book .lib-meta { margin:0; font-size:12px; }
.lib-book .lib-actions { margin-top:10px; }
.lib-book .lib-eyebrow { font-size:10px; }
.lib-cover.has-image { padding:0; border:0; background:#e4dac5; }
.lib-cover.has-image img { display:block; width:100%; height:100%; object-fit:cover; }
.lib-cover-progress { position:absolute; left:0; bottom:-1px; height:3px; background:var(--lib-accent); }
.lib-filters { display:flex; flex-direction:column; gap:14px; margin-bottom:30px; }
.lib-filters input[type=search] {
  box-sizing:border-box;
  width:100%;
  max-width:420px;
  min-height:44px;
  padding:10px 16px;
  border:1px solid #cfc3af;
  border-radius:22px;
  background:#fffaf0;
  color:var(--lib-ink);
  font:14px system-ui,-apple-system,'PingFang SC',sans-serif;
}
.lib-chips { display:flex; gap:8px; overflow-x:auto; padding-bottom:2px; }
.lib-chip {
  flex:none;
  min-height:36px;
  padding:6px 14px;
  border:1px solid #d6cbb7;
  border-radius:18px;
  background:transparent;
  color:#5f584a;
  font:13px system-ui,-apple-system,'PingFang SC',sans-serif;
  cursor:pointer;
}
.lib-chip:hover { background:#eee5d5; }
.lib-chip[aria-pressed=true] { border-color:var(--lib-sage); background:var(--lib-sage); color:#fffaf0; }
.lib-empty { grid-column:1/-1; color:var(--lib-muted); }
.lib-continue { margin-bottom:34px; padding-bottom:28px; border-bottom:1px solid var(--lib-line); }
.lib-continue-row { display:grid; grid-template-columns:repeat(auto-fill,minmax(230px,1fr)); gap:14px; margin-top:12px; }
.lib-continue-item {
  display:flex;
  align-items:center;
  gap:14px;
  padding:12px;
  border:1px solid var(--lib-line);
  border-radius:8px;
  background:#fffaf2;
  color:inherit;
  text-decoration:none;
}
.lib-continue-item:hover { border-color:#c9b896; }
.lib-continue-item>span:last-child { display:flex; flex:1; flex-direction:column; gap:6px; min-width:0; }
.lib-continue-item strong { overflow:hidden; font:600 14px/1.4 var(--lib-display); text-overflow:ellipsis; white-space:nowrap; }
.lib-continue-item small { color:var(--lib-muted); font-size:11px; }
.lib-continue-cover .lib-cover { width:44px; height:62px; padding:4px; border-left-width:3px; box-shadow:2px 2px 4px #4b3a242d; }
.lib-continue-cover .lib-cover strong,.lib-continue-cover .lib-cover small,.lib-continue-cover .lib-cover i { display:none; }
.lib-progress { display:block; height:4px; overflow:hidden; border-radius:2px; background:#e6dccb; }
.lib-progress>span { display:block; height:100%; border-radius:2px; background:var(--lib-accent); }
.lib-loan .lib-progress { max-width:280px; margin-top:12px; }

/* --- Book detail ------------------------------------------------------------------- */
.lib-detail { display:grid; grid-template-columns:auto minmax(0,1fr); align-items:start; gap:40px; }
.lib-detail-cover { padding:36px 34px; border-radius:6px; background:linear-gradient(145deg,#eee6d6,#e4dac5); }
.lib-detail-cover .lib-cover { width:184px; height:258px; padding:25px 20px; }
.lib-detail-cover .lib-cover strong { margin-top:26px; font-size:26px; }
.lib-detail-cover .lib-cover small { font-size:10px; }
.lib-detail-info h2 { margin:10px 0 6px; font:600 32px/1.35 var(--lib-display); overflow-wrap:anywhere; }
.lib-detail-author { margin:0 0 18px; color:#5f584a; font-size:15px; }
.lib-detail-info .lib-book-note { font-size:15px; }
.lib-detail-info .lib-progress { max-width:320px; margin-top:20px; }
.lib-detail-info .lib-actions { padding-top:18px; border-top:1px solid var(--lib-line); }
.lib-how { margin:14px 0 0; color:var(--lib-muted); font-size:12px; line-height:1.8; }
.lib-detail-notes { margin-top:44px; padding-top:26px; border-top:1px solid var(--lib-line); }
.lib-detail-notes h3 { margin:0 0 4px; font:600 19px/1.5 var(--lib-display); }
.lib-quote {
  margin:18px 0 0;
  padding:4px 0 4px 16px;
  border-left:3px solid var(--hl,#f2c94c);
  color:#4d473a;
  font:15px/1.9 'Songti SC','STSong','Noto Serif CJK SC',Georgia,serif;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
}
.lib-quote[data-color=yellow] { --hl:#f2c94c; }
.lib-quote[data-color=green] { --hl:#7fbf7f; }
.lib-quote[data-color=blue] { --hl:#7fb2e5; }
.lib-quote[data-color=pink] { --hl:#ef9ab5; }
.lib-quote cite { display:block; margin-top:6px; color:var(--lib-muted); font:normal 12px/1.6 system-ui,sans-serif; }
.lib-board-note .lib-quote { margin:8px 0 12px; }

/* --- Librarian: manage view (F3.20-F3.23) ----------------------------------------- */
.lib-manage-block { margin-bottom:40px; }
.lib-manage-block h2 { margin:0 0 6px; font:600 22px/1.4 var(--lib-display); }
.lib-drop {
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:120px;
  margin-top:16px;
  border:1.5px dashed #c6b89d;
  border-radius:8px;
  background:#fffaf2;
  color:#85502e;
  font-size:14px;
  cursor:pointer;
}
.lib-drop:hover { background:#f6eddd; }
.lib-drop input { position:absolute; width:1px; height:1px; opacity:0; }
.lib-drop:focus-within { outline:2px solid #8a652f; outline-offset:3px; }
.lib-upload-form { display:grid; grid-template-columns:150px minmax(0,1fr); gap:28px; margin-top:18px; }
.lib-upload-cover img,.lib-upload-cover .lib-cover { width:140px; height:196px; object-fit:cover; box-shadow:3px 6px 12px #4b3a242d; }
.lib-upload-cover .lib-meta { font-size:11px; overflow-wrap:anywhere; }
.lib-upload-fields,.lib-edit-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px 18px; align-items:end; }
.lib-upload-fields>.lib-actions,.lib-upload-fields>.lib-visibility { grid-column:1/-1; margin:0; }
.lib-field { display:flex; flex-direction:column; gap:5px; min-width:0; color:#625c4e; font-size:12px; }
.lib-field.is-wide,.lib-field:has(.is-wide) { grid-column:1/-1; }
.lib-field input,.lib-field textarea,.lib-inline-form input {
  box-sizing:border-box;
  width:100%;
  min-height:40px;
  padding:8px 12px;
  border:1px solid #cfc3af;
  border-radius:5px;
  background:#fffaf0;
  color:var(--lib-ink);
  font:14px/1.6 system-ui,-apple-system,'PingFang SC',sans-serif;
}
.lib-field textarea { resize:vertical; }
.lib-thumb .lib-cover { width:40px; height:56px; padding:3px; border-left-width:3px; box-shadow:none; }
.lib-thumb .lib-cover strong,.lib-thumb .lib-cover small,.lib-thumb .lib-cover i { display:none; }
.lib-manage-table td { vertical-align:top; }
.lib-manage-table tr.is-unlisted td { color:var(--lib-muted); }
.lib-manage-table tr.is-unlisted .lib-thumb { opacity:.55; }
.lib-edit summary { min-height:32px; padding-top:6px; color:#85502e; font-size:12px; cursor:pointer; }
.lib-edit-fields { min-width:300px; padding:12px 0 6px; }
.lib-edit-fields>.kp-btn { grid-column:1/-1; justify-self:start; }
.lib-people { margin:14px 0; padding:0; list-style:none; }
.lib-people li { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:8px 0; border-bottom:1px solid var(--lib-line); font-size:13px; }
.lib-inline-form { display:flex; gap:10px; max-width:460px; }

/* --- Reader (F3.15-F3.19): full screen, the page chrome steps aside --------------- */
body.lib-is-reading { overflow:hidden; }
body.lib-is-reading .kp-header,body.lib-is-reading .kp-dev-banner,body.lib-is-reading .lib-sidebar { display:none!important; }
body.lib-is-reading .lib-shell { display:block; max-width:none; height:100dvh; min-height:0; }
body.lib-is-reading .lib-main,html.kp-embed body.lib-is-reading .lib-main { height:100%; padding:0; overflow:hidden; }
body.lib-is-reading #view,.lib-reading { height:100%; }
.lib-reading>.lib-loading,.lib-reading>.lib-error { padding:60px 32px; }
.rd {
  --rd-bg:#fbf6ec; --rd-fg:#2f2b22; --rd-muted:#7b7365; --rd-line:#e3d9c7; --rd-panel:#f5eee0; --rd-hover:#0000000d;
  position:relative;
  display:flex;
  flex-direction:column;
  height:100%;
  background:var(--rd-bg);
  color:var(--rd-fg);
  font-family:system-ui,-apple-system,'PingFang SC',sans-serif;
}
.rd[data-theme=sepia] { --rd-bg:#f1e4c8; --rd-fg:#3b2f1e; --rd-muted:#7d6a4c; --rd-line:#dac9a5; --rd-panel:#eadbb9; }
.rd[data-theme=white] { --rd-bg:#ffffff; --rd-fg:#1f1f1f; --rd-muted:#6f6f6f; --rd-line:#e6e6e6; --rd-panel:#f6f6f4; }
.rd[data-theme=night] { --rd-bg:#1f2126; --rd-fg:#d8d2c6; --rd-muted:#8f897d; --rd-line:#33363d; --rd-panel:#26292f; --rd-hover:#ffffff12; color-scheme:dark; }
.rd button { font:inherit; color:inherit; }
.rd-bar { display:flex; flex:none; align-items:center; gap:10px; height:56px; padding:0 12px; border-bottom:1px solid var(--rd-line); }
.rd-heading { display:flex; flex:1; flex-direction:column; min-width:0; text-align:center; }
.rd-title,.rd-chapter { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rd-title { font-size:14px; font-weight:600; }
.rd-chapter { color:var(--rd-muted); font-size:11px; }
.rd-tools { display:flex; gap:2px; }
.rd-icon {
  position:relative;
  display:inline-flex;
  align-items:center;
  gap:6px;
  min-width:44px;
  min-height:44px;
  justify-content:center;
  padding:0 10px;
  border:0;
  border-radius:8px;
  background:transparent;
  font-size:13px!important;
  cursor:pointer;
}
.rd-icon:hover,.rd-icon[aria-expanded=true] { background:var(--rd-hover); }
.rd-count:not(:empty) { min-width:16px; padding:0 4px; border-radius:8px; background:#bc632c; color:#fff; font:600 10px/16px system-ui,sans-serif; }
.rd-body { position:relative; display:flex; flex:1; min-height:0; }
.rd-stage { display:flex; flex:1; align-items:stretch; min-width:0; }
.rd-view { position:relative; flex:1; min-width:0; }
.rd-view foliate-view { display:block; width:100%; height:100%; }
.rd-loading { padding:60px 0; color:var(--rd-muted); text-align:center; }
.rd-turn { flex:none; width:56px; border:0; background:transparent; color:var(--rd-muted); cursor:pointer; opacity:.55; }
.rd-turn:hover { background:var(--rd-hover); opacity:1; }
.rd[data-flow=scrolled] .rd-turn { display:none; }
.rd-panel { flex:none; width:340px; overflow:auto; border-left:1px solid var(--rd-line); background:var(--rd-panel); }
.rd-panel[hidden] { display:none; }
.rd-panel-head { position:sticky; top:0; z-index:1; display:flex; align-items:center; justify-content:space-between; padding:8px 8px 8px 18px; background:var(--rd-panel); }
.rd-panel-head h2 { margin:0; font-size:15px; font-weight:600; }
.rd-panel-actions { display:flex; flex-wrap:wrap; gap:8px; padding:0 18px 12px; }
.rd .kp-btn { min-height:36px; border-color:var(--rd-line); color:var(--rd-fg); background:transparent; }
.rd .kp-btn-accent { border-color:#a95724; background:#bc632c; color:#fffaf0; }
.rd-toc { margin:0; padding:0 8px 16px; list-style:none; }
.rd-toc .rd-toc { padding:0 0 0 14px; }
.rd-toc button { display:block; width:100%; min-height:40px; padding:8px 10px; border:0; border-radius:6px; background:transparent; font-size:14px; line-height:1.5; text-align:left; cursor:pointer; }
.rd-toc button:hover { background:var(--rd-hover); }
.rd-toc button[aria-current] { color:#bc632c; font-weight:600; }
.rd-notes { margin:0; padding:0 12px 20px; list-style:none; }
.rd-notes li { margin-bottom:10px; padding:10px 12px; border-left:3px solid var(--hl); border-radius:4px; background:var(--rd-bg); }
.rd-note-jump { display:flex; flex-direction:column; gap:6px; width:100%; padding:0; border:0; background:transparent; text-align:left; cursor:pointer; }
.rd-note-jump q { quotes:none; font:14px/1.75 'Songti SC','STSong','Noto Serif CJK SC',Georgia,serif; display:-webkit-box; -webkit-line-clamp:4; -webkit-box-orient:vertical; overflow:hidden; }
.rd-note-body { font-size:13px; line-height:1.7; white-space:pre-wrap; overflow-wrap:anywhere; }
.rd-eyebrow { color:var(--rd-muted); font-size:11px; letter-spacing:.02em; }
.rd-note-meta { display:flex; align-items:center; justify-content:space-between; margin-top:6px; color:var(--rd-muted); font-size:11px; }
.rd-note-meta button { min-height:32px; padding:0 8px; border:0; background:transparent; color:#bc632c; font-size:12px; cursor:pointer; }
.rd-empty { padding:0 18px; color:var(--rd-muted); font-size:13px; line-height:1.8; }
.rd-settings { display:flex; flex-direction:column; gap:20px; padding:4px 18px 24px; }
.rd-range { display:flex; flex-direction:column; gap:8px; font-size:13px; }
.rd-range input { width:100%; accent-color:#bc632c; }
.rd-seg { margin:0; padding:0; border:0; }
.rd-seg legend { margin-bottom:8px; padding:0; font-size:13px; }
.rd-seg { display:flex; flex-wrap:wrap; gap:6px; }
.rd-seg label { flex:1 0 auto; }
.rd-seg input { position:absolute; opacity:0; pointer-events:none; }
.rd-seg span { display:block; min-height:36px; padding:8px 10px; box-sizing:border-box; border:1px solid var(--rd-line); border-radius:6px; font-size:13px; text-align:center; cursor:pointer; }
.rd-seg input:checked+span { border-color:#bc632c; color:#bc632c; font-weight:600; }
.rd-seg input:focus-visible+span { outline:2px solid #bc632c; outline-offset:2px; }
.rd-foot { display:flex; flex:none; align-items:center; gap:14px; height:44px; padding:0 18px; border-top:1px solid var(--rd-line); color:var(--rd-muted); font-size:12px; }
.rd-foot-chapter { flex:0 1 220px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rd-progress { flex:1; min-width:0; accent-color:#bc632c; }
.rd-percent { flex:none; min-width:36px; text-align:right; font-variant-numeric:tabular-nums; }
.rd-pop {
  position:absolute;
  z-index:5;
  display:flex;
  align-items:center;
  gap:4px;
  padding:6px 8px;
  border-radius:10px;
  background:#2c2a25;
  color:#f5efe3;
  box-shadow:0 6px 20px #0000003d;
  transform:translateX(-50%);
}
.rd-pop[hidden] { display:none; }
.rd-pop>button:not(.rd-swatch) { min-height:36px; padding:0 10px; border:0; border-radius:6px; background:transparent; font-size:13px; cursor:pointer; }
.rd-pop>button:not(.rd-swatch):hover { background:#ffffff1f; }
.rd-pop-sep { width:1px; height:20px; margin:0 4px; background:#ffffff33; }
.rd-swatch { width:28px; height:28px; margin:4px; padding:0; border:2px solid #ffffff55; border-radius:50%; background:var(--sw); cursor:pointer; }
.rd-swatch[aria-checked=true] { border-color:currentColor; box-shadow:0 0 0 2px var(--rd-bg),0 0 0 4px var(--sw); }
.rd-sheet {
  width:min(520px,calc(100vw - 32px));
  max-height:calc(100dvh - 48px);
  padding:0;
  border:1px solid var(--rd-line);
  border-radius:12px;
  background:var(--rd-bg);
  color:var(--rd-fg);
  box-shadow:0 20px 50px #00000040;
}
.rd-sheet::backdrop { background:#1d1a144d; }
.rd-editor { display:flex; flex-direction:column; gap:12px; padding:20px; }
.rd-quote { max-height:180px; margin:0; padding:2px 0 2px 14px; overflow:auto; border-left:3px solid var(--hl); font:15px/1.8 'Songti SC','STSong','Noto Serif CJK SC',Georgia,serif; white-space:pre-wrap; }
.rd-colors { display:flex; gap:4px; color:var(--rd-fg); }
.rd-colors .rd-swatch { border-color:transparent; }
.rd-label { font-size:13px; color:var(--rd-muted); }
.rd-editor textarea { box-sizing:border-box; width:100%; min-height:120px; padding:12px 14px; resize:vertical; border:1px solid var(--rd-line); border-radius:8px; background:transparent; color:inherit; font:15px/1.8 system-ui,-apple-system,'PingFang SC',sans-serif; }
.rd-editor textarea:focus-visible { outline:2px solid #bc632c; outline-offset:1px; }
.rd-check { display:flex; align-items:center; gap:8px; min-height:36px; font-size:13px; }
.rd-error { margin:0; color:#c0492b; font-size:13px; }
.rd-error[hidden] { display:none; }
.rd-actions { display:flex; align-items:center; gap:8px; }
.rd-spacer { flex:1; }
.rd .rd-danger { color:#c0492b; }
@media(max-width:900px) {
  .rd-icon>span { display:none; }
  .rd-icon { padding:0; }
}
@media(max-width:760px) {
  .rd-turn { display:none; }
  .rd-bar,.rd-foot { transition:transform .2s,opacity .2s; }
  .rd.is-chrome-hidden .rd-bar,.rd.is-chrome-hidden .rd-foot { opacity:0; pointer-events:none; }
  .rd-panel { position:absolute; inset:auto 0 0; z-index:4; width:auto; max-height:70%; border-top:1px solid var(--rd-line); border-left:0; border-radius:14px 14px 0 0; box-shadow:0 -10px 30px #00000026; }
  /* Five tools leave the title about 80px on a phone: the title gets its own full line
     under them, and the chapter moves down beside the progress bar. */
  .rd-bar { flex-wrap:wrap; row-gap:0; height:auto; padding:2px 8px 8px; }
  .rd-tools { margin-left:auto; }
  .rd-heading { order:3; flex:1 0 100%; padding:0 4px; }
  .rd-title { font-size:15px; }
  .rd-heading .rd-chapter { display:none; }
  .rd-foot { gap:12px; padding:0 16px; }
  .rd-foot-chapter { flex:0 1 auto; max-width:30%; }
  .rd-sheet { width:100vw; max-width:none; margin:auto 0 0; border-radius:14px 14px 0 0; }
}
@media(max-width:700px) {
  .lib-grid { grid-template-columns:repeat(auto-fill,minmax(130px,1fr)); gap:26px 16px; }
  .lib-book .lib-cover { width:104px; height:146px; }
  .lib-detail { display:block; }
  .lib-detail-cover { display:flex; justify-content:center; margin-bottom:24px; padding:30px 16px; }
  .lib-detail-cover .lib-cover { width:150px; height:210px; }
  .lib-detail-info h2 { font-size:27px; }
  .lib-upload-form { grid-template-columns:1fr; }
  .lib-upload-fields,.lib-edit-fields { grid-template-columns:1fr; }
  .lib-edit-fields { min-width:220px; }
}
@media(prefers-reduced-motion:reduce) {
  .rd-bar,.rd-foot { transition:none; }
}

/* --- Workbench modal (embedded in the town): one header row, the town owns nothing else */
.lib-sidebar .kp-host-btn { border-color:#d6cbb7; color:#5f584a; }
.lib-sidebar .kp-host-btn:hover { background:#eee5d5; }
html.kp-workbench .lib-shell { display:flex; flex-direction:column; height:100dvh; min-height:0; max-width:none; }
html.kp-workbench .lib-sidebar {
  position:static;
  display:flex;
  flex:none;
  align-items:center;
  gap:22px;
  height:64px;
  box-sizing:border-box;
  padding:0 14px 0 26px;
  border-right:0;
  border-bottom:1px solid var(--lib-line);
  overflow:visible;
}
html.kp-workbench .lib-brand-mark { margin:0; font-size:20px; letter-spacing:-.6px; white-space:nowrap; }
html.kp-workbench .lib-brand-mark span { display:inline; margin:0 0 0 8px; font-size:9px; }
html.kp-workbench .lib-tabs { flex:1; flex-direction:row; gap:2px; min-width:0; overflow-x:auto; scrollbar-width:none; }
html.kp-workbench .lib-tabs a { flex:none; gap:8px; min-height:40px; padding:8px 12px; font-size:13px; white-space:nowrap; }
html.kp-workbench .lib-tabs a[aria-current] { box-shadow:inset 0 -2px #b76a32; }
html.kp-workbench #reading-list,html.kp-workbench .lib-sidebar-art { display:none; }
html.kp-workbench .lib-main { flex:1; min-height:0; padding:30px 44px 44px; overflow:auto; }
html.kp-workbench .lib-page-title { margin-bottom:24px; padding-bottom:18px; }
html.kp-workbench .lib-page-title h1 { margin-top:4px; font-size:clamp(22px,2.2vw,30px); }
@media(max-width:700px) {
  html.kp-workbench .lib-sidebar { flex-wrap:wrap; gap:2px 10px; height:auto; padding:8px 10px 0 16px; }
  html.kp-workbench .lib-brand-mark { display:block; font-size:17px; }
  html.kp-workbench .lib-brand-mark span { display:none; }
  html.kp-workbench .lib-tabs { flex-basis:100%; order:3; }
  html.kp-workbench .lib-tabs a { flex:1 0 auto; justify-content:center; padding:8px 10px; }
  html.kp-workbench .lib-main { padding:20px 18px 28px; }
}
.rd-town { margin-left:6px; border:1px solid var(--rd-line)!important; border-radius:50%!important; padding:0!important; }
