/* Alternative layout. Folio remains the default until selected in Settings. */
.shelves-only { display: none; }
.library-search-row, .library-filter-options { display: contents; }
.settings-header { display: inline-flex; }
.view-settings { margin: 0; padding: 0; border: 0; }
.view-settings legend { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.view-settings label { display: flex; align-items: center; gap: 16px; min-height: 80px; padding: 16px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.view-settings input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.view-settings label span { display: flex; flex-direction: column; gap: 4px; }
.view-settings strong { font-size: 18px; font-weight: 500; }
.view-settings small { font-size: 13px; color: var(--muted); }
.settings-links { display: flex; flex-direction: column; gap: 8px; margin-top: 28px; }
.settings-links a, .settings-links button { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 6px 0; color: inherit; text-align: left; text-decoration: none; }
.settings-links a:hover, .settings-links button:hover { color: var(--accent); }
.settings-actions { display: flex; flex-direction: column; gap: 4px; margin-bottom: 24px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.settings-actions button { display: flex; align-items: center; gap: 14px; min-height: 48px; padding: 8px 0; text-align: left; font-size: 16px; }
.settings-actions .icon { width: 24px; height: 24px; }
.shelves-mode {
  --accent: #963b4d;
  --accent-soft: #eadcce;
  --page-pad: 18px;
  --book-h: clamp(155px, 43vw, 200px);
  display: flex; flex-direction: column; height: 100svh; min-height: 0; overflow: hidden;
}
.shelves-mode .shelves-only { display: flex; }
.shelves-mode .app-header { flex: none; padding: calc(24px + env(safe-area-inset-top, 0px)) var(--page-pad) 14px; gap: 8px; }
.shelves-mode .library-heading { flex-direction: row; align-items: baseline; gap: 2px 10px; }
.shelves-mode .app-header h1 { font-family: "EB Garamond", Georgia, serif; font-size: clamp(21px, 5.6vw, 34px); letter-spacing: -0.035em; line-height: 1.15; white-space: nowrap; }
.shelves-mode .library-count { font-family: "EB Garamond", Georgia, serif; font-size: 15px; font-style: italic; }
.shelves-mode .header-actions { gap: 0; }
.shelves-mode .header-actions .icon-button { width: 44px; height: 44px; padding: 10px; }
.shelves-mode .header-actions .icon { width: 25px; height: 25px; }
.shelves-mode .header-actions > :not(#settings-open):not(#search-toggle):not(#sort-open) { display: none; }
.shelves-mode #search-toggle { display: inline-flex; align-items: center; justify-content: center; width: 48px; min-width: 48px; height: 48px; padding: 10px; border-radius: 50%; }
.shelves-mode #search-toggle span { display: none; }
.shelves-mode .header-actions [aria-expanded="true"], .shelves-mode .header-actions .has-filter { background: var(--accent-soft); }
#search-toggle, #sort-open { position: relative; }
.header-actions .icon.tool-state { position: absolute; right: 2px; bottom: 2px; width: 15px; height: 15px; border-radius: 50%; background: var(--paper); }
body:not(.shelves-mode) #search-toggle.has-filter { padding-right: 22px; }
.shelves-mode .library-tools {
  display: flex; flex-direction: column; flex: none; max-width: none; margin: 0 var(--page-pad); gap: 12px;
}
.shelves-mode .library-search-row { display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; }
.shelves-mode .search-field { flex: 1 1 0; min-width: 0; min-height: 48px; padding: 0 13px; gap: 10px; border: 1px solid #cbbdab; background: #eae0d280; border-radius: 13px; }
.shelves-mode .search-field .icon { width: 22px; height: 22px; opacity: 0.72; }
.shelves-mode .search-field input { height: 44px; min-width: 0; font-size: 16px; }
.shelves-mode .shelves-sort-button { flex: none; border-radius: 50%; width: 48px; height: 48px; }
.shelves-mode .quick-filters { gap: 8px; align-items: stretch; flex-wrap: wrap; min-width: 0; width: 100%; }
.quick-filters button { min-height: 44px; padding: 8px 14px; border-radius: 24px; white-space: nowrap; font-size: clamp(12px, 3.35vw, 14px); background: #e8ddcf; flex: 1; }
.quick-filters button:first-child { flex: 0 0 auto; min-width: 48px; }
.quick-filters button[aria-pressed="true"] { background: var(--accent); color: #fff9f3; }
@media (max-width: 767px) {
  .shelves-mode .quick-filters button { flex: 0 0 auto; min-height: 48px; }
  .shelves-mode .header-actions .icon-button { width: 48px; min-width: 48px; height: 48px; }
  .shelves-mode .library-heading { min-width: 0; flex-wrap: wrap; }
  .shelves-mode .app-header h1 { white-space: normal; }
}
.shelves-mode .library-filter-options { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 0 4px; }
.shelves-mode .library-filter-options select { font-size: 16px; min-height: 44px; flex: 1; width: 100%; max-width: none; }
.shelves-mode .sort-field { flex: 1 0 100%; display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.shelves-mode .sort-field select { color: var(--ink); }
.shelves-mode .library-view { display: block; flex: 1; min-height: 0; width: 100%; padding: 12px var(--page-pad) 18px; }
.shelves-mode .library-aside, .shelves-mode .mobile-selection, .shelves-mode .shelf-navigation { display: none; }
.shelves-mode .shelf-area { width: 100%; height: 100%; align-self: stretch; }
.shelves-mode .shelf-viewport { height: 100%; width: 100%; overflow-x: clip; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-gutter: stable; scrollbar-width: thin; padding: 0; }
.shelves-mode .shelf-track { display: block; height: auto; min-height: 100%; width: 100%; min-width: 0; gap: 0; }
.shelves-year { margin: 14px 0 22px; }
.shelves-year-heading { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 15px; align-items: center; padding: 0 8px; margin-bottom: 10px; opacity: var(--library-alpha); }
.shelves-year-heading h2 { font-family: "EB Garamond", Georgia, serif; font-size: 35px; line-height: 1.15; letter-spacing: -0.025em; }
.shelves-year-heading::after { content: ""; border-top: 1px solid #b6a38b; grid-column: 2; grid-row: 1; }
.shelves-year-heading p { font-family: "EB Garamond", Georgia, serif; font-style: italic; font-size: 17px; color: var(--muted); grid-column: 1 / -1; }
.shelves-row { position: relative; display: flex; align-items: flex-end; gap: 2px; padding: 22px 8px 24px; height: calc(var(--row-h) + 46px); margin-bottom: 14px; }
.shelves-ledge { position: absolute; left: 0; bottom: 0; width: 100%; height: 33px; pointer-events: none; }
.has-physical-shelves .shelves-ledge { visibility: hidden; }
.shelves-mode .book-slot { transition: none; }
.shelves-mode .book-ground-shadow { display: none; }
.shelves-mode .book-hit { border-radius: 4px; }
.shelves-mode .book-hit:focus-visible { outline-offset: 1px; }
.shelves-mode .book-slot.is-active .book-object { --book-ry: 90deg; --book-rx: 0deg; }
.book-object[data-binding="shelves"] .book-spine-type { inset: 16px 5px; flex-direction: column; justify-content: flex-start; gap: 16px; }
.book-object[data-binding="shelves"] .book-spine-author { display: block; flex: none; order: -1; max-height: 58px; font-family: "EB Garamond", Georgia, serif; font-size: 12px; line-height: 1.05; letter-spacing: 0; opacity: 1; }
.book-object[data-binding="shelves"] .book-spine-title { font-family: "EB Garamond", Georgia, serif; font-size: 29px !important; width: 100%; max-height: 265px; transform: none; line-height: 1.05; }
.book-object[data-binding="shelves"][data-spine-font="condensed"] .book-spine-title { font-family: Oswald, Inter, sans-serif; }
.book-object[data-spine-layout="vertical"] .book-spine-title { writing-mode: vertical-rl; text-orientation: mixed; rotate: 180deg; width: auto; height: 265px; align-self: center; white-space: normal; }
.shelves-mode .library-footer { position: absolute; left: 0; right: 0; bottom: max(8px, env(safe-area-inset-bottom, 0px)); min-height: 0; padding: 0 18px; font-size: 11px; justify-content: center; z-index: 30; pointer-events: none; }
.shelves-mode #account-hint { display: none; }
.shared-library-banner { display: flex; flex: 1 0 100%; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.is-shared-library .library-tools { flex-wrap: wrap; }
.shared-library-banner .plain-button { font-size: 14px; }
.shared-library-banner .secondary-button { font-size: 13px; min-height: 44px; padding: 8px 14px; }
.is-shared-library .app-header h1 { white-space: normal; overflow-wrap: anywhere; font-size: clamp(21px, 5.8vw, 32px); }
.is-shared-library .selection-note, .is-shared-library #selection-add-note,
.is-shared-library #mobile-note, .is-shared-library #mobile-add, .is-shared-library #add-open { display: none; }
.social-status { padding: 0 24px 12px; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.social-status:empty { display: none; }
.social-preview-hint { padding: 0 24px 12px; color: var(--muted); font-size: 12px; }
.social-content { display: flex; flex-direction: column; gap: 22px; }
.social-content input, .social-content select { width: 100%; min-width: 0; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: transparent; font-size: 16px; }
.social-form { display: flex; flex-direction: column; gap: 18px; }
.social-form label { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.social-form .social-check { flex-direction: row; align-items: center; gap: 12px; min-height: 44px; }
.social-check input { width: 20px; height: 20px; min-height: 20px; flex: none; accent-color: var(--accent); }
.social-link-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.social-list h3 { font-size: 14px; font-weight: 500; color: var(--muted); margin-bottom: 12px; }
.social-person { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.social-person > span, .social-name { min-width: 0; overflow-wrap: anywhere; text-align: left; }
.social-name { min-height: 44px; color: var(--accent); padding: 5px 0; }
.social-person-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px; flex: none; }
.social-person-actions .secondary-button { min-height: 44px; font-size: 13px; padding: 8px 12px; }
.social-add-friend { display: flex; flex-wrap: wrap; gap: 10px; }
.social-add-friend input { flex: 1 0 100%; }
@media (max-width: 767px) {
  .settings-header { display: none; }
  .shelves-mode .settings-header { display: inline-flex; }
}
@media (min-width: 768px) {
  .shelves-mode { --page-pad: clamp(32px, 5vw, 80px); --book-h: 235px; }
  .shelves-mode .app-header { padding-bottom: 24px; }
  .shelves-mode .library-tools { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 16px 24px; }
  .shelves-mode .library-search-row { flex: 1; max-width: 560px; min-width: 260px; }
  .shelves-mode .quick-filters { max-width: 440px; flex: 1; }
  .shelves-mode .library-filter-options { flex-basis: 100%; }
  .shelves-mode .sort-field { flex: 1; }
  .shelves-mode .library-filter-options select { max-width: 220px; }
  .shelves-year-heading { margin: 18px 0 18px; }
  .shelves-year-heading h2 { font-size: 42px; }
  .shelves-row { margin-bottom: 22px; }
}
@media (max-width: 359px) {
  .shelves-mode { --page-pad: 12px; }
  .shelves-mode .app-header h1 { font-size: 21px; }
  .shelves-mode .header-actions .icon-button { width: 40px; padding: 8px; }
  .quick-filters button { padding-inline: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .shelves-mode .shelf-viewport { scroll-behavior: auto; }
}
