/* Shared book labels use the same shape and spacing in every view. */
.book-purchase-link { max-width:100%; min-height:44px; height:auto; white-space:normal; line-height:1.5; }
.library-card>.book-purchase-link { grid-column:1 / -1; width:100%; }
.detail-title>.book-purchase-link { margin-top:14px; }
.synopsis-source { display:inline-flex; align-items:center; gap:5px; min-height:32px; max-width:100%; font-size:calc(11px * var(--text-scale,1)); line-height:1.5; color:var(--green); text-underline-offset:3px; }
.detail-synopsis-source { grid-column:1 / -1; margin:-10px 0 0; }
.detail-synopsis-source:empty { display:none; }
@media(max-width:760px) { .synopsis-source { min-height:40px; } }
.detail-title-row { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; }
.detail-hero .detail-title-row h3 { flex:1; min-width:0; margin:0; }
.detail-finished-date { display:grid; gap:4px; flex:0 0 auto; padding:8px 10px; border:1px solid var(--line); border-radius:10px; background:var(--green-light); color:var(--green); }
.detail-finished-date > span { font-size:calc(10px * var(--text-scale,1)); line-height:1.3; color:var(--muted); }
.detail-finished-date > time { font-size:calc(12px * var(--text-scale,1)); line-height:1.4; font-weight:500; white-space:nowrap; }
@media(max-width:760px) { .detail-title-row { flex-wrap:wrap; gap:10px; } .detail-hero .detail-title-row h3 { flex-basis:100%; } .detail-finished-date { flex-shrink:1; max-width:100%; padding:7px 9px; } }
.library-card .library-card-tags { grid-column:1 / -1; display:flex; flex-wrap:wrap; align-items:center; gap:8px; min-width:0; }
.library-card-state-tags { display:flex; flex-wrap:wrap; align-items:center; gap:8px; min-width:0; }
.library-card-tags>.library-loan { flex:1 1 100%; width:100%; }
.library-card .library-next-button { grid-column:1 / -1; min-height:44px; width:100%; height:auto; white-space:normal; line-height:1.5; }
.library-next-button.is-planned { background:var(--green-light); border-color:var(--green); color:var(--green); }
.library-purchase-options { grid-column:1 / -1; min-width:0; margin-top:auto; border:1px solid var(--line); border-radius:8px; }
.library-purchase-options > summary { display:flex; align-items:center; gap:10px; min-height:46px; padding:11px 14px; cursor:pointer; list-style:none; color:var(--green); }
.library-purchase-options > summary::-webkit-details-marker { display:none; }
.library-purchase-options > summary::marker { content:''; }
.library-purchase-options > summary > span { flex:1; min-width:0; font-size:calc(13px * var(--text-scale,1)); }
.library-purchase-options > summary > small { font-size:calc(11px * var(--text-scale,1)); color:var(--muted); }
.library-purchase-options > summary > svg { flex:0 0 16px; width:16px; height:16px; transition:transform .15s ease; }
.library-purchase-options > summary:hover { background:var(--bg); border-radius:8px; }
.library-purchase-options > summary:focus-visible { outline:2px solid var(--accent); outline-offset:3px; border-radius:8px; }
.library-purchase-options[open] > summary { border-bottom:1px solid var(--line); }
.library-purchase-options[open] > summary > svg { transform:rotate(180deg); }
.library-purchase-options .purchase-options-collapse, .library-purchase-options[open] .purchase-options-expand { display:none; }
.library-purchase-options[open] .purchase-options-collapse { display:inline; }
.library-purchase-options-body { display:flex; flex-direction:column; gap:10px; padding:12px; }
.library-purchase-options:not([open]) > .library-purchase-options-body { display:none; }
.library-card .library-purchase-options-body .btn { margin:0; min-height:44px; height:auto; white-space:normal; line-height:1.5; }
.library-purchase-options-body .library-copy-link { margin:0 auto; min-height:44px; }
.library-loan { margin-top:10px; min-width:0; display:grid; justify-items:start; gap:6px; }
.library-loan .loan-badge { display:inline-flex; align-items:center; gap:6px; min-height:28px; border-radius:20px; padding:5px 10px; font-size:calc(11px * var(--text-scale,1)); line-height:1.4; }
.library-loan .borrowed { background:var(--green-light); color:var(--green); }
.library-loan .lent { background:var(--warm,#f1e9de); color:var(--accent); }
.library-loan .loan-badge svg { flex:0 0 14px; width:14px; height:14px; }
.library-loan small { color:var(--muted); font-size:calc(11px * var(--text-scale,1)); line-height:1.6; overflow-wrap:anywhere; }
.library-loan small span { display:block; margin-top:2px; }
.library-loan .loan-overdue { color:var(--accent); }
.book-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
}
:is(.book-tags, .library-card-tags, .detail-badges)
  :is(.book-medium, .ownership-badge, .status-label, .priority-label) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 28px;
  max-width: 100%;
  margin: 0;
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: 20px;
  font-size: calc(11px * var(--text-scale, 1));
  font-weight: 500;
  line-height: 1.4;
}
:is(.book-tags, .library-card-tags, .detail-badges) .ownership-badge {
  border-color: var(--line);
}
:is(.book-tags, .library-card-tags, .detail-badges) svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}
.reading-card {
  grid-template-columns: 170px minmax(0, 1fr);
}
.reading-cover-column { display: grid; align-content: start; gap: 16px; min-width: 0; }
.reading-card-content { min-width: 0; }
.cover-synopsis { min-width: 0; }
.synopsis-caption { color: var(--green); font-size: 9px; letter-spacing: 1.1px; text-transform: uppercase; }
.cover-synopsis p { margin: 8px 0 4px; color: var(--muted); font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.synopsis-more { display: inline-flex; align-items: center; gap: 5px; min-height: 30px; padding: 4px 0; border: 0; background: none; color: var(--accent); text-align: left; font-size: 11px; }
.synopsis-more svg { width: 14px; height: 14px; }
.synopsis-more:hover { text-decoration: underline; text-underline-offset: 3px; }
.reading-cover-column > .book-cover {
  width: 170px;
  min-height: 0;
  aspect-ratio: 2 / 3;
  align-self: start;
}
@media (max-width: 1100px) {
  .reading-card {
    grid-template-columns: 136px minmax(0, 1fr);
  }
  .reading-cover-column > .book-cover {
    width: 136px;
  }
}
@media (max-width: 760px) {
  .reading-card {
    grid-template-columns: 98px minmax(0, 1fr);
  }
  .reading-cover-column > .book-cover {
    grid-column: 1;
    grid-row: 1;
    width: 98px;
  }
  .reading-card .reading-cover-column { display: contents; }
  .reading-card .book-heading { grid-row: 1; }
  .reading-card .book-tags { grid-row: 2; }
  .reading-card .cover-synopsis { grid-column: 1 / -1; grid-row: 3; padding: 12px 14px; border-left: 2px solid var(--line); border-radius: 0 8px 8px 0; background: var(--bg); }
  .cover-synopsis p { font-size: 13px; line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .synopsis-more { min-height: 36px; font-size: 12px; }
  .reading-card .book-tags {
    grid-column: 1 / -1;
    margin: 4px 0;
  }
}
@media (max-width: 360px) {
  .reading-card {
    grid-template-columns: 86px minmax(0, 1fr);
  }
  .reading-cover-column > .book-cover {
    width: 86px;
  }
}
/* Larger covers keep the edition's proportions inside the existing card grid. */
.library-card .cover-wrap {
  min-height: 280px;
  padding: 12px;
  align-items: center;
  background: var(--bg);
}
.library-card .book-cover {
  width: min(170px, 100%);
  min-height: 0;
  aspect-ratio: 2 / 3;
}
.library-copy-link {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: -4px auto 0;
  min-height: 36px;
  padding: 5px;
  background: transparent;
  border: 0;
  color: var(--green);
  font-size: calc(12px * var(--text-scale));
  text-decoration: underline;
  text-underline-offset: 3px;
  line-height: 1.5;
  grid-column: 1 / -1;
}
.ownership-fields { grid-column: 1 / -1; min-width: 0; margin: 8px 0; padding: 18px; border: 1px solid var(--line); border-radius: 12px; }
.ownership-fields legend { padding: 0 7px; font-weight: 600; font-size: 13px; }
.ownership-fields .form-grid { align-items: start; gap: 16px; }
.ownership-fields .field { min-width: 0; margin: 0; }
.book-path-summary.book-path-compact { padding: 20px; }
.book-path-overview > .book-forecast { margin: 0; }
.book-path-overview .book-forecast > .section-heading { margin: 0; }
.book-path-overview .book-forecast h4 { margin: 0; font-size: calc(23px * var(--text-scale, 1)); line-height: 1.3; color: var(--ink); }
.book-path-overview:empty { display: none; }
.book-path-details { margin-top: 18px; border-top: 1px solid var(--line); }
.book-path-details-summary { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 14px 0 0; list-style: none; cursor: pointer; color: var(--green); }
.book-path-details-summary::-webkit-details-marker { display: none; }
.book-path-details-summary::marker { content: ''; }
.book-path-details-summary > span { flex: 1; min-width: 0; font-size: calc(13px * var(--text-scale, 1)); font-weight: 500; line-height: 1.5; }
.book-path-details-summary small { color: var(--muted); font-size: calc(11px * var(--text-scale, 1)); }
.book-path-details-summary svg { flex: 0 0 16px; width: 16px; height: 16px; transition: transform .15s ease; }
.book-path-details-summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.book-path-details-summary .path-details-collapse { display: none; }
.book-path-details[open] > .book-path-details-summary .path-details-expand { display: none; }
.book-path-details[open] > .book-path-details-summary .path-details-collapse { display: inline; }
.book-path-details[open] > .book-path-details-summary svg { transform: rotate(180deg); }
.book-path-details-body { padding-top: 18px; }
.book-path-summary.book-path-finished { padding:0; overflow:hidden; }
.book-path-finished > .book-path-details-summary { padding:16px 18px; min-height:56px; }
.book-path-finished[open] > .book-path-details-summary { border-bottom:1px solid var(--line); }
.book-path-finished > .book-path-details-body { padding:18px 20px; }
.book-path-finished:not([open]) > .book-path-details-body { display:none; }
.book-path-finished .book-forecast { margin:0 0 22px; }
.book-path-details-body > .book-week:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.book-annotations.annotations-disclosure { padding: 0; margin: 18px 0; overflow: hidden; }
.annotations-summary { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 14px 16px; cursor: pointer; list-style: none; }
.annotations-summary::-webkit-details-marker { display: none; }
.annotations-summary::marker { content: ''; }
.annotations-summary:hover { background: var(--bg); }
.annotations-summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; border-radius: 12px; }
.annotations-summary h3 { flex: 1; min-width: 0; margin: 0; font-size: calc(21px * var(--text-scale, 1)); line-height: 1.3; }
.annotations-count { display: grid; place-items: center; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 20px; background: var(--green-light); color: var(--green); font-size: 11px; }
.annotations-chevron { width: 16px; height: 16px; flex: 0 0 16px; color: var(--green); transition: transform .15s ease; }
.annotations-disclosure[open] > .annotations-summary { border-bottom: 1px solid var(--line); }
.annotations-disclosure[open] .annotations-chevron { transform: rotate(180deg); }
.annotations-body { padding: 14px 16px; }
.annotations-tools { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.annotations-tools .btn { min-height: 40px; font-size: calc(12px * var(--text-scale, 1)); }
.annotations-body > .path-help { margin: 12px 0 0; }
.annotations-body .annotation-card { margin: 12px 0 0; padding: 12px 14px; }
.annotations-body .annotation-text { line-height: 1.7; }
@media (max-width: 600px) {
  .book-path-summary.book-path-compact { padding: 16px; }
  .book-path-overview .book-forecast h4 { font-size: calc(21px * var(--text-scale, 1)); }
  .ownership-fields { padding: 14px; }
  .ownership-fields .form-grid { grid-template-columns: minmax(0, 1fr); }
  .annotations-summary { gap: 9px; padding: 12px 14px; }
  .annotations-summary h3 { font-size: calc(20px * var(--text-scale, 1)); }
}
.library-saga-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--green);
  text-align: left;
}
.library-saga-link > span { flex: 1; min-width: 0; }
.library-saga-link strong { display: block; font-size: calc(13px * var(--text-scale, 1)); font-weight: 600; line-height: 1.45; overflow-wrap: anywhere; }
.library-saga-link small { display: block; margin-top: 3px; color: var(--muted); font-size: calc(11px * var(--text-scale, 1)); line-height: 1.5; }
.library-saga-link svg { flex: 0 0 20px; width: 20px; height: 22px; stroke-width: 1.5; }
.library-saga-link .library-saga-arrow { flex-basis: 14px; width: 14px; height: 18px; }
.library-saga-link:hover { border-color: var(--green); background: var(--green-light); }
#library-results {
  scroll-margin-top: calc(90px + var(--app-safe-area-top));
}
.library-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 18px 0;
  min-width: 0;
  color: var(--muted);
  font-size: calc(12px * var(--text-scale));
}
.library-pagination p {
  margin: 0;
  line-height: 1.7;
}
.library-pagination strong {
  color: var(--ink);
  font-weight: 500;
}
.library-page-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}
.library-page-button {
  min-width: 38px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 10px;
  background: var(--paper);
  color: var(--ink);
}
.library-page-button[aria-current="page"] {
  background: var(--green-light);
  border-color: var(--green);
  color: var(--green);
  font-weight: 600;
}
.library-page-button:disabled {
  opacity: 0.4;
  cursor: default;
}
.library-page-gap {
  padding: 4px;
}
.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 10px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.breadcrumb li {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.breadcrumb li > svg {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
}
.breadcrumb button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 4px 0;
  min-height: 32px;
  font: inherit;
  text-underline-offset: 4px;
}
.breadcrumb button:hover {
  color: var(--green);
  text-decoration: underline;
}
.breadcrumb span[aria-current="page"] {
  color: var(--ink);
  line-height: 1.5;
}
.breadcrumb.breadcrumb--mobile {
  display: none;
}
.path-heading-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.library-toolbar {
  display: grid;
  grid-template-columns: auto minmax(200px, 1fr) auto;
  gap: 14px;
  margin-bottom: 16px;
}
.library-toolbar > .tabs { grid-column: 1 / -1; justify-self: start; max-width: 100%; }
.library-toolbar > .searchbox { min-width: 0; max-width: none; width: 100%; order: initial; grid-column: auto; flex-basis: auto; }
.library-toolbar .searchbox input { padding-left: 38px; }
.library-toolbar > .view-toggle { grid-column: auto; grid-row: auto; justify-self: end; margin-left: 0; gap: 8px; }
.library-toolbar .view-toggle label { display: inline; }
.library-toolbar .view-toggle select { width: auto; min-width: 140px; min-height: 42px; font-size: 12px; }
.library-filter-toggle { white-space: nowrap; min-height: 42px; }
.library-filter-toggle[aria-expanded="true"] { border-color: var(--green); background: var(--green-light); color: var(--green); }
.library-filter-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 20px; background: var(--green-light); color: var(--green); font-size: 11px; }
.library-extra-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 24px; padding: 22px 24px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.library-extra-heading { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.library-extra-heading h2 { margin: 0; font-size: calc(23px * var(--text-scale, 1)); }
.library-extra-heading .btn-link, .library-active-filters .btn-link { font-size: calc(12px * var(--text-scale, 1)); min-height: 36px; }
.library-filter-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.library-filter-field label { font-size: calc(12px * var(--text-scale, 1)); color: var(--muted); }
.library-filter-field select { min-height: 44px; width: 100%; min-width: 0; font-size: calc(13px * var(--text-scale, 1)); }
.library-active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin-bottom: 16px; padding: 10px 14px; border-radius: 10px; background: var(--green-light); color: var(--green); font-size: calc(12px * var(--text-scale, 1)); }
.library-active-filters p { flex: 1; margin: 0; min-width: 0; overflow-wrap: anywhere; line-height: 1.7; }
:is(.library-extra-filters, .library-active-filters, .library-filter-count)[hidden] { display: none; }
@media (min-width: 1450px) {
  .library-toolbar { grid-template-columns: auto auto minmax(200px, 1fr) auto; }
  .library-toolbar > .tabs { grid-column: auto; }
}
@media (max-width: 760px) {
  .library-toolbar {
    grid-template-columns: minmax(0, 1fr) 128px;
    gap: 12px;
  }
  .library-toolbar .tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    order: 0;
  }
  .library-toolbar .tab {
    padding: 9px 5px;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .library-toolbar > .tabs { justify-self: stretch; width: 100%; }
  .library-toolbar > .library-filter-toggle { grid-column: 1 / -1; justify-self: start; min-height: 44px; }
  .library-toolbar > .searchbox { grid-column: 1; align-self: end; }
  .library-toolbar > .view-toggle { display: grid; grid-column: 2; width: 100%; gap: 5px; }
  .library-toolbar .view-toggle label { font-size: 11px; }
  .library-toolbar .view-toggle select { min-width: 0; width: 100%; min-height: 46px; padding: 8px; }
  .library-extra-filters { grid-template-columns: minmax(0, 1fr); padding: 18px 16px; gap: 18px; }
  .library-filter-field select { min-height: 46px; font-size: calc(14px * var(--text-scale, 1)); }
  html[data-text-size="larger"] .library-toolbar .tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .breadcrumb.breadcrumb--mobile {
    display: block;
    margin: 0 0 14px;
    font-size: calc(12px * var(--text-scale));
  }
  .breadcrumb--mobile button {
    min-height: 40px;
  }
  .library-card {
    grid-template-columns: 98px minmax(0, 1fr);
  }
  .library-card .cover-wrap {
    min-height: 0;
    padding: 0;
  }
  .library-card .book-cover {
    width: 98px;
  }
  .library-page-button {
    min-height: 44px;
  }
  .library-page-links {
    gap: 4px;
  }
  .library-copy-link {
    min-height: 44px;
  }
  .path-heading-actions {
    width: 100%;
  }
  .path-heading-actions .btn {
    flex: 1 1 auto;
  }
}
@media (max-width: 360px) {
  .library-card {
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 12px;
  }
  .library-card .book-cover {
    width: 86px;
  }
}

/* Timeline search is opened from the page actions. */
.page-heading-actions { display:flex; align-items:center; gap:10px; flex-shrink:0; }
#timeline-search-toggle[aria-expanded="true"] { background:var(--green-light); border-color:var(--green); color:var(--green); }
.timeline-search-count { display:inline-grid; place-items:center; min-width:20px; height:20px; border-radius:50%; background:var(--green-light); color:var(--green); font-size:10px; }
.timeline-collapsed-results { display:flex; align-items:center; flex-wrap:wrap; gap:10px 18px; color:var(--muted); font-size:12px; margin:0 0 24px; }
.timeline-year-navigation { padding:20px; margin:0 0 28px; background:var(--paper); border:1px solid var(--line); border-radius:14px; }
.timeline-year-navigation > p { margin:0 0 12px; font-size:calc(11px * var(--text-scale,1)); letter-spacing:.08em; color:var(--muted); }
.timeline-year-options { display:flex; flex-wrap:wrap; gap:10px; }
.timeline-year-button { min-height:44px; height:auto; gap:10px; border-radius:24px; padding:10px 16px; }
.timeline-year-button strong { font-size:calc(14px * var(--text-scale,1)); color:var(--ink); }
.timeline-year-button span { font-size:calc(11px * var(--text-scale,1)); color:var(--muted); }
.timeline-year-button:is(:hover,:focus-visible) { background:var(--green-light); border-color:var(--green); }
.timeline-year-start { scroll-margin-top:calc(90px + var(--app-safe-area-top)); }
.timeline-year-start:focus-visible { outline:2px solid var(--green); outline-offset:6px; border-radius:2px; }
@media(max-width:900px) {
  .page-heading--actions { flex-wrap:wrap; }
}
@media(max-width:600px) {
  .page-heading--actions { flex-direction:column; align-items:stretch; }
  .page-heading-actions { width:100%; gap:10px; }
  .page-heading-actions .btn { flex:1 1 0; min-width:0; min-height:44px; padding:10px 8px; font-size:calc(12px * var(--text-scale,1)); gap:6px; white-space:normal; }
  .page-heading-actions .btn svg { width:17px; height:17px; flex-shrink:0; }
}
