.books-page .book-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding-top: 10px;
}

.books-page .book-row {
  display: grid;
  place-items: center;
  min-height: 58px;
  padding: 8px 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
}

.books-page .book-row:hover,
.books-page .book-row:focus-visible {
  background: var(--green);
  border-color: var(--green);
  outline: none;
}

.books-page .book-row > span:nth-child(2),
.books-page .book-row > svg {
  display: none;
}

.books-page .book-abbr {
  width: auto;
  height: auto;
  color: var(--green);
  background: transparent;
  border-radius: 0;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0;
}

.books-page .book-abbr::after {
  content: var(--book-code);
  font-size: 14px;
  font-weight: 700;
}

.books-page .book-row:hover .book-abbr,
.books-page .book-row:focus-visible .book-abbr {
  color: var(--surface);
}

/* Antiguo Testamento */
.book-group:nth-child(1) .book-row:nth-child(1) { --book-code: "Gen"; }
.book-group:nth-child(1) .book-row:nth-child(2) { --book-code: "Exo"; }
.book-group:nth-child(1) .book-row:nth-child(3) { --book-code: "Lev"; }
.book-group:nth-child(1) .book-row:nth-child(4) { --book-code: "Num"; }
.book-group:nth-child(1) .book-row:nth-child(5) { --book-code: "Deu"; }
.book-group:nth-child(2) .book-row:nth-child(1) { --book-code: "Jos"; }
.book-group:nth-child(2) .book-row:nth-child(2) { --book-code: "Jue"; }
.book-group:nth-child(2) .book-row:nth-child(3) { --book-code: "Rut"; }
.book-group:nth-child(2) .book-row:nth-child(4) { --book-code: "1Sa"; }
.book-group:nth-child(2) .book-row:nth-child(5) { --book-code: "2Sa"; }
.book-group:nth-child(2) .book-row:nth-child(6) { --book-code: "1Re"; }
.book-group:nth-child(2) .book-row:nth-child(7) { --book-code: "2Re"; }
.book-group:nth-child(2) .book-row:nth-child(8) { --book-code: "1Cr"; }
.book-group:nth-child(2) .book-row:nth-child(9) { --book-code: "2Cr"; }
.book-group:nth-child(2) .book-row:nth-child(10) { --book-code: "Esd"; }
.book-group:nth-child(2) .book-row:nth-child(11) { --book-code: "Neh"; }
.book-group:nth-child(2) .book-row:nth-child(12) { --book-code: "Est"; }
.book-group:nth-child(3) .book-row:nth-child(1) { --book-code: "Job"; }
.book-group:nth-child(3) .book-row:nth-child(2) { --book-code: "Sal"; }
.book-group:nth-child(3) .book-row:nth-child(3) { --book-code: "Pro"; }
.book-group:nth-child(3) .book-row:nth-child(4) { --book-code: "Ecl"; }
.book-group:nth-child(3) .book-row:nth-child(5) { --book-code: "Can"; }
.book-group:nth-child(4) .book-row:nth-child(1) { --book-code: "Isa"; }
.book-group:nth-child(4) .book-row:nth-child(2) { --book-code: "Jer"; }
.book-group:nth-child(4) .book-row:nth-child(3) { --book-code: "Lam"; }
.book-group:nth-child(4) .book-row:nth-child(4) { --book-code: "Eze"; }
.book-group:nth-child(4) .book-row:nth-child(5) { --book-code: "Dan"; }
.book-group:nth-child(5) .book-row:nth-child(1) { --book-code: "Ose"; }
.book-group:nth-child(5) .book-row:nth-child(2) { --book-code: "Joe"; }
.book-group:nth-child(5) .book-row:nth-child(3) { --book-code: "Amo"; }
.book-group:nth-child(5) .book-row:nth-child(4) { --book-code: "Abd"; }
.book-group:nth-child(5) .book-row:nth-child(5) { --book-code: "Jon"; }
.book-group:nth-child(5) .book-row:nth-child(6) { --book-code: "Miq"; }
.book-group:nth-child(5) .book-row:nth-child(7) { --book-code: "Nah"; }
.book-group:nth-child(5) .book-row:nth-child(8) { --book-code: "Hab"; }
.book-group:nth-child(5) .book-row:nth-child(9) { --book-code: "Sof"; }
.book-group:nth-child(5) .book-row:nth-child(10) { --book-code: "Hag"; }
.book-group:nth-child(5) .book-row:nth-child(11) { --book-code: "Zac"; }
.book-group:nth-child(5) .book-row:nth-child(12) { --book-code: "Mal"; }

/* Nuevo Testamento */
.testament-tabs:has(button:nth-child(2)[aria-selected="true"]) + .book-groups .book-group:nth-child(1) .book-row:nth-child(1) { --book-code: "Mt"; }
.testament-tabs:has(button:nth-child(2)[aria-selected="true"]) + .book-groups .book-group:nth-child(1) .book-row:nth-child(2) { --book-code: "Mr"; }
.testament-tabs:has(button:nth-child(2)[aria-selected="true"]) + .book-groups .book-group:nth-child(1) .book-row:nth-child(3) { --book-code: "Lc"; }
.testament-tabs:has(button:nth-child(2)[aria-selected="true"]) + .book-groups .book-group:nth-child(1) .book-row:nth-child(4) { --book-code: "Jn"; }
.testament-tabs:has(button:nth-child(2)[aria-selected="true"]) + .book-groups .book-group:nth-child(2) .book-row:nth-child(1) { --book-code: "Hch"; }
.testament-tabs:has(button:nth-child(2)[aria-selected="true"]) + .book-groups .book-group:nth-child(3) .book-row:nth-child(1) { --book-code: "Rom"; }
.testament-tabs:has(button:nth-child(2)[aria-selected="true"]) + .book-groups .book-group:nth-child(3) .book-row:nth-child(2) { --book-code: "1Co"; }
.testament-tabs:has(button:nth-child(2)[aria-selected="true"]) + .book-groups .book-group:nth-child(3) .book-row:nth-child(3) { --book-code: "2Co"; }
.testament-tabs:has(button:nth-child(2)[aria-selected="true"]) + .book-groups .book-group:nth-child(3) .book-row:nth-child(4) { --book-code: "Gal"; }
.testament-tabs:has(button:nth-child(2)[aria-selected="true"]) + .book-groups .book-group:nth-child(3) .book-row:nth-child(5) { --book-code: "Efe"; }
.testament-tabs:has(button:nth-child(2)[aria-selected="true"]) + .book-groups .book-group:nth-child(3) .book-row:nth-child(6) { --book-code: "Fil"; }
.testament-tabs:has(button:nth-child(2)[aria-selected="true"]) + .book-groups .book-group:nth-child(3) .book-row:nth-child(7) { --book-code: "Col"; }
.testament-tabs:has(button:nth-child(2)[aria-selected="true"]) + .book-groups .book-group:nth-child(3) .book-row:nth-child(8) { --book-code: "1Ts"; }
.testament-tabs:has(button:nth-child(2)[aria-selected="true"]) + .book-groups .book-group:nth-child(3) .book-row:nth-child(9) { --book-code: "2Ts"; }
.testament-tabs:has(button:nth-child(2)[aria-selected="true"]) + .book-groups .book-group:nth-child(3) .book-row:nth-child(10) { --book-code: "1Ti"; }
.testament-tabs:has(button:nth-child(2)[aria-selected="true"]) + .book-groups .book-group:nth-child(3) .book-row:nth-child(11) { --book-code: "2Ti"; }
.testament-tabs:has(button:nth-child(2)[aria-selected="true"]) + .book-groups .book-group:nth-child(3) .book-row:nth-child(12) { --book-code: "Tit"; }
.testament-tabs:has(button:nth-child(2)[aria-selected="true"]) + .book-groups .book-group:nth-child(3) .book-row:nth-child(13) { --book-code: "Flm"; }
.testament-tabs:has(button:nth-child(2)[aria-selected="true"]) + .book-groups .book-group:nth-child(4) .book-row:nth-child(1) { --book-code: "Heb"; }
.testament-tabs:has(button:nth-child(2)[aria-selected="true"]) + .book-groups .book-group:nth-child(4) .book-row:nth-child(2) { --book-code: "Stg"; }
.testament-tabs:has(button:nth-child(2)[aria-selected="true"]) + .book-groups .book-group:nth-child(4) .book-row:nth-child(3) { --book-code: "1Pe"; }
.testament-tabs:has(button:nth-child(2)[aria-selected="true"]) + .book-groups .book-group:nth-child(4) .book-row:nth-child(4) { --book-code: "2Pe"; }
.testament-tabs:has(button:nth-child(2)[aria-selected="true"]) + .book-groups .book-group:nth-child(4) .book-row:nth-child(5) { --book-code: "1Jn"; }
.testament-tabs:has(button:nth-child(2)[aria-selected="true"]) + .book-groups .book-group:nth-child(4) .book-row:nth-child(6) { --book-code: "2Jn"; }
.testament-tabs:has(button:nth-child(2)[aria-selected="true"]) + .book-groups .book-group:nth-child(4) .book-row:nth-child(7) { --book-code: "3Jn"; }
.testament-tabs:has(button:nth-child(2)[aria-selected="true"]) + .book-groups .book-group:nth-child(4) .book-row:nth-child(8) { --book-code: "Jds"; }
.testament-tabs:has(button:nth-child(2)[aria-selected="true"]) + .book-groups .book-group:nth-child(5) .book-row:nth-child(1) { --book-code: "Apo"; }

@media (min-width: 680px) {
  .books-page .book-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (min-width: 980px) {
  .books-page .book-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}

/* Aplicación enfocada exclusivamente en la lectura bíblica */
.desktop-sidebar nav .side-link:first-child,
.bottom-nav button:first-child,
.home-page {
  display: none;
}

.bottom-nav {
  grid-template-columns: repeat(4, 1fr);
}

.topbar-title {
  display: none;
}

/* Biblioteca más compacta */
.books-page > .page-title {
  display: none;
}

.books-page {
  padding-top: 22px;
}

.books-page .testament-tabs {
  margin: 0 0 18px;
}

.books-page .book-groups {
  display: grid;
  gap: 12px;
}

.books-page .book-group {
  --section-color: #f3ead7;
  margin: 0;
  padding: 12px;
  background: color-mix(in srgb, var(--section-color) 72%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--section-color) 55%, var(--line));
  border-radius: 7px;
}

.books-page .book-group:nth-child(2) { --section-color: #dfecef; }
.books-page .book-group:nth-child(3) { --section-color: #f0e1e8; }
.books-page .book-group:nth-child(4) { --section-color: #e2eadb; }
.books-page .book-group:nth-child(5) { --section-color: #e9e2f0; }

.books-page .group-title {
  align-items: center;
  min-height: 20px;
  padding: 0 2px 8px;
  border: 0;
}

.books-page .group-title h2 {
  color: var(--ink);
  font-size: 10px;
  letter-spacing: .9px;
}

.books-page .group-title span {
  font-size: 9px;
}

.books-page .book-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  padding: 0;
}

.books-page .book-row {
  min-height: 43px;
  padding: 5px 2px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  border-color: color-mix(in srgb, var(--line) 78%, transparent);
}

.books-page .book-abbr::after {
  font-size: 12px;
}

:root[data-theme="dark"] .books-page .book-group {
  background: color-mix(in srgb, var(--section-color) 16%, var(--surface));
  border-color: color-mix(in srgb, var(--section-color) 22%, var(--line));
}

@media (min-width: 680px) {
  .books-page {
    padding-top: 30px;
  }

  .books-page .book-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
}

@media (min-width: 980px) {
  .books-page .book-groups {
    gap: 14px;
  }

  .books-page .book-grid {
    grid-template-columns: repeat(10, minmax(0, 1fr));
  }
}
