.library-page {
  --library-gutter: 22px;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 var(--library-gutter) calc(32px + env(safe-area-inset-bottom));
}

.library-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  gap: 16px;
}

.wordmark {
  font: 600 25px var(--serif);
  color: var(--ink);
  min-width: 44px;
  justify-content: flex-start;
  transition: opacity .15s;
}
.wordmark:hover { opacity: .85; }
.library-header .wordmark[aria-current=page] { text-decoration: none; }
.library-header .site-mark { display: block; width: 70px; height: auto; }
html[data-theme=night] .library-header .site-mark { filter: invert(1) hue-rotate(180deg) brightness(1.1); }

.library-header nav {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.library-header nav a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 36px;
  padding: 0 11px;
  border-radius: 18px;
  color: var(--muted);
  font-weight: 500;
  transition: background .15s, color .15s;
  text-decoration: none;
}

.library-header nav a:hover {
  color: var(--green);
  background: var(--wash);
}

.library-header nav a[aria-current=page] {
  color: var(--green);
  background: var(--wash);
  font-weight: 600;
  text-decoration: none;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--green) 14%, var(--paper));
  color: var(--green);
  font: 600 11px/1 var(--sans);
}

.library-header #login-button {
  justify-self: end;
  min-height: 36px;
  padding: 0 8px;
  font-size: 13px;
  color: var(--muted);
}

/* Cover the page gutters while the header is stuck above scrolling covers. */
.library-header::before {
  content: "";
  position: absolute;
  inset: 0 calc(-1 * var(--library-gutter));
  z-index: -1;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  pointer-events: none;
}

/* Search wrapper with icon and clear button */
.library-header.has-search {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
}
.library-header.has-search nav { justify-content: flex-end; }

.library-search-wrap {
  position: relative;
  width: 100%;
  max-width: 340px;
  justify-self: center;
  min-width: 0;
}

.library-search-wrap .search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}

.library-header .library-search {
  width: 100%;
  min-height: 40px;
  margin: 0;
  padding: 8px 36px 8px 36px;
  font-size: 14px;
  border-radius: 20px;
  background: var(--wash);
  border: 1px solid transparent;
  transition: border-color .15s, background .15s, box-shadow .15s;
}

.library-header .library-search:focus {
  background: var(--paper);
  border-color: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 14%, transparent);
  outline: none;
}

.library-header .library-search::-webkit-search-cancel-button { display: none; }

.search-clear {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--muted);
  font-size: 19px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.search-clear:hover { color: var(--ink); background: color-mix(in srgb, var(--line) 45%, transparent); }

/* Book 3D Cover frame */
.cover-frame {
  position: relative;
  display: inline-block;
  border-radius: 3px 6px 6px 3px;
  overflow: hidden;
  box-shadow: -2px 0 0 color-mix(in srgb, var(--line) 85%, #000), 0 6px 16px rgba(24, 34, 28, 0.12), 0 1px 3px rgba(24, 34, 28, 0.08);
  transition: transform .22s cubic-bezier(.2,.8,.2,1), box-shadow .22s cubic-bezier(.2,.8,.2,1);
}
.cover-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(255,255,255,0.22) 0%, rgba(0,0,0,0.06) 3.5%, rgba(255,255,255,0.12) 6%, transparent 14%);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
  pointer-events: none;
}
.cover-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cover-shelf-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--green) 92%, #000);
  color: #fff;
  font: 600 11px/1 var(--sans);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.22);
  z-index: 2;
}

/* Featured Hero Banner on Home Page */
.featured {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  margin-top: 24px;
  padding: 20px 24px;
  background: linear-gradient(135deg, var(--wash) 0%, color-mix(in srgb, var(--wash) 65%, var(--paper)) 100%);
  border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(30, 42, 34, 0.04);
}
.featured-cover { display: block; }
.featured-cover .cover-frame { width: 64px; height: 94px; }
.featured-cover .cover-frame img { width: 64px; height: 94px; object-fit: cover; }

.featured-info { min-width: 0; }
.featured-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 500 11px/1.4 var(--sans);
  letter-spacing: .04em;
  color: var(--green);
  margin-bottom: 5px;
}
.eyebrow-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}
.featured h1 {
  font-size: 22px;
  line-height: 1.35;
  letter-spacing: .01em;
  overflow-wrap: anywhere;
}
.featured h1 a { color: inherit; transition: color .15s; }
.featured .book-author { margin-top: 4px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.featured-place {
  margin-top: 7px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--green);
  font-weight: 500;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
}
.featured-place.muted { color: var(--muted); font-weight: 400; }
.featured-pct { color: var(--muted); font-weight: 400; }
.featured-bar {
  margin-top: 6px;
  width: min(100%, 200px);
  height: 4px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--line) 85%, transparent);
  overflow: hidden;
}
.featured-bar > span {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--green);
}
.featured-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.featured-start {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 18px;
  border-radius: 21px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--green) 24%, transparent);
  transition: transform .15s, box-shadow .15s, opacity .15s;
}
.featured-sublink {
  font-size: 12px;
  color: var(--muted);
  padding: 2px 8px;
  transition: color .15s;
}
.featured-sublink:hover { color: var(--green); }

/* Library section header & category filter pills */
.library-books { padding-top: 28px; }
.library-section-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-bottom: 22px;
}
.shelf-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0;
}
.shelf-heading h2 { font-size: 23px; letter-spacing: .01em; }
.shelf-heading span { font-size: 12px; color: var(--muted); }

.library-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  padding: 4px 12px;
  border-radius: 16px;
  font: 12px/1.4 var(--sans);
  color: var(--muted);
  background: var(--wash);
  border: 1px solid transparent;
  transition: all .15s;
}
.filter-pill span { font-size: 11px; opacity: .75; }
.filter-pill:hover { color: var(--ink); border-color: var(--line); }
.filter-pill[aria-pressed="true"] {
  color: var(--green);
  background: color-mix(in srgb, var(--green) 11%, var(--paper));
  border-color: color-mix(in srgb, var(--green) 32%, transparent);
  font-weight: 600;
}

/* Books Grid & Book Cards */
.books-grid {
  --book-card-min: clamp(104px, calc(12.5vw + 50px), 156px);
  --book-card-width: clamp(132px, calc(25vw - 34px), 192px);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--book-card-min)), 1fr));
  gap: 32px clamp(14px, 2.4vw, 28px);
}
.book-card {
  color: var(--ink);
  min-width: 0;
  width: min(100%, var(--book-card-width));
  justify-self: center;
  overflow-wrap: anywhere;
  display: flex;
  flex-direction: column;
  text-decoration: none;
}
.book-card .cover {
  aspect-ratio: 2/3;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  margin-bottom: 12px;
}
.book-card .cover-frame {
  max-width: 100%;
  max-height: 100%;
  display: flex;
}
.book-card img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  border-radius: 3px 6px 6px 3px;
}
@media(hover:hover) {
  .book-card:hover .cover-frame,
  .featured-cover:hover .cover-frame {
    transform: translateY(-4px);
    box-shadow: -3px 2px 0 color-mix(in srgb, var(--line) 85%, #000), 0 12px 24px rgba(24, 34, 28, 0.16), 0 3px 6px rgba(24, 34, 28, 0.1);
  }
  .book-card:hover h3 { color: var(--green); }
  .featured h1 a:hover { color: var(--green); }
  .featured-start:hover { transform: translateY(-1px); }
}

.book-card h3 {
  font-size: clamp(15px, 2vw, 17px);
  line-height: 1.45;
  margin: 0;
  transition: color .15s;
}
.book-english {
  font: 14px/1.55 Georgia, serif;
  color: var(--muted);
  margin: 6px 0 8px;
  overflow-wrap: anywhere;
}
.book-author {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}
.book-card .book-author { margin: 4px 0 6px; }

.book-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}
.book-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 4px;
  background: #f5efe2;
  color: #8c6530;
  font: 500 11px/16px var(--sans);
}
.book-tag-bilingual { background: #e8f1fa; color: #3b668f; }
.book-tag-sample { background: #e6f2ec; color: #286b59; }
html[data-theme=night] .book-tag { background: #3b3526; color: #dfc088; }
html[data-theme=night] .book-tag-bilingual { background: #263849; color: #9ac2e8; }
html[data-theme=night] .book-tag-sample { background: #243b32; color: #9fc9af; }

.book-card .book-status {
  color: var(--green);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  margin-top: 6px;
  overflow-wrap: anywhere;
  display: flex;
  align-items: center;
  gap: 5px;
}
.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}
.book-meta-hint {
  font-size: 11px;
  color: var(--muted);
  opacity: .8;
  margin-top: 6px;
  line-height: 1.5;
}

/* Detail / Table of Contents Page */
.detail-nav-bar {
  display: flex;
  align-items: center;
  margin: 14px 0 -8px;
}
.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 4px 12px 4px 8px;
  border-radius: 19px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  transition: background .15s, color .15s;
}
.detail-back:hover {
  color: var(--green);
  background: var(--wash);
}

.book-overview {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  align-items: start;
  gap: 0 24px;
  margin-top: 18px;
  padding: 24px;
  background: linear-gradient(145deg, var(--wash) 0%, color-mix(in srgb, var(--wash) 60%, var(--paper)) 100%);
  border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  border-radius: 14px;
  box-shadow: 0 6px 24px rgba(28, 38, 32, 0.04);
}
.overview-cover { display: block; width: 100%; }
.overview-cover .cover-frame { width: 100%; }
.overview-cover img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 182px;
  object-fit: contain;
  object-position: center top;
}
.overview-info { min-width: 0; padding-top: 2px; }
.book-overview .book-author { font-size: 13px; line-height: 1.65; color: var(--ink); font-weight: 500; }
.book-overview h1 { font-size: 28px; letter-spacing: .01em; line-height: 1.35; overflow-wrap: anywhere; }
.book-overview h1 a { color: inherit; }
.book-title-note {
  display: inline-block;
  font-size: .65em;
  font-weight: 400;
  line-height: 1.6;
  color: var(--muted);
  margin-left: .5em;
  vertical-align: baseline;
}
.book-card .book-title-note { display: block; margin: 3px 0 0; font-size: .85em; white-space: normal; }

.detail-meta, .detail-records {
  font-size: 12px;
  line-height: 1.75;
  color: var(--muted);
  margin-top: 10px;
  overflow-wrap: anywhere;
}
.detail-badges { margin-top: 8px; }
.sample-count-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 12px;
  font: 500 11px/1.6 var(--sans);
  background: color-mix(in srgb, var(--green) 12%, var(--paper));
  color: var(--green);
}
.detail-records { margin-top: 6px; color: var(--green); font-weight: 500; }

.overview-footer {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.overview-footer .last-place {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.resume-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 3px;
}
.resume-location { color: var(--ink); font-weight: 500; }
.resume-location.muted { color: var(--muted); font-weight: 400; font-size: 12px; }
.resume-percent { color: var(--muted); font-weight: 400; white-space: nowrap; font-size: 12px; }
.resume-bar {
  margin-top: 6px;
  width: min(100%, 220px);
  height: 4px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--line) 90%, transparent);
  overflow: hidden;
}
.resume-bar > span {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--green);
}

.overview-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }
.overview-actions .primary,
.overview-actions .secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
  transition: all .15s;
}
.overview-actions .primary {
  box-shadow: 0 2px 8px color-mix(in srgb, var(--green) 22%, transparent);
}
.overview-actions .secondary {
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--paper);
}
.overview-actions [aria-pressed=true] {
  color: var(--green);
  border-color: var(--green);
  background: color-mix(in srgb, var(--green) 8%, var(--paper));
}
@media(hover:hover) {
  .book-overview h1 a:hover { color: var(--green); }
  .overview-actions .secondary:hover { border-color: var(--green); color: var(--green); }
}

.detail-description {
  font: 16px/1.9 var(--serif);
  margin: 22px 0 0;
  padding: 18px 20px;
  background: color-mix(in srgb, var(--wash) 55%, var(--paper));
  border-left: 3px solid color-mix(in srgb, var(--green) 55%, var(--line));
  border-radius: 0 10px 10px 0;
  color: var(--ink);
}
.description-source {
  font: 11px/1.6 var(--sans);
  color: var(--muted);
  margin-top: 8px;
}

.detail-toc { margin-top: 26px; }
.detail-toc-head {
  position: sticky;
  top: 70px;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 5;
  padding: 16px 0 12px;
  border-bottom: 1px solid var(--line);
}
.detail-toc-head .shelf-heading {
  justify-content: space-between;
  margin: 0;
}

.toc-volume {
  font: 600 19px/1.5 var(--serif);
  color: var(--ink);
  margin-top: 28px;
  padding-bottom: 6px;
}
.detail-toc .toc-group {
  padding: 16px 0 6px;
  font-size: 12px;
  color: var(--muted);
}

.detail-toc .toc-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 12px 10px;
  margin: 0 -10px;
  border-radius: 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 65%, transparent);
  width: calc(100% + 20px);
  text-align: left;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  transition: background .15s, color .15s;
  overflow-wrap: anywhere;
}
.detail-toc .toc-item:hover {
  background: var(--wash);
  color: var(--green);
}
.detail-toc .toc-item .num {
  font: 500 12px/1 var(--sans);
  min-width: 24px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.detail-toc .toc-item .toc-name {
  flex: 1;
  min-width: 0;
}
.detail-toc .toc-item.toc-only .toc-name {
  color: color-mix(in srgb, var(--ink) 78%, var(--muted));
}
.detail-toc .toc-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.toc-sample-pill {
  font: 500 11px/1.4 var(--sans);
  padding: 2px 7px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--green) 12%, var(--paper));
  color: var(--green);
  white-space: nowrap;
}
.toc-minutes {
  font: 12px/1 var(--sans);
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.detail-toc .toc-item.current {
  color: var(--green);
  font-weight: 600;
  background: color-mix(in srgb, var(--green) 7%, var(--paper));
}
.detail-toc .toc-item.current:before {
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 2px;
}

.library-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 48px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.library-footer button {
  min-height: 40px;
  color: var(--green);
  padding: 0 10px;
  border-radius: 6px;
  transition: background .15s;
}
.library-footer button:hover { background: var(--wash); }
.library-status { color: var(--muted); font-size: 13px; line-height: 1.8; }
.error-message { padding: 50px 0; line-height: 1.9; }
.error-message a, .error-message button { display: inline-block; min-height: 44px; color: var(--green); margin-top: 20px; }

/* Series & Collections */
.book-series { margin-top: 28px; border-top: 1px solid var(--line); scroll-margin-top: 90px; }
.book-series > summary { display: flex; align-items: center; gap: 16px; min-height: 66px; padding: 12px 0; list-style: none; cursor: pointer; }
.book-series > summary::-webkit-details-marker { display: none; }
.book-series h2 { font: 500 21px/1.5 var(--serif); flex: 1; min-width: 0; }
.book-series h2 span { display: block; font: 12px/1.8 var(--sans); color: var(--muted); margin-top: 3px; }
.series-count { font: 12px/1.6 var(--sans); color: var(--muted); white-space: nowrap; }
.book-series > summary::after { content: ""; width: 7px; height: 7px; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: rotate(45deg); margin-right: 4px; flex-shrink: 0; }
.book-series[open] > summary::after { transform: rotate(225deg); }
.book-series > summary:focus-visible { outline: 2px solid var(--green); outline-offset: 4px; }
.series-books { padding: 20px 0 26px; }
.group-eyebrow { font: 11px/1.8 var(--sans); color: var(--muted); margin-bottom: 5px; }
.collection-covers { position: relative; padding: 0 16px 0 0; isolation: isolate; }
.book-card .collection-covers img { position: absolute; bottom: calc(var(--stack)*4px); left: calc(var(--stack)*8px); width: calc(100% - 16px); height: auto; z-index: calc(3 - var(--stack)); }
.collection-volumes .shelf-heading { margin-bottom: 0; }
.volume-row { display: grid; grid-template-columns: 70px minmax(0,1fr); gap: 20px; padding: 24px 0; border-bottom: 1px solid var(--line); }
.volume-cover img { display: block; width: 70px; max-height: 110px; object-fit: contain; object-position: top left; border-radius: 2px; }
.volume-info h3 { font: 500 21px/1.5 var(--serif); overflow-wrap: anywhere; }
.volume-meta, .volume-info .book-status { font-size: 12px; line-height: 1.8; color: var(--muted); margin-top: 6px; }
.volume-info .book-status { color: var(--green); }
.volume-actions { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 8px; font-size: 13px; }
.volume-actions a { display: inline-flex; align-items: center; min-height: 44px; }

.detail-editions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.detail-editions button { min-height: 38px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; color: var(--muted); }
.detail-editions button[aria-pressed="true"] { color: var(--green); border-color: var(--green); background: var(--wash); }

/* Responsive Breakpoints */
@media(min-width: 660px) {
  .books-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media(min-width: 700px) {
  .library-page { --library-gutter: 32px; }
  .book-overview { grid-template-columns: 128px minmax(0, 1fr); gap: 0 28px; padding: 28px; }
  .overview-cover img { max-height: 192px; }
  .book-overview h1 { font-size: 31px; }
}
@media(min-width: 800px) {
  .books-grid { row-gap: 36px; }
}
@media(max-width: 599px) {
  .library-header.has-search { grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; }
  .library-header nav { gap: 2px; }
  .library-header nav a { padding: 0 8px; font-size: 12px; }
  .library-header .library-search { font-size: 13px; min-height: 36px; padding-left: 32px; }
  .library-search-wrap .search-icon { left: 10px; width: 14px; height: 14px; }
  .featured { grid-template-columns: 56px minmax(0, 1fr) auto; gap: 14px; padding: 16px; }
  .featured-cover .cover-frame, .featured-cover .cover-frame img { width: 56px; height: 82px; }
  .featured h1 { font-size: 19px; }
  .featured-start { padding: 8px 14px; min-height: 38px; font-size: 12px; }
  .featured-sublink { display: none; }
  .book-overview { grid-template-columns: 88px minmax(0, 1fr); gap: 0 18px; padding: 18px; }
  .overview-cover img { max-height: 132px; }
  .book-overview h1 { font-size: 23px; line-height: 1.4; }
  .book-title-note { display: block; margin: 4px 0 0; }
  .book-overview .book-english { font-size: 13px; margin: 5px 0 7px; }
  .overview-footer { flex-direction: column; align-items: stretch; gap: 14px; margin-top: 16px; padding-top: 14px; }
  .overview-actions .primary { flex: 1; }
  .overview-actions .secondary { min-width: 104px; padding-inline: 14px; }
  .detail-toc .toc-item { padding: 12px 6px; margin: 0 -6px; width: calc(100% + 12px); font-size: 16px; }
}
@media(max-width: 380px) {
  .library-page { --library-gutter: 16px; }
  .library-header.has-search { grid-template-columns: 1fr auto; padding: 8px 0 12px; row-gap: 6px; }
  .library-header.has-search .library-search-wrap { grid-column: 1 / -1; grid-row: 2; max-width: none; }
  .library-header.has-search nav { grid-column: 2; grid-row: 1; }
  .books-grid { --book-card-min: 128px; }
  .detail-toc-head { top: 108px; }
  .book-overview { grid-template-columns: 76px minmax(0, 1fr); gap: 0 14px; padding: 16px; }
  .overview-cover img { max-height: 112px; }
  .book-overview h1 { font-size: 21px; }
}
