:root {
  color-scheme: light;
  --bg: #edf3f8;
  --surface: #ffffff;
  --surface-2: #f8fbff;
  --surface-3: #e5edf5;
  --text: #17212b;
  --muted: #5e7184;
  --faint: #8594a3;
  --line: #ced9e4;
  --accent: #2c5f9e;
  --accent-strong: #1f4d82;
  --accent-soft: rgba(44, 95, 158, 0.12);
  --warn: #b86e16;
  --danger: #b8423f;
  --danger-soft: rgba(184, 66, 63, 0.12);
  --shadow: 0 18px 45px rgba(23, 33, 43, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), transparent 260px),
    linear-gradient(90deg, rgba(44, 95, 158, 0.08), rgba(184, 110, 22, 0.06));
  pointer-events: none;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

button {
  letter-spacing: 0;
}

kbd {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.08rem 0.42rem;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.82rem;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 20px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  font-weight: 750;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 38px;
  border: 1px solid rgba(44, 95, 158, 0.3);
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
}

.brand-text {
  white-space: nowrap;
}

.topbar-note {
  color: var(--muted);
  font-size: 0.9rem;
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
}

.primary-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0.22rem;
}

.primary-nav a {
  border-radius: 6px;
  padding: 0.46rem 0.62rem;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 760;
  text-decoration: none;
  white-space: nowrap;
}

.primary-nav a:hover,
.primary-nav a.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.language-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.language-switch a {
  min-width: 42px;
  padding: 0.42rem 0.62rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.language-switch a.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.page {
  padding: 26px 0 42px;
}

.eyebrow {
  margin: 0 0 0.55rem;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 750;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.85rem;
  font-size: 3.6rem;
  line-height: 1.02;
  font-weight: 800;
}

h2 {
  margin-bottom: 0;
  font-size: 1.18rem;
  font-weight: 760;
}

h3 {
  margin-bottom: 0.35rem;
  font-size: 1rem;
}

.lead {
  max-width: 700px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.lead.compact {
  margin-bottom: 0;
  font-size: 0.98rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0.68rem 1rem;
  cursor: pointer;
  font-weight: 730;
  text-decoration: none;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button:not(:disabled):hover {
  transform: translateY(-1px);
}

.button-primary {
  background: var(--accent);
  color: #ffffff;
}

.button-primary:not(:disabled):hover {
  background: var(--accent-strong);
}

.button-primary:disabled {
  border-color: var(--line);
  background: var(--surface-3);
  color: var(--muted);
}

.button-secondary,
.button-ghost {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.button-secondary:hover,
.button-ghost:hover {
  border-color: var(--accent);
}

.search-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  align-items: center;
  gap: 40px;
  min-height: calc(100vh - 170px);
}

.search-panel,
.result-section,
.library-panel,
.empty-state {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.search-panel {
  padding: 26px;
}

.input-label,
.filter-field span {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 680;
}

.search-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.search-field input,
.filter-field input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  outline: none;
  padding: 0.75rem 0.85rem;
}

.search-field input:focus,
.filter-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.hint {
  margin: 0.8rem 0 0;
  color: var(--faint);
  font-size: 0.88rem;
}

.notice {
  margin-top: 18px;
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}

.notice-error {
  border: 1px solid rgba(239, 100, 97, 0.45);
  background: var(--danger-soft);
  color: var(--danger);
}

.loading-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(16, 18, 20, 0.74);
  backdrop-filter: blur(5px);
  z-index: 20;
}

.loading-overlay.active {
  display: flex;
}

.loading-box {
  display: grid;
  place-items: center;
  gap: 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1.4rem 1.6rem;
}

.loading-box p {
  margin: 0;
  color: var(--muted);
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 820ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 22px;
}

.page-heading h1 {
  margin-bottom: 0;
  font-size: 3rem;
}

.results-grid,
.recommendations-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.82fr) minmax(0, 1.18fr);
  gap: 18px;
  align-items: start;
}

.recommendations-layout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.recommendations-feed {
  display: grid;
  gap: 18px;
}

.feed-section,
.author-bio {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  padding: 18px;
}

.author-bio {
  margin-bottom: 18px;
}

.author-bio p {
  margin: 0.65rem 0 0;
  color: var(--muted);
  line-height: 1.58;
}

.sticky-section-heading {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: -18px -18px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  padding: 14px 18px;
  backdrop-filter: blur(10px);
}

.result-section {
  padding: 18px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 14px;
}

.count-pill {
  min-width: 32px;
  border-radius: 999px;
  padding: 0.22rem 0.62rem;
  background: var(--surface-2);
  color: var(--muted);
  text-align: center;
  font-weight: 750;
}

.list-stack,
.book-result-list {
  display: grid;
  gap: 10px;
}

.book-result-list.spacious {
  gap: 12px;
}

.result-row,
.book-result {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  text-decoration: none;
}

.result-row:hover,
.book-result:hover {
  border-color: rgba(44, 95, 158, 0.55);
}

.result-title {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.result-action,
.muted-text,
.muted-link,
.empty-inline {
  color: var(--muted);
  font-size: 0.92rem;
}

.muted-link {
  text-decoration: none;
}

.muted-link:hover {
  color: var(--accent);
}

.book-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(170px, auto);
  gap: 1rem;
  padding: 1rem;
}

.book-result h3 {
  overflow-wrap: anywhere;
}

.format-links {
  display: flex;
  align-items: start;
  justify-content: end;
  gap: 6px;
  flex-wrap: wrap;
  max-width: 220px;
}

.book-copy {
  min-width: 0;
}

.book-description {
  margin: 0.72rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.expandable-text.collapsed,
.book-description.collapsed {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.book-description.inline.collapsed {
  -webkit-line-clamp: 2;
}

.expandable-text.expanded,
.book-description.expanded {
  display: block;
}

.book-description.inline {
  max-width: 100%;
  font-size: 0.84rem;
}

.expand-toggle {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  min-height: 28px;
  border: 1px solid rgba(44, 95, 158, 0.24);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  cursor: pointer;
  padding: 0.18rem 0.62rem 0.22rem;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1;
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.expand-toggle:hover {
  border-color: rgba(44, 95, 158, 0.42);
  background: rgba(44, 95, 158, 0.18);
  color: var(--accent-strong);
}

.book-description.muted-empty {
  color: var(--faint);
}

.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(23, 33, 43, 0.42);
  padding: 18px;
}

.modal-backdrop[hidden] {
  display: none;
}

.detail-modal {
  width: min(720px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(23, 33, 43, 0.24);
  overflow: hidden;
}

.detail-modal-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 16px;
}

.detail-modal-header h2 {
  margin: 0;
  overflow-wrap: anywhere;
}

.detail-modal-body {
  overflow: auto;
  padding: 18px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.62;
  white-space: pre-wrap;
}

.format-link {
  border: 1px solid rgba(44, 95, 158, 0.35);
  border-radius: 6px;
  padding: 0.3rem 0.48rem;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  text-decoration: none;
}

.format-link:hover {
  border-color: var(--accent);
}

.card-actions {
  display: grid;
  align-items: start;
  justify-content: end;
  gap: 8px;
}

.inline-downloads {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 6px;
  flex-wrap: wrap;
  max-width: 230px;
}

.download-label,
.download-loading {
  width: 100%;
  color: var(--faint);
  font-size: 0.78rem;
  font-weight: 740;
  text-align: right;
}

.bookmark-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  padding: 0.36rem 0.58rem;
  font-size: 0.78rem;
  font-weight: 800;
}

.bookmark-button:hover,
.bookmark-button.saved {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.bookmark-button.icon {
  flex: 0 0 auto;
  align-self: flex-start;
  max-width: 122px;
}

.bookmark-button.compact {
  background: var(--surface-3);
}

.details-button,
.modal-close {
  min-height: 34px;
  border: 1px solid rgba(44, 95, 158, 0.26);
  border-radius: 7px;
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  padding: 0.35rem 0.62rem;
  font-size: 0.82rem;
  font-weight: 760;
}

.details-button:hover,
.modal-close:hover {
  border-color: rgba(44, 95, 158, 0.48);
  background: var(--accent-soft);
}

.recommendation-meta {
  margin: 0.45rem 0 0;
  color: var(--faint);
  font-size: 0.86rem;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 0.75rem;
  padding: 44px 18px;
  text-align: center;
}

.empty-state p {
  margin-bottom: 0.3rem;
  color: var(--muted);
}

.empty-state.small {
  box-shadow: none;
  margin: 8px 0 86px;
  padding: 28px 16px;
}

.library-panel {
  padding: 18px;
}

.library-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  align-items: end;
  gap: 16px;
  margin-bottom: 14px;
}

.format-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: end;
}

.format-tab {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  padding: 0.52rem 0.72rem;
  cursor: pointer;
  font-weight: 780;
}

.format-tab strong {
  min-width: 28px;
  border-radius: 999px;
  padding: 0.12rem 0.4rem;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 0.78rem;
}

.format-tab.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.format-tab:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.selection-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-block: 1px solid var(--line);
  padding: 12px 0;
  margin-bottom: 12px;
}

.selection-count {
  color: var(--accent);
  font-size: 1.45rem;
  font-weight: 830;
}

.selection-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.progress-panel {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 12px;
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 10px;
  color: var(--muted);
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 180ms ease;
}

.book-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 10px;
  padding-bottom: 90px;
}

.book-item {
  display: flex;
  align-items: flex-start;
  gap: 0.78rem;
  min-height: 86px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  padding: 0.86rem;
  text-align: left;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.book-row-actions {
  flex: 0 0 auto;
  display: grid;
  gap: 8px;
  align-self: flex-start;
}

.book-select-button {
  flex: 1 1 auto;
  display: flex;
  align-items: flex-start;
  gap: 0.78rem;
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.book-item:hover {
  border-color: rgba(44, 95, 158, 0.55);
  background: #f1f7ff;
}

.book-select-button:focus-visible,
.bookmark-button:focus-visible,
.details-button:focus-visible,
.modal-close:focus-visible,
.primary-nav a:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 2px;
}

.book-item.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.book-item.hidden {
  display: none;
}

.checkmark {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  margin-top: 1px;
}

.book-item.selected .checkmark {
  border-color: var(--accent);
  background: var(--accent);
}

.book-item.selected .checkmark::before {
  content: "";
  width: 9px;
  height: 5px;
  border-left: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  transform: rotate(-45deg) translateY(-1px);
}

.book-info {
  min-width: 0;
  display: grid;
  gap: 0.45rem;
  flex: 1 1 auto;
}

.book-title {
  overflow-wrap: anywhere;
  line-height: 1.35;
  font-weight: 720;
}

.book-formats {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
}

.download-bar {
  position: sticky;
  bottom: 14px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid rgba(44, 95, 158, 0.35);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  padding: 12px;
}

.download-bar div {
  min-width: 0;
  display: grid;
  gap: 0.18rem;
}

.download-bar strong,
.download-bar span {
  overflow-wrap: anywhere;
}

.download-bar span {
  color: var(--muted);
  font-size: 0.88rem;
}

.toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 30;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
}

.toast {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.8rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 0.9rem;
}

.toast.error {
  border-left-color: var(--danger);
}

.toast-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 850;
}

.toast.error .toast-icon {
  color: var(--danger);
}

.toast-title {
  font-weight: 760;
}

.toast-message {
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.88rem;
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 24px, 1180px);
  }

  .topbar {
    align-items: flex-start;
    padding: 14px 0;
  }

  .topbar,
  .page-heading,
  .selection-strip,
  .download-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-note {
    display: none;
  }

  .topbar-actions {
    align-self: stretch;
    justify-content: space-between;
  }

  .search-hero,
  .results-grid,
  .recommendations-layout,
  .library-toolbar {
    grid-template-columns: 1fr;
  }

  .search-hero {
    align-items: start;
    gap: 22px;
    min-height: auto;
    padding-top: 20px;
  }

  h1,
  .page-heading h1 {
    font-size: 2.55rem;
  }

  .format-tabs {
    justify-content: start;
  }

  .book-result {
    grid-template-columns: 1fr;
  }

  .format-links,
  .card-actions {
    justify-content: start;
    max-width: none;
  }

  .inline-downloads {
    justify-content: start;
    max-width: none;
  }

  .download-label,
  .download-loading {
    text-align: left;
  }
}

@media (max-width: 540px) {
  body {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .app-shell {
    width: min(100% - 18px, 1180px);
  }

  .page {
    padding: 8px 0 28px;
  }

  .brand {
    gap: 0.6rem;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand-text {
    font-size: 0.98rem;
  }

  .topbar-actions {
    display: grid;
    gap: 0.62rem;
  }

  .primary-nav {
    overflow-x: auto;
    scrollbar-width: none;
  }

  .primary-nav::-webkit-scrollbar {
    display: none;
  }

  .language-switch {
    justify-self: start;
  }

  h1 {
    font-size: 2rem;
    line-height: 1.08;
  }

  .page-heading h1 {
    font-size: 2rem;
  }

  .lead {
    font-size: 0.98rem;
    line-height: 1.5;
  }

  .search-panel,
  .result-section,
  .library-panel,
  .feed-section,
  .author-bio {
    padding: 14px;
  }

  .sticky-section-heading {
    margin: -14px -14px 12px;
    padding: 12px 14px;
  }

  .search-hero {
    gap: 18px;
  }

  .search-field input,
  .filter-field input {
    min-height: 48px;
  }

  .search-field {
    grid-template-columns: 1fr;
  }

  .search-field .button,
  .page-heading .button {
    width: 100%;
  }

  .result-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.35rem;
  }

  .book-result {
    padding: 0.86rem;
  }

  .format-link {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
  }

  .library-toolbar {
    position: sticky;
    top: 0;
    z-index: 8;
    margin: -14px -14px 12px;
    padding: 14px 14px 12px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
  }

  .format-tabs {
    display: flex;
    flex-wrap: nowrap;
    justify-content: start;
    gap: 8px;
    overflow-x: auto;
    margin: 0 -14px;
    padding: 0 14px 2px;
    scrollbar-width: none;
  }

  .format-tabs::-webkit-scrollbar {
    display: none;
  }

  .book-list {
    grid-template-columns: 1fr;
    gap: 8px;
    padding-bottom: 118px;
  }

  .format-tab {
    flex: 0 0 auto;
    min-width: 104px;
    min-height: 46px;
    padding-inline: 0.78rem;
  }

  .selection-strip {
    padding: 10px 0;
  }

  .selection-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .selection-actions .button {
    width: 100%;
  }

  .book-item {
    min-height: 78px;
    padding: 0.82rem;
  }

  .book-row-actions {
    gap: 6px;
  }

  .bookmark-button.icon,
  .details-button {
    max-width: 104px;
    padding-inline: 0.48rem;
  }

  .book-title {
    font-size: 0.96rem;
  }

  .modal-backdrop {
    padding: 10px;
  }

  .detail-modal {
    max-height: calc(100vh - 20px);
  }

  .detail-modal-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px;
  }

  .detail-modal-body {
    padding: 14px;
    font-size: 0.96rem;
  }

  .download-bar {
    bottom: calc(10px + env(safe-area-inset-bottom));
    gap: 0.8rem;
    padding: 10px;
  }

  .download-bar .button {
    width: 100%;
    min-height: 48px;
  }

  .toast-stack {
    top: auto;
    right: 9px;
    bottom: calc(92px + env(safe-area-inset-bottom));
    width: calc(100vw - 18px);
  }
}
