#kb-reader-library {
  --ink: #39382f;
  --muted: #645f53;
  --line: #d9d2c1;
  --blue: #1768a6;
  width: min(58rem, calc(100% - 36px));
  max-width: none;
  max-height: min(87dvh, 51rem);
  margin: auto;
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: #fff;
  border: 1px solid #c6bda7;
  border-radius: 11px;
  box-shadow: 0 24px 80px #161f1752;
  font: 400 15px/1.5 Manrope, system-ui, sans-serif;
  text-align: left;
}
#kb-reader-library, #kb-reader-library * { box-sizing: border-box; }
#kb-reader-library::backdrop { background: #20282088; }
#kb-reader-library .kbr-shell { display: flex; flex-direction: column; max-height: inherit; }
#kb-reader-library :is(h2,h3,h4,p) { margin: 0; color: inherit; }
#kb-reader-library button { font: inherit; cursor: pointer; color: inherit; background: transparent; border: 0; padding: 0; box-shadow: none; }
#kb-reader-library :is(button,a,textarea,select):focus-visible { outline: 3px solid #2677ae; outline-offset: 2px; }
#kb-reader-library a { color: var(--blue); text-underline-offset: .18em; }
#kb-reader-library .kbr-head { display: flex; align-items: center; gap: 15px; flex: none; padding: 12px clamp(18px,3vw,36px); background: #f3f0e7; border-bottom: 1px solid var(--line); }
#kb-reader-library .kbr-head > span { font-size: .85rem; color: var(--muted); }
#kb-reader-library .kbr-close { margin-left: auto; width: 38px; height: 38px; border-radius: 50%; font: 400 31px/1 system-ui,sans-serif; }
#kb-reader-library .kbr-close:hover { background: #e5dfd0; }
#kb-reader-library .kbr-content { padding: clamp(20px,3.2vw,38px); overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
#kb-reader-library h2 { font: 500 clamp(33px,4.2vw,55px)/1.08 Georgia,serif; letter-spacing: -.035em; }
#kb-reader-library .kbr-help { margin-top: 9px; color: var(--muted); }
#kb-reader-library .kbr-modes { display: flex; gap: 5px; margin: 22px 0; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
#kb-reader-library .kbr-modes button { font-weight: 700; padding: 8px 17px; border-radius: 25px; }
#kb-reader-library .kbr-modes [aria-pressed=true] { background: var(--blue); color: #fff; }
#kb-reader-library .kbr-modes [aria-pressed=false]:hover { background: #f2f0e9; }
#kb-reader-library .kbr-layout { display: grid; grid-template-columns: minmax(135px, 1fr) minmax(0,3.5fr); gap: clamp(18px,3vw,34px); align-items: start; }
#kb-reader-library .kbr-filters { display: grid; gap: 2px; }
#kb-reader-library .kbr-filters button { display: flex; gap: 10px; align-items: center; justify-content: space-between; min-height: 38px; padding: 6px 10px; border-radius: 5px; text-align: left; font-size: 14px; }
#kb-reader-library .kbr-filters b { font: 600 .82rem/1.2 system-ui,sans-serif; color: var(--muted); font-variant-numeric: tabular-nums; }
#kb-reader-library .kbr-filters [aria-pressed=true] { background: #ebe7da; font-weight: 750; }
#kb-reader-library .kbr-filters button:hover { background: #f3f0e7; }
#kb-reader-library .kbr-results { min-width: 0; }
#kb-reader-library .kbr-listhead { min-height: 38px; display: flex; gap: 12px; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--line); }
#kb-reader-library h3 { font: 500 24px/1.25 Georgia,serif; letter-spacing: -.025em; }
#kb-reader-library .kbr-listhead > span { color: var(--muted); white-space: nowrap; font-size: 13px; }
#kb-reader-library .kbr-book { display: grid; grid-template-columns: 54px minmax(0,1fr) auto; align-items: start; gap: 10px 15px; padding: 17px 0; border-bottom: 1px solid #e6e2d7; }
#kb-reader-library .kbr-cover { display: grid; place-items: start center; }
#kb-reader-library .kbr-cover img { display: block; width: 100%; height: auto; max-height: 88px; object-fit: contain; }
#kb-reader-library .kbr-cover-fallback { display: grid; place-items: center; width: 43px; aspect-ratio: 1/1.55; border: 1px solid #d7cfb8; background: #f5f2e8; border-left: 4px double #c2b99d; }
#kb-reader-library .kbr-cover-fallback > span { width: 47%; height: 16%; border-top: 1px solid #aba18a; border-bottom: 1px solid #aba18a; }
#kb-reader-library h4 { font: 600 21px/1.17 Georgia,serif; overflow-wrap: anywhere; }
#kb-reader-library h4 strong { font-weight: inherit; }
#kb-reader-library h4 a { text-decoration-thickness: 1px; }
#kb-reader-library .kbr-author { margin-top: 3px; font-size: 14px; }
#kb-reader-library .kbr-biblio small { color: var(--muted); display: block; margin-top: 2px; font: 11px/1.6 ui-monospace,monospace; }
#kb-reader-library .kbr-state { display: block; font-size: 12px; font-weight: 700; color: #315a46; }
#kb-reader-library .kbr-note { font: italic 15px/1.5 Georgia,serif; color: var(--muted); margin-top: 5px; overflow-wrap: anywhere; white-space: pre-line; }
#kb-reader-library .kbr-edit, #kb-reader-library .kbr-empty button { color: var(--blue); font-size: 13px; text-decoration: underline; text-underline-offset: .18em; min-height: 36px; padding-inline: 2px; }
#kb-reader-library .kbr-editor { grid-column: 1/-1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 14px; background: #f7f5ef; border-radius: 5px; }
#kb-reader-library .kbr-editor label { display: grid; min-width: 0; gap: 4px; font-size: 13px; font-weight: 700; }
#kb-reader-library .kbr-editor :is(select,textarea) { width: 100%; min-width: 0; min-height: 39px; padding: 8px; font: 400 15px/1.4 system-ui,sans-serif; background: white; color: var(--ink); border: 1px solid #bfb8a5; border-radius: 5px; }
#kb-reader-library .kbr-note-input, #kb-reader-library .kbr-formbuttons { grid-column: 1/-1; }
#kb-reader-library .kbr-editor textarea { resize: vertical; }
#kb-reader-library .kbr-formbuttons { display: flex; gap: 10px; }
#kb-reader-library .kbr-formbuttons button { padding: 7px 13px; border-radius: 5px; font-weight: 650; }
#kb-reader-library .kbr-formbuttons [type=submit] { background: var(--blue); color: #fff; }
#kb-reader-library .kbr-empty { padding: 24px 0; }
#kb-reader-library .kbr-empty p { margin: 8px 0 12px; }
#kb-reader-library .kbr-foot { flex: none; display: flex; width: 100%; max-width: none; margin: 0; gap: 15px; align-items: center; justify-content: space-between; padding: 10px clamp(18px,3vw,36px); border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
#kb-reader-library .kbr-foot a { white-space: nowrap; font-weight: 700; }
@media (max-width: 650px) {
  #kb-reader-library { width: calc(100% - 16px); max-height: 92dvh; }
  #kb-reader-library .kbr-head { padding: 6px 15px; }
  #kb-reader-library .kbr-content { padding: 19px 15px; scrollbar-gutter: auto; }
  #kb-reader-library .kbr-layout { display: block; }
  #kb-reader-library .kbr-modes { margin: 14px 0 8px; }
  #kb-reader-library .kbr-filters { display: flex; flex-wrap: wrap; gap: 2px; margin-bottom: 14px; }
  #kb-reader-library .kbr-filters button { padding: 5px 8px; min-height: 36px; gap: 5px; font-size: 13px; }
  #kb-reader-library .kbr-book { grid-template-columns: 44px minmax(0,1fr) auto; gap: 8px; padding: 14px 0; }
  #kb-reader-library h4 { font-size: 18px; }
  #kb-reader-library .kbr-foot { padding: 9px 15px; line-height: 1.35; }
  #kb-reader-library .kbr-editor :is(select,textarea) { font-size: 16px; }
}
