.book-modal {
  position: fixed;
  z-index: 110;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 24, 19, .58);
  backdrop-filter: blur(5px);
}

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

.book-modal-panel {
  width: min(100%, 620px);
  max-height: min(86vh, 760px);
  padding: 21px 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
  overflow-y: auto;
}

.book-modal-header {
  position: sticky;
  z-index: 2;
  top: -21px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin: -1px -1px 15px;
  padding: 1px 1px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.book-modal-header span {
  display: block;
  margin-bottom: 5px;
  color: var(--gold);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
}

.book-modal-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 400;
}

.book-modal-close {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 23px;
}

.book-modal-close:hover,
.book-modal-close:focus-visible {
  color: var(--surface);
  background: var(--green);
  border-color: var(--green);
  outline: none;
}

.book-modal-section {
  --book-section: #e6eee4;
  margin-top: 11px;
  padding: 11px;
  background: color-mix(in srgb, var(--book-section) 72%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--book-section) 55%, var(--line));
  border-radius: 7px;
}

.book-modal-section.nt {
  --book-section: #e7e2ef;
}

.book-modal-section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 9px;
  color: var(--ink);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
}

.book-modal-section-title small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

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

.book-modal-grid button {
  min-height: 43px;
  padding: 5px 2px;
  color: var(--green);
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 12px;
  font-weight: 700;
}

.book-modal-grid button:hover,
.book-modal-grid button:focus-visible {
  color: var(--surface);
  background: var(--green);
  border-color: var(--green);
  outline: none;
}

.book-modal-grid button[aria-current="true"] {
  color: var(--surface);
  background: var(--green-2);
  border-color: var(--green-2);
}

:root[data-theme="dark"] .book-modal-section {
  background: color-mix(in srgb, var(--book-section) 15%, var(--surface));
  border-color: color-mix(in srgb, var(--book-section) 20%, var(--line));
}

body.book-modal-open {
  overflow: hidden;
}

@media (min-width: 680px) {
  .book-modal-panel {
    padding: 25px 22px 22px;
  }

  .book-modal-header {
    top: -25px;
  }

  .book-modal-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }
}
