/* Lulla Library: the shared storybook world, with the catalogue kept front and centre. */
.world-library { background: radial-gradient(ellipse at 50% 180px, #fffaf0 0, transparent 680px), var(--paper); }
.world-library [hidden] { display: none !important; }
.world-library :is(a, button, input, select):focus-visible { outline: 3px solid #54724a; outline-offset: 3px; }
.world-library button:disabled { cursor: default; opacity: .6; }
.library-width { width: min(1240px, calc(100% - 64px)); margin-inline: auto; }
.library-welcome { position: relative; isolation: isolate; margin-bottom: 28px; background: #fff5df; border-bottom: 1px solid #c8b48460; }
.library-banner-art { position: absolute; inset: 0; z-index: -1; display: block; width: 100%; height: 100%; object-fit: contain; }
.library-welcome-inner { display: grid; grid-template-columns: 33% 41% 26%; align-items: center; width: min(100%, 1680px); min-height: min(33.333vw, 560px); margin-inline: auto; }
.library-welcome-copy { grid-column: 2; padding-block: 30px; text-align: center; }
.library-eyebrow { margin: 0 0 10px; color: #746340; font-size: 11px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.library-welcome h1 { margin: 0; font: 500 clamp(30px, 3.6vw, 54px)/1.06 Georgia, serif; letter-spacing: -.035em; }
.library-welcome h1 em { color: var(--green); font-weight: 400; }
.library-welcome-description { max-width: 500px; margin: 16px auto 0; color: #536050; font-size: 14px; line-height: 1.65; }
.library-banner-note { margin: 16px 0 0; font: italic 15px/1.4 Georgia, serif; color: #746340; }
.library-search-form { padding: 22px 24px; background: #fffaf0; border: 1px solid #c8b484; border-radius: 20px; box-shadow: 0 4px 0 #c4af7720, 0 12px 32px #5d643907; }
.library-search-row { display: flex; align-items: end; gap: 12px; }
.library-search { flex: 1; min-width: 0; }
.library-search-row label, .library-filters label { display: grid; gap: 7px; font-size: 12px; font-weight: 700; color: #42543e; }
.library-search-row input, .library-filters select { width: 100%; min-width: 0; min-height: 44px; border: 1px solid #c6c7aa; border-radius: 10px; background: #fffef8; color: var(--ink); padding: 10px 12px; font: 14px "Trebuchet MS", Arial, sans-serif; }
.library-search-row input::placeholder { color: #737763; opacity: 1; }
.library-search-button, .library-load-all, .library-app-button, .copy-book-button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; border: 1px solid #3e623c; border-radius: 10px; padding: 10px 20px; color: #fffaf0; background: var(--green); font-weight: 700; text-decoration: none; }
.library-search-button:hover, .library-load-all:not([aria-disabled="true"]):hover, .library-app-button:hover, .copy-book-button:hover { background: #2f4f2e; }
.library-filter-toggle, .library-clear, .library-load-more, .library-retry { min-height: 44px; padding: 10px 16px; border: 1px solid #c6b686; border-radius: 10px; background: #f5ead0; color: #42543e; font-size: 13px; font-weight: 700; }
.library-clear { border-color: transparent; background: transparent; text-decoration: underline; text-underline-offset: 4px; }
.library-filter-toggle:hover, .library-load-more:hover, .library-retry:hover { background: #efe0b9; }
.library-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; padding-top: 18px; margin-top: 18px; border-top: 1px solid #dfd4b9; }
.age-filter { grid-column: span 2; min-width: 0; margin: 0; padding: 0; border: 0; }
.age-filter legend { padding: 0; margin-bottom: 7px; font-size: 12px; color: #42543e; font-weight: 700; }
.age-chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.library-filters .age-chip { position: relative; display: block; }
.age-chip input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.age-chip span { display: grid; place-items: center; width: 38px; min-height: 44px; border: 1px solid #c6c7aa; border-radius: 10px; background: #fffef8; font-size: 14px; }
.age-chip input:checked + span { color: #fffaf0; border-color: var(--green); background: var(--green); }
.age-chip input:focus-visible + span { outline: 3px solid #54724a; outline-offset: 3px; }
.library-results-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding-block: 30px 22px; }
.library-results-heading h2 { margin: 0 0 7px; font: 400 clamp(22px, 2.4vw, 29px)/1.2 Georgia, serif; letter-spacing: -.025em; }
.library-status { margin: 0; font-size: 13px; color: #5e694f; line-height: 1.5; }
.library-view-actions { text-align: right; }
.library-load-all { min-width: 210px; min-height: 52px; padding-inline: 28px; border-radius: 13px; box-shadow: 0 3px 0 #263f24; font-size: 16px; }
.library-load-all[aria-disabled="true"] { background: #e7ecd8; color: #3e623c; border-color: #a6b48d; box-shadow: none; cursor: default; }
.library-view-actions p { margin: 8px 0 0; font-size: 11px; line-height: 1.5; color: #64694e; }
.library-paged { min-height: 32px; margin-top: 2px; padding: 4px 0; border: 0; background: transparent; color: #3e623c; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.free-book-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; }
.free-book-card { min-width: 0; display: flex; flex-direction: column; padding: 10px; border: 1px solid #d2bd8d; border-radius: 17px; background: #fffbef; box-shadow: 0 4px 0 #bda56c22; }
.book-cover { display: grid; place-items: center; width: 100%; aspect-ratio: 1; overflow: hidden; border-radius: 10px; padding: 10px; background: #eee8d4; color: #627154; }
.free-book-card:nth-child(4n+2) .book-cover { background: #e8ecd9; }
.free-book-card:nth-child(4n+3) .book-cover { background: #f4e4cd; }
.free-book-card:nth-child(4n+4) .book-cover { background: #e9ece4; }
.book-cover img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; filter: drop-shadow(0 3px 4px #34372325); }
.book-cover span { padding: 14px; text-align: center; font: 22px/1.3 Georgia, serif; }
.book-card-summary { flex: 1; display: flex; flex-direction: column; padding: 13px 3px 3px; }
.book-visible-details { flex: 1; }
.book-visible-details h3 { margin: 0 0 10px; font: 500 20px/1.2 Georgia, serif; overflow-wrap: anywhere; }
.book-popularity { display: grid; gap: 5px; color: #69715d; font-size: 11px; line-height: 1.4; }
.book-stars { color: #c6b991; letter-spacing: 2px; font-size: 15px; }
.book-stars .is-filled { color: #986514; }
.book-card-actions { display: flex; align-items: stretch; gap: 8px; margin-top: 16px; }
.book-more-button, .book-pending { display: inline-flex; justify-content: center; align-items: center; min-height: 44px; padding: 8px 10px; border: 1px solid #cbbd98; border-radius: 9px; background: #faf3e2; color: #45543c; font-size: 12px; font-weight: 700; }
.copy-book-button { flex: 1; padding: 8px 10px; border-radius: 9px; font-size: 12px; }
.book-more-button:hover { background: #eee6cd; }
.library-load-more { display: block; min-width: 240px; margin: 32px auto 0; }
.library-empty { grid-column: 1 / -1; margin: 0; padding: 50px 24px; text-align: center; border: 1px dashed #bcb389; border-radius: 18px; background: #f8f1dc; line-height: 1.65; }
.library-take-home { display: grid; grid-template-columns: 130px minmax(0, 1fr) 120px; align-items: center; gap: 26px; margin-block: 56px 32px; padding: 26px; border-block: 1px solid #c8b48480; }
.library-take-home-art { width: 100%; height: auto; border-radius: 50%; mix-blend-mode: multiply; }
.library-take-home h2 { margin: 0; font: 400 29px/1.2 Georgia, serif; }
.library-take-home p:not(.library-eyebrow) { color: #536050; font-size: 14px; line-height: 1.7; }
.library-app-actions { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; font-size: 12px; }
.library-app-actions > a:last-child { text-underline-offset: 4px; }
.library-qr { margin: 0; text-align: center; }
.library-qr img { width: 100%; height: auto; border-radius: 12px; }
.library-qr figcaption { margin-top: 6px; color: #536050; font-size: 11px; }
.world-library .world-footer { padding: 10px 20px 26px; font-size: 11px; flex-wrap: wrap; }
.book-modal-open { overflow: hidden; }
.book-modal-backdrop { position: fixed; z-index: 30; inset: 0; display: grid; place-items: center; padding: 20px; background: #20362bc4; }
.book-modal { width: min(900px, 100%); max-height: 90svh; overflow-y: auto; padding: 26px; border: 1px solid #c8b484; border-radius: 22px; background: var(--paper); box-shadow: 0 20px 80px #14231a60; overscroll-behavior: contain; }
.book-modal h2 { margin: 14px 0 22px; font: 400 32px/1.2 Georgia, serif; }
.book-modal p { color: #536050; line-height: 1.7; }
.book-modal-close, .book-preview-nav, .book-rating-controls button { min-height: 44px; padding: 9px 16px; border: 1px solid #b5b991; border-radius: 10px; background: #f8f0d9; color: #354f33; }
.book-modal-close { display: block; margin-left: auto; }
.book-preview-viewer { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.book-preview-frame { min-width: 0; margin: 0; padding: 12px; border-radius: 14px; background: #e9e7d2; }
.book-preview-frame img { display: block; width: 100%; height: min(50svh, 460px); object-fit: contain; }
.book-preview-frame figcaption { padding-top: 10px; text-align: center; font-size: 12px; color: #526049; }
.book-modal-meta { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; padding-block: 18px; border-block: 1px solid #c8b48480; font-size: 13px; line-height: 1.6; }
.book-modal-meta dt { color: #647050; }
.book-modal-meta dd { margin: 0; overflow-wrap: anywhere; }
.book-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.book-tags span { padding: 5px 9px; border-radius: 20px; background: #e6e9d3; font-size: 11px; color: #45543c; }
.book-rating-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 22px; font-size: 13px; }
.book-rating-controls button { min-width: 44px; padding-inline: 12px; }
@media (max-width: 1050px) {
  .library-width { width: calc(100% - 40px); }
  .library-welcome-copy { padding-block: 20px; }
  .library-welcome .library-eyebrow { font-size: 9px; letter-spacing: .09em; }
  .library-welcome-description { font-size: 12px; margin-top: 12px; }
  .library-banner-note { font-size: 13px; margin-top: 12px; }
  .free-book-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
  .library-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .age-filter { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .library-width { width: calc(100% - 32px); }
  .library-welcome { margin-bottom: 22px; }
  .library-banner-art { position: static; height: auto; }
  .library-welcome-inner { display: block; min-height: 0; }
  .library-welcome-copy { padding: 12px 24px 26px; }
  .library-welcome h1 { font-size: clamp(32px, 5.2vw, 40px); }
  .library-eyebrow { font-size: 10px; line-height: 1.5; letter-spacing: .09em; }
  .library-welcome-description { max-width: 470px; font-size: 13px; line-height: 1.6; }
  .library-search-form { padding: 16px; border-radius: 16px; }
  .library-search-row { flex-wrap: wrap; gap: 8px; }
  .library-search { flex-basis: 100%; }
  .library-search-row input, .library-filters select { font-size: 16px; }
  .library-search-button { padding-inline: 18px; font-size: 13px; }
  .library-filter-toggle { flex: 1; padding-inline: 10px; }
  .library-clear { padding-inline: 8px; }
  .library-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 10px; }
  .age-chip-list { gap: 5px; }
  .age-chip span { width: 35px; }
  .library-results-heading { align-items: flex-start; gap: 16px; padding-block: 24px 18px; }
  .library-results-heading h2 { font-size: 23px; }
  .library-load-all { min-width: 180px; padding-inline: 16px; }
  .free-book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .free-book-card { padding: 8px; border-radius: 14px; }
  .book-visible-details h3 { font-size: 18px; }
  .book-card-actions { flex-direction: column; margin-top: 12px; }
  .library-take-home { grid-template-columns: 80px minmax(0, 1fr); gap: 16px; padding: 24px 0; }
  .library-take-home h2 { font-size: 24px; }
  .library-qr { display: none; }
  .library-take-home .library-app-button { padding: 10px 12px; }
  .book-modal-backdrop { padding: 12px; }
  .book-modal { padding: 16px; max-height: 94svh; }
  .book-modal h2 { font-size: 26px; }
  .book-preview-viewer { grid-template-columns: 1fr 1fr; }
  .book-preview-frame { grid-column: 1 / -1; grid-row: 1; }
}
@media (max-width: 480px) {
  .library-results-heading { display: block; }
  .library-view-actions { margin-top: 16px; text-align: left; }
  .library-load-all { width: 100%; }
  .library-view-actions p { text-align: center; }
  .library-paged { display: block; margin-inline: auto; }
  .book-cover { padding: 6px; }
  .book-card-summary { padding: 11px 2px 2px; }
  .book-visible-details h3 { font-size: 17px; }
  .library-take-home { grid-template-columns: 1fr; }
  .library-take-home-art { width: 90px; }
}
